@mrpelz/uikit-ish 7.9.0 → 7.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 (235) hide show
  1. package/dist/components/action-sheet/main.d.ts +1 -2
  2. package/dist/components/action-sheet/main.d.ts.map +1 -1
  3. package/dist/components/action-sheet/main.js +12 -12
  4. package/dist/components/action-sheet/main.js.map +1 -1
  5. package/dist/components/action-sheet/props.d.ts +2 -2
  6. package/dist/components/action-sheet/props.d.ts.map +1 -1
  7. package/dist/components/action-sheet/style.css +10 -1
  8. package/dist/components/activity-view/main.d.ts +1 -1
  9. package/dist/components/activity-view/main.d.ts.map +1 -1
  10. package/dist/components/activity-view/main.js +9 -11
  11. package/dist/components/activity-view/main.js.map +1 -1
  12. package/dist/components/activity-view/style.css +21 -21
  13. package/dist/components/alert/main.d.ts +2 -3
  14. package/dist/components/alert/main.d.ts.map +1 -1
  15. package/dist/components/alert/main.js +12 -15
  16. package/dist/components/alert/main.js.map +1 -1
  17. package/dist/components/alert/props.d.ts +3 -3
  18. package/dist/components/alert/style.css +23 -23
  19. package/dist/components/avatar/main.d.ts.map +1 -1
  20. package/dist/components/avatar/main.js +7 -8
  21. package/dist/components/avatar/main.js.map +1 -1
  22. package/dist/components/avatar/style.css +1 -1
  23. package/dist/components/badge/main.d.ts +1 -1
  24. package/dist/components/badge/main.js +4 -4
  25. package/dist/components/badge/main.js.map +1 -1
  26. package/dist/components/badge/style.css +7 -2
  27. package/dist/components/button/main.d.ts.map +1 -1
  28. package/dist/components/button/main.js +9 -9
  29. package/dist/components/button/main.js.map +1 -1
  30. package/dist/components/button/props.d.ts +8 -8
  31. package/dist/components/button/props.d.ts.map +1 -1
  32. package/dist/components/button/style.css +27 -29
  33. package/dist/components/checkbox/main.d.ts.map +1 -1
  34. package/dist/components/checkbox/main.js +5 -7
  35. package/dist/components/checkbox/main.js.map +1 -1
  36. package/dist/components/checkbox/style.css +3 -3
  37. package/dist/components/color-picker/main.d.ts +27 -4
  38. package/dist/components/color-picker/main.d.ts.map +1 -1
  39. package/dist/components/color-picker/main.js +265 -90
  40. package/dist/components/color-picker/main.js.map +1 -1
  41. package/dist/components/color-picker/props.d.ts +45 -10
  42. package/dist/components/color-picker/props.d.ts.map +1 -1
  43. package/dist/components/color-picker/style.css +124 -38
  44. package/dist/components/contextual-menu/main.d.ts.map +1 -1
  45. package/dist/components/contextual-menu/main.js +189 -236
  46. package/dist/components/contextual-menu/main.js.map +1 -1
  47. package/dist/components/contextual-menu/props.d.ts +10 -33
  48. package/dist/components/contextual-menu/props.d.ts.map +1 -1
  49. package/dist/components/contextual-menu/style.css +60 -34
  50. package/dist/components/date-picker/main.d.ts.map +1 -1
  51. package/dist/components/date-picker/main.js +100 -66
  52. package/dist/components/date-picker/main.js.map +1 -1
  53. package/dist/components/date-picker/props.d.ts +10 -10
  54. package/dist/components/date-picker/props.d.ts.map +1 -1
  55. package/dist/components/date-picker/style.css +51 -47
  56. package/dist/components/drawer/main.d.ts.map +1 -1
  57. package/dist/components/drawer/main.js +52 -7
  58. package/dist/components/drawer/main.js.map +1 -1
  59. package/dist/components/drawer/style.css +1 -1
  60. package/dist/components/edit-menu/main.d.ts.map +1 -1
  61. package/dist/components/edit-menu/main.js +31 -22
  62. package/dist/components/edit-menu/main.js.map +1 -1
  63. package/dist/components/edit-menu/props.d.ts +4 -4
  64. package/dist/components/edit-menu/props.d.ts.map +1 -1
  65. package/dist/components/edit-menu/style.css +10 -1
  66. package/dist/components/form/main.js +3 -3
  67. package/dist/components/form/main.js.map +1 -1
  68. package/dist/components/glass/main.d.ts +1 -1
  69. package/dist/components/glass/main.js +4 -4
  70. package/dist/components/glass/main.js.map +1 -1
  71. package/dist/components/glass/props.d.ts +5 -5
  72. package/dist/components/glass/props.d.ts.map +1 -1
  73. package/dist/components/glass/style.css +157 -157
  74. package/dist/components/header/main.d.ts.map +1 -1
  75. package/dist/components/header/main.js +27 -26
  76. package/dist/components/header/main.js.map +1 -1
  77. package/dist/components/header/style.css +13 -52
  78. package/dist/components/index.d.ts +5 -5
  79. package/dist/components/index.d.ts.map +1 -1
  80. package/dist/components/index.js +2 -2
  81. package/dist/components/index.js.map +1 -1
  82. package/dist/components/layout/main.js +5 -5
  83. package/dist/components/layout/main.js.map +1 -1
  84. package/dist/components/layout/style.css +2 -2
  85. package/dist/components/list/main.d.ts +11 -3
  86. package/dist/components/list/main.d.ts.map +1 -1
  87. package/dist/components/list/main.js +296 -300
  88. package/dist/components/list/main.js.map +1 -1
  89. package/dist/components/list/props.d.ts +49 -16
  90. package/dist/components/list/props.d.ts.map +1 -1
  91. package/dist/components/list/reorder.d.ts +146 -0
  92. package/dist/components/list/reorder.d.ts.map +1 -0
  93. package/dist/components/list/reorder.js +819 -0
  94. package/dist/components/list/reorder.js.map +1 -0
  95. package/dist/components/list/select.d.ts +6 -0
  96. package/dist/components/list/select.d.ts.map +1 -0
  97. package/dist/components/list/select.js +141 -0
  98. package/dist/components/list/select.js.map +1 -0
  99. package/dist/components/list/style.css +206 -158
  100. package/dist/components/menu/main.d.ts +77 -30
  101. package/dist/components/menu/main.d.ts.map +1 -1
  102. package/dist/components/menu/main.js +364 -89
  103. package/dist/components/menu/main.js.map +1 -1
  104. package/dist/components/menu/props.d.ts +3 -4
  105. package/dist/components/menu/props.d.ts.map +1 -1
  106. package/dist/components/menu/style.css +25 -11
  107. package/dist/components/navigation/main.d.ts +5 -2
  108. package/dist/components/navigation/main.d.ts.map +1 -1
  109. package/dist/components/navigation/main.js +287 -57
  110. package/dist/components/navigation/main.js.map +1 -1
  111. package/dist/components/navigation/props.d.ts +37 -4
  112. package/dist/components/navigation/props.d.ts.map +1 -1
  113. package/dist/components/navigation/style.css +32 -2
  114. package/dist/components/page/main.d.ts.map +1 -1
  115. package/dist/components/page/main.js +12 -7
  116. package/dist/components/page/main.js.map +1 -1
  117. package/dist/components/page/props.d.ts +1 -1
  118. package/dist/components/page/style.css +3 -6
  119. package/dist/components/page-control/main.d.ts +1 -1
  120. package/dist/components/page-control/main.js +9 -9
  121. package/dist/components/page-control/main.js.map +1 -1
  122. package/dist/components/page-control/style.css +2 -2
  123. package/dist/components/popover/main.d.ts.map +1 -1
  124. package/dist/components/popover/main.js +17 -14
  125. package/dist/components/popover/main.js.map +1 -1
  126. package/dist/components/popover/props.d.ts +2 -2
  127. package/dist/components/popover/style.css +10 -1
  128. package/dist/components/progress/main.d.ts +1 -2
  129. package/dist/components/progress/main.d.ts.map +1 -1
  130. package/dist/components/progress/main.js +45 -19
  131. package/dist/components/progress/main.js.map +1 -1
  132. package/dist/components/progress/props.d.ts +22 -8
  133. package/dist/components/progress/props.d.ts.map +1 -1
  134. package/dist/components/progress/style.css +15 -15
  135. package/dist/components/roll/main.js +10 -10
  136. package/dist/components/roll/main.js.map +1 -1
  137. package/dist/components/roll/props.d.ts +1 -1
  138. package/dist/components/roll/style.css +11 -11
  139. package/dist/components/segmented/main.d.ts.map +1 -1
  140. package/dist/components/segmented/main.js +44 -27
  141. package/dist/components/segmented/main.js.map +1 -1
  142. package/dist/components/segmented/style.css +14 -9
  143. package/dist/components/sheet/main.d.ts +1 -1
  144. package/dist/components/sheet/main.d.ts.map +1 -1
  145. package/dist/components/sheet/main.js +22 -18
  146. package/dist/components/sheet/main.js.map +1 -1
  147. package/dist/components/sheet/props.d.ts +1 -1
  148. package/dist/components/sheet/style.css +22 -16
  149. package/dist/components/sidebar/main.d.ts.map +1 -1
  150. package/dist/components/sidebar/main.js +9 -13
  151. package/dist/components/sidebar/main.js.map +1 -1
  152. package/dist/components/sidebar/style.css +8 -8
  153. package/dist/components/slider/main.d.ts.map +1 -1
  154. package/dist/components/slider/main.js +19 -19
  155. package/dist/components/slider/main.js.map +1 -1
  156. package/dist/components/slider/props.d.ts +1 -2
  157. package/dist/components/slider/props.d.ts.map +1 -1
  158. package/dist/components/slider/style.css +25 -25
  159. package/dist/components/stepper/main.d.ts.map +1 -1
  160. package/dist/components/stepper/main.js +13 -15
  161. package/dist/components/stepper/main.js.map +1 -1
  162. package/dist/components/stepper/style.css +8 -8
  163. package/dist/components/switch/main.d.ts.map +1 -1
  164. package/dist/components/switch/main.js +25 -18
  165. package/dist/components/switch/main.js.map +1 -1
  166. package/dist/components/switch/props.d.ts +5 -3
  167. package/dist/components/switch/props.d.ts.map +1 -1
  168. package/dist/components/switch/style.css +13 -17
  169. package/dist/components/symbol/main.d.ts +1 -1
  170. package/dist/components/symbol/main.d.ts.map +1 -1
  171. package/dist/components/symbol/main.js +6 -5
  172. package/dist/components/symbol/main.js.map +1 -1
  173. package/dist/components/symbol/props.d.ts +3 -3
  174. package/dist/components/symbol/style.css +1 -1
  175. package/dist/components/tab-bar/main.d.ts +2 -2
  176. package/dist/components/tab-bar/main.d.ts.map +1 -1
  177. package/dist/components/tab-bar/main.js +78 -59
  178. package/dist/components/tab-bar/main.js.map +1 -1
  179. package/dist/components/tab-bar/props.d.ts +3 -3
  180. package/dist/components/tab-bar/style.css +92 -56
  181. package/dist/components/text-field/main.d.ts +3 -2
  182. package/dist/components/text-field/main.d.ts.map +1 -1
  183. package/dist/components/text-field/main.js +26 -28
  184. package/dist/components/text-field/main.js.map +1 -1
  185. package/dist/components/text-field/props.d.ts +16 -1
  186. package/dist/components/text-field/props.d.ts.map +1 -1
  187. package/dist/components/text-field/style.css +105 -31
  188. package/dist/components/toolbar/main.d.ts.map +1 -1
  189. package/dist/components/toolbar/main.js +18 -20
  190. package/dist/components/toolbar/main.js.map +1 -1
  191. package/dist/components/toolbar/props.d.ts +10 -4
  192. package/dist/components/toolbar/props.d.ts.map +1 -1
  193. package/dist/components/toolbar/style.css +13 -13
  194. package/dist/components/tooltip/main.js +4 -4
  195. package/dist/components/tooltip/main.js.map +1 -1
  196. package/dist/components/tooltip/style.css +5 -5
  197. package/dist/components/typography/main.d.ts +2 -2
  198. package/dist/components/typography/main.d.ts.map +1 -1
  199. package/dist/components/typography/main.js +10 -12
  200. package/dist/components/typography/main.js.map +1 -1
  201. package/dist/components/typography/props.d.ts +9 -9
  202. package/dist/components/typography/props.d.ts.map +1 -1
  203. package/dist/components/typography/style.css +503 -503
  204. package/dist/components/utils/main.d.ts +47 -6
  205. package/dist/components/utils/main.d.ts.map +1 -1
  206. package/dist/components/utils/main.js +155 -5
  207. package/dist/components/utils/main.js.map +1 -1
  208. package/dist/components/utils/props.d.ts +24 -3
  209. package/dist/components/utils/props.d.ts.map +1 -1
  210. package/dist/components/utils/style.css +4 -4
  211. package/dist/components/viewport/edge-effect.d.ts +10 -0
  212. package/dist/components/viewport/edge-effect.d.ts.map +1 -0
  213. package/dist/components/viewport/edge-effect.js +100 -0
  214. package/dist/components/viewport/edge-effect.js.map +1 -0
  215. package/dist/components/viewport/edge.d.ts +39 -0
  216. package/dist/components/viewport/edge.d.ts.map +1 -0
  217. package/dist/components/viewport/edge.js +151 -0
  218. package/dist/components/viewport/edge.js.map +1 -0
  219. package/dist/components/viewport/input.d.ts +19 -3
  220. package/dist/components/viewport/input.d.ts.map +1 -1
  221. package/dist/components/viewport/input.js +197 -12
  222. package/dist/components/viewport/input.js.map +1 -1
  223. package/dist/components/viewport/main.d.ts +9 -4
  224. package/dist/components/viewport/main.d.ts.map +1 -1
  225. package/dist/components/viewport/main.js +326 -89
  226. package/dist/components/viewport/main.js.map +1 -1
  227. package/dist/components/viewport/padding.d.ts +31 -3
  228. package/dist/components/viewport/padding.d.ts.map +1 -1
  229. package/dist/components/viewport/padding.js +111 -16
  230. package/dist/components/viewport/padding.js.map +1 -1
  231. package/dist/components/viewport/props.d.ts +69 -8
  232. package/dist/components/viewport/props.d.ts.map +1 -1
  233. package/dist/components/viewport/style.css +211 -6
  234. package/dist/styles.css +285 -302
  235. package/package.json +3 -4
