@kanso-labs/react-native-kanso-ui 0.8.0 → 0.10.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 (253) hide show
  1. package/README.md +4 -3
  2. package/dist/autocomplete/index.js +15 -1
  3. package/dist/autocomplete/index.js.map +1 -1
  4. package/dist/badge/index.js +9 -70
  5. package/dist/badge/index.js.map +1 -1
  6. package/dist/button/group.d.ts +5 -0
  7. package/dist/button/group.js +115 -0
  8. package/dist/button/group.js.map +1 -0
  9. package/dist/button/index.d.ts +4 -1
  10. package/dist/button/index.js +45 -23
  11. package/dist/button/index.js.map +1 -1
  12. package/dist/button/palettes.d.ts +2 -0
  13. package/dist/button/slots.js +2 -1
  14. package/dist/button/slots.js.map +1 -1
  15. package/dist/calendar/index.js +351 -182
  16. package/dist/calendar/index.js.map +1 -1
  17. package/dist/calendar/styles.js +33 -2
  18. package/dist/calendar/styles.js.map +1 -1
  19. package/dist/carousel/arrangement.d.ts +5 -0
  20. package/dist/carousel/arrangement.js +123 -0
  21. package/dist/carousel/arrangement.js.map +1 -0
  22. package/dist/chequer/index.js +95 -0
  23. package/dist/chequer/index.js.map +1 -0
  24. package/dist/collection/index.d.ts +157 -0
  25. package/dist/collection/index.js +1331 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/color-thumb/index.js +56 -0
  28. package/dist/color-thumb/index.js.map +1 -0
  29. package/dist/components/badge/index.d.ts +48 -0
  30. package/dist/components/badge/index.js +122 -0
  31. package/dist/components/badge/index.js.map +1 -0
  32. package/dist/{badge → components/badge}/styles.js +10 -6
  33. package/dist/components/badge/styles.js.map +1 -0
  34. package/dist/components/breadcrumbs/index.d.ts +66 -0
  35. package/dist/components/breadcrumbs/index.js +285 -0
  36. package/dist/components/breadcrumbs/index.js.map +1 -0
  37. package/dist/components/button/index.d.ts +4 -2
  38. package/dist/components/button/index.js +227 -188
  39. package/dist/components/button/index.js.map +1 -1
  40. package/dist/components/button-group/index.d.ts +87 -0
  41. package/dist/components/button-group/index.js +275 -0
  42. package/dist/components/button-group/index.js.map +1 -0
  43. package/dist/components/calendar/index.d.ts +11 -3
  44. package/dist/components/calendar/index.js +60 -45
  45. package/dist/components/calendar/index.js.map +1 -1
  46. package/dist/components/carousel/index.d.ts +72 -0
  47. package/dist/components/carousel/index.js +496 -0
  48. package/dist/components/carousel/index.js.map +1 -0
  49. package/dist/components/checkbox/index.d.ts +7 -1
  50. package/dist/components/checkbox/index.js +183 -138
  51. package/dist/components/checkbox/index.js.map +1 -1
  52. package/dist/components/checkbox-group/index.d.ts +92 -0
  53. package/dist/components/checkbox-group/index.js +306 -0
  54. package/dist/components/checkbox-group/index.js.map +1 -0
  55. package/dist/components/code/index.d.ts +25 -0
  56. package/dist/components/code/index.js +87 -0
  57. package/dist/components/code/index.js.map +1 -0
  58. package/dist/components/color-area/index.d.ts +85 -0
  59. package/dist/components/color-area/index.js +630 -0
  60. package/dist/components/color-area/index.js.map +1 -0
  61. package/dist/components/color-field/index.d.ts +144 -0
  62. package/dist/components/color-field/index.js +516 -0
  63. package/dist/components/color-field/index.js.map +1 -0
  64. package/dist/components/color-picker/index.d.ts +74 -0
  65. package/dist/components/color-picker/index.js +317 -0
  66. package/dist/components/color-picker/index.js.map +1 -0
  67. package/dist/components/color-slider/index.d.ts +82 -0
  68. package/dist/components/color-slider/index.js +456 -0
  69. package/dist/components/color-slider/index.js.map +1 -0
  70. package/dist/components/color-swatch/index.d.ts +46 -0
  71. package/dist/components/color-swatch/index.js +127 -0
  72. package/dist/components/color-swatch/index.js.map +1 -0
  73. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  74. package/dist/components/color-swatch-picker/index.js +287 -0
  75. package/dist/components/color-swatch-picker/index.js.map +1 -0
  76. package/dist/components/color-wheel/index.d.ts +71 -0
  77. package/dist/components/color-wheel/index.js +407 -0
  78. package/dist/components/color-wheel/index.js.map +1 -0
  79. package/dist/components/combo-box/index.d.ts +193 -0
  80. package/dist/components/combo-box/index.js +616 -0
  81. package/dist/components/combo-box/index.js.map +1 -0
  82. package/dist/components/container/index.d.ts +47 -0
  83. package/dist/components/container/index.js +85 -0
  84. package/dist/components/container/index.js.map +1 -0
  85. package/dist/components/date-field/index.d.ts +120 -0
  86. package/dist/components/date-field/index.js +111 -0
  87. package/dist/components/date-field/index.js.map +1 -0
  88. package/dist/components/date-picker/index.d.ts +130 -0
  89. package/dist/components/date-picker/index.js +310 -0
  90. package/dist/components/date-picker/index.js.map +1 -0
  91. package/dist/components/date-range-picker/index.d.ts +139 -0
  92. package/dist/components/date-range-picker/index.js +421 -0
  93. package/dist/components/date-range-picker/index.js.map +1 -0
  94. package/dist/components/disclosure/index.d.ts +94 -0
  95. package/dist/components/disclosure/index.js +365 -0
  96. package/dist/components/disclosure/index.js.map +1 -0
  97. package/dist/components/disclosure-group/index.d.ts +61 -0
  98. package/dist/components/disclosure-group/index.js +100 -0
  99. package/dist/components/disclosure-group/index.js.map +1 -0
  100. package/dist/components/drop-zone/index.d.ts +113 -0
  101. package/dist/components/drop-zone/index.js +304 -0
  102. package/dist/components/drop-zone/index.js.map +1 -0
  103. package/dist/components/fab/index.d.ts +80 -0
  104. package/dist/components/fab/index.js +246 -0
  105. package/dist/components/fab/index.js.map +1 -0
  106. package/dist/components/fab-menu/index.d.ts +120 -0
  107. package/dist/components/fab-menu/index.js +640 -0
  108. package/dist/components/fab-menu/index.js.map +1 -0
  109. package/dist/components/feed/index.d.ts +57 -0
  110. package/dist/components/feed/index.js +167 -0
  111. package/dist/components/feed/index.js.map +1 -0
  112. package/dist/components/form/index.d.ts +3 -2
  113. package/dist/components/form/index.js.map +1 -1
  114. package/dist/components/icon-button/index.d.ts +4 -2
  115. package/dist/components/icon-button/index.js +204 -171
  116. package/dist/components/icon-button/index.js.map +1 -1
  117. package/dist/components/keycap/index.d.ts +27 -0
  118. package/dist/components/keycap/index.js +136 -0
  119. package/dist/components/keycap/index.js.map +1 -0
  120. package/dist/components/list/index.d.ts +15 -158
  121. package/dist/components/list/index.js +21 -1047
  122. package/dist/components/list/index.js.map +1 -1
  123. package/dist/components/list-box/index.d.ts +73 -0
  124. package/dist/components/list-box/index.js +82 -0
  125. package/dist/components/list-box/index.js.map +1 -0
  126. package/dist/components/loading-indicator/index.d.ts +32 -0
  127. package/dist/components/loading-indicator/index.js +174 -0
  128. package/dist/components/loading-indicator/index.js.map +1 -0
  129. package/dist/components/menu/index.js +1 -1
  130. package/dist/components/navigation-tree/index.d.ts +117 -0
  131. package/dist/components/navigation-tree/index.js +135 -0
  132. package/dist/components/navigation-tree/index.js.map +1 -0
  133. package/dist/components/number-field/index.js +132 -143
  134. package/dist/components/number-field/index.js.map +1 -1
  135. package/dist/components/range-calendar/index.d.ts +69 -0
  136. package/dist/components/range-calendar/index.js +144 -0
  137. package/dist/components/range-calendar/index.js.map +1 -0
  138. package/dist/components/search-view/index.d.ts +78 -0
  139. package/dist/components/search-view/index.js +570 -0
  140. package/dist/components/search-view/index.js.map +1 -0
  141. package/dist/components/select/index.d.ts +152 -0
  142. package/dist/components/select/index.js +419 -0
  143. package/dist/components/select/index.js.map +1 -0
  144. package/dist/components/separator/index.d.ts +3 -2
  145. package/dist/components/separator/index.js +29 -26
  146. package/dist/components/separator/index.js.map +1 -1
  147. package/dist/components/slider/index.d.ts +111 -0
  148. package/dist/components/slider/index.js +673 -0
  149. package/dist/components/slider/index.js.map +1 -0
  150. package/dist/components/split-button/index.d.ts +77 -0
  151. package/dist/components/split-button/index.js +354 -0
  152. package/dist/components/split-button/index.js.map +1 -0
  153. package/dist/components/supporting-pane/index.d.ts +44 -0
  154. package/dist/components/supporting-pane/index.js +109 -0
  155. package/dist/components/supporting-pane/index.js.map +1 -0
  156. package/dist/components/tabs/index.d.ts +196 -0
  157. package/dist/components/tabs/index.js +1137 -0
  158. package/dist/components/tabs/index.js.map +1 -0
  159. package/dist/components/text/index.d.ts +1 -1
  160. package/dist/components/text/index.js +49 -21
  161. package/dist/components/text/index.js.map +1 -1
  162. package/dist/components/text-area/index.d.ts +145 -0
  163. package/dist/components/text-area/index.js +231 -0
  164. package/dist/components/text-area/index.js.map +1 -0
  165. package/dist/components/time-field/index.d.ts +43 -0
  166. package/dist/components/time-field/index.js +107 -0
  167. package/dist/components/time-field/index.js.map +1 -0
  168. package/dist/components/time-picker/index.d.ts +65 -0
  169. package/dist/components/time-picker/index.js +1168 -0
  170. package/dist/components/time-picker/index.js.map +1 -0
  171. package/dist/components/toolbar/index.d.ts +53 -0
  172. package/dist/components/toolbar/index.js +185 -0
  173. package/dist/components/toolbar/index.js.map +1 -0
  174. package/dist/components/tooltip/index.d.ts +101 -0
  175. package/dist/components/tooltip/index.js +223 -0
  176. package/dist/components/tooltip/index.js.map +1 -0
  177. package/dist/components/tree/index.d.ts +112 -0
  178. package/dist/components/tree/index.js +157 -0
  179. package/dist/components/tree/index.js.map +1 -0
  180. package/dist/control/group.js +23 -0
  181. package/dist/control/group.js.map +1 -0
  182. package/dist/disclosure/chevron.js +75 -0
  183. package/dist/disclosure/chevron.js.map +1 -0
  184. package/dist/disclosure/index.js +7 -0
  185. package/dist/disclosure/index.js.map +1 -0
  186. package/dist/drop/index.d.ts +54 -0
  187. package/dist/drop/index.js +161 -0
  188. package/dist/drop/index.js.map +1 -0
  189. package/dist/fab/index.d.ts +19 -0
  190. package/dist/fab/index.js +147 -0
  191. package/dist/fab/index.js.map +1 -0
  192. package/dist/field/chevron.js +74 -0
  193. package/dist/field/chevron.js.map +1 -0
  194. package/dist/field/index.d.ts +2 -1
  195. package/dist/field/index.js +350 -153
  196. package/dist/field/index.js.map +1 -1
  197. package/dist/field/styles.js +27 -0
  198. package/dist/field/styles.js.map +1 -1
  199. package/dist/files/index.d.ts +18 -0
  200. package/dist/files/index.js +107 -0
  201. package/dist/files/index.js.map +1 -0
  202. package/dist/form/index.d.ts +6 -4
  203. package/dist/form/index.js +64 -85
  204. package/dist/form/index.js.map +1 -1
  205. package/dist/glyphs/index.js +92 -1
  206. package/dist/glyphs/index.js.map +1 -1
  207. package/dist/i18n/index.js +20 -1
  208. package/dist/i18n/index.js.map +1 -1
  209. package/dist/i18n/messages.js +1394 -34
  210. package/dist/i18n/messages.js.map +1 -1
  211. package/dist/index.d.ts +51 -6
  212. package/dist/index.js +47 -4
  213. package/dist/indicator/paths.js +23 -1
  214. package/dist/indicator/paths.js.map +1 -1
  215. package/dist/modal/index.js +96 -68
  216. package/dist/modal/index.js.map +1 -1
  217. package/dist/navigation/index.js +8 -5
  218. package/dist/navigation/index.js.map +1 -1
  219. package/dist/number/keyboard.js +16 -0
  220. package/dist/number/keyboard.js.map +1 -0
  221. package/dist/overlay/anchored.js +68 -38
  222. package/dist/overlay/anchored.js.map +1 -1
  223. package/dist/overlay/keyboard.js +57 -0
  224. package/dist/overlay/keyboard.js.map +1 -0
  225. package/dist/overlay/panel.js +173 -19
  226. package/dist/overlay/panel.js.map +1 -1
  227. package/dist/overlay/placement.js +16 -2
  228. package/dist/overlay/placement.js.map +1 -1
  229. package/dist/picker/index.js +322 -0
  230. package/dist/picker/index.js.map +1 -0
  231. package/dist/press/index.d.ts +2 -0
  232. package/dist/press/index.js +102 -100
  233. package/dist/press/index.js.map +1 -1
  234. package/dist/row/index.js +77 -69
  235. package/dist/row/index.js.map +1 -1
  236. package/dist/row/styles.js +13 -2
  237. package/dist/row/styles.js.map +1 -1
  238. package/dist/segments/field.js +277 -0
  239. package/dist/segments/field.js.map +1 -0
  240. package/dist/segments/index.js +574 -0
  241. package/dist/segments/index.js.map +1 -0
  242. package/dist/segments/styles.js +24 -0
  243. package/dist/segments/styles.js.map +1 -0
  244. package/dist/separator/index.js +7 -0
  245. package/dist/separator/index.js.map +1 -0
  246. package/dist/slider/index.js +145 -0
  247. package/dist/slider/index.js.map +1 -0
  248. package/dist/swatch/index.js +56 -0
  249. package/dist/swatch/index.js.map +1 -0
  250. package/dist/typography/size.js +14 -0
  251. package/dist/typography/size.js.map +1 -0
  252. package/package.json +11 -2
  253. package/dist/badge/styles.js.map +0 -1
