@@ -1,14 +1,11 @@
1module Yoga.Block.Atom.Input.View where
1module Yoga.Block.Atom.Input.View where
3import Yoga.Prelude.View
3import Yoga.Prelude.View
4−import Data.Array as Array
5−import Data.Interpolate (i)
6import Data.String.NonEmpty (NonEmptyString)
4import Data.String.NonEmpty (NonEmptyString)
7import Foreign.Object (Object)
5import Foreign.Object (Object)
8import Foreign.Object as Object
6import Foreign.Object as Object
9import Framer.Motion as M
7import Framer.Motion as M
10−import Partial.Unsafe (unsafeCrashWith)
11−import React.Basic.DOM (CSS, css)
8+import React.Basic.DOM (css)
12import React.Basic.DOM as R
9import React.Basic.DOM as R
13import React.Basic.Hooks as React
10import React.Basic.Hooks as React
14import Web.HTML.HTMLInputElement as InputElement
11import Web.HTML.HTMLInputElement as InputElement
@@ -49,73 +46,6 @@ mkLeftIcon icon =
60− , transition: { duration: 0.6 }
65− drawPathUntil (Array.length path + 1) path
69− clipPath = 6 Array... (Array.length path) <#> \ln -> drawPathUntil ln path
74−drawPathUntil ∷ Int -> Array Point -> String
75−drawPathUntil idx thePath = do
76− let fn { x, y } = i x "%" " " y "%"
77− let firstFew = Array.take idx thePath
78− let lastFew = Array.drop idx thePath $> (Array.last firstFew # fromMaybe' \_ -> unsafeCrashWith "ogod")
79− let rendered = intercalate "," $ fn <$> (firstFew <> lastFew)
80− i "polygon(" rendered ")"
85−mkPath ∷ Int -> Int -> Array Point
86−mkPath borderX borderY = do
89− [ {- ⌜ -} p borderX borderY
90− , {- ⌞ -} p borderX (100 - borderY)
91− , {- ⌟ -} p (100 - borderX) (100 - borderY)
92− , {- ⌝ -} p (100 - borderX) borderY
93− , {- ⌜ -} p borderX borderY
108− inside <> outside <> (Array.reverse inside)
110− p ∷ Int -> Int -> Point
113−containerVariantLabels ∷
114− { blurred ∷ M.VariantLabel
115− , focussed ∷ M.VariantLabel
117−containerVariantLabels = M.makeVariantLabels containerVariants
119rawInput ∷ ∀ p. ReactComponent { | p }
49rawInput ∷ ∀ p. ReactComponent { | p }
120rawInput =
50rawInput =
121 mkForwardRefComponent "Input" do
51 mkForwardRefComponent "Input" do
@@ -206,8 +136,7 @@ rawComponent =
207 inputContainer =
137 inputContainer =
208 rawContainer
138 rawContainer
209− </ { label: (mkLabel <$> props.label) ?|| mempty
210− , hasFocus: hasFocus
139+ </ { hasFocus: hasFocus
211 , isInvalid: aria # Object.lookup "invalid" <#> (_ == "true") # maybeToOp
140 , isInvalid: aria # Object.lookup "invalid" <#> (_ == "true") # maybeToOp
212 , css: props.css
141 , css: props.css