@@ -6,25 +6,26 @@ import { useRender } from '@base-ui/react/use-render';
6
6
  import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from 'react';
7
7
  import { createPortal } from 'react-dom';
8
8
  import { Check, Checkbox as CheckboxBase, Radio as RadioBase, } from '../checkbox/main.js';
9
- import { cn, edgeScrollDelta, frameElapsed, useForwardedRef, usePointerDrag, useSecondaryClick, withStyle, } from '../utils/main.js';
9
+ import { cn, useForwardedRef, usePointerDrag, useSecondaryClick, withStyle, } from '../utils/main.js';
10
+ import { createReorderHandle, ListReorderHandle, reorder, reorderByKey, setItemEntry, startReorderDrag, } from './reorder.js';
11
+ import { dragToSelect } from './select.js';
10
12
  import { createSwipeActionsHandle } from './swipe-actions-handle.js';
13
+ export { ListReorderHandle, useCreateReorderHandle, } from './reorder.js';
11
14
  export { ListSwipeActionsHandle, useCreateSwipeActionsHandle, } from './swipe-actions-handle.js';
12
- // Source: Apple iOS 26 Figma (“Lists and tables”: “Row” Height=Regular/Tall,
13
- // “_Images”, “_Trailing”, “_Edit Buttons”, “_Grabber”, “_Separator”, “Row -
14
- // Button”, “Row with Swipe Actions”, “_Swipe Actions”, “Header”, “_Header
15
- // Trailing Accessories”, “Section Title”, “Grouped Table Footer”, “Index Bar”),
16
- // with its colors mapped to UIKit semantic colors (the tint, the label colors,
17
- // `systemRed`, `systemGray2`/`3`/`5`); the separator is a token in
18
- // `styles.css`. What Figma doesn't define follows Framework7 (`list.less`,
19
- // `list-ios.less`, `list-vars.less`, `swipeout.less`, `swipeout-ios.less`,
20
- // `swipeout.js`, `list-index.less`, `block.less`):
21
- // - list styles (UIKit `UITableView.Style`): `insetGrouped` (the default: 16px
22
- // inset, 24px corners), `grouped`, `plain` (Framework7 `.list`,
23
- // `.list.inset`); 35px between sections (none at the list's ends: its
24
- // neighbors' and container's spacing); optionally outlined
25
- // (`.list-outline`)
26
- // - pressed rows (UIKit's cell selection, `systemGray4`), hiding the separators
27
- // around pressed and swiped rows
15
+ // Rows (regular and tall), images, trailing accessories, edit buttons,
16
+ // grabbers, separators, button rows, swipe actions, headers (with trailing
17
+ // accessories), section titles, grouped footers and an index bar, in the
18
+ // semantic colors (the tint, the label colors, `systemRed`,
19
+ // `systemGray2`/`3`/`5`); the separator is a token in `styles.css`. Behavior
20
+ // after Framework7 (`list.less`, `list-ios.less`, `list-vars.less`,
21
+ // `swipeout.less`, `swipeout-ios.less`, `swipeout.js`, `list-index.less`,
22
+ // `block.less`):
23
+ // - list styles: `insetGrouped` (the default: 16px inset, 24px corners),
24
+ // `grouped`, `plain` (Framework7 `.list`, `.list.inset`); 35px between
25
+ // sections (none at the list's ends: its neighbors' and container's
26
+ // spacing); optionally outlined (`.list-outline`)
27
+ // - pressed rows (`systemGray4`), hiding the separators around pressed and
28
+ // swiped rows
28
29
  // - swiping: the row follows the pointer (rubber-banding past its actions) over