@@ -0,0 +1,365 @@
1
+ import { useTheme } from "../../theme/scope.js";
2
+ import { composeStyles, themedStyles } from "../../theme/styles.js";
3
+ import { usePressFeedback } from "../../press/index.js";
4
+ import { rowContentColor, rowStyles } from "../../row/styles.js";
5
+ import { RowContent, rowStyleOf } from "../../row/index.js";
6
+ import { ExpandChevron } from "../../disclosure/chevron.js";
7
+ import { DisclosureGroupStateContext } from "../../disclosure/index.js";
8
+ import { c } from "react/compiler-runtime";
9
+ import { Pressable, StyleSheet, View } from "react-native";
10
+ import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from "react-native-reanimated";
11
+ import { createContext, use, useEffect, useId, useState } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { useDisclosureState } from "react-stately/useDisclosureState";
14
+ //#region src/components/disclosure/index.tsx
15
+ const stylesOf = themedStyles(({ spacing }) => StyleSheet.create({ inner: {
16
+ paddingBottom: spacing.lg,
17
+ paddingHorizontal: spacing.lg
18
+ } }));
19
+ const styles = StyleSheet.create({
20
+ clip: { overflow: "hidden" },
21
+ closed: { display: "none" }
22
+ });
23
+ const DisclosureContext = createContext(null);
24
+ function chevronFor(isExpanded) {
25
+ return /* @__PURE__ */ jsx(ExpandChevron, { isExpanded });
26
+ }
27
+ /**
28
+ * A section that opens to show what is under it. Pass `isExpanded` with
29
+ * `onExpandedChange` to hold whether it is open, or `defaultExpanded` to let
30
+ * it keep its own.
31
+ *
32
+ * ```tsx
33
+ * <Disclosure>
34
+ * <Disclosure.Header>Headline</Disclosure.Header>
35
+ * <Disclosure.Panel>
36
+ * <Text>Supporting line</Text>
37
+ * </Disclosure.Panel>
38
+ * </Disclosure>
39
+ * ```
40
+ *
41
+ * The header is the row every list here draws, so a section above a list of
42
+ * rows lines up with them. The panel opens to whatever height its content
43
+ * reports, and opens and closes at once under reduced motion.
44
+ *
45
+ * Inside a `DisclosureGroup`, give it an `id`, the key the group reports.
46
+ *
47
+ * `style`, `ref` and `testID` land on the section's own view, as they do on
48
+ * each part's.
49
+ */
50
+ function Disclosure(t0) {
51
+ const $ = c(24);
52
+ const { children, defaultExpanded, id, isDisabled: t1, isExpanded, onExpandedChange, ref, style, testID } = t0;
53
+ const isDisabled = t1 === void 0 ? false : t1;
54
+ const group = use(DisclosureGroupStateContext);
55
+ const fallback = useId();
56
+ const key = id ?? fallback;
57
+ let t2;
58
+ if ($[0] !== group || $[1] !== isExpanded || $[2] !== key) {
59
+ t2 = group === null ? isExpanded : group.expandedKeys.has(key);
60
+ $[0] = group;
61
+ $[1] = isExpanded;
62
+ $[2] = key;
63
+ $[3] = t2;
64
+ } else t2 = $[3];
65
+ let t3;
66
+ if ($[4] !== group || $[5] !== key || $[6] !== onExpandedChange) {
67
+ t3 = expandedChangeOf(group, key, onExpandedChange);
68
+ $[4] = group;
69
+ $[5] = key;
70
+ $[6] = onExpandedChange;
71
+ $[7] = t3;
72
+ } else t3 = $[7];
73
+ let t4;
74
+ if ($[8] !== defaultExpanded || $[9] !== t2 || $[10] !== t3) {
75
+ t4 = {
76
+ defaultExpanded,
77
+ isExpanded: t2,
78
+ onExpandedChange: t3
79
+ };
80
+ $[8] = defaultExpanded;
81
+ $[9] = t2;
82
+ $[10] = t3;
83
+ $[11] = t4;
84
+ } else t4 = $[11];
85
+ const state = useDisclosureState(t4);
86
+ const header = useId();
87
+ const disabled = isDisabled || (group?.isDisabled ?? false);
88
+ let t5;
89
+ if ($[12] !== disabled || $[13] !== header || $[14] !== state) {
90
+ t5 = {
91
+ header,
92
+ isDisabled: disabled,
93
+ state
94
+ };
95
+ $[12] = disabled;
96
+ $[13] = header;
97
+ $[14] = state;
98
+ $[15] = t5;
99
+ } else t5 = $[15];
100
+ const value = t5;
101
+ let t6;
102
+ if ($[16] !== children || $[17] !== ref || $[18] !== style || $[19] !== testID) {
103
+ t6 = /* @__PURE__ */ jsx(View, {
104
+ ref,
105
+ style,
106
+ testID,
107
+ children
108
+ });
109
+ $[16] = children;
110
+ $[17] = ref;
111
+ $[18] = style;
112
+ $[19] = testID;
113
+ $[20] = t6;
114
+ } else t6 = $[20];
115
+ let t7;
116
+ if ($[21] !== t6 || $[22] !== value) {
117
+ t7 = /* @__PURE__ */ jsx(DisclosureContext, {
118
+ value,
119
+ children: t6
120
+ });
121
+ $[21] = t6;
122
+ $[22] = value;
123
+ $[23] = t7;
124
+ } else t7 = $[23];
125
+ return t7;
126
+ }
127
+ /**
128
+ * The row that opens and closes the section: a button announced as expanded
129
+ * or collapsed, drawing the shared row's slots with a chevron in the
130
+ * trailing one.
131
+ */
132
+ function DisclosureHeader(t0) {
133
+ const $ = c(32);
134
+ const { children, leading, ref, style, supporting, testID } = t0;
135
+ const { header, isDisabled, state } = useDisclosure("Disclosure.Header");
136
+ const theme = useTheme();
137
+ let t1;
138
+ if ($[0] !== isDisabled || $[1] !== theme) {
139
+ t1 = rowContentColor(theme, { isDisabled });
140
+ $[0] = isDisabled;
141
+ $[1] = theme;
142
+ $[2] = t1;
143
+ } else t1 = $[2];
144
+ let t2;
145
+ if ($[3] !== isDisabled || $[4] !== t1) {
146
+ t2 = {
147
+ color: t1,
148
+ disabled: isDisabled
149
+ };
150
+ $[3] = isDisabled;
151
+ $[4] = t1;
152
+ $[5] = t2;
153
+ } else t2 = $[5];
154
+ const feedback = usePressFeedback(t2);
155
+ const t3 = state.isExpanded;
156
+ let t4;
157
+ if ($[6] !== state) {
158
+ t4 = toggleOf(state);
159
+ $[6] = state;
160
+ $[7] = t4;
161
+ } else t4 = $[7];
162
+ const t5 = feedback.handlers;
163
+ let t6;
164
+ if ($[8] !== feedback.ring || $[9] !== style || $[10] !== supporting || $[11] !== theme) {
165
+ t6 = composeStyles(rowStyleOf(theme, { supporting }), feedback.ring, feedback.ring === void 0 ? void 0 : rowStyles.ring, style);
166
+ $[8] = feedback.ring;
167
+ $[9] = style;
168
+ $[10] = supporting;
169
+ $[11] = theme;
170
+ $[12] = t6;
171
+ } else t6 = $[12];
172
+ const t7 = feedback.layer;
173
+ let t8;
174
+ if ($[13] !== state.isExpanded) {
175
+ t8 = chevronFor(state.isExpanded);
176
+ $[13] = state.isExpanded;
177
+ $[14] = t8;
178
+ } else t8 = $[14];
179
+ let t9;
180
+ if ($[15] !== children || $[16] !== isDisabled || $[17] !== leading || $[18] !== supporting || $[19] !== t8) {
181
+ t9 = /* @__PURE__ */ jsx(RowContent, {
182
+ isDisabled,
183
+ leading,
184
+ supporting,
185
+ trailing: t8,
186
+ children
187
+ });
188
+ $[15] = children;
189
+ $[16] = isDisabled;
190
+ $[17] = leading;
191
+ $[18] = supporting;
192
+ $[19] = t8;
193
+ $[20] = t9;
194
+ } else t9 = $[20];
195
+ let t10;
196
+ if ($[21] !== feedback.handlers || $[22] !== feedback.layer || $[23] !== header || $[24] !== isDisabled || $[25] !== ref || $[26] !== state.isExpanded || $[27] !== t4 || $[28] !== t6 || $[29] !== t9 || $[30] !== testID) {
197
+ t10 = /* @__PURE__ */ jsxs(Pressable, {
198
+ "aria-expanded": t3,
199
+ id: header,
200
+ onPress: t4,
201
+ ref,
202
+ role: "button",
203
+ testID,
204
+ ...t5,
205
+ disabled: isDisabled,
206
+ style: t6,
207
+ children: [t7, t9]
208
+ });
209
+ $[21] = feedback.handlers;
210
+ $[22] = feedback.layer;
211
+ $[23] = header;
212
+ $[24] = isDisabled;
213
+ $[25] = ref;
214
+ $[26] = state.isExpanded;
215
+ $[27] = t4;
216
+ $[28] = t6;
217
+ $[29] = t9;
218
+ $[30] = testID;
219
+ $[31] = t10;
220
+ } else t10 = $[31];
221
+ return t10;
222
+ }
223
+ /**
224
+ * What the section shows while it is open. Its content sits 16dp in, lined
225
+ * up with the headline above it, and it is named by the header.
226
+ */
227
+ function DisclosurePanel(t0) {
228
+ const $ = c(26);
229
+ const { children, ref, role: t1, style, testID } = t0;
230
+ const role = t1 === void 0 ? "group" : t1;
231
+ const { header, state } = useDisclosure("Disclosure.Panel");
232
+ const { isExpanded } = state;
233
+ const theme = useTheme();
234
+ const own = stylesOf(theme);
235
+ const { motion } = theme;
236
+ const reduceMotion = useReducedMotion();
237
+ const [shown, setShown] = useState(isExpanded);
238
+ const openness = useSharedValue(isExpanded ? 1 : 0);
239
+ const height = useSharedValue(-1);
240
+ let t2;
241
+ if ($[0] !== height || $[1] !== shown) {
242
+ t2 = (event) => {
243
+ if (shown) height.set(event.nativeEvent.layout.height);
244
+ };
245
+ $[0] = height;
246
+ $[1] = shown;
247
+ $[2] = t2;
248
+ } else t2 = $[2];
249
+ const measure = t2;
250
+ if (isExpanded && !shown) setShown(true);
251
+ else if (!isExpanded && shown && reduceMotion) setShown(false);
252
+ let t3;
253
+ let t4;
254
+ if ($[3] !== isExpanded || $[4] !== motion || $[5] !== openness || $[6] !== reduceMotion) {
255
+ t3 = () => {
256
+ const target = isExpanded ? 1 : 0;
257
+ if (reduceMotion) {
258
+ openness.set(target);
259
+ return;
260
+ }
261
+ openness.set(withTiming(target, {
262
+ duration: motion.durationMedium2,
263
+ easing: Easing.bezier(...motion.easingEmphasized)
264
+ }));
265
+ if (isExpanded) return;
266
+ const timer = setTimeout(() => {
267
+ setShown(false);
268
+ }, motion.durationMedium2);
269
+ return () => {
270
+ clearTimeout(timer);
271
+ };
272
+ };
273
+ t4 = [
274
+ isExpanded,
275
+ motion,
276
+ openness,
277
+ reduceMotion
278
+ ];
279
+ $[3] = isExpanded;
280
+ $[4] = motion;
281
+ $[5] = openness;
282
+ $[6] = reduceMotion;
283
+ $[7] = t3;
284
+ $[8] = t4;
285
+ } else {
286
+ t3 = $[7];
287
+ t4 = $[8];
288
+ }
289
+ useEffect(t3, t4);
290
+ const clip = useAnimatedStyle(() => {
291
+ "worklet";
292
+ const measured = height.get();
293
+ const progress = openness.get();
294
+ if (measured < 0) return progress === 1 ? {} : { height: 0 };
295
+ return { height: measured * progress };
296
+ });
297
+ const t5 = Animated;
298
+ const t6 = !isExpanded;
299
+ let t7;
300
+ if ($[9] !== clip || $[10] !== style) {
301
+ t7 = composeStyles(styles.clip, clip, style);
302
+ $[9] = clip;
303
+ $[10] = style;
304
+ $[11] = t7;
305
+ } else t7 = $[11];
306
+ const T0 = View;
307
+ const t8 = composeStyles(own.inner, shown ? void 0 : styles.closed);
308
+ let t9;
309
+ if ($[12] !== T0 || $[13] !== children || $[14] !== measure || $[15] !== t8) {
310
+ t9 = /* @__PURE__ */ jsx(T0, {
311
+ onLayout: measure,
312
+ style: t8,
313
+ children
314
+ });
315
+ $[12] = T0;
316
+ $[13] = children;
317
+ $[14] = measure;
318
+ $[15] = t8;
319
+ $[16] = t9;
320
+ } else t9 = $[16];
321
+ let t10;
322
+ if ($[17] !== header || $[18] !== ref || $[19] !== role || $[20] !== t5.View || $[21] !== t6 || $[22] !== t7 || $[23] !== t9 || $[24] !== testID) {
323
+ t10 = /* @__PURE__ */ jsx(t5.View, {
324
+ "aria-hidden": t6,
325
+ "aria-labelledby": header,
326
+ ref,
327
+ role,
328
+ style: t7,
329
+ testID,
330
+ children: t9
331
+ });
332
+ $[17] = header;
333
+ $[18] = ref;
334
+ $[19] = role;
335
+ $[20] = t5.View;
336
+ $[21] = t6;
337
+ $[22] = t7;
338
+ $[23] = t9;
339
+ $[24] = testID;
340
+ $[25] = t10;
341
+ } else t10 = $[25];
342
+ return t10;
343
+ }
344
+ function expandedChangeOf(group, key, onExpandedChange) {
345
+ return (expanded) => {
346
+ group?.toggleKey(key);
347
+ onExpandedChange?.(expanded);
348
+ };
349
+ }
350
+ function toggleOf(state) {
351
+ return () => {
352
+ state.toggle();
353
+ };
354
+ }
355
+ function useDisclosure(part) {
356
+ const value = use(DisclosureContext);
357
+ if (value === null) throw new Error(`${part} is drawn inside Disclosure.`);
358
+ return value;
359
+ }
360
+ Disclosure.Header = DisclosureHeader;
361
+ Disclosure.Panel = DisclosurePanel;
362
+ //#endregion
363
+ export { Disclosure, DisclosureHeader, DisclosurePanel };
364
+
365
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","LayoutChangeEvent","StyleProp","ViewStyle","AnimatedStyle","Key","DisclosureGroupState","DisclosureState","createContext","use","useCallback","useEffect","useId","useMemo","useState","Pressable","StyleSheet","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","useDisclosureState","ResolvedTheme","DisclosureGroupStateContext","ExpandChevron","usePressFeedback","RowContent","rowContentColor","rowStyleOf","rowStyles","useTheme","composeStyles","themedStyles","stylesOf","spacing","create","inner","paddingBottom","lg","paddingHorizontal","styles","clip","overflow","closed","display","DisclosureContextValue","header","isDisabled","state","DisclosureHeaderProps","children","leading","ref","style","supporting","testID","DisclosurePanelProps","role","DisclosureProps","defaultExpanded","id","isExpanded","onExpandedChange","DisclosureContext","chevronFor","Disclosure","t0","$","_c","t1","undefined","group","fallback","key","t2","expandedKeys","has","t3","expandedChangeOf","t4","disabled","t5","value","t6","t7","DisclosureHeader","useDisclosure","theme","color","feedback","toggleOf","handlers","ring","layer","t8","t9","t10","DisclosurePanel","own","motion","reduceMotion","shown","setShown","openness","height","event","set","nativeEvent","layout","measure","target","duration","durationMedium2","easing","bezier","easingEmphasized","timer","setTimeout","clearTimeout","measured","get","progress","T0","expanded","toggleKey","toggle","part","Error","Header","Panel","_c"],"sources":["../../../src/components/disclosure/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native'\nimport type { AnimatedStyle } from 'react-native-reanimated'\nimport type { Key } from 'react-stately'\nimport type { DisclosureGroupState } from 'react-stately/useDisclosureGroupState'\nimport type { DisclosureState } from 'react-stately/useDisclosureState'\n\nimport {\n createContext,\n use,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated'\nimport { useDisclosureState } from 'react-stately/useDisclosureState'\n\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport { DisclosureGroupStateContext } from '../../disclosure'\nimport { ExpandChevron } from '../../disclosure/chevron'\nimport { usePressFeedback } from '../../press'\nimport { RowContent, rowContentColor, rowStyleOf, rowStyles } from '../../row'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\n\n// kanso-ui's Disclosure: a section that opens to show what is under it, and\n// closes again. The header is the row every list here draws, src/row, shared\n// with ListItem and every menu item, so its 56dp floor, 72dp with a\n// supporting line, body-large headline, body-medium supporting line and\n// state layers are that module's, and a header above a list cannot drift\n// from the rows below it. A 24dp chevron in its trailing slot turns a quarter\n// to point down once the section is open, over the short3 duration on the\n// standard curve, as web's does, and mirrors under right-to-left. The panel\n// holds its content 16dp in, lined up with the headline above it.\n//\n// **The header is a button and not a heading.** Web renders the button\n// inside a heading at `headingLevel`; React Native's screen readers have no\n// heading levels, so the prop is dropped, as AppBar drops it. The button\n// reports whether the section is expanded.\n//\n// **The panel moves its height on Reanimated**, from nothing to the height\n// its content reports through `onLayout`, over the medium2 duration on the\n// emphasised curve, web's. Under reduced motion it opens and closes at once.\n// It closes the same way it opens, which web does not: there the collapsed\n// panel takes React Aria's `hidden=\"until-found\"`, which stops its content\n// being laid out at once and leaves nothing to shrink, and native has no\n// counterpart to it. Once closed, its content is laid out no longer, so\n// nothing in it is reached by a press, a key or a screen reader, and it is\n// hidden from a screen reader while it closes.\n//\n// The state is React Stately's `useDisclosureState`, the one web's React Aria\n// keeps, handed to the two parts through context. Inside a DisclosureGroup\n// the group's keys say whether the section is open, under its `id`, and the\n// group's `isDisabled` disables it as its own does, as React Aria's do.\n\nconst stylesOf = themedStyles(({ spacing }: ResolvedTheme) =>\n StyleSheet.create({\n inner: {\n paddingBottom: spacing.lg,\n paddingHorizontal: spacing.lg,\n },\n }),\n)\n\nconst styles = StyleSheet.create({\n // What the panel's height moves inside: its content lays out at its own\n // height whatever the clip is, which is what `onLayout` measures.\n clip: {\n overflow: 'hidden',\n },\n // A closed panel's content, which takes no part in layout, presses, keys\n // or a screen reader once its close has run.\n closed: {\n display: 'none',\n },\n})\n\ntype DisclosureContextValue = {\n readonly header: string\n readonly isDisabled: boolean\n readonly state: DisclosureState\n}\n\ntype DisclosureHeaderProps = {\n /** The header's headline, what the section is about. */\n readonly children?: ReactNode\n /** Content before the headline: an avatar, an icon. */\n readonly leading?: ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n /** A second line under the headline, in the muted role. */\n readonly supporting?: ReactNode\n readonly testID?: string\n}\n\ntype DisclosurePanelProps = {\n /** What the section shows while it is open. */\n readonly children?: ReactNode\n readonly ref?: Ref<ComponentRef<typeof View>>\n /**\n * `region` names the panel as a landmark, for a section a reader should be\n * able to jump to, where `group` only gathers what is in it.\n * @default 'group'\n */\n readonly role?: 'group' | 'region'\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n}\n\ntype DisclosureProps = {\n /** A `Disclosure.Header` and a `Disclosure.Panel`. */\n readonly children?: ReactNode\n /** Whether the section starts open, when it keeps its own state. */\n readonly defaultExpanded?: boolean\n /**\n * The section's key in a `DisclosureGroup`, which the group reports as\n * expanded. Outside a group it does nothing.\n */\n readonly id?: Key\n /**\n * Keeps the section from opening or closing, and draws its header\n * disabled.\n * @default false\n */\n readonly isDisabled?: boolean\n /** Whether the section is open, when the call site holds the state. */\n readonly isExpanded?: boolean\n /** Called with the new state as the section opens or closes. */\n readonly onExpandedChange?: (isExpanded: boolean) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n}\n\nconst DisclosureContext = createContext<DisclosureContextValue | null>(null)\n\n// The chevron, turned or not. A call rather than JSX written at the prop,\n// which is what react-perf's jsx-no-jsx-as-prop is after; the React Compiler\n// memoises the result on `isExpanded`.\nfunction chevronFor(isExpanded: boolean) {\n return <ExpandChevron isExpanded={isExpanded} />\n}\n\n/**\n * A section that opens to show what is under it. Pass `isExpanded` with\n * `onExpandedChange` to hold whether it is open, or `defaultExpanded` to let\n * it keep its own.\n *\n * ```tsx\n * <Disclosure>\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>\n * <Text>Supporting line</Text>\n * </Disclosure.Panel>\n * </Disclosure>\n * ```\n *\n * The header is the row every list here draws, so a section above a list of\n * rows lines up with them. The panel opens to whatever height its content\n * reports, and opens and closes at once under reduced motion.\n *\n * Inside a `DisclosureGroup`, give it an `id`, the key the group reports.\n *\n * `style`, `ref` and `testID` land on the section's own view, as they do on\n * each part's.\n */\nfunction Disclosure({\n children,\n defaultExpanded,\n id,\n isDisabled = false,\n isExpanded,\n onExpandedChange,\n ref,\n style,\n testID,\n}: DisclosureProps) {\n const group = use(DisclosureGroupStateContext)\n const fallback = useId()\n const key = id ?? fallback\n const state = useDisclosureState({\n defaultExpanded,\n isExpanded: group === null ? isExpanded : group.expandedKeys.has(key),\n onExpandedChange: expandedChangeOf(group, key, onExpandedChange),\n })\n const header = useId()\n const disabled = isDisabled || (group?.isDisabled ?? false)\n const value = useMemo<DisclosureContextValue>(\n () => ({ header, isDisabled: disabled, state }),\n [disabled, header, state],\n )\n\n return (\n <DisclosureContext value={value}>\n <View ref={ref} style={style} testID={testID}>\n {children}\n </View>\n </DisclosureContext>\n )\n}\n\n/**\n * The row that opens and closes the section: a button announced as expanded\n * or collapsed, drawing the shared row's slots with a chevron in the\n * trailing one.\n */\nfunction DisclosureHeader({\n children,\n leading,\n ref,\n style,\n supporting,\n testID,\n}: DisclosureHeaderProps) {\n const { header, isDisabled, state } = useDisclosure('Disclosure.Header')\n const theme = useTheme()\n const feedback = usePressFeedback({\n color: rowContentColor(theme, { isDisabled }),\n disabled: isDisabled,\n })\n\n return (\n <Pressable\n aria-expanded={state.isExpanded}\n id={header}\n onPress={toggleOf(state)}\n ref={ref}\n role=\"button\"\n testID={testID}\n {...feedback.handlers}\n disabled={isDisabled}\n style={composeStyles<ViewStyle>(\n rowStyleOf(theme, { supporting }),\n feedback.ring,\n feedback.ring === undefined ? undefined : rowStyles.ring,\n style,\n )}\n >\n {feedback.layer}\n <RowContent\n isDisabled={isDisabled}\n leading={leading}\n supporting={supporting}\n trailing={chevronFor(state.isExpanded)}\n >\n {children}\n </RowContent>\n </Pressable>\n )\n}\n\n/**\n * What the section shows while it is open. Its content sits 16dp in, lined\n * up with the headline above it, and it is named by the header.\n */\nfunction DisclosurePanel({\n children,\n ref,\n role = 'group',\n style,\n testID,\n}: DisclosurePanelProps) {\n const { header, state } = useDisclosure('Disclosure.Panel')\n const { isExpanded } = state\n const theme = useTheme()\n const own = stylesOf(theme)\n const { motion } = theme\n const reduceMotion = useReducedMotion()\n // Whether the content is laid out: from the moment the section opens until\n // its close has run.\n const [shown, setShown] = useState(isExpanded)\n const openness = useSharedValue(isExpanded ? 1 : 0)\n // The content's own height, once it has reported one while laid out. A\n // closed panel's content reports nothing worth keeping, and the handler is\n // there from the start all the same: React Native Web watches a view's size\n // only if it had a handler when it mounted.\n const height = useSharedValue(-1)\n const measure = useCallback(\n (event: LayoutChangeEvent) => {\n if (shown) {\n height.set(event.nativeEvent.layout.height)\n }\n },\n [height, shown],\n )\n\n // Laid out the moment it opens, and at once no longer when it closes with\n // no motion to run.\n if (isExpanded && !shown) {\n setShown(true)\n } else if (!isExpanded && shown && reduceMotion) {\n setShown(false)\n }\n\n useEffect(() => {\n const target = isExpanded ? 1 : 0\n\n if (reduceMotion) {\n openness.set(target)\n return undefined\n }\n\n openness.set(\n withTiming(target, {\n duration: motion.durationMedium2,\n easing: Easing.bezier(...motion.easingEmphasized),\n }),\n )\n if (isExpanded) {\n return undefined\n }\n\n const timer = setTimeout(() => {\n setShown(false)\n }, motion.durationMedium2)\n\n return () => {\n clearTimeout(timer)\n }\n }, [isExpanded, motion, openness, reduceMotion])\n\n // Open before the content has reported a height, the panel takes the\n // content's own, so a section that starts open draws it on the first\n // frame; otherwise it is the share of that height the motion has reached.\n const clip = useAnimatedStyle(() => {\n 'worklet'\n const measured = height.get()\n const progress = openness.get()\n\n if (measured < 0) {\n return progress === 1 ? {} : { height: 0 }\n }\n\n return { height: measured * progress }\n })\n\n return (\n <Animated.View\n aria-hidden={!isExpanded}\n aria-labelledby={header}\n ref={ref}\n role={role}\n style={composeStyles<AnimatedStyle<ViewStyle>>(styles.clip, clip, style)}\n testID={testID}\n >\n <View\n onLayout={measure}\n style={composeStyles<ViewStyle>(\n own.inner,\n shown ? undefined : styles.closed,\n )}\n >\n {children}\n </View>\n </Animated.View>\n )\n}\n\n// What a section calls as it opens or closes: inside a group, the group's\n// toggle of its key first, then the call site's own handler either way.\nfunction expandedChangeOf(\n group: DisclosureGroupState | null,\n key: Key,\n onExpandedChange: ((isExpanded: boolean) => void) | undefined,\n) {\n return (expanded: boolean) => {\n group?.toggleKey(key)\n onExpandedChange?.(expanded)\n }\n}\n\n// A press's toggle. Built by a call rather than declared in the component,\n// which is what react-perf's jsx-no-new-function-as-prop is after; the React\n// Compiler memoises the result on its input.\nfunction toggleOf(state: DisclosureState) {\n return () => {\n state.toggle()\n }\n}\n\nfunction useDisclosure(part: string): DisclosureContextValue {\n const value = use(DisclosureContext)\n if (value === null) {\n throw new Error(`${part} is drawn inside Disclosure.`)\n }\n return value\n}\n\nDisclosure.Header = DisclosureHeader\nDisclosure.Panel = DisclosurePanel\n\nexport { Disclosure, DisclosureHeader, DisclosurePanel }\nexport type { DisclosureHeaderProps, DisclosurePanelProps, DisclosureProps }\n"],"mappings":";;;;;;;;;;;;;;AAiEA,MAAMsC,WAAWD,cAAc,EAAEE,cAC/BrB,WAAWsB,OAAO,EAChBC,OAAO;CACLC,eAAeH,QAAQI;CACvBC,mBAAmBL,QAAQI;AAC7B,EACF,CAAC,CACH;AAEA,MAAME,SAAS3B,WAAWsB,OAAO;CAG/BM,MAAM,EACJC,UAAU,SACZ;CAGAC,QAAQ,EACNC,SAAS,OACX;AACF,CAAC;AA2DD,MAAMmB,oBAAoB1D,cAA6C,IAAI;AAK3E,S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AA;CAAA,IAAA6B;CAAA,IAAA7B,EAAA,QAAArB,UAAAqB,EAAA,QAAAf,OAAAe,EAAA,QAAAV,QAAAU,EAAA,QAAAc,GAAAnE,QAAAqD,EAAA,QAAAgB,MAAAhB,EAAA,QAAAiB,MAAAjB,EAAA,QAAA4B,MAAA5B,EAAA,QAAAZ,QAAA;EAhBTyC,MAAA,oBAAA,GAAA,MAAA;GACe,eAAAb;GACIrC,mBAAAA;GACZM;GACCK;GACC,OAAA2B;GACC7B;GAERwC,UAAAA;EASF,CAAA;EAAgB5B,EAAA,MAAArB;EAAAqB,EAAA,MAAAf;EAAAe,EAAA,MAAAV;EAAAU,EAAA,MAAAc,GAAAnE;EAAAqD,EAAA,MAAAgB;EAAAhB,EAAA,MAAAiB;EAAAjB,EAAA,MAAA4B;EAAA5B,EAAA,MAAAZ;EAAAY,EAAA,MAAA6B;CAAA,OAAAA,MAAA7B,EAAA;CAAA,OAjBhB6B;AAiBgB;AAMpB,SAASlB,iBACPP,OACAE,KACAX,kBACA;CACA,QAAQ6D,aAAsB;EAC5BpD,OAAOqD,UAAUnD,GAAG;EACpBX,mBAAmB6D,QAAQ;CAC7B;AACF;AAKA,SAASjC,SAAS1C,OAAwB;CACxC,aAAa;EACXA,MAAM6E,OAAO;CACf;AACF;AAEA,SAASvC,cAAcwC,MAAsC;CAC3D,MAAM5C,QAAQ5E,IAAIyD,iBAAiB;CACnC,IAAImB,UAAU,MACZ,MAAM,IAAI6C,MAAM,GAAGD,KAAI,6BAA8B;CAEvD,OAAO5C;AACT;AAEAjB,WAAW+D,SAAS3C;AACpBpB,WAAWgE,QAAQhC"}
@@ -0,0 +1,61 @@
1
+ import { StyleProp, View, ViewStyle } from "react-native";
2
+ import { ComponentRef, ReactNode, Ref } from "react";
3
+ import { Key } from "react-stately";
4
+ //#region src/components/disclosure-group/index.d.ts
5
+ type DisclosureGroupProps = {
6
+ /**
7
+ * Whether several sections may be open at once. Otherwise opening one
8
+ * closes the one that was open.
9
+ * @default false
10
+ */
11
+ readonly allowsMultipleExpanded?: boolean;
12
+ /** The sections, as `Disclosure` elements each given an `id`. */
13
+ readonly children?: ReactNode;
14
+ /** The keys of the sections open at first, when the group keeps its own. */
15
+ readonly defaultExpandedKeys?: Iterable<Key>;
16
+ /**
17
+ * Whether a rule is drawn between the sections. There is never one above
18
+ * the first or below the last.
19
+ * @default true
20
+ */
21
+ readonly divided?: boolean;
22
+ /** The keys of the open sections, when the call site holds them. */
23
+ readonly expandedKeys?: Iterable<Key>;
24
+ /**
25
+ * Keeps every section from opening or closing, and draws their headers
26
+ * disabled.
27
+ * @default false
28
+ */
29
+ readonly isDisabled?: boolean;
30
+ /** Called with the keys of the open sections as one opens or closes. */
31
+ readonly onExpandedChange?: (keys: Set<Key>) => void;
32
+ readonly ref?: Ref<ComponentRef<typeof View>>;
33
+ readonly style?: StyleProp<ViewStyle>;
34
+ readonly testID?: string;
35
+ };
36
+ /**
37
+ * A stack of `Disclosure` sections that agree about what is open. Pass
38
+ * `expandedKeys` with `onExpandedChange` to hold which are open, or
39
+ * `defaultExpandedKeys` to let the group keep its own.
40
+ *
41
+ * ```tsx
42
+ * <DisclosureGroup defaultExpandedKeys={FIRST}>
43
+ * <Disclosure id="first">
44
+ * <Disclosure.Header>Headline</Disclosure.Header>
45
+ * <Disclosure.Panel>
46
+ * <Text>Supporting line</Text>
47
+ * </Disclosure.Panel>
48
+ * </Disclosure>
49
+ * </DisclosureGroup>
50
+ * ```
51
+ *
52
+ * One section opens at a time unless `allowsMultipleExpanded` says otherwise.
53
+ * Give every section an `id`, which is the key the group reports.
54
+ *
55
+ * `style`, `ref` and `testID` land on the group's own view, the one a layout
56
+ * positions.
57
+ */
58
+ declare function DisclosureGroup({ allowsMultipleExpanded, children, defaultExpandedKeys, divided, expandedKeys, isDisabled, onExpandedChange, ref, style, testID }: DisclosureGroupProps): import("react").JSX.Element;
59
+ //#endregion
60
+ export { DisclosureGroup, type DisclosureGroupProps };
61
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,100 @@
1
+ import { DisclosureGroupStateContext } from "../../disclosure/index.js";
2
+ import { Separator } from "../separator/index.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { View } from "react-native";
5
+ import { Children, Fragment, isValidElement } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useDisclosureGroupState } from "react-stately/useDisclosureGroupState";
8
+ //#region src/components/disclosure-group/index.tsx
9
+ /**
10
+ * A stack of `Disclosure` sections that agree about what is open. Pass
11
+ * `expandedKeys` with `onExpandedChange` to hold which are open, or
12
+ * `defaultExpandedKeys` to let the group keep its own.
13
+ *
14
+ * ```tsx
15
+ * <DisclosureGroup defaultExpandedKeys={FIRST}>
16
+ * <Disclosure id="first">
17
+ * <Disclosure.Header>Headline</Disclosure.Header>
18
+ * <Disclosure.Panel>
19
+ * <Text>Supporting line</Text>
20
+ * </Disclosure.Panel>
21
+ * </Disclosure>
22
+ * </DisclosureGroup>
23
+ * ```
24
+ *
25
+ * One section opens at a time unless `allowsMultipleExpanded` says otherwise.
26
+ * Give every section an `id`, which is the key the group reports.
27
+ *
28
+ * `style`, `ref` and `testID` land on the group's own view, the one a layout
29
+ * positions.
30
+ */
31
+ function DisclosureGroup(t0) {
32
+ const $ = c(17);
33
+ const { allowsMultipleExpanded, children, defaultExpandedKeys, divided: t1, expandedKeys, isDisabled, onExpandedChange, ref, style, testID } = t0;
34
+ const divided = t1 === void 0 ? true : t1;
35
+ let t2;
36
+ if ($[0] !== allowsMultipleExpanded || $[1] !== defaultExpandedKeys || $[2] !== expandedKeys || $[3] !== isDisabled || $[4] !== onExpandedChange) {
37
+ t2 = {
38
+ allowsMultipleExpanded,
39
+ defaultExpandedKeys,
40
+ expandedKeys,
41
+ isDisabled,
42
+ onExpandedChange
43
+ };
44
+ $[0] = allowsMultipleExpanded;
45
+ $[1] = defaultExpandedKeys;
46
+ $[2] = expandedKeys;
47
+ $[3] = isDisabled;
48
+ $[4] = onExpandedChange;
49
+ $[5] = t2;
50
+ } else t2 = $[5];
51
+ const state = useDisclosureGroupState(t2);
52
+ let t3;
53
+ if ($[6] !== children || $[7] !== divided) {
54
+ t3 = divided ? dividedChildren(children) : children;
55
+ $[6] = children;
56
+ $[7] = divided;
57
+ $[8] = t3;
58
+ } else t3 = $[8];
59
+ let t4;
60
+ if ($[9] !== ref || $[10] !== style || $[11] !== t3 || $[12] !== testID) {
61
+ t4 = /* @__PURE__ */ jsx(View, {
62
+ ref,
63
+ style,
64
+ testID,
65
+ children: t3
66
+ });
67
+ $[9] = ref;
68
+ $[10] = style;
69
+ $[11] = t3;
70
+ $[12] = testID;
71
+ $[13] = t4;
72
+ } else t4 = $[13];
73
+ let t5;
74
+ if ($[14] !== state || $[15] !== t4) {
75
+ t5 = /* @__PURE__ */ jsx(DisclosureGroupStateContext, {
76
+ value: state,
77
+ children: t4
78
+ });
79
+ $[14] = state;
80
+ $[15] = t4;
81
+ $[16] = t5;
82
+ } else t5 = $[16];
83
+ return t5;
84
+ }
85
+ function dividedChildren(children) {
86
+ return flatten(children).map((section, index) => /* @__PURE__ */ jsxs(Fragment, { children: [index === 0 ? null : /* @__PURE__ */ jsx(Separator, {}), section] }, keyOf(section, index)));
87
+ }
88
+ function flatten(children) {
89
+ return Children.toArray(children).flatMap((child) => {
90
+ if (isValidElement(child) && child.type === Fragment) return flatten(child.props.children);
91
+ return [child];
92
+ });
93
+ }
94
+ function keyOf(section, index) {
95
+ return isValidElement(section) && section.key !== null ? section.key : String(index);
96
+ }
97
+ //#endregion
98
+ export { DisclosureGroup };
99
+
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","ViewStyle","Key","Children","Fragment","isValidElement","View","useDisclosureGroupState","DisclosureGroupStateContext","Separator","DisclosureGroupProps","allowsMultipleExpanded","children","defaultExpandedKeys","Iterable","divided","expandedKeys","isDisabled","onExpandedChange","keys","Set","ref","style","testID","DisclosureGroup","t0","$","_c","t1","undefined","t2","state","t3","dividedChildren","t4","t5","flatten","map","section","index","keyOf","toArray","flatMap","child","type","props","key","String","_c"],"sources":["../../../src/components/disclosure-group/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, ViewStyle } from 'react-native'\nimport type { Key } from 'react-stately'\n\nimport { Children, Fragment, isValidElement } from 'react'\nimport { View } from 'react-native'\nimport { useDisclosureGroupState } from 'react-stately/useDisclosureGroupState'\n\nimport { DisclosureGroupStateContext } from '../../disclosure'\nimport { Separator } from '../separator'\n\n// kanso-ui's DisclosureGroup: a stack of Disclosures that agree with each\n// other about what is open, the lists page's accordion. The sections are the\n// library's own `Disclosure`, unchanged: this adds only the agreement between\n// them and the rule that divides them.\n//\n// Give each section an `id`, which is the key the group reports as expanded.\n// Whether one opens at a time or several is `allowsMultipleExpanded`, and the\n// keys are React Stately's `useDisclosureGroupState`, the state web's React\n// Aria keeps, handed to the sections through context.\n//\n// **A rule between the sections, and none at the ends.** The group draws the\n// library's `Separator` between each pair rather than asking each section to\n// draw a border, so a section drawn on its own and a section in a group stay\n// the same component. `divided={false}` leaves them undivided, for a stack\n// sitting on cards of its own.\n//\n// **Nothing else is added.** The group draws no container, no corner and no\n// colour: an accordion inside a card and one running down a screen want\n// different surroundings, and the screen is what knows which it is.\n\ntype DisclosureGroupProps = {\n /**\n * Whether several sections may be open at once. Otherwise opening one\n * closes the one that was open.\n * @default false\n */\n readonly allowsMultipleExpanded?: boolean\n /** The sections, as `Disclosure` elements each given an `id`. */\n readonly children?: ReactNode\n /** The keys of the sections open at first, when the group keeps its own. */\n readonly defaultExpandedKeys?: Iterable<Key>\n /**\n * Whether a rule is drawn between the sections. There is never one above\n * the first or below the last.\n * @default true\n */\n readonly divided?: boolean\n /** The keys of the open sections, when the call site holds them. */\n readonly expandedKeys?: Iterable<Key>\n /**\n * Keeps every section from opening or closing, and draws their headers\n * disabled.\n * @default false\n */\n readonly isDisabled?: boolean\n /** Called with the keys of the open sections as one opens or closes. */\n readonly onExpandedChange?: (keys: Set<Key>) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n readonly testID?: string\n}\n\n/**\n * A stack of `Disclosure` sections that agree about what is open. Pass\n * `expandedKeys` with `onExpandedChange` to hold which are open, or\n * `defaultExpandedKeys` to let the group keep its own.\n *\n * ```tsx\n * <DisclosureGroup defaultExpandedKeys={FIRST}>\n * <Disclosure id=\"first\">\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>\n * <Text>Supporting line</Text>\n * </Disclosure.Panel>\n * </Disclosure>\n * </DisclosureGroup>\n * ```\n *\n * One section opens at a time unless `allowsMultipleExpanded` says otherwise.\n * Give every section an `id`, which is the key the group reports.\n *\n * `style`, `ref` and `testID` land on the group's own view, the one a layout\n * positions.\n */\nfunction DisclosureGroup({\n allowsMultipleExpanded,\n children,\n defaultExpandedKeys,\n divided = true,\n expandedKeys,\n isDisabled,\n onExpandedChange,\n ref,\n style,\n testID,\n}: DisclosureGroupProps) {\n const state = useDisclosureGroupState({\n allowsMultipleExpanded,\n defaultExpandedKeys,\n expandedKeys,\n isDisabled,\n onExpandedChange,\n })\n\n return (\n <DisclosureGroupStateContext value={state}>\n <View ref={ref} style={style} testID={testID}>\n {divided ? dividedChildren(children) : children}\n </View>\n </DisclosureGroupStateContext>\n )\n}\n\n// The sections with a rule between each pair, and none at the ends.\nfunction dividedChildren(children: ReactNode) {\n return flatten(children).map((section, index) => (\n <Fragment key={keyOf(section, index)}>\n {index === 0 ? null : <Separator />}\n {section}\n </Fragment>\n ))\n}\n\n// The sections, with any fragment around them opened up first.\n// `Children.toArray` flattens arrays but hands back a fragment as one child,\n// and a call site that writes its sections inside one, or maps over data and\n// wraps the result, would otherwise get a single entry and no rules at all.\n// Recursive, since a fragment may hold another.\nfunction flatten(children: ReactNode): ReactNode[] {\n return Children.toArray(children).flatMap((child) => {\n if (\n isValidElement<{ children?: ReactNode }>(child) &&\n child.type === Fragment\n ) {\n return flatten(child.props.children)\n }\n return [child]\n })\n}\n\n// The key `Children.toArray` put on each element, or the entry's position for\n// anything that is not one.\nfunction keyOf(section: ReactNode, index: number) {\n return isValidElement(section) && section.key !== null\n ? section.key\n : String(index)\n}\n\nexport { DisclosureGroup }\nexport type { DisclosureGroupProps }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAA2B,gBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAyB,MAAA,EAAAhB,wBAAAC,UAAAC,qBAAAE,SAAAa,IAAAZ,cAAAC,YAAAC,kBAAAG,KAAAC,OAAAC,WAAAE;CAIvB,MAAAV,UAAAa,OAAAC,KAAAA,IAAA,OAAAD;CAAc,IAAAE;CAAA,IAAAJ,EAAA,OAAAf,0BAAAe,EAAA,OAAAb,uBAAAa,EAAA,OAAAV,gBAAAU,EAAA,OAAAT,cAAAS,EAAA,OAAAR,kBAAA;EAQwBY,KAAA;GAAAnB;GAAAE;GAAAG;GAAAC;GAAAC;EAMtC;EAACQ,EAAA,KAAAf;EAAAe,EAAA,KAAAb;EAAAa,EAAA,KAAAV;EAAAU,EAAA,KAAAT;EAAAS,EAAA,KAAAR;EAAAQ,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAND,MAAAK,QAAcxB,wBAAwBuB,EAMrC;CAAC,IAAAE;CAAA,IAAAN,EAAA,OAAAd,YAAAc,EAAA,OAAAX,SAAA;EAKKiB,KAAAjB,UAAUkB,gBAAgBrB,QAAmB,IAA7CA;EAA8Cc,EAAA,KAAAd;EAAAc,EAAA,KAAAX;EAAAW,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAL,OAAAK,EAAA,QAAAJ,SAAAI,EAAA,QAAAM,MAAAN,EAAA,QAAAH,QAAA;EADjDW,KAAA,oBAAC,MAAD;GAAWb;GAAYC;GAAeC;GACnC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