Skip to content

Commit f6aaf7b

Browse files
author
matdsoupe
committed
adds Form components
- Form (Floating, Group, Label, Text, Control, Range, Select) - FormControl (Feedback) - Form.Check (Input, Label) - FloatingLabel
1 parent d474fb8 commit f6aaf7b

File tree

1 file changed

+182
-111
lines changed

1 file changed

+182
-111
lines changed

src/ReactBootstrap.res

Lines changed: 182 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -569,128 +569,30 @@ module Dropdown = {
569569
}
570570
}
571571

572-
module Container = {
573-
@module("react-bootstrap") @react.component
574-
external make: (~children: React.element, ~className: string=?) => React.element = "Container"
575-
}
576-
577-
module Row = {
572+
module Figure = {
578573
@module("react-bootstrap") @react.component
579574
external make: (
580-
~xs: int=?,
581-
~sm: int=?,
582-
~md: int=?,
583-
~lg: int=?,
584-
~xl: int=?,
585-
~xxl: int=?,
575+
~_as: string=?,
586576
~className: string=?,
587577
~children: React.element,
588-
) => React.element = "Row"
578+
~bsPrefix: string=?,
579+
) => React.element = "Figure"
589580
}
590581

591-
module Col = {
582+
module FigureImage = {
592583
@module("react-bootstrap") @react.component
593-
external make: (
594-
~xs: int=?,
595-
~sm: int=?,
596-
~md: int=?,
597-
~lg: int=?,
598-
~xl: int=?,
599-
~xxl: int=?,
600-
~className: string=?,
601-
~children: React.element,
602-
) => React.element = "Col"
584+
external make: (~width: int=?, ~height: int=?, ~alt: string=?, ~src: string=?) => React.element =
585+
"FigureImage"
603586
}
604587

605-
module Navbar = {
588+
module FigureCaption = {
606589
@module("react-bootstrap") @react.component
607590
external make: (
608-
~id: string=?,
609591
~_as: string=?,
610-
~children: React.element,
611-
~bg: string=?,
612-
~expand: [#sm | #md | #lg | #xl | #xxl],
613-
~expanded: bool=?,
614-
~fixed: [#top | #bottom],
615-
~role: string=?,
616-
~variant: [#light | #dark],
617-
~collapseOnSelect: bool=?,
618-
~sticky: string=?,
619-
~className: string=?,
620-
) => React.element = "Navbar"
621-
622-
module Brand = {
623-
@module("react-bootstrap") @scope("Navbar") @react.component
624-
external make: (
625-
~is: string=?,
626-
~_as: string=?,
627-
~href: string,
628-
~className: string=?,
629-
~children: React.element,
630-
) => React.element = "Brand"
631-
}
632-
633-
module Collapse = {
634-
@module("react-bootstrap") @scope("Navbar") @react.component
635-
external make: (
636-
~id: string=?,
637-
~className: string=?,
638-
~children: React.element,
639-
) => React.element = "Collapse"
640-
}
641-
642-
module Toggle = {
643-
@module("react-bootstrap") @scope("Navbar") @react.component
644-
external make: (
645-
~id: string=?,
646-
~_as: string=?,
647-
~children: React.element=?,
648-
~label: string=?,
649-
~\"aria-controls": string=?,
650-
~className: string=?,
651-
) => React.element = "Toggle"
652-
}
653-
}
654-
655-
module Nav = {
656-
@module("react-bootstrap") @react.component
657-
external make: (
658-
~id: string=?,
659-
~activeKey: string=?,
660-
~className: string=?,
661-
~navbarScroll: bool=?,
662-
~_as: string=?,
663-
~fill: bool=?,
664-
~justify: bool=?,
665-
~navbar: bool=?,
666-
~role: string=?,
667-
~variant: [#tabs | #pills],
668592
~className: string=?,
669593
~children: React.element,
670-
) => React.element = "Nav"
671-
672-
module Item = {
673-
@module("react-bootstrap") @scope("Nav") @react.component
674-
external make: (
675-
~id: string=?,
676-
~className: string=?,
677-
~children: React.element,
678-
~_as: string=?,
679-
) => React.element = "Item"
680-
}
681-
682-
module Link = {
683-
@module("react-bootstrap") @scope("Nav") @react.component
684-
external make: (
685-
~id: string=?,
686-
~children: React.element,
687-
~_as: string=?,
688-
~active: bool=?,
689-
~disabled: bool=?,
690-
~href: string,
691-
~className: string=?,
692-
) => React.element = "Link"
693-
}
594+
~bsPrefix: string,
595+
) => React.element = "FigureCaption"
694596
}
695597

696598
module Form = {
@@ -703,6 +605,16 @@ module Form = {
703605
~className: string=?,
704606
) => React.element = "Form"
705607

608+
module Floating = {
609+
@module("react-bootstrap") @scope("Form") @react.component
610+
external make: (
611+
~_as: string=?,
612+
~className: string=?,
613+
~children: React.element,
614+
~bsPrefix: string,
615+
) => React.element = "Floating"
616+
}
617+
706618
module Group = {
707619
@module("react-bootstrap") @scope("Form") @react.component
708620
external make: (
@@ -715,15 +627,18 @@ module Form = {
715627
}
716628

717629
module Label = {
630+
type column = Bool(bool) | Size([#sm | #lg])
631+
718632
@module("react-bootstrap") @scope("Form") @react.component
719633
external make: (
720634
~_ref: ReactDOM.Ref.t=?,
721635
~_as: string=?,
722-
~column: [#sm | #lg]=?,
636+
~column: column=?,
723637
~visuallyHidden: bool=?,
724638
~htmlFor: string=?,
725639
~className: string=?,
726640
~children: React.element,
641+
~bsPrefix: string=?,
727642
) => React.element = "Label"
728643
}
729644

@@ -735,6 +650,7 @@ module Form = {
735650
~muted: bool=?,
736651
~className: string=?,
737652
~children: React.element,
653+
~bsPrefix: string=?,
738654
) => React.element = "Text"
739655
}
740656

@@ -755,6 +671,7 @@ module Form = {
755671
~value: string=?,
756672
~className: string=?,
757673
~onChange: ReactEvent.Form.t=?,
674+
~bsPrefix: string=?,
758675
) => React.element = "Control"
759676

760677
module Feedback = {
@@ -776,11 +693,18 @@ module Form = {
776693
~_as: string=?,
777694
~children: React.element=?,
778695
~disabled: bool=?,
696+
~feedback: reactNode=?,
697+
~feedbackTooltip: bool=?,
698+
~id: string=?,
779699
~inline: bool=?,
780700
~isInvalid: bool=?,
781701
~isValid: bool=?,
702+
~label: string=?,
782703
~title: string=?,
783704
~className: string=?,
705+
~_type: [#radio | #checkbox | #"switch"]=?,
706+
~bsPrefix: string=?,
707+
~bsSwitchPredfix: string=?,
784708
) => React.element = "Check"
785709

786710
module Input = {
@@ -792,16 +716,37 @@ module Form = {
792716
~isValid: bool=?,
793717
~className: string=?,
794718
~_type: [#radio | #checkbox]=?,
719+
~bsPrefix: string=?,
795720
) => React.element = "Input"
796721
}
797722

798723
module Label = {
799724
@module("react-bootstrap") @scope(("Form", "Check")) @react.component
800-
external make: (~htmlFor: string, ~className: string=?) => React.element = "Label"
725+
external make: (
726+
~htmlFor: string,
727+
~className: string=?,
728+
~children: React.element,
729+
~bsPrefix: string=?,
730+
) => React.element = "Label"
731+
}
732+
733+
module Range = {
734+
type value<'a> = Value('a) | Values(array<'a>)
735+
736+
@module("react-bootstrap") @scope(("Form", "Check")) @react.component
737+
external make: (
738+
~disabled: bool=?,
739+
~id: string=?,
740+
~onChange: ReactEvent.Form.t => unit=?,
741+
~value: value<'a>=?,
742+
~bsPrefix: string=?,
743+
) => React.element = "Label"
801744
}
802745
}
803746

804747
module Select = {
748+
type value<'a> = Value('a) | Values(array<'a>)
749+
805750
@module("react-bootstrap") @scope("Form") @react.component
806751
external make: (
807752
~disabled: bool=?,
@@ -810,7 +755,9 @@ module Form = {
810755
~isValid: bool=?,
811756
~onChange: ReactEvent.Form.t=?,
812757
~className: string=?,
758+
~value: value<'a>=?,
813759
~size: [#sm | #lg]=?,
760+
~bsPrefix: string=?,
814761
) => React.element = "Select"
815762
}
816763

@@ -819,7 +766,7 @@ module Form = {
819766
external make: (
820767
~_as: string=?,
821768
~controlId: string=?,
822-
~label: string=?,
769+
~label: string,
823770
~className: string=?,
824771
~children: React.element,
825772
) => React.element = "FloatingLabel"
@@ -836,3 +783,127 @@ module InputGroup = {
836783
~children: React.element,
837784
) => React.element = "InputGroup"
838785
}
786+
787+
module Container = {
788+
@module("react-bootstrap") @react.component
789+
external make: (~children: React.element, ~className: string=?) => React.element = "Container"
790+
}
791+
792+
module Row = {
793+
@module("react-bootstrap") @react.component
794+
external make: (
795+
~xs: int=?,
796+
~sm: int=?,
797+
~md: int=?,
798+
~lg: int=?,
799+
~xl: int=?,
800+
~xxl: int=?,
801+
~className: string=?,
802+
~children: React.element,
803+
) => React.element = "Row"
804+
}
805+
806+
module Col = {
807+
@module("react-bootstrap") @react.component
808+
external make: (
809+
~xs: int=?,
810+
~sm: int=?,
811+
~md: int=?,
812+
~lg: int=?,
813+
~xl: int=?,
814+
~xxl: int=?,
815+
~className: string=?,
816+
~children: React.element,
817+
) => React.element = "Col"
818+
}
819+
820+
module Navbar = {
821+
@module("react-bootstrap") @react.component
822+
external make: (
823+
~id: string=?,
824+
~_as: string=?,
825+
~children: React.element,
826+
~bg: string=?,
827+
~expand: [#sm | #md | #lg | #xl | #xxl],
828+
~expanded: bool=?,
829+
~fixed: [#top | #bottom],
830+
~role: string=?,
831+
~variant: [#light | #dark],
832+
~collapseOnSelect: bool=?,
833+
~sticky: string=?,
834+
~className: string=?,
835+
) => React.element = "Navbar"
836+
837+
module Brand = {
838+
@module("react-bootstrap") @scope("Navbar") @react.component
839+
external make: (
840+
~is: string=?,
841+
~_as: string=?,
842+
~href: string,
843+
~className: string=?,
844+
~children: React.element,
845+
) => React.element = "Brand"
846+
}
847+
848+
module Collapse = {
849+
@module("react-bootstrap") @scope("Navbar") @react.component
850+
external make: (
851+
~id: string=?,
852+
~className: string=?,
853+
~children: React.element,
854+
) => React.element = "Collapse"
855+
}
856+
857+
module Toggle = {
858+
@module("react-bootstrap") @scope("Navbar") @react.component
859+
external make: (
860+
~id: string=?,
861+
~_as: string=?,
862+
~children: React.element=?,
863+
~label: string=?,
864+
~\"aria-controls": string=?,
865+
~className: string=?,
866+
) => React.element = "Toggle"
867+
}
868+
}
869+
870+
module Nav = {
871+
@module("react-bootstrap") @react.component
872+
external make: (
873+
~id: string=?,
874+
~activeKey: string=?,
875+
~className: string=?,
876+
~navbarScroll: bool=?,
877+
~_as: string=?,
878+
~fill: bool=?,
879+
~justify: bool=?,
880+
~navbar: bool=?,
881+
~role: string=?,
882+
~variant: [#tabs | #pills],
883+
~className: string=?,
884+
~children: React.element,
885+
) => React.element = "Nav"
886+
887+
module Item = {
888+
@module("react-bootstrap") @scope("Nav") @react.component
889+
external make: (
890+
~id: string=?,
891+
~className: string=?,
892+
~children: React.element,
893+
~_as: string=?,
894+
) => React.element = "Item"
895+
}
896+
897+
module Link = {
898+
@module("react-bootstrap") @scope("Nav") @react.component
899+
external make: (
900+
~id: string=?,
901+
~children: React.element,
902+
~_as: string=?,
903+
~active: bool=?,
904+
~disabled: bool=?,
905+
~href: string,
906+
~className: string=?,
907+
) => React.element = "Link"
908+
}
909+
}

0 commit comments

Comments
 (0)