29
30
  // its actions, pinned to the list's edge, which scale in one after another
30
31
  // from the edge; it opens on releasing past half the actions, or on a quick
@@ -33,60 +34,55 @@ export { ListSwipeActionsHandle, useCreateSwipeActionsHandle, } from './swipe-ac
33
34
  // others, which follow the row, and arms overswiping (see `armDistance`;
34
35
  // Framework7: past 1.2 times the actions), triggering it on release; armed,
35
36
  // its symbol moves to the row's end, its label hides (150ms)
36
- // - reordering rows by their grabbers (`sortable.js`, see `useReorder`),
37
+ // - reordering rows by their grabbers (`sortable.js`, see `reorder.ts`),
37
38
  // independent of the leading edit controls (`Checkbox`, `Radio`,
38
- // `EditButton`); entering and leaving edit mode (`Root` `editing`; UIKit
39
- // `setEditing(_:animated:)`), they slide in and out from the rows' edges
40
- // (300ms), the rows' content making room
41
- // - media rows, as in Mail (`.media-list`: a `Text` part)
39
+ // `EditButton`); entering and leaving edit mode (`Root` `editing`), they
40
+ // slide in and out from the rows' edges (300ms), the rows' content making
41
+ // room
42
+ // - media rows, as in a mail app (`.media-list`: a `Text` part)
42
43
  // - the Content Block (`Block`)
43
44
  //
44
45
  // Titles, subtitles and details are in the Body and Subheadline text styles,
45
46
  // prominent headers in Title 3 Emphasized, index letters in Caption 1
46
- // Emphasized; Figma's nested and extra prominent headers, header subtitles and
47
+ // Emphasized; nested and extra prominent headers, header subtitles and
47
48
  // details, footers and swipe action labels differ from the text styles in
48
- // tracking, and are kept.
49
+ // tracking.
49
50
  //
50
51
  // Rows are grids: [edit control] [image] title/subtitle [trailing …], where
51
52
  // everything that is not a leading part, a title or a subtitle is trailing
52
- // (Figma “Contents - Trailing”: 16px apart), e.g. a `Switch` or a `Menu`
53
- // trigger; up to 36px high (e.g. a `Stepper` or `Segmented`), they fit regular
54
- // rows (8px from their edges). Rows with a subtitle are tall (Figma
55
- // Height=Tall: 68px); others are regular (52px). Both are minimum heights,
56
- // growing with wrapping text. A row is pressable when its `Title` (or `Button`)
57
- // is a link or button (`render`): its hit area covers the row, beneath the
58
- // trailing controls.
53
+ // (16px apart), e.g. a `Switch` or a `Menu` trigger; up to 36px high (e.g. a
54
+ // `Stepper` or `Segmented`), they fit regular rows (8px from their edges).
55
+ // Rows with a subtitle are tall (68px); others are regular (52px). Both are
56
+ // minimum heights, growing with wrapping text. A row is pressable when its
57
+ // `Title` (or `Button`) is a link or button (`render`): its hit area covers
58
+ // the row, beneath the trailing controls.
59
59
  //
60
- // Deviations:
60
+ // Also:
61
61
  // - Focusing a swipe action opens the actions. A trigger opens them
62
62
  // (`SwipeActionsTrigger`: in the row, or by a handle; e.g. rendering the
63
63
  // delete edit button), not the edit button itself.
64
- // - Header and footer text is aligned with the rows' text (Figma: headers are
65
- // laid out for the full width, footers for the rows').
66
- // - Sticky section titles (plain lists) are opaque (Framework7 contacts list;
67
- // Figma: a blur only), and sections snap to the top of a scroll container
68
- // with `scroll-snap-type` (Framework7: none).
69
- // - Images keep their regular size (one line's height) in tall rows (Figma
70
- // Height=Tall: rounded 44px, circular 60px, fill 68px).
71
- // - Swiped rows taller than Figma's tall rows (e.g. Mail's) get 34px corners
72
- // (Figma: a capsule, which would cut into their content).
64
+ // - Header and footer text is aligned with the rows' text.
65
+ // - Sticky section titles (plain lists) are opaque (Framework7 contacts
66
+ // list), and sections snap to the top of a scroll container with
67
+ // `scroll-snap-type` (Framework7: none).
68
+ // - Images keep their regular size (one line's height) in tall rows.
69
+ // - Swiped rows taller than tall rows (e.g. a mail app's) get 34px corners (a
70
+ // capsule would cut into their content).
73
71
  // - Swiped rows keep a round end at their place's edge, their content sliding
74
- // away beneath it (iOS; Figma shows rows opened in place only).
75
- // - Swipe actions are 44px circles, 4px from a regular row's edges (Figma:
76
- // 52px, the row's height), or rounded rectangles as high as the row (as iOS
77
- // notifications'), by action; labels are optional (for multi-line rows), 4px
78
- // below the shapes, in 13px (Figma: 50px circles, 3px above 15px labels,
79
- // which overflow a 68px row). Symbols can be text, in capitals (regular
80
- // weight).
81
- // - Actions fade in as they scale in, and the others fade out while overswiping
82
- // (iOS; Figma: none).
83
- // - Rounded and circular images size their symbol to the image (Figma: none
84
- // given); header buttons are round (Figma PNG; CSS: 10px corners).
72
+ // away beneath it.
73
+ // - Swipe actions are 44px circles, 4px from a regular row's edges, or
74
+ // rounded rectangles as high as the row (as notifications'), by action;
75
+ // labels are optional (for multi-line rows), 4px below the shapes, in 13px.
76
+ // Symbols can be text, in capitals (regular weight).
77
+ // - Actions fade in as they scale in, and the others fade out while
78
+ // overswiping.
79
+ // - Rounded and circular images size their symbol to the image; header
80
+ // buttons are round.
85
81
  // - Separators, chevrons and the checkmarks are drawn as CSS borders and SVG
