package bonsai
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A library for building dynamic webapps, using Js_of_ocaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
v0.17.0.tar.gz
sha256=c78c4476ee6b856846e2d0941e5965009d5e1b853e564b2b1bee61202f0b1ebb
doc/src/bonsai.web_ui_form/elements_automatic.ml.html
Source file elements_automatic.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007open! Core module Private_view = View_automatic open! Bonsai_web open Bonsai.Let_syntax module View = Private_view let path = let%map.Computation path_id = Bonsai.path_id in path_id, Vdom.Attr.id path_id ;; open Form_manual open Elements_manual module type Model = Model module type Stringable_model = Stringable_model module Selectable_style = Selectable_style module Form = Form_automatic module Conversion = struct (* [with_extra_attr] adds an id attr to the [extra_attr] argument of a [Form2.Elements] function *) let with_extra_attr f extra_attr = let%sub path_and_id = path in let%sub extra_attr = match extra_attr with | None -> let%arr path_and_id = path_and_id in let _, id = path_and_id in id | Some extra_attr -> let%arr extra_attr = extra_attr and path_and_id = path_and_id in let _, id = path_and_id in Vdom.Attr.combine id extra_attr in let%sub form = f ~extra_attr in let%arr form = form and path_and_id = path_and_id in let path, _ = path_and_id in map_view form ~f:(fun view -> View.of_vdom ~unique_key:path view) ;; (* [with_extra_attrs] adds an id attr to the [extra_attrs] argument of a [Form2.Elements] function *) let with_extra_attrs f extra_attrs = let%sub path_and_id = path in let%sub extra_attrs = match extra_attrs with | None -> let%arr path_and_id = path_and_id in let _, id = path_and_id in [ id ] | Some extra_attrs -> let%arr extra_attrs = extra_attrs and path_and_id = path_and_id in let _, id = path_and_id in id :: extra_attrs in let%sub form = f ~extra_attrs in let%arr form = form and path_and_id = path_and_id in let path, _ = path_and_id in map_view form ~f:(fun view -> View.of_vdom ~unique_key:path view) ;; (* [don't_attach_id] does not add an id attr to an underlying [Form2.Elements] function *) let don't_attach_id form = let%sub path = Bonsai.path_id in let%sub form = form in let%arr form = form and path = path in map_view form ~f:(fun view -> View.of_vdom ~unique_key:path view) ;; end module Non_interactive = struct open Non_interactive let constant view value = Conversion.don't_attach_id (constant view value) end module Textbox = struct open Textbox let string ?extra_attrs ?placeholder ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> string ~extra_attrs ?placeholder ~allow_updates_when_focused ()) extra_attrs ;; let int ?extra_attrs ?placeholder ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> int ~extra_attrs ?placeholder ~allow_updates_when_focused ()) extra_attrs ;; let float ?extra_attrs ?placeholder ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> float ~extra_attrs ?placeholder ~allow_updates_when_focused ()) extra_attrs ;; let sexpable ?extra_attrs ?placeholder ~allow_updates_when_focused model = Conversion.with_extra_attrs (fun ~extra_attrs -> sexpable ~extra_attrs ?placeholder ~allow_updates_when_focused model) extra_attrs ;; let stringable ?extra_attrs ?placeholder ~allow_updates_when_focused model = Conversion.with_extra_attrs (fun ~extra_attrs -> stringable ~extra_attrs ?placeholder ~allow_updates_when_focused model) extra_attrs ;; end module Password = struct open Password let string ?extra_attrs ?placeholder ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> string ~extra_attrs ?placeholder ~allow_updates_when_focused ()) extra_attrs ;; let stringable ?extra_attrs ?placeholder ~allow_updates_when_focused model = Conversion.with_extra_attrs (fun ~extra_attrs -> stringable ~extra_attrs ?placeholder ~allow_updates_when_focused model) extra_attrs ;; end module Textarea = struct open Textarea let string ?extra_attrs ?placeholder ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> string ~extra_attrs ?placeholder ~allow_updates_when_focused ()) extra_attrs ;; let int ?extra_attrs ?placeholder ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> int ~extra_attrs ?placeholder ~allow_updates_when_focused ()) extra_attrs ;; let float ?extra_attrs ?placeholder ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> float ~extra_attrs ?placeholder ~allow_updates_when_focused ()) extra_attrs ;; let sexpable ?extra_attrs ?placeholder ~allow_updates_when_focused model = Conversion.with_extra_attrs (fun ~extra_attrs -> sexpable ~extra_attrs ?placeholder ~allow_updates_when_focused model) extra_attrs ;; let stringable ?extra_attrs ?placeholder ~allow_updates_when_focused model = Conversion.with_extra_attrs (fun ~extra_attrs -> stringable ~extra_attrs ?placeholder ~allow_updates_when_focused model) extra_attrs ;; end module Checkbox = struct open Checkbox let bool ?extra_attrs ~default () = Conversion.with_extra_attrs (fun ~extra_attrs -> bool ~extra_attrs ~default ()) extra_attrs ;; let set ?style ?extra_container_attrs ?extra_checkbox_attrs ?to_string ?layout comparator values = Conversion.with_extra_attrs (fun ~extra_attrs -> set ?style ~extra_container_attrs:extra_attrs ?extra_checkbox_attrs ?to_string ?layout comparator values) extra_container_attrs ;; module Private = struct open Checkbox.Private let make_input ~id ~extra_attrs ~state ~set_state = make_input ~extra_attrs:(id :: extra_attrs) ~state ~set_state ;; end end module Toggle = struct open Toggle let bool ?extra_attr ~default () = Conversion.with_extra_attr (fun ~extra_attr -> bool ~extra_attr ~default ()) extra_attr ;; end module Dropdown = struct open Dropdown let list_opt ?init ?extra_attrs ?extra_option_attrs ?to_string m ~equal all = Conversion.with_extra_attrs (fun ~extra_attrs -> list_opt ?init ~extra_attrs ?extra_option_attrs ?to_string m ~equal all) extra_attrs ;; let enumerable_opt ?init ?extra_attrs ?extra_option_attrs ?to_string m = Conversion.with_extra_attrs (fun ~extra_attrs -> enumerable_opt ?init ~extra_attrs ?extra_option_attrs ?to_string m) extra_attrs ;; let list ?init ?extra_attrs ?extra_option_attrs ?to_string m ~equal all = Conversion.with_extra_attrs (fun ~extra_attrs -> list ?init ~extra_attrs ?extra_option_attrs ?to_string m ~equal all) extra_attrs ;; let enumerable ?init ?extra_attrs ?extra_option_attrs ?to_string m = Conversion.with_extra_attrs (fun ~extra_attrs -> enumerable ?init ~extra_attrs ?extra_option_attrs ?to_string m) extra_attrs ;; module Private = struct open Dropdown.Private module Opt = Opt let make_input ?to_string m ~equal ~id ~include_empty ~default_value ~state ~set_state ~extra_attrs ~extra_option_attrs ~all = make_input ?to_string m ~equal ~include_empty ~default_value ~state ~set_state ~extra_attrs:(id :: extra_attrs) ~extra_option_attrs ~all ;; end end module Typeahead = struct open Typeahead let single_opt ?extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option model ~equal ~all_options = Conversion.with_extra_attrs (fun ~extra_attrs -> single_opt ~extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option model ~equal ~all_options) extra_attrs ;; let single ?extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option m ~equal ~all_options = Conversion.with_extra_attrs (fun ~extra_attrs -> single ~extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option m ~equal ~all_options) extra_attrs ;; let set ?extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option ?split m ~all_options = Conversion.with_extra_attrs (fun ~extra_attrs -> set ~extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option ?split m ~all_options) extra_attrs ;; let list ?extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option ?split m ~all_options = Conversion.with_extra_attrs (fun ~extra_attrs -> list ~extra_attrs ?placeholder ?to_string ?to_option_description ?handle_unknown_option ?split m ~all_options) extra_attrs ;; end module Date_time = struct open Date_time module Span_unit = Span_unit let date_opt ?extra_attrs ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> date_opt ~extra_attrs ~allow_updates_when_focused ()) extra_attrs ;; let date ?extra_attrs ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> date ~extra_attrs ~allow_updates_when_focused ()) extra_attrs ;; let time_opt ?extra_attrs ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> time_opt ~extra_attrs ~allow_updates_when_focused ()) extra_attrs ;; let time ?extra_attrs ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> time ~extra_attrs ~allow_updates_when_focused ()) extra_attrs ;; let time_span_opt ?extra_unit_attrs ?extra_amount_attrs ?default_unit ?default ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs:extra_amount_attrs -> Date_time.time_span_opt ?extra_unit_attrs ~extra_amount_attrs ?default_unit ?default ~allow_updates_when_focused ()) extra_amount_attrs ;; let time_span ?extra_unit_attrs ?extra_amount_attrs ?default_unit ?default ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs:extra_amount_attrs -> Date_time.time_span ?extra_unit_attrs ~extra_amount_attrs ?default_unit ?default ~allow_updates_when_focused ()) extra_amount_attrs ;; let datetime_local_opt ?extra_attrs ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> datetime_local_opt ~extra_attrs ~allow_updates_when_focused ()) extra_attrs ;; let datetime_local ?extra_attrs ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> datetime_local ~extra_attrs ~allow_updates_when_focused ()) extra_attrs ;; module Range = struct open Date_time.Range (* We don't attach ids on date range functions because they're not meaningful: it's not clear what the cursor should focus when the label is clicked. *) let date_opt ?extra_attr ?allow_equal ~allow_updates_when_focused () = Conversion.don't_attach_id (date_opt ?extra_attr ?allow_equal ~allow_updates_when_focused ()) ;; let date ?extra_attr ?allow_equal ~allow_updates_when_focused () = Conversion.don't_attach_id (date ?extra_attr ?allow_equal ~allow_updates_when_focused ()) ;; let time_opt ?extra_attr ?allow_equal ~allow_updates_when_focused () = Conversion.don't_attach_id (time_opt ?extra_attr ?allow_equal ~allow_updates_when_focused ()) ;; let time ?extra_attr ?allow_equal ~allow_updates_when_focused () = Conversion.don't_attach_id (time ?extra_attr ?allow_equal ~allow_updates_when_focused ()) ;; let datetime_local_opt ?extra_attr ?allow_equal ~allow_updates_when_focused () = Conversion.don't_attach_id (datetime_local_opt ?extra_attr ?allow_equal ~allow_updates_when_focused ()) ;; let datetime_local ?extra_attr ?allow_equal ~allow_updates_when_focused () = Conversion.don't_attach_id (datetime_local ?extra_attr ?allow_equal ~allow_updates_when_focused ()) ;; end end module Multiselect = struct open Multiselect let set ?extra_attrs ?to_string ?default_selection_status ~allow_updates_when_focused m input_list = Conversion.with_extra_attrs (fun ~extra_attrs -> set ~extra_attrs ?to_string ?default_selection_status ~allow_updates_when_focused m input_list) extra_attrs ;; let list ?extra_attrs ?to_string ?default_selection_status ~allow_updates_when_focused m input_list = Conversion.with_extra_attrs (fun ~extra_attrs -> list ~extra_attrs ?to_string ?default_selection_status ~allow_updates_when_focused m input_list) extra_attrs ;; end module Multiple = struct open Multiple let stringable_list ?extra_input_attr ?extra_pill_container_attr ?extra_pill_attr ?placeholder m ~equal = Conversion.with_extra_attr (fun ~extra_attr:extra_input_attr -> stringable_list ~extra_input_attr ?extra_pill_container_attr ?extra_pill_attr ?placeholder m ~equal) extra_input_attr ;; let extract_add_element_text = function | Some value -> let%arr value = value in Some value | None -> Bonsai.const None ;; let map_list_view ?element_group_label ?add_element_text ?( = `Indented) form ~view_item = let%sub add_element_text = extract_add_element_text add_element_text in let%arr form = form and add_element_text = add_element_text in map_view form ~f:(fun { items; add_element = append } -> List.map items ~f:(fun { form = { view; value = _; set = _ }; remove } -> View.list_item ~view:(view_item view) ~remove_item:(Remove_info { remove; element_label = element_group_label })) |> View.list ~append_item:(Append_info { append; text = add_element_text }) ~legacy_button_position:button_placement) ;; let map_nonempty_list_view ?element_group_label ?add_element_text ?( = `Indented) form ~view_item = let%sub add_element_text = extract_add_element_text add_element_text in let%arr form = form and add_element_text = add_element_text in map_view form ~f:(fun { hd = { view = hd_view; _ }; tl; add_element = append } -> (* [Remove_view Vdom.Node.none] works but leads to a not quite correct result in the end, since the empty delete button becomes an empty <tr> that takes up 2 pixels of height. It's not that big of a deal though, since people should move to Form2 anyways eventually. *) let hd_view = View.list_item ~view:(view_item hd_view) ~remove_item:(Remove_view Vdom.Node.none) in let tl_views = List.map tl ~f:(fun { form = { view; _ }; remove } -> let element_label = let%map.Option element_group_label = element_group_label in fun ~ i -> element_group_label ~delete_button (i + Int.one) in View.list_item ~view:(view_item view) ~remove_item:(Remove_info { remove; element_label })) in View.list (hd_view :: tl_views) ~append_item:(Append_info { append; text = add_element_text }) ~legacy_button_position:button_placement) ;; let list (type a) ?element_group_label ?add_element_text ? (t : a Form.t Computation.t) : a list Form.t Computation.t = let%sub form = list t in map_list_view ?element_group_label ?add_element_text ?button_placement form ~view_item:Fn.id ;; let nonempty_list (type a) ?element_group_label ?add_element_text ? (t : a Form.t Computation.t) : a Nonempty_list.t Form.t Computation.t = let%sub form = nonempty_list t in map_nonempty_list_view ?element_group_label ?add_element_text ?button_placement form ~view_item:Fn.id ;; let set ?element_group_label ?add_element_text ? m form = let%sub form = set m form in map_list_view ?element_group_label ?add_element_text ?button_placement form ~view_item:Fn.id ;; let map ?element_group_label ?add_element_text ? m ~key ~data = let%sub form = map m ~key ~data in map_list_view ?element_group_label ?add_element_text ?button_placement form ~view_item:(fun (key_view, data_view) -> View.tuple [ key_view; data_view ]) ;; end module Number = struct open Number let int ?extra_attrs ?min ?max ?default ~step ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> int ~extra_attrs ?min ?max ?default ~step ~allow_updates_when_focused ()) extra_attrs ;; let float ?extra_attrs ?min ?max ?default ~step ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> float ~extra_attrs ?min ?max ?default ~step ~allow_updates_when_focused ()) extra_attrs ;; end module Range = struct open Range let int ?extra_attrs ?min ?max ?left_label ?right_label ?default ~step ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> int ~extra_attrs ?min ?max ?left_label ?right_label ?default ~step ~allow_updates_when_focused ()) extra_attrs ;; let float ?extra_attrs ?min ?max ?left_label ?right_label ?default ~step ~allow_updates_when_focused () = Conversion.with_extra_attrs (fun ~extra_attrs -> float ~extra_attrs ?min ?max ?left_label ?right_label ?default ~step ~allow_updates_when_focused ()) extra_attrs ;; end module Color_picker = struct open Color_picker let hex ?extra_attr () = Conversion.with_extra_attr (fun ~extra_attr -> hex ~extra_attr ()) extra_attr ;; end module File_select = struct open File_select let single_opt ?extra_attrs ?accept () = Conversion.with_extra_attrs (fun ~extra_attrs -> single_opt ~extra_attrs ?accept ()) extra_attrs ;; let single ?extra_attrs ?accept () = Conversion.with_extra_attrs (fun ~extra_attrs -> single ~extra_attrs ?accept ()) extra_attrs ;; let multiple ?extra_attrs ?accept () = Conversion.with_extra_attrs (fun ~extra_attrs -> multiple ~extra_attrs ?accept ()) extra_attrs ;; end module Freeform_multiselect = struct open Freeform_multiselect let set ?extra_attr ?placeholder ?split () = Conversion.with_extra_attr (fun ~extra_attr -> set ~extra_attr ?placeholder ?split ()) extra_attr ;; let list ?extra_attr ?placeholder ?split () = Conversion.with_extra_attr (fun ~extra_attr -> list ~extra_attr ?placeholder ?split ()) extra_attr ;; end module Rank = struct open Rank let list key ?enable_debug_overlay ?extra_item_attrs ?left ?right ?empty_list_placeholder ?default_item_height render = Conversion.don't_attach_id (list key ?enable_debug_overlay ?extra_item_attrs ?left ?right ?empty_list_placeholder ?default_item_height render) ;; end module Query_box = struct open Query_box let create_opt key ?initial_query ?max_visible_items ?suggestion_list_kind ?selected_item_attr ?extra_list_container_attr ?extra_input_attr ?extra_attr ~selection_to_string ~f () = Conversion.don't_attach_id (create_opt key ?initial_query ?max_visible_items ?suggestion_list_kind ?selected_item_attr ?extra_list_container_attr ?extra_input_attr ?extra_attr ~selection_to_string ~f ()) ;; let create key ?initial_query ?max_visible_items ?suggestion_list_kind ?selected_item_attr ?extra_list_container_attr ?extra_input_attr ?extra_attr ~selection_to_string ~f () = Conversion.don't_attach_id (create key ?initial_query ?max_visible_items ?suggestion_list_kind ?selected_item_attr ?extra_list_container_attr ?extra_input_attr ?extra_attr ~selection_to_string ~f ()) ;; let single_opt ?extra_attrs ?to_string ?to_option_description ?selected_item_attr ?extra_list_container_attr ?handle_unknown_option m ~all_options = Conversion.with_extra_attrs (fun ~extra_attrs -> single_opt ~extra_attrs ?to_string ?to_option_description ?selected_item_attr ?extra_list_container_attr ?handle_unknown_option m ~all_options) extra_attrs ;; let single ?extra_attrs ?to_string ?to_option_description ?selected_item_attr ?extra_list_container_attr ?handle_unknown_option m ~all_options = Conversion.with_extra_attrs (fun ~extra_attrs -> single ~extra_attrs ?to_string ?to_option_description ?selected_item_attr ?extra_list_container_attr ?handle_unknown_option m ~all_options) extra_attrs ;; end module Optional = struct open Typed_elements_manual.Optional let dropdown (type a) ?some_label ?none_label (form : a Form.t Computation.t) = let%sub form = dropdown ?some_label ?none_label form in let%arr form = form in map_view form ~f:(fun (clause_selector, sub_form) -> View.variant ~clause_selector ~selected_clause: (Option.map sub_form ~f:(fun view -> { View.clause_name = "Some"; clause_view = view }))) ;; end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>