Skip to content

Commit 5f71b25

Browse files
authored
Merge pull request #686 from laurentpayot/feliz_v3.0
[v3] menu HTML element + popover API props
2 parents 5027aa3 + 37090a8 commit 5f71b25

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

src/Feliz/Html.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ module HtmlHelper =
2626
return [arrNext_, null]; // return full arr and None option for children"""
2727

2828
let createElement (name: string) (props: IReactProperty list) : ReactElement =
29-
29+
3030
match unbox<(string*obj) list> props |> extractByKeyFast "children" with
3131
| props, Some (_, children) ->
3232
ReactLegacy.createElement(
33-
name,
33+
name,
3434
Fable.Core.JsInterop.createObj props,
3535
unbox<ReactElement list> children
3636
)
@@ -528,6 +528,9 @@ type Html =
528528
static member inline metadata xs = HtmlHelper.createElement "metadata" xs
529529
static member inline metadata (children: #seq<ReactElement>) = HtmlHelper.createElementWithChildren "metadata" children
530530

531+
static member inline menu xs = HtmlHelper.createElement "menu" xs
532+
static member inline menu(children: #seq<ReactElement>) = HtmlHelper.createElementWithChildren "menu" children
533+
531534
static member inline meter xs = HtmlHelper.createElement "meter" xs
532535
static member inline meter (value: float) = HtmlHelper.createElementWithChild "meter" value
533536
static member inline meter (value: int) = HtmlHelper.createElementWithChild "meter" value

src/Feliz/Properties.fs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ type prop =
609609

610610
/// This attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource.
611611
static member inline download (value: bool) = PropHelper.mkAttr "download" value
612-
612+
613613
/// This attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource.
614614
/// The value specifies the default file name for use in labeling the resource in a local file system.
615615
static member inline download (value: string) = PropHelper.mkAttr "download" value
@@ -1495,6 +1495,10 @@ type prop =
14951495
/// viewing the content and assuming that one unit along the z-axis equals one unit in x and y.
14961496
static member inline pointsAtZ (value: int) = PropHelper.mkAttr "pointsAtZ" value
14971497

1498+
/// Turns a <button> or <input> element into a popover control button.
1499+
/// Takes the ID of the popover element to control as its value.
1500+
static member inline popoverTarget(value: string) = PropHelper.mkAttr "popovertarget" value
1501+
14981502
/// Indicates how a <feConvolveMatrix> element handles alpha transparency.
14991503
static member inline preserveAlpha (value: bool) = PropHelper.mkAttr "preserveAlpha" value
15001504

@@ -3090,6 +3094,26 @@ module prop =
30903094
/// when the pattern was applied.
30913095
static member inline userSpaceOnUse = PropHelper.mkAttr "patternUnits" "userSpaceOnUse"
30923096

3097+
/// A global attribute that turns an element into a popover element.
3098+
[<Erase>]
3099+
type popover =
3100+
/// Auto popovers can be hidden by clicking outside it or pressing the Esc key.
3101+
static member inline auto = PropHelper.mkAttr "popover" "auto"
3102+
/// Hint popovers do not close auto popovers when they are displayed, but will close other hint popovers.
3103+
static member inline hint = PropHelper.mkAttr "popover" "hint"
3104+
/// Manual popovers must be displayed and closed using declarative show/hide/toggle buttons or JavaScript.
3105+
static member inline manual = PropHelper.mkAttr "popover" "manual"
3106+
3107+
/// Specifies the action to be performed on the popover element being controlled by a control <button> or <input>.
3108+
[<Erase>]
3109+
type popoverTargetAction =
3110+
/// The button will hide a shown popover. If you try to hide an already hidden popover, no action will be taken.
3111+
static member inline hide = PropHelper.mkAttr "popoverTargetAction" "hide"
3112+
/// The button will show a hidden popover. If you try to show an already showing popover, no action will be taken.
3113+
static member inline show = PropHelper.mkAttr "popoverTargetAction" "show"
3114+
///The button will toggle a popover between showing and hidden.
3115+
static member inline toggle = PropHelper.mkAttr "popoverTargetAction" "toggle"
3116+
30933117
/// Provide a hint to the browser about what the author thinks will lead to the best user experience with regards
30943118
/// to what content is loaded before the video is played.
30953119
[<Erase>]

0 commit comments

Comments
 (0)