86
- // strokes (Figma: SF Symbols glyphs 􀆊, 􀆅, 􀅼, 􀅽, 􀌇, 􀆏).
87
- // Glyphs (SF Symbols, as SVG strokes at the current font size).
82
+ // strokes.
83
+ // Glyphs (SVG strokes at the current font size).
88
84
  const Chevron = () => (_jsx("svg", { "aria-hidden": "true", fill: "none", height: "0.75em", stroke: "currentcolor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 8 14", width: "0.43em", children: _jsx("path", { d: "M1.5 1.5L6.5 7l-5 5.5" }) }));
89
- // Figma PNG: 15.2 × 14.5px of ink at 17px (590).
85
+ // 15.2 × 14.5px of ink at 17px (590).
90
86
  const Lines = () => (_jsx("svg", { "aria-hidden": "true", fill: "none", height: "0.7em", stroke: "currentcolor", strokeLinecap: "round", strokeWidth: "1.5", viewBox: "0 0 18 12", width: "1.06em", children: _jsx("path", { d: "M1 1h16M1 6h16M1 11h16" }) }));
91
87
  // Root: the list's style, as custom properties for its parts (their
92
88
  // fallbacks are `insetGrouped`'s, for parts outside of a root).
@@ -111,8 +107,10 @@ const StyledRoot = forwardRef(({ className, listStyle, outline, render, ...props
111
107
  ref,
112
108
  render,
113
109
  }));
