@lotics/ui 42.3.0 → 43.0.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.
- package/MIGRATION.md +115 -0
- package/docs/catalog.md +49 -7
- package/docs/composition.md +21 -1
- package/docs/data_entry.md +9 -4
- package/package.json +3 -1
- package/src/back_button.tsx +4 -1
- package/src/check_circle.tsx +1 -2
- package/src/checkbox_input.tsx +2 -2
- package/src/choice_list.tsx +2 -2
- package/src/comments_button.tsx +3 -1
- package/src/control_surface.ts +27 -0
- package/src/data_grid.tsx +1 -1
- package/src/date_calendar.tsx +210 -58
- package/src/date_filter.tsx +1 -5
- package/src/date_picker.tsx +2 -0
- package/src/date_range_selection.ts +18 -0
- package/src/date_segments.ts +15 -1
- package/src/file_dropzone.tsx +2 -1
- package/src/file_row.tsx +2 -2
- package/src/file_thumbnail.tsx +4 -1
- package/src/focus_ring_pressable.tsx +6 -1
- package/src/icon_button.tsx +3 -1
- package/src/image_gallery.tsx +1 -1
- package/src/inline_button.tsx +3 -1
- package/src/inline_time_picker.tsx +97 -48
- package/src/list_item.tsx +109 -11
- package/src/locale.tsx +9 -2
- package/src/menu_button.tsx +19 -0
- package/src/option_list.tsx +8 -0
- package/src/picker.tsx +50 -5
- package/src/picker_empty_option.ts +30 -0
- package/src/pressable_highlight.tsx +20 -8
- package/src/pressable_row.tsx +2 -2
- package/src/scroll_to_bottom.tsx +3 -0
- package/src/slider.tsx +2 -2
- package/src/switch.tsx +3 -1
- package/src/text.tsx +16 -11
- package/src/time_columns.tsx +225 -0
- package/src/time_options.ts +138 -0
- package/src/time_picker.tsx +102 -64
- package/src/use_option_list.ts +19 -0
package/src/use_option_list.ts
CHANGED
|
@@ -252,6 +252,25 @@ export function useOptionList<T extends string, MULTI extends boolean = false, D
|
|
|
252
252
|
if (index >= 0) scrollRef.current?.scrollTo({ y: index * OPTION_HEIGHT - 80, animated: false });
|
|
253
253
|
}, []);
|
|
254
254
|
|
|
255
|
+
// Scroll the OPENING seat into view.
|
|
256
|
+
//
|
|
257
|
+
// `initialIndex` seats the highlight through `useState`, which fires no
|
|
258
|
+
// `onActiveChange` — so the row it lands on was highlighted and never scrolled
|
|
259
|
+
// to. On a list short enough to fit that is invisible; past a screenful the
|
|
260
|
+
// list opens at the top with the current value somewhere below the fold, which
|
|
261
|
+
// is the one row it was opened to show. A day of times at 15-minute steps is 96
|
|
262
|
+
// rows, so an afternoon value sat two thirds of the way down an unscrolled list.
|
|
263
|
+
//
|
|
264
|
+
// Gated on rows ARRIVING rather than on mount, so an async list (options still
|
|
265
|
+
// loading when the popover opens) seats on its real value instead of on the
|
|
266
|
+
// empty list's index 0. Once only: after that the member owns the scroll.
|
|
267
|
+
const scrollSeatedRef = useRef(false);
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
if (scrollSeatedRef.current || rows.length === 0) return;
|
|
270
|
+
scrollSeatedRef.current = true;
|
|
271
|
+
scrollToIndex(initialActiveIndex);
|
|
272
|
+
}, [rows.length, initialActiveIndex, scrollToIndex]);
|
|
273
|
+
|
|
255
274
|
const requestClose = useCallback(() => {
|
|
256
275
|
onRequestClose?.();
|
|
257
276
|
if (onClose) {
|