@@ -10,7 +10,7 @@ import Foreign.Object (Object)
10import Foreign.Object as Object
10import Foreign.Object as Object
11import Framer.Motion as M
11import Framer.Motion as M
12import Partial.Unsafe (unsafeCrashWith)
12import Partial.Unsafe (unsafeCrashWith)
13−import React.Basic.DOM (CSS, Props_input, css)
13+import React.Basic.DOM (CSS, css)
14import React.Basic.DOM as R
14import React.Basic.DOM as R
15import React.Basic.Emotion (Style)
15import React.Basic.Emotion (Style)
16import React.Basic.Hooks (reactComponent)
16import React.Basic.Hooks (reactComponent)
@@ -131,7 +131,7 @@ rawInput =
132rawContainer ∷ ∀ p. ReactComponent { | p }
132rawContainer ∷ ∀ p. ReactComponent { | p }
133rawContainer =
133rawContainer =
134− mkForwardRefComponent "Input" do
134+ mkForwardRefComponent "InputContainer" do
135 \( props ∷
135 \( props ∷
136 { children ∷ Array JSX
136 { children ∷ Array JSX
137 , label ∷ JSX
137 , label ∷ JSX
@@ -228,41 +228,29 @@ rawComponent =
228 setHasValue (v /= "")
228 setHasValue (v /= "")
230 onFocus = handler preventDefault (const $ unless hasFocus $ setHasFocus true)
230 onFocus = handler preventDefault (const $ unless hasFocus $ setHasFocus true)
234+ { onFocus = composeHandler props.onFocus onFocus
235+ , onBlur = composeHandler props.onBlur onBlur
237+ , placeholder = maybePlaceholder # maybeToOp # unsafeUnOptional
239+ if props.label # opToMaybe # isJust then
240+ aria # Object.insert "labelledby" labelId
231 inputContainer =
245 inputContainer =
232− M.div
246+ rawContainer
233− </* M.motion
247+ </ { label: (mkLabel <$> props.label) ?|| mempty
234− { variants: M.variants containerVariants
248+ , hasFocus: hasFocus
235− , animate: M.animate if hasFocus then containerVariantLabels.focussed else containerVariantLabels.blurred
249+ , inputProps: props
236− }
250+ , css: props.css
237− { className: "ry-input-container"
238− , css: Style.inputContainer props
240− Object.fromHomogeneous
241− { "invalid": aria # Object.lookup "invalid" # fromMaybe ""
244 /> [ leading # foldMap \l -> div </ { ref: leftIconRef } /> [ l ]
252 /> [ leading # foldMap \l -> div </ { ref: leftIconRef } /> [ l ]
245− , rawInput
253+ , theInput
247− { onFocus = composeHandler props.onFocus onFocus
248− , onBlur = composeHandler props.onBlur onBlur
250− , placeholder = maybePlaceholder # maybeToOp # unsafeUnOptional
252− if props.label # opToMaybe # isJust then
253− aria # Object.insert "labelledby" labelId
259− -- ( props { type = HTMLInput.toString <$> props.type # unsafeUnOptional }
260− -- # setOrDelete (SProxy ∷ _ "placeholder") (maybePlaceholder # maybeToOp)
261− -- # setOrDelete (SProxy ∷ _ "value") (maybeValue # maybeToOp)
263− -- { className: "ry-input"
264− -- , css: Style.input
266 , trailing # foldMap \t -> div </ {} /> [ t ]
254 , trailing # foldMap \t -> div </ {} /> [ t ]