114
- /** A list (UIKit `UITableView`): sections of rows, headers and footers. */
115
- const Root = forwardRef(({ editing = 'ignore', ...props }, ref) => (_jsx(EditingContext.Provider, { value: editing, children: _jsx(StyledRoot, { ref: ref, ...props }) })));
110
+ // Dragging to select (see `select.ts`): the root's, for its checkboxes.
111
+ const DragToSelectContext = createContext(true);
112
+ /** A list: sections of rows, headers and footers. */
113
+ const Root = forwardRef(({ dragToSelect: isDragToSelect = true, editing = 'ignore', ...props }, ref) => (_jsx(DragToSelectContext.Provider, { value: isDragToSelect, children: _jsx(EditingContext.Provider, { value: editing, children: _jsx(StyledRoot, { ref: ref, ...props }) }) })));
116
114
  const StyledSection = forwardRef(({ className, render, ...props }, ref) => useRender({
117
115
  defaultTagName: 'section',
118
116
  props: {
@@ -128,204 +126,54 @@ const Section = forwardRef(({ editing, ...props }, ref) => {
128
126
  const inherited = useContext(EditingContext);
129
127
  return (_jsx(EditingContext.Provider, { value: editing ?? inherited, children: _jsx(StyledSection, { ref: ref, ...props }) }));
130
128
  });
131
- // Reordering (Framework7 `sortable.js`, `sortable.less`): dragging a row's
132
- // grabber lifts the row, which follows the pointer within its group, the
133
- // other rows making room (300ms); near an end of the scroll container, it
134
- // scrolls (as the tab bar's lens does). Released, the row settles into its
135
- // place, and the group's `onReorder` is called; the app reorders its rows.
136
- // Until their order changes (or, if it doesn't, the rows slide back), they
137
- // keep their offsets. Arrow keys on a focused grabber move its row by one.
138
- const reorderDuration = 300;
139
- const isItem = (element) => element instanceof HTMLElement && element.matches('[data-list-part=item]');
140
- // The nearest ancestor scrolling vertically, or the document's.
141
- const scrollContainerOf = (element) => {
142
- for (let current = element.parentElement; current; current = current.parentElement) {
143
- const { overflowY } = getComputedStyle(current);
144
- if ((overflowY === 'auto' || overflowY === 'scroll') &&
145
- current.scrollHeight > current.clientHeight) {
146
- return current;
147
- }
148
- }
149
- return element.ownerDocument.scrollingElement ?? element.ownerDocument.body;
129
+ const RangeContext = createContext(undefined);
130
+ const handlesOf = (handle) => {
131
+ if (handle === undefined)
132
+ return [];
133
+ return handle instanceof ListReorderHandle ? [handle] : handle;
150
134
  };
151
- const setOffset = (item, offset, isAnimated) => {
152
- item.style.transition = isAnimated
153
- ? `transform ${reorderDuration}ms`
154
- : 'none';
155
- item.style.transform = offset === 0 ? '' : `translateY(${offset}px)`;
135
+ /**
136
+ * Keeps an entry in its handles' sets (`pick`: which), as they change, until
137
+ * unmounted.
138
+ */
139
+ const useHandleEntry = (entry, handles, pick) => {
140
+ const registered = useRef([]);
141
+ useLayoutEffect(() => {
142
+ for (const handle of registered.current) {
143
+ if (!handles.includes(handle))
144
+ pick(handle).delete(entry);
145
+ }
146
+ for (const handle of handles)
147
+ pick(handle).add(entry);
148
+ registered.current = handles;
149
+ });
150
+ useLayoutEffect(() => () => {
151
+ for (const handle of registered.current)
152
+ pick(handle).delete(entry);
153
+ registered.current = [];
154
+ }, [entry, pick]);
156
155
  };
157
- /** Reorders a group's rows by their grabbers (see above). */
158
- const useReorder = (groupRef, onReorder) => {
159
- const onReorderRef = useRef(onReorder);
156
+ const targetsOf = (handle) => handle.targets;
157
+ const itemsOf = (handle) => handle.items;
158
+ /**
159
+ * A range's gaps as targets of its handles (see `DropGroup`, `Group`): its
160
+ * rows' set, for them to register with.
161
+ */
162
+ const useRange = (part, reorderHandle, dropName, ref) => {
163
+ const latest = useRef({ dropName, reorderHandle });
160
164
  useLayoutEffect(() => {
161
- onReorderRef.current = onReorder;
165
+ latest.current = { dropName, reorderHandle };
162
166
  });
163
- useEffect(() => {
164
- const { current: group } = groupRef;
165
- if (!group)
166
- return undefined;
167
- const grabberOf = (target) => {
168
- const grabber = target instanceof Element
169
- ? target.closest('[data-list-part=grabber]')
170
- : null;
171
- const item = grabber?.closest('[data-list-part=item]');
172
- return grabber && item && item.parentElement === group
173
- ? { grabber, item }
174
- : undefined;
175
- };
176
- // Clears the rows' offsets once their order changed, or slides them
177
- // back if it doesn't.
178
- const commit = (items, from, to) => {
179
- const settle = { observer: undefined };
180
- let timeout;
181
- const clearOffsets = (isAnimated) => {
182
- settle.observer?.disconnect();
183
- clearTimeout(timeout);
184
- for (const element of items) {
185
- setOffset(element, 0, isAnimated);
186
- delete element.dataset.reordering;
187
- delete element.dataset.reorderEdge;
188
- }
189
- };
190
- settle.observer = new MutationObserver(() => clearOffsets(false));
191
- settle.observer.observe(group, { childList: true });
192
- timeout = setTimeout(() => clearOffsets(true), reorderDuration);
193
- if (from === to) {
194
- clearOffsets(true);
195
- return;
196
- }
197
- onReorderRef.current?.(from, to);
198
- };
199
- const onPointerDown = (event) => {
200
- if (event.button !== 0)
201
- return;
202
- const target = grabberOf(event.target);
203
- if (!target)
204
- return;
205
- const { grabber, item } = target;
206
- const items = [...group.children].filter(isItem);
207
- const from = items.indexOf(item);
208
- const origin = group.getBoundingClientRect().top;
209
- // Relative to the group, which may scroll.
210
- const tops = items.map((element) => element.getBoundingClientRect().top - origin);
211
- const heights = items.map((element) => element.offsetHeight);
212
- const height = heights[from] ?? 0;
213
- const top = tops[from] ?? 0;
214
- const bottomLimit = (tops.at(-1) ?? 0) + (heights.at(-1) ?? 0) - top - height;
215
- const startY = event.clientY - origin;
216
- let clientY = event.clientY;
217
- let to = from;
218
- event.preventDefault();
219
- grabber.setPointerCapture(event.pointerId);
220
- item.dataset.reordering = '';
221
- const scroller = scrollContainerOf(group);
222
- // The rows' corners and separators follow their order on screen.
223
- const markEdges = (place) => {
224
- const order = items.filter((element) => element !== item);
225
- order.splice(place, 0, item);
226
- for (const [index, element] of order.entries()) {
227
- element.dataset.reorderEdge = [
228
- index === 0 ? 'first' : '',
229
- index === order.length - 1 ? 'last' : '',
230
- order[index - 1] === item ? 'after' : '',
231
- ]
232
- .filter(Boolean)
233
- .join(' ');
234
- }
235
- };
236
- markEdges(from);
237
- const update = () => {
238
- const groupTop = group.getBoundingClientRect().top;
239
- const offset = Math.min(Math.max(clientY - groupTop - startY, -top), bottomLimit);
240
- setOffset(item, offset, false);
241
- // The row's place: its leading edge past the middle of the rows
242
- // it's moved over (so it reaches the group's ends at any heights).
243
- to = from;
244
- for (const [index, rowTop] of tops.entries()) {
245
- const middle = rowTop + (heights[index] ?? 0) / 2;
246
- if (index < from && top + offset <= middle)
247
- to = Math.min(to, index);
248
- if (index > from && top + height + offset >= middle) {
249
- to = Math.max(to, index);
250
- }
251
- }
252
- for (const [index, element] of items.entries()) {
253
- if (index === from)
254
- continue;
255
- const isBelow = index > from && index <= to;
256
- const isAbove = index < from && index >= to;
257
- setOffset(element, (isAbove ? height : 0) - (isBelow ? height : 0), true);
258
- }
259
- markEdges(to);
260
- };
261
- const elapsedOf = frameElapsed();
262
- let frame = requestAnimationFrame(function scroll(time) {
263
- frame = requestAnimationFrame(scroll);
264
- const elapsed = elapsedOf(time);
265
- const { bottom, top: scrollerTop } = scroller === scroller.ownerDocument.scrollingElement
266
- ? { bottom: window.innerHeight, top: 0 }
267
- : scroller.getBoundingClientRect();
268
- const delta = edgeScrollDelta(clientY, scrollerTop, bottom, elapsed);
269
- if (delta === 0)
270
- return;
271
- const before = scroller.scrollTop;
272
- scroller.scrollTop += delta;
273
- if (scroller.scrollTop !== before)
274
- update();
275
- });
276
- const onMove = (moveEvent) => {
277
- if (moveEvent.pointerId !== event.pointerId)
278
- return;
279
- clientY = moveEvent.clientY;
280
- update();
281
- };
282
- const onEnd = (endEvent) => {
283
- if (endEvent.pointerId !== event.pointerId)
284
- return;
285
- cancelAnimationFrame(frame);
286
- grabber.removeEventListener('pointermove', onMove);
287
- grabber.removeEventListener('pointerup', onEnd);
288
- grabber.removeEventListener('pointercancel', onEnd);
289
- // Settles into its place, then commits.
290
- const place = to > from
291
- ? (tops[to] ?? 0) + (heights[to] ?? 0) - top - height
292
- : (tops[to] ?? 0) - top;
293
- const committed = endEvent.type === 'pointercancel' ? from : to;
294
- if (committed === from) {
295
- for (const element of items)
296
- setOffset(element, 0, true);
297
- }
298
- else {
299
- setOffset(item, place, true);
300
- }
301
- markEdges(committed);
302
- setTimeout(() => commit(items, from, committed), reorderDuration);
303
- };
304
- grabber.addEventListener('pointermove', onMove);
305
- grabber.addEventListener('pointerup', onEnd);
306
- grabber.addEventListener('pointercancel', onEnd);
307
- };
308
- const onKeyDown = (event) => {
309
- if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown')
310
- return;
311
- const target = grabberOf(event.target);
312
- if (!target)
313
- return;
314
- const items = [...group.children].filter(isItem);
315
- const from = items.indexOf(target.item);
316
- const to = from + (event.key === 'ArrowUp' ? -1 : 1);
317
- if (to < 0 || to >= items.length)
318
- return;
319
- event.preventDefault();
320
- onReorderRef.current?.(from, to);
321
- };
322
- group.addEventListener('pointerdown', onPointerDown);
323
- group.addEventListener('keydown', onKeyDown);
324
- return () => {
325
- group.removeEventListener('pointerdown', onPointerDown);
326
- group.removeEventListener('keydown', onKeyDown);
327
- };
328
- }, [groupRef]);
167
+ const [entry] = useState(() => ({
168
+ handles: () => handlesOf(latest.current.reorderHandle),
169
+ members: new Set(),
170
+ name: () => latest.current.dropName,
171
+ part,
172
+ ref,
173
+ }));
174
+ const handles = handlesOf(reorderHandle);
175
+ useHandleEntry(entry, handles, targetsOf);
176
+ return handles.length === 0 ? undefined : entry.members;
329
177
  };
330
178
  /** The rows of a section, on the list's background (inset: a card). */
331
179
  // Clips swiped rows sideways only (and reordered rows' shadows).
@@ -339,15 +187,56 @@ const StyledGroup = forwardRef(({ className, render, ...props }, ref) => useRend
339
187
  ref,
340
188
  render,
341
189
  }));
342
- const Group = forwardRef(({ editing, onReorder, ...props }, ref) => {
190
+ const Group = forwardRef(({ dropName, editing, reorderHandle, ...props }, ref) => {
343
191
  const groupRef = useForwardedRef(ref);
344
192
  const inherited = useContext(EditingContext);
345
- useReorder(groupRef, onReorder);
346
- return (_jsx(EditingContext.Provider, { value: editing ?? inherited, children: _jsx(StyledGroup, { ref: groupRef, ...props }) }));
193
+ const range = useRange('Group', reorderHandle, dropName, groupRef);
194
+ return (_jsx(EditingContext.Provider, { value: editing ?? inherited, children: _jsx(RangeContext.Provider, { value: range, children: _jsx(StyledGroup, { ref: groupRef, ...props }) }) }));
195
+ });
196
+ /**
197
+ * A range of rows' gaps, targets of its handles (as a `Group` given a
198
+ * `reorderHandle`: before, between and after its rows), with no element of
199
+ * its own (only an empty, hidden one marking where it is, its gap once
200
+ * emptied): its rows stay its group's.
201
+ */
202
+ const DropGroup = ({ children, dropName, reorderHandle, }) => {
203
+ // Where it is, emptied: an empty, hidden element (as a `DropTarget`'s).
204
+ const markerRef = useRef(null);
205
+ const range = useRange('DropGroup', reorderHandle, dropName, markerRef);
206
+ return (_jsxs(RangeContext.Provider, { value: range, children: [_jsx("li", { ref: markerRef, "aria-hidden": true, className: "uikit-list-drop-target", "data-list-part": "drop-target" }), children] }));
207
+ };
208
+ /**
209
+ * A gap rows of its handles can be dropped into, where it's placed among a
210
+ * group's rows: an empty, hidden element (no height), only marking it.
211
+ */
212
+ const DropTarget = forwardRef(({ className, dropName, render, reorderHandle, ...props }, ref) => {
213
+ const targetRef = useForwardedRef(ref);
214
+ const latest = useRef({ dropName, reorderHandle });
215
+ useLayoutEffect(() => {
216
+ latest.current = { dropName, reorderHandle };
217
+ });
218
+ const [entry] = useState(() => ({
219
+ handles: () => handlesOf(latest.current.reorderHandle),
220
+ name: () => latest.current.dropName,
221
+ part: 'DropTarget',
222
+ ref: targetRef,
223
+ }));
224
+ useHandleEntry(entry, handlesOf(reorderHandle), targetsOf);
225
+ return useRender({
226
+ defaultTagName: 'li',
227
+ props: {
228
+ 'aria-hidden': true,
229
+ 'data-list-part': 'drop-target',
230
+ className: cn('uikit-list-drop-target', className),
231
+ ...props,
232
+ },
233
+ ref: targetRef,
234
+ render,
235
+ });
347
236
  });
348
237
  // Rows.
349
238
  /**
350
- * A swiped row's corners: a capsule up to Figma's tall rows (68px), taller
239
+ * A swiped row's corners: a capsule up to tall rows (68px), taller
351
240
  * rows (e.g. Mail's) get rounded corners.
352
241
  */
353
242
  const swipeRadius = 34;
@@ -463,14 +352,14 @@ const overswipeArm = 304;
463
352
  const armDuration = 150;
464
353
  /**
465
354
  * Actions fade in from this opacity as they scale in, and the others fade
466
- * to it while overswiping, until armed (iOS, measured: shapes, symbols and
355
+ * to it while overswiping, until armed (measured: shapes, symbols and
467
356
  * labels each at 36%).
468
357
  */
469
358
  const actionFade = 0.36;
470
359
  const sides = ['leading', 'trailing'];
471
360
  const isRtl = (element) => getComputedStyle(element).direction === 'rtl';
472
361
  /**
473
- * Overswipe (Framework7 iOS): widens the outermost action's shape by
362
+ * Overswipe (Framework7's iOS theme): widens the outermost action's shape by
474
363
  * `extra` px towards the row (`towardsRow`, physical), from the edge (its
475
364
  * negative margin keeps the action's size), its symbol and label centered in
476
365
  * it, as the row moves (`transition`).
@@ -764,7 +653,7 @@ const PanelContext = createContext(undefined);
764
653
  * Its collapsible's rows (Base UI `Collapsible.Panel`, `Accordion.Panel`),
765
654
  * shown or not, opening and closing in place, together (each its height),
766
655
  * e.g. an inline `Calendar` or `TimeRoll` below a row with a `DatePicker`
767
- * (see `DatePicker.Expandable`, as iOS's Calendar). Placed among a group's
656
+ * (see `DatePicker.Expandable`, as a calendar app's). Placed among a group's
768
657
  * rows (no element of its own: the group's rows stay its children), or
769
658
  * among another's (closed with it). Closed, they're inert.
770
659
  */
@@ -916,7 +805,39 @@ const useExpandedRow = (itemRef, idProp) => {
916
805
  return id ?? idProp;
917
806
  };
918
807
  /**
919
- * A row (UIKit `UITableViewCell`), with optional swipe actions. With a click
808
+ * A row in reordering (see `reorder.ts`): its name, its handles; in a
809
+ * range, one of its rows.
810
+ */
811
+ const useReorderItem = (itemRef, reorderHandle, dropName) => {
812
+ const range = useContext(RangeContext);
813
+ useLayoutEffect(() => {
814
+ if (!range)
815
+ return undefined;
816
+ range.add(itemRef);
817
+ return () => {
818
+ range.delete(itemRef);
819
+ };
820
+ }, [itemRef, range]);
821
+ const latest = useRef({ dropName, reorderHandle });
822
+ useLayoutEffect(() => {
823
+ latest.current = { dropName, reorderHandle };
824
+ });
825
+ const [entry] = useState(() => ({
826
+ handles: () => handlesOf(latest.current.reorderHandle),
827
+ name: () => latest.current.dropName,
828
+ ref: itemRef,
829
+ }));
830
+ useHandleEntry(entry, handlesOf(reorderHandle), itemsOf);
831
+ useLayoutEffect(() => {
832
+ const { current: element } = itemRef;
833
+ if (!element)
834
+ return undefined;
835
+ setItemEntry(element, entry);
836
+ return () => setItemEntry(element, undefined);
837
+ }, [entry, itemRef]);
838
+ };
839
+ /**
840
+ * A row, with optional swipe actions. With a click
920
841
  * handler, it's pressable itself (e.g. passing the click on to a control in
921
842
  * it), but where its own controls are pressed.
922
843
  *
@@ -927,10 +848,11 @@ const useExpandedRow = (itemRef, idProp) => {
927
848
  * once the scroll comes to rest there, so scrolling back disarms it.
928
849
  */
929
850
  const Item = forwardRef((itemProps, ref) => {
930
- const { children, onBlurCapture, onClickCapture, onLostPointerCapture, onPointerCancel, onPointerDown, onPointerMove, onPointerUp, editing: itemEditing, id: idProp, level, selected, style, ...props } = useSecondaryClick(itemProps);
851
+ const { children, onBlurCapture, onClickCapture, onLostPointerCapture, onPointerCancel, onPointerDown, onPointerMove, onPointerUp, dropName, editing: itemEditing, id: idProp, level, reorderHandle, selected, style, ...props } = useSecondaryClick(itemProps);
931
852
  const inheritedEditing = useContext(EditingContext);
932
853
  const editing = itemEditing ?? inheritedEditing;
933
854
  const itemRef = useForwardedRef(ref);
855
+ useReorderItem(itemRef, reorderHandle, dropName);
934
856
  const id = useExpandedRow(itemRef, idProp);
935
857
  useEditingSizes(itemRef, editing !== 'ignore');
936
858
  useStrictSlots(itemRef);
@@ -1417,7 +1339,6 @@ const Item = forwardRef((itemProps, ref) => {
1417
1339
  base: offsetOf(item),
1418
1340
  isMoved: false,
1419
1341
  pointerId: event.pointerId,
1420
- scroll: item.scrollLeft,
1421
1342
  time: performance.now(),
1422
1343
  x: event.clientX,
1423
1344
  y: event.clientY,
@@ -1446,8 +1367,9 @@ const Item = forwardRef((itemProps, ref) => {
1446
1367
  item.style.scrollSnapType = 'none';
1447
1368
  showSnaps();
1448
1369
  }
1449
- // The content follows the pointer.
1450
- item.scrollLeft = drag.scroll - dx;
1370
+ // The content follows the pointer (by its offset: the room before it
1371
+ // grows as the swipe starts, see `showSnaps`).
1372
+ scrollTo(drag.base + (isRtl(item) ? -dx : dx), false);
1451
1373
  };
1452
1374
  // A mouse drag released: overswiped (armed), opened (past half its
1453
1375
  // actions, or quickly towards them) or closed, scrolling there.
@@ -1616,21 +1538,57 @@ const Span = forwardRef(({ className, render, ...props }, ref) => useRender({
1616
1538
  render,
1617
1539
  }));
1618
1540
  /**
1619
- * A line under a row's line, across it (e.g. a field's description and
1620
- * error, a status); last in its row. Hidden (`hidden`), it collapses:
1621
- * growing and shrinking as it's shown and hidden (kept rendered).
1541
+ * A `Below`'s start: its row's content's (after the leading parts, e.g. an
1542
+ * image, edit controls), as `--uikit-list-below-start`; measured, again as
1543
+ * the row's parts resize (e.g. entering edit mode).
1622
1544
  */
1623
- const Below = forwardRef(({ className, render, ...props }, ref) => useRender({
1624
- defaultTagName: 'div',
1625
- props: {
1626
- 'data-list-part': 'below',
1627
- className: cn('uikit-list-below', className),
1628
- ...props,
1629
- },
1630
- ref,
1631
- render,
1632
- }));
1633
- // Figma “Title”; as a link or button (`render`), it makes the row pressable.
1545
+ const useBelowStart = (below) => {
1546
+ useLayoutEffect(() => {
1547
+ const { current: element } = below;
1548
+ const row = element?.parentElement;
1549
+ const content = row?.querySelector(':scope > :is([data-list-part="content"], [data-list-part="span"])');
1550
+ if (!element || !row || !content)
1551
+ return undefined;
1552
+ const measure = () => {
1553
+ const style = getComputedStyle(row);
1554
+ const rowRect = row.getBoundingClientRect();
1555
+ const contentRect = content.getBoundingClientRect();
1556
+ const offset = style.direction === 'rtl'
1557
+ ? rowRect.right - contentRect.right
1558
+ : contentRect.left - rowRect.left;
1559
+ const start = Math.max(offset - Number.parseFloat(style.paddingInlineStart), 0);
1560
+ element.style.setProperty('--uikit-list-below-start', `${String(start)}px`);
1561
+ };
1562
+ measure();
1563
+ const observer = new ResizeObserver(measure);
1564
+ observer.observe(row);
1565
+ observer.observe(content);
1566
+ return () => {
1567
+ observer.disconnect();
1568
+ };
1569
+ }, [below]);
1570
+ };
1571
+ /**
1572
+ * A line under a row's line, across it from where its content starts (e.g.
1573
+ * a field's description and error, a status, a message's preview); last in
1574
+ * its row. Hidden (`hidden`), it collapses: growing and shrinking as it's
1575
+ * shown and hidden (kept rendered).
1576
+ */
1577
+ const Below = forwardRef(({ className, render, ...props }, forwardedRef) => {
1578
+ const ref = useForwardedRef(forwardedRef);
1579
+ useBelowStart(ref);
1580
+ return useRender({
1581
+ defaultTagName: 'div',
1582
+ props: {
1583
+ 'data-list-part': 'below',
1584
+ className: cn('uikit-list-below', className),
1585
+ ...props,
1586
+ },
1587
+ ref,
1588
+ render,
1589
+ });
1590
+ });
1591
+ // A row's title; as a link or button (`render`), it makes the row pressable.
1634
1592
  const Title = forwardRef(({ className, render, ...props }, ref) => useRender({
1635
1593
  defaultTagName: 'span',
1636
1594
  props: {
@@ -1642,7 +1600,7 @@ const Title = forwardRef(({ className, render, ...props }, ref) => useRender({
1642
1600
  ref,
1643
1601
  render,
1644
1602
  }));
1645
- // Figma “Subtitle” (rows), “Supertitle” and “Subtitle” (headers).
1603
+ // A subtitle (rows), or a supertitle or subtitle (headers).
1646
1604
  const Subtitle = forwardRef(({ className, render, ...props }, ref) => useRender({
1647
1605
  defaultTagName: 'span',
1648
1606
  props: {
@@ -1677,7 +1635,7 @@ const Supertitle = forwardRef(({ className, render, ...props }, ref) => useRende
1677
1635
  ref,
1678
1636
  render,
1679
1637
  }));
1680
- // Figma “Detail”.
1638
+ // A detail (trailing text).
1681
1639
  const Detail = forwardRef(({ className, render, ...props }, ref) => useRender({
1682
1640
  defaultTagName: 'span',
1683
1641
  props: {
@@ -1688,7 +1646,7 @@ const Detail = forwardRef(({ className, render, ...props }, ref) => useRender({
1688
1646
  ref,
1689
1647
  render,
1690
1648
  }));
1691
- // Figma “_Images”: a symbol, or an image (`img`, `video`, `canvas` filling
1649
+ // A symbol, or an image (`img`, `video`, `canvas` filling
1692
1650
  // it, or a symbol) in a rounded, circular or square frame.
1693
1651
  const Image = forwardRef(({ className, render, variant = 'symbol', ...props }, ref) => useRender({
1694
1652
  defaultTagName: 'span',
@@ -1701,7 +1659,7 @@ const Image = forwardRef(({ className, render, variant = 'symbol', ...props }, r
1701
1659
  ref,
1702
1660
  render,
1703
1661
  }));
1704
- // Figma “Symbol” and “Info”: a symbol in the tint color, pressable as a
1662
+ // A symbol (e.g. info) in the tint color, pressable as a
1705
1663
  // link or button (`render`).
1706
1664
  const Accessory = forwardRef(({ className, render, ...props }, ref) => useRender({
1707
1665
  defaultTagName: 'span',
@@ -1713,7 +1671,7 @@ const Accessory = forwardRef(({ className, render, ...props }, ref) => useRender
1713
1671
  ref,
1714
1672
  render,
1715
1673
  }));
1716
- // Figma “Checkmark” (􀆅, 17px, 590).
1674
+ // A checkmark (17px, 590).
1717
1675
  const Checkmark = forwardRef(({ children, className, render, ...props }, ref) => useRender({
1718
1676
  defaultTagName: 'span',
1719
1677
  props: {
@@ -1725,7 +1683,7 @@ const Checkmark = forwardRef(({ children, className, render, ...props }, ref) =>
1725
1683
  ref,
1726
1684
  render,
1727
1685
  }));
1728
- // Figma “Drill-in” (􀆊, 17px, 590).
1686
+ // A drill-in chevron (17px, 590).
1729
1687
  const DrillIn = forwardRef(({ children, className, render, ...props }, ref) => useRender({
1730
1688
  defaultTagName: 'span',
1731
1689
  props: {
@@ -1738,7 +1696,7 @@ const DrillIn = forwardRef(({ children, className, render, ...props }, ref) => u
1738
1696
  ref,
1739
1697
  render,
1740
1698
  }));
1741
- // Figma “Disclosure” (rows: 17px, headers: 19px, 590, in the tint color),
1699
+ // A disclosure chevron (rows: 17px, headers: 19px, 590, in the tint color),
1742
1700
  // turned down while open (e.g. in a Base UI `Collapsible.Trigger`).
1743
1701
  const Disclosure = forwardRef(({ children, className, render, ...props }, ref) => {
1744
1702
  // Turned down while its row's collapsible is open (see
@@ -1758,12 +1716,13 @@ const Disclosure = forwardRef(({ children, className, render, ...props }, ref) =
1758
1716
  render,
1759
1717
  });
1760
1718
  });
1761
- // Figma “_Grabber” (􀌇, 17px, 400).
1719
+ // Three lines (17px, 400).
1762
1720
  /**
1763
- * Figma “_Grabber”: drags its row to reorder its group (see `Group`
1764
- * `onReorder`); focused, arrow keys move the row.
1721
+ * A grabber: drags its row to reorder it (see `Item`
1722
+ * `reorderHandle`); focused, arrow keys move the row (grabbed by the app:
1723
+ * from target to target, Enter or Space dropping it).
1765
1724
  */
1766
- const Grabber = forwardRef(({ children, className, onClick, render, ...props }, ref) => useRender({
1725
+ const Grabber = forwardRef(({ children, className, onClick, onKeyDown, onPointerDown, render, ...props }, ref) => useRender({
1767
1726
  defaultTagName: 'span',
1768
1727
  props: {
1769
1728
  'data-list-part': 'grabber',
@@ -1771,7 +1730,19 @@ const Grabber = forwardRef(({ children, className, onClick, render, ...props },
1771
1730
  tabIndex: 0,
1772
1731
  children: children ?? _jsx(Lines, {}),
1773
1732
  ...props,
1774
- // The click ending a drag (captured by the grabber, see `useReorder`)
1733
+ onKeyDown: (event) => {
1734
+ onKeyDown?.(event);
1735
+ if (event.defaultPrevented)
1736
+ return;
1737
+ reorderByKey(event, event.currentTarget);
1738
+ },
1739
+ onPointerDown: (event) => {
1740
+ onPointerDown?.(event);
1741
+ if (event.defaultPrevented)
1742
+ return;
1743
+ startReorderDrag(event, event.currentTarget);
1744
+ },
1745
+ // The click ending a drag (captured by the grabber, see `reorder.ts`)
1775
1746
  // stays with it: its row doesn't act on it (e.g. pass it on to its
1776
1747
  // checkbox, see `forwardClick`).
1777
1748
  onClick: (event) => {
@@ -1782,7 +1753,7 @@ const Grabber = forwardRef(({ children, className, onClick, render, ...props },
1782
1753
  ref,
1783
1754
  render,
1784
1755
  }));
1785
- // Figma Type=Button (rows) and Type=Action (headers): text in the tint
1756
+ // A button (rows) or an action (headers): text in the tint
1786
1757
  // color.
1787
1758
  const Action = forwardRef(({ className, render, ...props }, ref) => useRender({
1788
1759
  defaultTagName: 'button',
@@ -1795,7 +1766,7 @@ const Action = forwardRef(({ className, render, ...props }, ref) => useRender({
1795
1766
  ref,
1796
1767
  render,
1797
1768
  }));
1798
- // Figma “Row - Button”: a pressable row's title in the tint color.
1769
+ // A button row: a pressable row's title in the tint color.
1799
1770
  const Button = forwardRef(({ className, destructive, render, ...props }, ref) => useRender({
1800
1771
  defaultTagName: 'button',
1801
1772
  props: {
@@ -1808,8 +1779,29 @@ const Button = forwardRef(({ className, destructive, render, ...props }, ref) =>
1808
1779
  ref,
1809
1780
  render,
1810
1781
  }));
1811
- /** Figma State=Selected/Unselected: a checkbox (selecting rows). */
1812
- const Checkbox = forwardRef(({ whileEditing, ...props }, ref) => (_jsx(CheckboxBase.Root, { ref: ref, "data-list-part": "edit", ...whileEditingOf(whileEditing), ...props })));
1782
+ /**
1783
+ * A checkbox (selecting rows); pressed and dragged along the rows,
1784
+ * selecting them (see `select.ts`, `Root`'s `dragToSelect`): neither
1785
+ * scrolling nor swiping a sheet away then.
1786
+ */
1787
+ const Checkbox = forwardRef(({ onPointerDown, onTouchMove, whileEditing, ...props }, ref) => {
1788
+ const isDragToSelect = useContext(DragToSelectContext);
1789
+ return (_jsx(CheckboxBase.Root, { ref: ref, "data-base-ui-swipe-ignore": isDragToSelect ? '' : undefined, "data-drag-to-select": isDragToSelect ? '' : undefined, "data-list-part": "edit", onPointerDown: (event) => {
1790
+ onPointerDown?.(event);
1791
+ const { button, currentTarget, isPrimary } = event;
1792
+ const root = currentTarget.closest('[data-list-part=root]');
1793
+ if (!isDragToSelect || !isPrimary || button !== 0 || !root)
1794
+ return;
1795
+ dragToSelect(currentTarget, root, event);
1796
+ },
1797
+ // Not scrolling where `touch-action` isn't kept (seen on iOS): on
1798
+ // the element itself, cancelable.
1799
+ onTouchMove: (event) => {
1800
+ onTouchMove?.(event);
1801
+ if (isDragToSelect && event.cancelable)
1802
+ event.preventDefault();
1803
+ }, ...whileEditingOf(whileEditing), ...props }));
1804
+ });
1813
1805
  /**
1814
1806
  * A radio (selecting one row), as `Checkbox`; its group is a `RadioGroup`
1815
1807
  * (e.g. rendering a `Group`).
@@ -1827,7 +1819,7 @@ const StyledEditButton = forwardRef(({ className, render, ...props }, ref) => us
1827
1819
  render,
1828
1820
  }));
1829
1821
  /**
1830
- * Figma State=Remove/Add: a symbol (its child) in a circle of its `tint`,
1822
+ * A remove or add button: a symbol (its child) in a circle of its `tint`,
1831
1823
  * doing what the app gives it (e.g. deleting the row; or, rendered by a
1832
1824
  * `SwipeActionsTrigger`, opening its trailing actions).
1833
1825
  */
@@ -1835,7 +1827,7 @@ const EditButton = forwardRef(({ style, textColor, tint, ...props }, ref) => (_j
1835
1827
  '--uikit-list-edit-text-color': textColor,
1836
1828
  '--uikit-list-edit-tint': tint,
1837
1829
  }, style), ...props })));
1838
- // Swipe actions (Figma “Row with Swipe Actions”, “_Swipe Actions”): shapes
1830
+ // Swipe actions: shapes
1839
1831
  // 10px apart, 10px from the row and 16px from the edge.
1840
1832
  // Circles centered in the row, rounded rectangles 4px from its edges.
1841
1833
  const StyledSwipeActions = forwardRef(({ className, overswipe, render, side, ...props }, ref) => useRender({
@@ -1949,8 +1941,7 @@ const SwipeAction = forwardRef(({ children, label, onClick, style, textColor, ti
1949
1941
  item?.close();
1950
1942
  }, children: [_jsx("span", { "data-list-part": "swipe-action-shape", children: _jsx("span", { "data-list-part": "swipe-action-symbol", children: children }) }), _jsx("span", { "aria-hidden": "true", "data-list-part": "swipe-action-label", children: label })] }));
1951
1943
  });
1952
- // Headers (Figma “Header” Type, “Section Title”) and footers (Figma
1953
- // “Grouped Table Footer”).
1944
+ // Headers (and section titles) and footers.
1954
1945
  const Header = forwardRef(({ className, prominence, render, ...props }, ref) => useRender({
1955
1946
  defaultTagName: 'div',
1956
1947
  props: {
@@ -1984,7 +1975,7 @@ const Block = forwardRef(({ className, render, strong, ...props }, ref) => useRe
1984
1975
  ref,
1985
1976
  render,
1986
1977
  }));
1987
- // Index (Figma “Index Bar”; Framework7 “List Index”): letters in the tint
1978
+ // Index (Framework7 “List Index”): letters in the tint
1988
1979
  // color, selected by pressing or scrubbing over them (clicking each item).
1989
1980
  // Placing it is up to the page (Framework7: at the page's edge), above the
1990
1981
  // sticky headers of plain lists (z-index 2).
@@ -2020,7 +2011,7 @@ const scrub = (index, state, y) => {
2020
2011
  state.item = item;
2021
2012
  item.click();
2022
2013
  };
2023
- const Index = forwardRef(({ onLostPointerCapture, onPointerCancel, onPointerDown, onPointerMove, onPointerUp, ...props }, ref) => {
2014
+ const Index = forwardRef(({ onLostPointerCapture, onPointerCancel, onPointerDown, onPointerMove, onPointerUp, onTouchMove, ...props }, ref) => {
2024
2015
  const handlers = usePointerDrag({
2025
2016
  end: () => undefined,
2026
2017
  move: (index, state, event) => scrub(index, state, event.clientY),
@@ -2037,6 +2028,7 @@ const Index = forwardRef(({ onLostPointerCapture, onPointerCancel, onPointerDown
2037
2028
  onPointerDown,
2038
2029
  onPointerMove,
2039
2030
  onPointerUp,
2031
+ onTouchMove,
2040
2032
  });
2041
2033
  return (_jsx(StyledIndex, { ref: ref, ...props, ...handlers }));
2042
2034
  });
@@ -2053,7 +2045,7 @@ const IndexItem = forwardRef(({ className, render, ...props }, ref) => useRender
2053
2045
  }));
2054
2046
  /**
2055
2047
  * A row's click handler passing the click on to the control in it
2056
- * (`selector`, e.g. `[role=switch]`), as iOS rows do, unless it was the
2048
+ * (`selector`, e.g. `[role=switch]`), as native rows do, unless it was the
2057
2049
  * control's own: `<List.Item onClick={forwardClick('[role=switch]')}>`. As
2058
2050
  * the click it is: a pointer's (`detail` > 0) or a keyboard's (a control's
2059
2051
  * `click()` would be a keyboard's, so menus would open with their first
@@ -2072,6 +2064,8 @@ export const List = {
2072
2064
  Section,
2073
2065
  Header,
2074
2066
  Group,
2067
+ DropGroup,
2068
+ DropTarget,
2075
2069
  Item,
2076
2070
  Leading,
2077
2071
  Content,
@@ -2110,5 +2104,7 @@ export const List = {
2110
2104
  Index,
2111
2105
  IndexItem,
2112
2106
  createSwipeActionsHandle,
2107
+ createReorderHandle,
2108
+ reorder,
2113
2109
  };
2114
2110
  //# sourceMappingURL=main.js.map