@fto-consult/expo-ui 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/adaptive-icon.png +0 -0
- package/assets/add_photo.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/logo.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.alias.js +32 -0
- package/babel.config.js +18 -0
- package/circular-dependencies.js +24 -0
- package/compiler.config.js +28 -0
- package/expo.metro.config.js +27 -0
- package/index.js +21 -0
- package/metro.config.js +1 -0
- package/package.json +60 -0
- package/src/App.js +65 -0
- package/src/Preferences.js +5 -0
- package/src/auth/Login.js +254 -0
- package/src/auth/index.js +3 -0
- package/src/components/ActivityIndicator/index.js +9 -0
- package/src/components/Animations/Animation/index.js +95 -0
- package/src/components/Animations/Animation/utils.js +78 -0
- package/src/components/Animations/OpacityAnimation/index.js +53 -0
- package/src/components/Animations/OpacityAnimation/utils.js +38 -0
- package/src/components/Animations/index.js +6 -0
- package/src/components/AppBar/Content.js +132 -0
- package/src/components/AppBar/index.js +164 -0
- package/src/components/AppBar/utils.js +204 -0
- package/src/components/AutoLink/index.js +45 -0
- package/src/components/Avatar/AutoHeightImage/AnimatableImage.js +22 -0
- package/src/components/Avatar/AutoHeightImage/ImagePolyfill.js +33 -0
- package/src/components/Avatar/AutoHeightImage/cache.js +75 -0
- package/src/components/Avatar/AutoHeightImage/helpers.js +2 -0
- package/src/components/Avatar/AutoHeightImage/index.js +97 -0
- package/src/components/Avatar/Image.js +115 -0
- package/src/components/Avatar/Text.js +74 -0
- package/src/components/Avatar/index.js +89 -0
- package/src/components/BackToTop/index.js +89 -0
- package/src/components/Badge/index.js +141 -0
- package/src/components/Badge/index1.js +34 -0
- package/src/components/BottomSheet/Content.js +19 -0
- package/src/components/BottomSheet/Menu.js +126 -0
- package/src/components/BottomSheet/Provider.js +58 -0
- package/src/components/BottomSheet/Sheet.js +434 -0
- package/src/components/BottomSheet/index.js +8 -0
- package/src/components/BottomSheet/utils.js +30 -0
- package/src/components/Br/index.js +4 -0
- package/src/components/Br/index.web.js +3 -0
- package/src/components/Browser/index.js +4 -0
- package/src/components/Button/index.js +465 -0
- package/src/components/CardView/index.android.js +55 -0
- package/src/components/CardView/index.ios.js +36 -0
- package/src/components/CardView/index.web.js +3 -0
- package/src/components/Chart/appexchart.3.5.text +14 -0
- package/src/components/Chart/index.js +22 -0
- package/src/components/Chart/index.native.js +61 -0
- package/src/components/Chart/utils.js +0 -0
- package/src/components/Checkbox/index.js +178 -0
- package/src/components/Chip/index.js +350 -0
- package/src/components/Color/ColorPicker.js +724 -0
- package/src/components/Color/assets/black-gradient-rotated.png +0 -0
- package/src/components/Color/assets/black-gradient.png +0 -0
- package/src/components/Color/assets/color-wheel.png +0 -0
- package/src/components/Color/index.js +158 -0
- package/src/components/ContentLoader/BarChar.js +19 -0
- package/src/components/ContentLoader/Circle.js +3 -0
- package/src/components/ContentLoader/Circle.web.js +3 -0
- package/src/components/ContentLoader/Datagrid.js +28 -0
- package/src/components/ContentLoader/Form.js +39 -0
- package/src/components/ContentLoader/Loader/RLoader/index.js +3 -0
- package/src/components/ContentLoader/Loader/RLoader/index.web.js +3 -0
- package/src/components/ContentLoader/Loader/index.js +20 -0
- package/src/components/ContentLoader/PieChart.js +22 -0
- package/src/components/ContentLoader/Placeholder/Placeholder.js +52 -0
- package/src/components/ContentLoader/Placeholder/PlaceholderLine.js +59 -0
- package/src/components/ContentLoader/Placeholder/PlaceholderMedia.js +47 -0
- package/src/components/ContentLoader/Placeholder/animations/Fade.js +58 -0
- package/src/components/ContentLoader/Placeholder/animations/Loader.js +24 -0
- package/src/components/ContentLoader/Placeholder/animations/Progressive.js +62 -0
- package/src/components/ContentLoader/Placeholder/animations/Raw.js +4 -0
- package/src/components/ContentLoader/Placeholder/animations/Shine.js +56 -0
- package/src/components/ContentLoader/Placeholder/animations/ShineOverlay.js +56 -0
- package/src/components/ContentLoader/Placeholder/animations/context.js +4 -0
- package/src/components/ContentLoader/Placeholder/index.js +12 -0
- package/src/components/ContentLoader/Placeholder/tokens.js +9 -0
- package/src/components/ContentLoader/Profile.js +27 -0
- package/src/components/ContentLoader/Rect.js +3 -0
- package/src/components/ContentLoader/Rect.web.js +3 -0
- package/src/components/ContentLoader/Skeleton.js +145 -0
- package/src/components/ContentLoader/Table.js +69 -0
- package/src/components/ContentLoader/TaskList.js +27 -0
- package/src/components/ContentLoader/index copy.js +148 -0
- package/src/components/ContentLoader/index.js +151 -0
- package/src/components/ContentLoader/utils.js +8 -0
- package/src/components/CountUp/index.js +67 -0
- package/src/components/Countries/SelectCountry.js +65 -0
- package/src/components/Countries/index.js +5 -0
- package/src/components/Countries/resources/countries.json +1746 -0
- package/src/components/Countries/resources/flags/images/ad.png +0 -0
- package/src/components/Countries/resources/flags/images/ae.png +0 -0
- package/src/components/Countries/resources/flags/images/af.png +0 -0
- package/src/components/Countries/resources/flags/images/ag.png +0 -0
- package/src/components/Countries/resources/flags/images/ai.png +0 -0
- package/src/components/Countries/resources/flags/images/al.png +0 -0
- package/src/components/Countries/resources/flags/images/am.png +0 -0
- package/src/components/Countries/resources/flags/images/ao.png +0 -0
- package/src/components/Countries/resources/flags/images/ar.png +0 -0
- package/src/components/Countries/resources/flags/images/as.png +0 -0
- package/src/components/Countries/resources/flags/images/at.png +0 -0
- package/src/components/Countries/resources/flags/images/au.png +0 -0
- package/src/components/Countries/resources/flags/images/aw.png +0 -0
- package/src/components/Countries/resources/flags/images/ax.png +0 -0
- package/src/components/Countries/resources/flags/images/az.png +0 -0
- package/src/components/Countries/resources/flags/images/ba.png +0 -0
- package/src/components/Countries/resources/flags/images/bb.png +0 -0
- package/src/components/Countries/resources/flags/images/bd.png +0 -0
- package/src/components/Countries/resources/flags/images/be.png +0 -0
- package/src/components/Countries/resources/flags/images/bf.png +0 -0
- package/src/components/Countries/resources/flags/images/bg.png +0 -0
- package/src/components/Countries/resources/flags/images/bh.png +0 -0
- package/src/components/Countries/resources/flags/images/bi.png +0 -0
- package/src/components/Countries/resources/flags/images/bj.png +0 -0
- package/src/components/Countries/resources/flags/images/bl.png +0 -0
- package/src/components/Countries/resources/flags/images/bm.png +0 -0
- package/src/components/Countries/resources/flags/images/bn.png +0 -0
- package/src/components/Countries/resources/flags/images/bo.png +0 -0
- package/src/components/Countries/resources/flags/images/bq.png +0 -0
- package/src/components/Countries/resources/flags/images/br.png +0 -0
- package/src/components/Countries/resources/flags/images/bs.png +0 -0
- package/src/components/Countries/resources/flags/images/bt.png +0 -0
- package/src/components/Countries/resources/flags/images/bw.png +0 -0
- package/src/components/Countries/resources/flags/images/by.png +0 -0
- package/src/components/Countries/resources/flags/images/bz.png +0 -0
- package/src/components/Countries/resources/flags/images/ca.png +0 -0
- package/src/components/Countries/resources/flags/images/cc.png +0 -0
- package/src/components/Countries/resources/flags/images/cd.png +0 -0
- package/src/components/Countries/resources/flags/images/cf.png +0 -0
- package/src/components/Countries/resources/flags/images/cg.png +0 -0
- package/src/components/Countries/resources/flags/images/ch.png +0 -0
- package/src/components/Countries/resources/flags/images/ci.png +0 -0
- package/src/components/Countries/resources/flags/images/ck.png +0 -0
- package/src/components/Countries/resources/flags/images/cl.png +0 -0
- package/src/components/Countries/resources/flags/images/cm.png +0 -0
- package/src/components/Countries/resources/flags/images/cn.png +0 -0
- package/src/components/Countries/resources/flags/images/co.png +0 -0
- package/src/components/Countries/resources/flags/images/cr.png +0 -0
- package/src/components/Countries/resources/flags/images/cu.png +0 -0
- package/src/components/Countries/resources/flags/images/cv.png +0 -0
- package/src/components/Countries/resources/flags/images/cw.png +0 -0
- package/src/components/Countries/resources/flags/images/cx.png +0 -0
- package/src/components/Countries/resources/flags/images/cy.png +0 -0
- package/src/components/Countries/resources/flags/images/cz.png +0 -0
- package/src/components/Countries/resources/flags/images/de.png +0 -0
- package/src/components/Countries/resources/flags/images/dj.png +0 -0
- package/src/components/Countries/resources/flags/images/dk.png +0 -0
- package/src/components/Countries/resources/flags/images/dm.png +0 -0
- package/src/components/Countries/resources/flags/images/do.png +0 -0
- package/src/components/Countries/resources/flags/images/dz.png +0 -0
- package/src/components/Countries/resources/flags/images/ec.png +0 -0
- package/src/components/Countries/resources/flags/images/ee.png +0 -0
- package/src/components/Countries/resources/flags/images/eg.png +0 -0
- package/src/components/Countries/resources/flags/images/eh.png +0 -0
- package/src/components/Countries/resources/flags/images/er.png +0 -0
- package/src/components/Countries/resources/flags/images/es.png +0 -0
- package/src/components/Countries/resources/flags/images/et.png +0 -0
- package/src/components/Countries/resources/flags/images/fi.png +0 -0
- package/src/components/Countries/resources/flags/images/fj.png +0 -0
- package/src/components/Countries/resources/flags/images/fk.png +0 -0
- package/src/components/Countries/resources/flags/images/fm.png +0 -0
- package/src/components/Countries/resources/flags/images/fo.png +0 -0
- package/src/components/Countries/resources/flags/images/fr.png +0 -0
- package/src/components/Countries/resources/flags/images/ga.png +0 -0
- package/src/components/Countries/resources/flags/images/gb.png +0 -0
- package/src/components/Countries/resources/flags/images/gd.png +0 -0
- package/src/components/Countries/resources/flags/images/ge.png +0 -0
- package/src/components/Countries/resources/flags/images/gf.png +0 -0
- package/src/components/Countries/resources/flags/images/gg.png +0 -0
- package/src/components/Countries/resources/flags/images/gh.png +0 -0
- package/src/components/Countries/resources/flags/images/gi.png +0 -0
- package/src/components/Countries/resources/flags/images/gm.png +0 -0
- package/src/components/Countries/resources/flags/images/gn.png +0 -0
- package/src/components/Countries/resources/flags/images/gp.png +0 -0
- package/src/components/Countries/resources/flags/images/gq.png +0 -0
- package/src/components/Countries/resources/flags/images/gr.png +0 -0
- package/src/components/Countries/resources/flags/images/gt.png +0 -0
- package/src/components/Countries/resources/flags/images/gu.png +0 -0
- package/src/components/Countries/resources/flags/images/gw.png +0 -0
- package/src/components/Countries/resources/flags/images/gy.png +0 -0
- package/src/components/Countries/resources/flags/images/hk.png +0 -0
- package/src/components/Countries/resources/flags/images/hn.png +0 -0
- package/src/components/Countries/resources/flags/images/hr.png +0 -0
- package/src/components/Countries/resources/flags/images/ht.png +0 -0
- package/src/components/Countries/resources/flags/images/hu.png +0 -0
- package/src/components/Countries/resources/flags/images/id.png +0 -0
- package/src/components/Countries/resources/flags/images/ie.png +0 -0
- package/src/components/Countries/resources/flags/images/il.png +0 -0
- package/src/components/Countries/resources/flags/images/im.png +0 -0
- package/src/components/Countries/resources/flags/images/in.png +0 -0
- package/src/components/Countries/resources/flags/images/io.png +0 -0
- package/src/components/Countries/resources/flags/images/iq.png +0 -0
- package/src/components/Countries/resources/flags/images/ir.png +0 -0
- package/src/components/Countries/resources/flags/images/is.png +0 -0
- package/src/components/Countries/resources/flags/images/it.png +0 -0
- package/src/components/Countries/resources/flags/images/je.png +0 -0
- package/src/components/Countries/resources/flags/images/jm.png +0 -0
- package/src/components/Countries/resources/flags/images/jo.png +0 -0
- package/src/components/Countries/resources/flags/images/jp.png +0 -0
- package/src/components/Countries/resources/flags/images/ke.png +0 -0
- package/src/components/Countries/resources/flags/images/kg.png +0 -0
- package/src/components/Countries/resources/flags/images/kh.png +0 -0
- package/src/components/Countries/resources/flags/images/ki.png +0 -0
- package/src/components/Countries/resources/flags/images/km.png +0 -0
- package/src/components/Countries/resources/flags/images/kn.png +0 -0
- package/src/components/Countries/resources/flags/images/kp.png +0 -0
- package/src/components/Countries/resources/flags/images/kr.png +0 -0
- package/src/components/Countries/resources/flags/images/ks.png +0 -0
- package/src/components/Countries/resources/flags/images/kw.png +0 -0
- package/src/components/Countries/resources/flags/images/ky.png +0 -0
- package/src/components/Countries/resources/flags/images/kz.png +0 -0
- package/src/components/Countries/resources/flags/images/la.png +0 -0
- package/src/components/Countries/resources/flags/images/lb.png +0 -0
- package/src/components/Countries/resources/flags/images/lc.png +0 -0
- package/src/components/Countries/resources/flags/images/li.png +0 -0
- package/src/components/Countries/resources/flags/images/lk.png +0 -0
- package/src/components/Countries/resources/flags/images/lr.png +0 -0
- package/src/components/Countries/resources/flags/images/ls.png +0 -0
- package/src/components/Countries/resources/flags/images/lt.png +0 -0
- package/src/components/Countries/resources/flags/images/lu.png +0 -0
- package/src/components/Countries/resources/flags/images/lv.png +0 -0
- package/src/components/Countries/resources/flags/images/ly.png +0 -0
- package/src/components/Countries/resources/flags/images/ma.png +0 -0
- package/src/components/Countries/resources/flags/images/mc.png +0 -0
- package/src/components/Countries/resources/flags/images/md.png +0 -0
- package/src/components/Countries/resources/flags/images/me.png +0 -0
- package/src/components/Countries/resources/flags/images/mf.png +0 -0
- package/src/components/Countries/resources/flags/images/mg.png +0 -0
- package/src/components/Countries/resources/flags/images/mh.png +0 -0
- package/src/components/Countries/resources/flags/images/mk.png +0 -0
- package/src/components/Countries/resources/flags/images/ml.png +0 -0
- package/src/components/Countries/resources/flags/images/mm.png +0 -0
- package/src/components/Countries/resources/flags/images/mn.png +0 -0
- package/src/components/Countries/resources/flags/images/mo.png +0 -0
- package/src/components/Countries/resources/flags/images/mp.png +0 -0
- package/src/components/Countries/resources/flags/images/mq.png +0 -0
- package/src/components/Countries/resources/flags/images/mr.png +0 -0
- package/src/components/Countries/resources/flags/images/ms.png +0 -0
- package/src/components/Countries/resources/flags/images/mt.png +0 -0
- package/src/components/Countries/resources/flags/images/mu.png +0 -0
- package/src/components/Countries/resources/flags/images/mv.png +0 -0
- package/src/components/Countries/resources/flags/images/mw.png +0 -0
- package/src/components/Countries/resources/flags/images/mx.png +0 -0
- package/src/components/Countries/resources/flags/images/my.png +0 -0
- package/src/components/Countries/resources/flags/images/mz.png +0 -0
- package/src/components/Countries/resources/flags/images/na.png +0 -0
- package/src/components/Countries/resources/flags/images/nc.png +0 -0
- package/src/components/Countries/resources/flags/images/ne.png +0 -0
- package/src/components/Countries/resources/flags/images/nf.png +0 -0
- package/src/components/Countries/resources/flags/images/ng.png +0 -0
- package/src/components/Countries/resources/flags/images/ni.png +0 -0
- package/src/components/Countries/resources/flags/images/nl.png +0 -0
- package/src/components/Countries/resources/flags/images/no.png +0 -0
- package/src/components/Countries/resources/flags/images/np.png +0 -0
- package/src/components/Countries/resources/flags/images/nr.png +0 -0
- package/src/components/Countries/resources/flags/images/nu.png +0 -0
- package/src/components/Countries/resources/flags/images/nz.png +0 -0
- package/src/components/Countries/resources/flags/images/om.png +0 -0
- package/src/components/Countries/resources/flags/images/pa.png +0 -0
- package/src/components/Countries/resources/flags/images/pe.png +0 -0
- package/src/components/Countries/resources/flags/images/pf.png +0 -0
- package/src/components/Countries/resources/flags/images/pg.png +0 -0
- package/src/components/Countries/resources/flags/images/ph.png +0 -0
- package/src/components/Countries/resources/flags/images/pk.png +0 -0
- package/src/components/Countries/resources/flags/images/pl.png +0 -0
- package/src/components/Countries/resources/flags/images/pm.png +0 -0
- package/src/components/Countries/resources/flags/images/pr.png +0 -0
- package/src/components/Countries/resources/flags/images/ps.png +0 -0
- package/src/components/Countries/resources/flags/images/pt.png +0 -0
- package/src/components/Countries/resources/flags/images/pw.png +0 -0
- package/src/components/Countries/resources/flags/images/py.png +0 -0
- package/src/components/Countries/resources/flags/images/qa.png +0 -0
- package/src/components/Countries/resources/flags/images/re.png +0 -0
- package/src/components/Countries/resources/flags/images/ro.png +0 -0
- package/src/components/Countries/resources/flags/images/rs.png +0 -0
- package/src/components/Countries/resources/flags/images/ru.png +0 -0
- package/src/components/Countries/resources/flags/images/rw.png +0 -0
- package/src/components/Countries/resources/flags/images/sa.png +0 -0
- package/src/components/Countries/resources/flags/images/sb.png +0 -0
- package/src/components/Countries/resources/flags/images/sc.png +0 -0
- package/src/components/Countries/resources/flags/images/sd.png +0 -0
- package/src/components/Countries/resources/flags/images/se.png +0 -0
- package/src/components/Countries/resources/flags/images/sg.png +0 -0
- package/src/components/Countries/resources/flags/images/sh.png +0 -0
- package/src/components/Countries/resources/flags/images/si.png +0 -0
- package/src/components/Countries/resources/flags/images/sj.png +0 -0
- package/src/components/Countries/resources/flags/images/sk.png +0 -0
- package/src/components/Countries/resources/flags/images/sl.png +0 -0
- package/src/components/Countries/resources/flags/images/sm.png +0 -0
- package/src/components/Countries/resources/flags/images/sn.png +0 -0
- package/src/components/Countries/resources/flags/images/so.png +0 -0
- package/src/components/Countries/resources/flags/images/sr.png +0 -0
- package/src/components/Countries/resources/flags/images/ss.png +0 -0
- package/src/components/Countries/resources/flags/images/st.png +0 -0
- package/src/components/Countries/resources/flags/images/sv.png +0 -0
- package/src/components/Countries/resources/flags/images/sx.png +0 -0
- package/src/components/Countries/resources/flags/images/sy.png +0 -0
- package/src/components/Countries/resources/flags/images/sz.png +0 -0
- package/src/components/Countries/resources/flags/images/tc.png +0 -0
- package/src/components/Countries/resources/flags/images/td.png +0 -0
- package/src/components/Countries/resources/flags/images/tg.png +0 -0
- package/src/components/Countries/resources/flags/images/th.png +0 -0
- package/src/components/Countries/resources/flags/images/tj.png +0 -0
- package/src/components/Countries/resources/flags/images/tk.png +0 -0
- package/src/components/Countries/resources/flags/images/tl.png +0 -0
- package/src/components/Countries/resources/flags/images/tm.png +0 -0
- package/src/components/Countries/resources/flags/images/tn.png +0 -0
- package/src/components/Countries/resources/flags/images/to.png +0 -0
- package/src/components/Countries/resources/flags/images/tr.png +0 -0
- package/src/components/Countries/resources/flags/images/tt.png +0 -0
- package/src/components/Countries/resources/flags/images/tv.png +0 -0
- package/src/components/Countries/resources/flags/images/tw.png +0 -0
- package/src/components/Countries/resources/flags/images/tz.png +0 -0
- package/src/components/Countries/resources/flags/images/ua.png +0 -0
- package/src/components/Countries/resources/flags/images/ug.png +0 -0
- package/src/components/Countries/resources/flags/images/us.png +0 -0
- package/src/components/Countries/resources/flags/images/uy.png +0 -0
- package/src/components/Countries/resources/flags/images/uz.png +0 -0
- package/src/components/Countries/resources/flags/images/va.png +0 -0
- package/src/components/Countries/resources/flags/images/vc.png +0 -0
- package/src/components/Countries/resources/flags/images/ve.png +0 -0
- package/src/components/Countries/resources/flags/images/vg.png +0 -0
- package/src/components/Countries/resources/flags/images/vi.png +0 -0
- package/src/components/Countries/resources/flags/images/vn.png +0 -0
- package/src/components/Countries/resources/flags/images/vu.png +0 -0
- package/src/components/Countries/resources/flags/images/wf.png +0 -0
- package/src/components/Countries/resources/flags/images/ws.png +0 -0
- package/src/components/Countries/resources/flags/images/ye.png +0 -0
- package/src/components/Countries/resources/flags/images/yt.png +0 -0
- package/src/components/Countries/resources/flags/images/za.png +0 -0
- package/src/components/Countries/resources/flags/images/zm.png +0 -0
- package/src/components/Countries/resources/flags/images/zw.png +0 -0
- package/src/components/Countries/resources/flags/index.js +255 -0
- package/src/components/Countries/utils.js +28 -0
- package/src/components/Datagrid/Accordion/AppleSwipeable.js +123 -0
- package/src/components/Datagrid/Accordion/Filters.js +186 -0
- package/src/components/Datagrid/Accordion/GmailSwipeable.js +85 -0
- package/src/components/Datagrid/Accordion/Row.js +295 -0
- package/src/components/Datagrid/Accordion/index.js +719 -0
- package/src/components/Datagrid/Accordion/utils.js +22 -0
- package/src/components/Datagrid/Actions/Header.js +58 -0
- package/src/components/Datagrid/Actions/index.js +104 -0
- package/src/components/Datagrid/Checkbox.js +40 -0
- package/src/components/Datagrid/Common/Common.js +1866 -0
- package/src/components/Datagrid/Common/TableData.js +245 -0
- package/src/components/Datagrid/Common/factory.js +9 -0
- package/src/components/Datagrid/Common/index.js +7 -0
- package/src/components/Datagrid/Common/session.js +20 -0
- package/src/components/Datagrid/Common/setQueryLimit.js +32 -0
- package/src/components/Datagrid/Footer/Footer.js +86 -0
- package/src/components/Datagrid/Footer/index.js +93 -0
- package/src/components/Datagrid/List.js +2 -0
- package/src/components/Datagrid/RenderType.js +53 -0
- package/src/components/Datagrid/RenderTypes/index.native.js +1 -0
- package/src/components/Datagrid/RenderTypes/index.web.js +10 -0
- package/src/components/Datagrid/RenderTypes/utils.js +5 -0
- package/src/components/Datagrid/Table/Cell.js +45 -0
- package/src/components/Datagrid/Table/Datatable.js +232 -0
- package/src/components/Datagrid/Table/index.js +446 -0
- package/src/components/Datagrid/Table/renderTable.js +664 -0
- package/src/components/Datagrid/factory.js +12 -0
- package/src/components/Datagrid/getComponent.js +26 -0
- package/src/components/Datagrid/index.js +43 -0
- package/src/components/Datagrid/utils.js +185 -0
- package/src/components/Date/DatePickerModal/index.js +10 -0
- package/src/components/Date/DatePickerModal/index.native.js +22 -0
- package/src/components/Date/PickerInput/TextInputMask.js +106 -0
- package/src/components/Date/PickerInput/index.js +253 -0
- package/src/components/Date/Time.js +154 -0
- package/src/components/Date/TimePickerModal/index.js +3 -0
- package/src/components/Date/TimePickerModal/index.native.js +21 -0
- package/src/components/Date/dictionary.js +26 -0
- package/src/components/Date/index.js +11 -0
- package/src/components/Date/utils.common.js +3 -0
- package/src/components/Date/utils.common.native.js +0 -0
- package/src/components/Date/utils.js +209 -0
- package/src/components/Dialog/AppBarDialog.js +41 -0
- package/src/components/Dialog/Dialog.js +377 -0
- package/src/components/Dialog/DialogActions.js +69 -0
- package/src/components/Dialog/DialogFooter.js +36 -0
- package/src/components/Dialog/DialogTitle.js +47 -0
- package/src/components/Dialog/DropdownAlert/Queue.js +28 -0
- package/src/components/Dialog/DropdownAlert/Utils.js +36 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/cancel@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/error@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/info@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/success@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn@2x.png +0 -0
- package/src/components/Dialog/DropdownAlert/assets/warn@3x.png +0 -0
- package/src/components/Dialog/DropdownAlert/index.js +685 -0
- package/src/components/Dialog/Provider.js +75 -0
- package/src/components/Dialog/confirm/Alert/Alert.old/Alert.web.js +360 -0
- package/src/components/Dialog/confirm/Alert/Alert.old/index.js +2 -0
- package/src/components/Dialog/confirm/Alert/index.js +43 -0
- package/src/components/Dialog/confirm/index.js +12 -0
- package/src/components/Dialog/confirm/showConfirmOrAlertOrPrompt.js +145 -0
- package/src/components/Dialog/dialogs.js +70 -0
- package/src/components/Dialog/index.js +17 -0
- package/src/components/Dialog/showConfirmOrAlertOrPrompt.js +90 -0
- package/src/components/Dialog/style.css +103 -0
- package/src/components/Dialog/utils.js +33 -0
- package/src/components/Divider/index.js +44 -0
- package/src/components/Drawer/DrawerHeader.js +70 -0
- package/src/components/Drawer/DrawerItems/DrawerItem.js +88 -0
- package/src/components/Drawer/DrawerItems/DrawerSection.js +34 -0
- package/src/components/Drawer/DrawerItems/ExpandableItem.js +44 -0
- package/src/components/Drawer/DrawerItems/_DrawerItem.js +173 -0
- package/src/components/Drawer/DrawerItems/index.js +155 -0
- package/src/components/Drawer/DrawerItems/utils.js +107 -0
- package/src/components/Drawer/DrawerLayout/index.js +476 -0
- package/src/components/Drawer/NavigationView.js +90 -0
- package/src/components/Drawer/Provider.js +6 -0
- package/src/components/Drawer/index.js +455 -0
- package/src/components/Drawer/session.js +28 -0
- package/src/components/Drawer/utils.js +39 -0
- package/src/components/Dropdown/index.js +1317 -0
- package/src/components/Dropdown/utils.js +19 -0
- package/src/components/ErrorBoundary/ErrorMessage.js +107 -0
- package/src/components/ErrorBoundary/Provider.js +68 -0
- package/src/components/ErrorBoundary/index.js +64 -0
- package/src/components/Expandable/Item.js +159 -0
- package/src/components/Expandable/index.js +229 -0
- package/src/components/Fab/Fab.js +46 -0
- package/src/components/Fab/Group.js +143 -0
- package/src/components/Fab/GroupComponent.js +384 -0
- package/src/components/Fab/index.js +8 -0
- package/src/components/FadeInOut/index.js +70 -0
- package/src/components/Filter/filterTextTypes.js +1 -0
- package/src/components/Filter/index.js +570 -0
- package/src/components/Filter/session.js +18 -0
- package/src/components/Filter/utils.js +289 -0
- package/src/components/Form/Action.js +112 -0
- package/src/components/Form/Fields/Checkbox.js +29 -0
- package/src/components/Form/Fields/Color.js +21 -0
- package/src/components/Form/Fields/Date.js +24 -0
- package/src/components/Form/Fields/Field.js +1048 -0
- package/src/components/Form/Fields/Html.js +21 -0
- package/src/components/Form/Fields/IdField.js +131 -0
- package/src/components/Form/Fields/Image.js +65 -0
- package/src/components/Form/Fields/PieceField.js +143 -0
- package/src/components/Form/Fields/Radio.js +31 -0
- package/src/components/Form/Fields/SelectCountry.js +12 -0
- package/src/components/Form/Fields/SelectField.js +147 -0
- package/src/components/Form/Fields/SelectStructData.js +24 -0
- package/src/components/Form/Fields/SelectTableData.js +24 -0
- package/src/components/Form/Fields/SelectTheme.js +11 -0
- package/src/components/Form/Fields/Slider.js +32 -0
- package/src/components/Form/Fields/Switch.js +34 -0
- package/src/components/Form/Fields/Tel.js +21 -0
- package/src/components/Form/Fields/TextField.js +44 -0
- package/src/components/Form/Fields/Time.js +28 -0
- package/src/components/Form/Fields/index.js +52 -0
- package/src/components/Form/Fields/selectPromptField.js +59 -0
- package/src/components/Form/Fields/sprintf.js +42 -0
- package/src/components/Form/Fields/sprintfSelectors.js +117 -0
- package/src/components/Form/Fields/utils.js +8 -0
- package/src/components/Form/Form.js +221 -0
- package/src/components/Form/FormData/Dialog.js +116 -0
- package/src/components/Form/FormData/DialogProvider.js +117 -0
- package/src/components/Form/FormData/FormData.js +403 -0
- package/src/components/Form/FormData/FormDataActions.js +155 -0
- package/src/components/Form/FormData/componentsTypes.js +117 -0
- package/src/components/Form/FormData/index.js +15 -0
- package/src/components/Form/FormData/utils.js +111 -0
- package/src/components/Form/KeyboardAvoidingView.js +23 -0
- package/src/components/Form/KeyboardEventHandler/index.js +115 -0
- package/src/components/Form/KeyboardEventHandler/keyEvents.js +139 -0
- package/src/components/Form/KeyboardEventHandler/readMe.md +1 -0
- package/src/components/Form/List/List.js +794 -0
- package/src/components/Form/List/index.js +2 -0
- package/src/components/Form/index.js +14 -0
- package/src/components/Form/utils/FormsManager.js +101 -0
- package/src/components/Form/utils/index.js +8 -0
- package/src/components/Form/utils/keyboardEvents.js +8 -0
- package/src/components/Form/utils/keyboardShortcuts.js +57 -0
- package/src/components/Grid/Cell.js +108 -0
- package/src/components/Grid/Col.js +30 -0
- package/src/components/Grid/Grid.js +35 -0
- package/src/components/Grid/Row.js +30 -0
- package/src/components/Grid/index.js +11 -0
- package/src/components/Hashtag/index.js +119 -0
- package/src/components/HeavyScreen/index.js +52 -0
- package/src/components/HeavyScreen/utils.js +36 -0
- package/src/components/HelperText/index.js +36 -0
- package/src/components/Html/AutoSizedImage.js +56 -0
- package/src/components/Html/HtmlToElement.js +173 -0
- package/src/components/Html/View.js +166 -0
- package/src/components/Icon/Checkbox.js +83 -0
- package/src/components/Icon/CrossFadeIcon.js +133 -0
- package/src/components/Icon/Icon.js +52 -0
- package/src/components/Icon/IconButton.js +155 -0
- package/src/components/Icon/MaterialCommunityIcon.js +93 -0
- package/src/components/Icon/index.js +10 -0
- package/src/components/Icon/utils.js +15 -0
- package/src/components/Image/Editor/index copy.js +42 -0
- package/src/components/Image/Editor/index.js +52 -0
- package/src/components/Image/index.js +309 -0
- package/src/components/InlineIndicator/Select.js +58 -0
- package/src/components/InlineIndicator/index.js +156 -0
- package/src/components/Label/index.js +104 -0
- package/src/components/Link/Browser.js +17 -0
- package/src/components/Link/getUrlCallback.js +10 -0
- package/src/components/Link/index.js +38 -0
- package/src/components/List/BigList.js +44 -0
- package/src/components/List/Common.js +233 -0
- package/src/components/List/FlashList.js +29 -0
- package/src/components/List/FlatList.js +34 -0
- package/src/components/List/RecyclerView.js +83 -0
- package/src/components/List/index.js +12 -0
- package/src/components/List/utils.js +23 -0
- package/src/components/Logo/Logo.js +98 -0
- package/src/components/Logo/Progress.js +21 -0
- package/src/components/Logo/index.js +3 -0
- package/src/components/Menu/Item.js +203 -0
- package/src/components/Menu/Menu.js +590 -0
- package/src/components/Menu/index.js +118 -0
- package/src/components/Menu/utils.js +81 -0
- package/src/components/Modal/index.js +212 -0
- package/src/components/NewLine/index.js +4 -0
- package/src/components/NewLine/index.web.js +3 -0
- package/src/components/Paragraph/index.js +32 -0
- package/src/components/PasswordText/index.js +29 -0
- package/src/components/PhoneInput/PhoneNumber.js +121 -0
- package/src/components/PhoneInput/country.js +54 -0
- package/src/components/PhoneInput/index.js +217 -0
- package/src/components/PhoneInput/numberType.json +14 -0
- package/src/components/PhoneInput/styles.js +52 -0
- package/src/components/Portal/index.js +5 -0
- package/src/components/Preloader/index.js +227 -0
- package/src/components/Progress/LoadingDots.js +126 -0
- package/src/components/Progress/index.js +18 -0
- package/src/components/Radio/index.js +164 -0
- package/src/components/ReadMoreText/index.js +120 -0
- package/src/components/ScrollView/index.js +34 -0
- package/src/components/Signature/Panel.js +246 -0
- package/src/components/Signature/index.js +69 -0
- package/src/components/SimpleSelect/index.js +483 -0
- package/src/components/Slider/Slider.js +770 -0
- package/src/components/Slider/index.js +144 -0
- package/src/components/Slider/styles.js +39 -0
- package/src/components/SplashScreen/index.js +194 -0
- package/src/components/SplashScreen/styles.js +74 -0
- package/src/components/StatusBar/Component/index.js +5 -0
- package/src/components/StatusBar/Component/index.web.js +88 -0
- package/src/components/StatusBar/index.js +7 -0
- package/src/components/Surface/Elevations.js +218 -0
- package/src/components/Surface/index.js +22 -0
- package/src/components/Swipeable/Swipe.js +225 -0
- package/src/components/Swipeable/SwipeableGesture.js +77 -0
- package/src/components/Swipeable/index.js +5 -0
- package/src/components/Swiper/Controls.js +277 -0
- package/src/components/Swiper/index.js +463 -0
- package/src/components/Swiper/nodeType.js +8 -0
- package/src/components/Swiper/renderNode.js +21 -0
- package/src/components/Switch/index.js +172 -0
- package/src/components/Tab/TabContent.js +72 -0
- package/src/components/Tab/TabItem.js +112 -0
- package/src/components/Tab/TabItems.js +246 -0
- package/src/components/Tab/index.js +114 -0
- package/src/components/Table/index.js +383 -0
- package/src/components/TextField/Affix.js +18 -0
- package/src/components/TextField/index.js +749 -0
- package/src/components/TextField/utils.js +64 -0
- package/src/components/Tooltip/Popover/index.js +254 -0
- package/src/components/Tooltip/Popover/index.web.js +60 -0
- package/src/components/Tooltip/index.js +42 -0
- package/src/components/TouchableRipple/index.js +0 -0
- package/src/components/View/index.js +49 -0
- package/src/components/WebView/Component/index.native.js +2 -0
- package/src/components/WebView/Component/index.web.js +154 -0
- package/src/components/WebView/Component/postMock.html +21 -0
- package/src/components/WebView/index.js +79 -0
- package/src/index.js +166 -0
- package/src/layouts/AppBar/index.js +59 -0
- package/src/layouts/AppBar/utils.js +12 -0
- package/src/layouts/Fab/actions.js +5 -0
- package/src/layouts/Fab/index.js +60 -0
- package/src/layouts/Fab/utils.js +25 -0
- package/src/layouts/Footer/index.js +8 -0
- package/src/layouts/Screen/FormData/FormData.js +103 -0
- package/src/layouts/Screen/FormData/List.js +83 -0
- package/src/layouts/Screen/FormData/index.js +3 -0
- package/src/layouts/Screen/Screen.js +173 -0
- package/src/layouts/Screen/index.js +11 -0
- package/src/media/Assets/index.js +6 -0
- package/src/media/Assets/utils.js +28 -0
- package/src/media/camera.js +1 -0
- package/src/media/camera.native.js +4 -0
- package/src/media/camera.web.js +9 -0
- package/src/media/file-system/index.js +20 -0
- package/src/media/file-system/utils/index.js +32 -0
- package/src/media/file-system/utils/utils.js +0 -0
- package/src/media/file-system/utils.native/index.js +1 -0
- package/src/media/index.js +137 -0
- package/src/navigation/Drawer/ProfilAvatar/defaultAvatar.js +1 -0
- package/src/navigation/Drawer/ProfilAvatar/index.js +142 -0
- package/src/navigation/Drawer/ProfilAvatar/style.css +18 -0
- package/src/navigation/Drawer/index.js +81 -0
- package/src/navigation/Drawer/items/SidebarFeedsItems.js +0 -0
- package/src/navigation/Drawer/items/SyncDataItem.js +20 -0
- package/src/navigation/Drawer/items/index.js +23 -0
- package/src/navigation/Drawer/items/items.js +31 -0
- package/src/navigation/Drawer/utils.js +18 -0
- package/src/navigation/index.js +45 -0
- package/src/navigation/utils.js +1 -0
- package/src/screens/Auth/index.js +31 -0
- package/src/screens/Auth/routes.js +9 -0
- package/src/screens/Auth/utils.js +5 -0
- package/src/screens/index.js +201 -0
- package/src/screens/mainScreens.js +4 -0
- package/src/screens/utils.js +13 -0
- package/webpack.config.js +31 -0
- package/workflows/release-package.yml +33 -0
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import React, { Component } from "$react";
|
|
2
|
+
import {normalize,RGB_MAX,HUE_MAX,SV_MAX,hexToRgb} from "$theme/colors";
|
|
3
|
+
import {extendObj} from "$utils";
|
|
4
|
+
import View from "$ecomponents/View";
|
|
5
|
+
import {
|
|
6
|
+
Animated,
|
|
7
|
+
Image,
|
|
8
|
+
PanResponder,
|
|
9
|
+
StyleSheet,
|
|
10
|
+
TouchableWithoutFeedback,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
|
|
13
|
+
import Elevations from '$ecomponents/Surface/Elevations';
|
|
14
|
+
import srcWheel from './assets/color-wheel.png';
|
|
15
|
+
import srcSlider from './assets/black-gradient.png';
|
|
16
|
+
import srcSliderRotated from './assets/black-gradient-rotated.png';
|
|
17
|
+
|
|
18
|
+
import {Colors} from "$theme";
|
|
19
|
+
import TextField from "$ecomponents/TextField";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const PALETTE = [
|
|
23
|
+
'#000000',
|
|
24
|
+
'#888888',
|
|
25
|
+
'#ed1c24',
|
|
26
|
+
'#d11cd5',
|
|
27
|
+
'#1633e6',
|
|
28
|
+
'#00aeef',
|
|
29
|
+
'#00c85d',
|
|
30
|
+
'#57ff0a',
|
|
31
|
+
'#ffde17',
|
|
32
|
+
'#f26522',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
// expands hex to full 6 chars (#fff -> #ffffff) if necessary
|
|
36
|
+
const expandColor = color => typeof color == 'string' && color.length === 4
|
|
37
|
+
? `#${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}`
|
|
38
|
+
: color;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
export default class ColorPickerComponent extends Component {
|
|
42
|
+
// testData = {}
|
|
43
|
+
// testView = {forceUpdate(){}}
|
|
44
|
+
color = {h:0,s:0,v:100}
|
|
45
|
+
slideX = new Animated.Value(0)
|
|
46
|
+
slideY = new Animated.Value(0)
|
|
47
|
+
panX = new Animated.Value(30)
|
|
48
|
+
panY = new Animated.Value(30)
|
|
49
|
+
sliderLength = 0
|
|
50
|
+
wheelSize = 0
|
|
51
|
+
sliderMeasure = {}
|
|
52
|
+
wheelMeasure = {}
|
|
53
|
+
wheelWidth = 0
|
|
54
|
+
static defaultProps = {
|
|
55
|
+
row: false, // use row or vertical layout
|
|
56
|
+
noSnap: false, // enables snapping on the center of wheel and edges of wheel and slider
|
|
57
|
+
thumbSize: 50, // wheel color thumb size
|
|
58
|
+
sliderSize: 20, // slider and slider color thumb size
|
|
59
|
+
gapSize: 16, // size of gap between slider and wheel
|
|
60
|
+
discrete: false, // use swatchs of shades instead of slider
|
|
61
|
+
discreteLength: 10, // number of swatchs of shades
|
|
62
|
+
sliderHidden: false, // if true the slider is hidden
|
|
63
|
+
swatches: true, // show color swatches
|
|
64
|
+
swatchesLast: true, // if false swatches are shown before wheel
|
|
65
|
+
swatchesOnly: false, // show swatch only and hide wheel and slider
|
|
66
|
+
swatchesHitSlop: undefined, // defines how far the touch event can start away from the swatch
|
|
67
|
+
color: '#ffffff', // color of the color picker
|
|
68
|
+
palette: PALETTE, // palette colors of swatches
|
|
69
|
+
shadeWheelThumb: true, // if true the wheel thumb color is shaded
|
|
70
|
+
shadeSliderThumb: false, // if true the slider thumb color is shaded
|
|
71
|
+
autoResetSlider: false, // if true the slider thumb is reset to 0 value when wheel thumb is moved
|
|
72
|
+
onInteractionStart: () => {}, // callback function triggered when user begins dragging slider/wheel
|
|
73
|
+
onColorChange: () => {}, // callback function providing current color while user is actively dragging slider/wheel
|
|
74
|
+
onColorChangeComplete: () => {}, // callback function providing final color when user stops dragging slider/wheel
|
|
75
|
+
}
|
|
76
|
+
wheelPanResponder = PanResponder.create({
|
|
77
|
+
onStartShouldSetPanResponderCapture: (event, gestureState) => {
|
|
78
|
+
const {nativeEvent} = event
|
|
79
|
+
if (this.outOfWheel(nativeEvent)) return
|
|
80
|
+
this.wheelMovement(event, gestureState)
|
|
81
|
+
this.updateHueSaturation({nativeEvent})
|
|
82
|
+
return true
|
|
83
|
+
},
|
|
84
|
+
onStartShouldSetPanResponder: () => true,
|
|
85
|
+
onMoveShouldSetPanResponderCapture: () => true,
|
|
86
|
+
onPanResponderGrant: (event, gestureState) => {
|
|
87
|
+
const { locationX, locationY } = event.nativeEvent
|
|
88
|
+
const { moveX, moveY, x0, y0 } = gestureState
|
|
89
|
+
const x = x0 - locationX, y = y0 - locationY
|
|
90
|
+
this.wheelMeasure.x = x
|
|
91
|
+
this.wheelMeasure.y = y
|
|
92
|
+
this.props.onInteractionStart();
|
|
93
|
+
return true
|
|
94
|
+
},
|
|
95
|
+
onPanResponderMove: (event, gestureState) => {
|
|
96
|
+
if(event && event.nativeEvent && typeof event.nativeEvent.preventDefault == 'function') event.nativeEvent.preventDefault()
|
|
97
|
+
if(event && event.nativeEvent && typeof event.nativeEvent.stopPropagation == 'function') event.nativeEvent.stopPropagation()
|
|
98
|
+
if (this.outOfWheel(event.nativeEvent) || this.outOfBox(this.wheelMeasure, gestureState)) return;
|
|
99
|
+
this.wheelMovement(event, gestureState)
|
|
100
|
+
},
|
|
101
|
+
onMoveShouldSetPanResponder: () => true,
|
|
102
|
+
onPanResponderRelease: (event, gestureState) => {
|
|
103
|
+
const {nativeEvent} = event
|
|
104
|
+
const {radius} = this.polar(nativeEvent)
|
|
105
|
+
const {hsv} = this.state
|
|
106
|
+
const {h,s,v} = hsv
|
|
107
|
+
if (!this.props.noSnap && radius <= 0.10 && radius >= 0) this.animate('#ffffff', 'hs', false, true)
|
|
108
|
+
if (!this.props.noSnap && radius >= 0.95 && radius <= 1) this.animate(this.state.currentColor, 'hs', true)
|
|
109
|
+
if (this.props.onColorChangeComplete) this.props.onColorChangeComplete(hsvToHex(hsv))
|
|
110
|
+
this.setState({currentColor:this.state.currentColor}, x=>this.renderDiscs())
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
sliderPanResponder = PanResponder.create({
|
|
114
|
+
onStartShouldSetPanResponderCapture: (event, gestureState) => {
|
|
115
|
+
const {nativeEvent} = event
|
|
116
|
+
if (this.outOfSlider(nativeEvent)) return
|
|
117
|
+
this.sliderMovement(event, gestureState)
|
|
118
|
+
this.updateValue({nativeEvent})
|
|
119
|
+
return true
|
|
120
|
+
},
|
|
121
|
+
onStartShouldSetPanResponder: () => true,
|
|
122
|
+
onMoveShouldSetPanResponderCapture: () => true,
|
|
123
|
+
onPanResponderGrant: (event, gestureState) => {
|
|
124
|
+
const { locationX, locationY } = event.nativeEvent
|
|
125
|
+
const { moveX, moveY, x0, y0 } = gestureState
|
|
126
|
+
const x = x0 - locationX, y = y0 - locationY
|
|
127
|
+
this.sliderMeasure.x = x
|
|
128
|
+
this.sliderMeasure.y = y
|
|
129
|
+
this.props.onInteractionStart();
|
|
130
|
+
return true
|
|
131
|
+
},
|
|
132
|
+
onPanResponderMove: (event, gestureState) => {
|
|
133
|
+
if(event && event.nativeEvent && typeof event.nativeEvent.preventDefault == 'function') event.nativeEvent.preventDefault()
|
|
134
|
+
if(event && event.nativeEvent && typeof event.nativeEvent.stopPropagation == 'function') event.nativeEvent.stopPropagation()
|
|
135
|
+
if (this.outOfSlider(event.nativeEvent) || this.outOfBox(this.sliderMeasure, gestureState)) return;
|
|
136
|
+
this.sliderMovement(event, gestureState)
|
|
137
|
+
},
|
|
138
|
+
onMoveShouldSetPanResponder: () => true,
|
|
139
|
+
onPanResponderRelease: (event, gestureState) => {
|
|
140
|
+
const {nativeEvent} = event
|
|
141
|
+
const {hsv} = this.state
|
|
142
|
+
const {h,s,v} = hsv
|
|
143
|
+
const ratio = this.ratio(nativeEvent)
|
|
144
|
+
if (!this.props.noSnap && ratio <= 0.05 && ratio >= 0) this.animate(this.state.currentColor, 'v', false)
|
|
145
|
+
if (!this.props.noSnap && ratio >= 0.95 && ratio <= 1) this.animate(this.state.currentColor, 'v', true)
|
|
146
|
+
if (this.props.onColorChangeComplete) this.props.onColorChangeComplete(hsvToHex(hsv))
|
|
147
|
+
},
|
|
148
|
+
})
|
|
149
|
+
constructor (props) {
|
|
150
|
+
super(props)
|
|
151
|
+
extendObj(this.state,{
|
|
152
|
+
wheelOpacity: 0,
|
|
153
|
+
visible : typeof this.props.visible ==='boolean'? this.props.visible : false,
|
|
154
|
+
sliderOpacity: 0,
|
|
155
|
+
hueSaturation: hsvToHex(this.color.h,this.color.s,100),
|
|
156
|
+
currentColor: props.color,
|
|
157
|
+
hsv: {h:0,s:0,v:100},
|
|
158
|
+
});
|
|
159
|
+
this.wheelMovement = new Animated.event(
|
|
160
|
+
[
|
|
161
|
+
{
|
|
162
|
+
nativeEvent: {
|
|
163
|
+
locationX: this.panX,
|
|
164
|
+
locationY: this.panY,
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
null,
|
|
168
|
+
],
|
|
169
|
+
{
|
|
170
|
+
useNativeDriver: false,
|
|
171
|
+
listener: this.updateHueSaturation
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
this.sliderMovement = new Animated.event(
|
|
175
|
+
[
|
|
176
|
+
{
|
|
177
|
+
nativeEvent: {
|
|
178
|
+
locationX: this.slideX,
|
|
179
|
+
locationY: this.slideY,
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
null,
|
|
183
|
+
],
|
|
184
|
+
{
|
|
185
|
+
useNativeDriver: false,
|
|
186
|
+
listener: this.updateValue
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
this.swatchAnim = props.palette.map((c,i) => (new Animated.Value(0)))
|
|
190
|
+
this.discAnim = (`1`).repeat(props.discreteLength).split('').map((c,i) => (new Animated.Value(0)))
|
|
191
|
+
this.renderSwatches()
|
|
192
|
+
this.renderDiscs()
|
|
193
|
+
}
|
|
194
|
+
onSwatchPress = (c,i) => {
|
|
195
|
+
this.swatchAnim[i].stopAnimation()
|
|
196
|
+
Animated.timing(this.swatchAnim[i], {
|
|
197
|
+
toValue: 1,
|
|
198
|
+
useNativeDriver: false,
|
|
199
|
+
duration: 500,
|
|
200
|
+
}).start(x=>{
|
|
201
|
+
this.swatchAnim[i].setValue(0)
|
|
202
|
+
})
|
|
203
|
+
this.animate(c)
|
|
204
|
+
}
|
|
205
|
+
onDiscPress = (c,i) => {
|
|
206
|
+
this.discAnim[i].stopAnimation()
|
|
207
|
+
Animated.timing(this.discAnim[i], {
|
|
208
|
+
toValue: 1,
|
|
209
|
+
useNativeDriver: false,
|
|
210
|
+
duration: 500,
|
|
211
|
+
}).start(x=>{
|
|
212
|
+
this.discAnim[i].setValue(0)
|
|
213
|
+
})
|
|
214
|
+
const val = i>=9?100:11*i
|
|
215
|
+
this.updateValue({nativeEvent:null}, val)
|
|
216
|
+
this.animate({h:this.color.h,s:this.color.s,v:val}, 'v')
|
|
217
|
+
}
|
|
218
|
+
onSquareLayout = (e) => {
|
|
219
|
+
let {x, y, width, height} = e.nativeEvent.layout
|
|
220
|
+
this.wheelWidth = Math.min(width, height)
|
|
221
|
+
this.tryForceUpdate()
|
|
222
|
+
}
|
|
223
|
+
onWheelLayout = (e) => {
|
|
224
|
+
/*
|
|
225
|
+
* const {x, y, width, height} = nativeEvent.layout
|
|
226
|
+
* onlayout values are different than measureInWindow
|
|
227
|
+
* x and y are the distances to its previous element
|
|
228
|
+
* but in measureInWindow they are relative to the window
|
|
229
|
+
*/
|
|
230
|
+
this.wheel.measureInWindow((x, y, width, height) => {
|
|
231
|
+
this.wheelMeasure = {x, y, width, height}
|
|
232
|
+
this.wheelSize = width
|
|
233
|
+
// this.panX.setOffset(-width/2)
|
|
234
|
+
// this.panY.setOffset(-width/2)
|
|
235
|
+
this.update(this.state.currentColor)
|
|
236
|
+
this.setState({wheelOpacity:1})
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
onSliderLayout = (e) => {
|
|
240
|
+
if(!this.slider || !this.slider.measureInWindow) return;
|
|
241
|
+
this.slider.measureInWindow((x, y, width, height) => {
|
|
242
|
+
this.sliderMeasure = {x, y, width, height}
|
|
243
|
+
this.sliderLength = this.props.row ? height-width : width-height
|
|
244
|
+
// this.slideX.setOffset(-width/2)
|
|
245
|
+
// this.slideY.setOffset(-width/2)
|
|
246
|
+
this.update(this.state.currentColor)
|
|
247
|
+
this.setState({sliderOpacity:1})
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
outOfBox (measure, gestureState) {
|
|
251
|
+
const { x, y, width, height } = measure
|
|
252
|
+
const { moveX, moveY, x0, y0 } = gestureState
|
|
253
|
+
// console.log(`${moveX} , ${moveY} / ${x} , ${y} / ${locationX} , ${locationY}`);
|
|
254
|
+
return !(moveX >= x && moveX <= x+width && moveY >= y && moveY <= y+height)
|
|
255
|
+
}
|
|
256
|
+
outOfWheel (nativeEvent) {
|
|
257
|
+
const {radius} = this.polar(nativeEvent)
|
|
258
|
+
return radius > 1
|
|
259
|
+
}
|
|
260
|
+
outOfSlider (nativeEvent) {
|
|
261
|
+
const row = this.props.row
|
|
262
|
+
const loc = row ? nativeEvent.locationY : nativeEvent.locationX
|
|
263
|
+
const {width,height} = this.sliderMeasure
|
|
264
|
+
return (loc > (row ? height-width : width-height))
|
|
265
|
+
}
|
|
266
|
+
val (v) {
|
|
267
|
+
const d = this.props.discrete, r = 11*Math.round(v/11)
|
|
268
|
+
return d ? (r>=99?100:r) : v
|
|
269
|
+
}
|
|
270
|
+
ratio (nativeEvent) {
|
|
271
|
+
const row = this.props.row
|
|
272
|
+
const loc = row ? nativeEvent.locationY : nativeEvent.locationX
|
|
273
|
+
const {width,height} = this.sliderMeasure
|
|
274
|
+
return 1 - (loc / (row ? height-width : width-height))
|
|
275
|
+
}
|
|
276
|
+
polar (nativeEvent) {
|
|
277
|
+
const lx = nativeEvent.locationX, ly = nativeEvent.locationY
|
|
278
|
+
const [x, y] = [lx - this.wheelSize/2, ly - this.wheelSize/2]
|
|
279
|
+
return {
|
|
280
|
+
deg: Math.atan2(y, x) * (-180 / Math.PI),
|
|
281
|
+
radius: Math.sqrt(y * y + x * x) / (this.wheelSize / 2),
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
cartesian (deg, radius) {
|
|
285
|
+
const r = radius * this.wheelSize / 2 // was normalized
|
|
286
|
+
const rad = Math.PI * deg / 180
|
|
287
|
+
const x = r * Math.cos(rad)
|
|
288
|
+
const y = r * Math.sin(rad)
|
|
289
|
+
return {
|
|
290
|
+
left: this.wheelSize / 2 + x,
|
|
291
|
+
top: this.wheelSize / 2 - y,
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
updateHueSaturation = ({nativeEvent}) => {
|
|
295
|
+
const {deg, radius} = this.polar(nativeEvent), h = deg, s = 100 * radius, v = this.color.v
|
|
296
|
+
// if(radius > 1 ) return
|
|
297
|
+
const hsv = {h,s,v}// v: 100} // causes bug
|
|
298
|
+
if(this.props.autoResetSlider === true) {
|
|
299
|
+
this.slideX.setValue(0)
|
|
300
|
+
this.slideY.setValue(0)
|
|
301
|
+
hsv.v = 100
|
|
302
|
+
}
|
|
303
|
+
const currentColor = hsvToHex(hsv)
|
|
304
|
+
this.color = hsv
|
|
305
|
+
this.setState({hsv, currentColor, hueSaturation: hsvToHex(this.color.h,this.color.s,100)})
|
|
306
|
+
this.props.onColorChange(hsvToHex(hsv))
|
|
307
|
+
// this.testData.deg = deg
|
|
308
|
+
// this.testData.radius = radius
|
|
309
|
+
// this.testData.pan = JSON.stringify({x:this.panX,y:this.panY})
|
|
310
|
+
// this.testData.pan = JSON.stringify(this.state.pan.getTranslateTransform())
|
|
311
|
+
// this.testView.forceUpdate()
|
|
312
|
+
}
|
|
313
|
+
updateValue = ({nativeEvent}, val) => {
|
|
314
|
+
const {h,s} = this.color, v = (typeof val == 'number') ? val : 100 * this.ratio(nativeEvent)
|
|
315
|
+
const hsv = {h,s,v}
|
|
316
|
+
const currentColor = hsvToHex(hsv)
|
|
317
|
+
this.color = hsv
|
|
318
|
+
this.setState({hsv, currentColor, hueSaturation: hsvToHex(this.color.h,this.color.s,100)})
|
|
319
|
+
this.props.onColorChange(hsvToHex(hsv))
|
|
320
|
+
}
|
|
321
|
+
update = (color, who, max, force) => {
|
|
322
|
+
const isHex = /^#(([0-9a-f]{2}){3}|([0-9a-f]){3})$/i
|
|
323
|
+
if (!isHex.test(color)) color = '#ffffff'
|
|
324
|
+
color = expandColor(color);
|
|
325
|
+
const specific = (typeof who == 'string'), who_hs = (who=='hs'), who_v = (who=='v')
|
|
326
|
+
let {h, s, v} = (typeof color == 'string') ? hexToHsv(color) : color, stt = {}
|
|
327
|
+
h = (who_hs||!specific) ? h : this.color.h
|
|
328
|
+
s = (who_hs && max) ? 100 : (who_hs && max===false) ? 0 : (who_hs||!specific) ? s : this.color.s
|
|
329
|
+
v = (who_v && max) ? 100 : (who_v && max===false) ? 0 : (who_v||!specific) ? v : this.color.v
|
|
330
|
+
const range = (100 - v) / 100 * this.sliderLength
|
|
331
|
+
const {left, top} = this.cartesian(h, s / 100)
|
|
332
|
+
const hsv = {h,s,v}
|
|
333
|
+
if(!specific||force) {
|
|
334
|
+
this.color = hsv
|
|
335
|
+
stt.hueSaturation = hsvToHex(this.color.h,this.color.s,100)
|
|
336
|
+
// this.setState({hueSaturation: hsvToHex(this.color.h,this.color.s,100)})
|
|
337
|
+
}
|
|
338
|
+
stt.currentColor = hsvToHex(hsv)
|
|
339
|
+
this.setState(stt, x=>{ this.tryForceUpdate(); this.renderDiscs(); })
|
|
340
|
+
// this.setState({currentColor:hsvToHex(hsv)}, x=>this.tryForceUpdate())
|
|
341
|
+
this.props.onColorChange(hsvToHex(hsv))
|
|
342
|
+
if (this.props.onColorChangeComplete) this.props.onColorChangeComplete(hsvToHex(hsv))
|
|
343
|
+
if(who_hs||!specific) {
|
|
344
|
+
this.panY.setValue(top)// - this.props.thumbSize / 2)
|
|
345
|
+
this.panX.setValue(left)// - this.props.thumbSize / 2)
|
|
346
|
+
}
|
|
347
|
+
if(who_v||!specific) {
|
|
348
|
+
this.slideX.setValue(range)
|
|
349
|
+
this.slideY.setValue(range)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
animate = (color, who, max, force) => {
|
|
353
|
+
color = expandColor(color);
|
|
354
|
+
const specific = (typeof who == 'string'), who_hs = (who=='hs'), who_v = (who=='v')
|
|
355
|
+
let {h, s, v} = (typeof color == 'string') ? hexToHsv(color) : color, stt = {}
|
|
356
|
+
h = (who_hs||!specific) ? h : this.color.h
|
|
357
|
+
s = (who_hs && max) ? 100 : (who_hs && max===false) ? 0 : (who_hs||!specific) ? s : this.color.s
|
|
358
|
+
v = (who_v && max) ? 100 : (who_v && max===false) ? 0 : (who_v||!specific) ? v : this.color.v
|
|
359
|
+
const range = (100 - v) / 100 * this.sliderLength
|
|
360
|
+
const {left, top} = this.cartesian(h, s / 100)
|
|
361
|
+
const hsv = {h,s,v}
|
|
362
|
+
// console.log(hsv);
|
|
363
|
+
if(!specific||force) {
|
|
364
|
+
this.color = hsv
|
|
365
|
+
stt.hueSaturation = hsvToHex(this.color.h,this.color.s,100)
|
|
366
|
+
// this.setState({hueSaturation: hsvToHex(this.color.h,this.color.s,100)})
|
|
367
|
+
}
|
|
368
|
+
stt.currentColor = hsvToHex(hsv)
|
|
369
|
+
this.setState(stt, x=>{ this.tryForceUpdate(); this.renderDiscs(); })
|
|
370
|
+
// this.setState({currentColor:hsvToHex(hsv)}, x=>this.tryForceUpdate())
|
|
371
|
+
this.props.onColorChange(hsvToHex(hsv))
|
|
372
|
+
if (this.props.onColorChangeComplete) this.props.onColorChangeComplete(hsvToHex(hsv))
|
|
373
|
+
let anims = []
|
|
374
|
+
if(who_hs||!specific) anims.push(//{//
|
|
375
|
+
Animated.spring(this.panX, { toValue: left, useNativeDriver: false, friction: 90 }),//.start()//
|
|
376
|
+
Animated.spring(this.panY, { toValue: top, useNativeDriver: false, friction: 90 }),//.start()//
|
|
377
|
+
)//}//
|
|
378
|
+
if(who_v||!specific) anims.push(//{//
|
|
379
|
+
Animated.spring(this.slideX, { toValue: range, useNativeDriver: false, friction: 90 }),//.start()//
|
|
380
|
+
Animated.spring(this.slideY, { toValue: range, useNativeDriver: false, friction: 90 }),//.start()//
|
|
381
|
+
)//}//
|
|
382
|
+
Animated.parallel(anims).start()
|
|
383
|
+
}
|
|
384
|
+
// componentWillReceiveProps(nextProps) {
|
|
385
|
+
// const { color } = nextProps
|
|
386
|
+
// if(color !== this.props.color) this.animate(color)
|
|
387
|
+
// }
|
|
388
|
+
componentDidUpdate(prevProps) {
|
|
389
|
+
super.componentDidUpdate();
|
|
390
|
+
const { color } = this.props
|
|
391
|
+
if(color !== prevProps.color) this.animate(color)
|
|
392
|
+
}
|
|
393
|
+
revert() {
|
|
394
|
+
if(this._isMounted()) this.animate(this.props.color)
|
|
395
|
+
}
|
|
396
|
+
tryForceUpdate () {
|
|
397
|
+
if(this._isMounted()) this.forceUpdate()
|
|
398
|
+
}
|
|
399
|
+
renderSwatches () {
|
|
400
|
+
this.swatches = this.props.palette.map((c,i) => (
|
|
401
|
+
<View style={[styles.swatch,{backgroundColor:c}]} key={'S'+i} hitSlop={this.props.swatchesHitSlop}>
|
|
402
|
+
<TouchableWithoutFeedback onPress={x=>this.onSwatchPress(c,i)} hitSlop={this.props.swatchesHitSlop}>
|
|
403
|
+
<Animated.View style={[styles.swatchTouch,{backgroundColor:c,transform:[{scale:this.swatchAnim[i].interpolate({inputRange:[0,0.5,1],outputRange:[0.666,1,0.666]})}]}]} />
|
|
404
|
+
</TouchableWithoutFeedback>
|
|
405
|
+
</View>
|
|
406
|
+
))
|
|
407
|
+
}
|
|
408
|
+
renderDiscs () {
|
|
409
|
+
this.disc = (`1`).repeat(this.props.discreteLength).split('').map((c,i) => (
|
|
410
|
+
<View style={[styles.swatch,{backgroundColor:this.state.hueSaturation}]} key={'D'+i} hitSlop={this.props.swatchesHitSlop}>
|
|
411
|
+
<TouchableWithoutFeedback onPress={x=>this.onDiscPress(c,i)} hitSlop={this.props.swatchesHitSlop}>
|
|
412
|
+
<Animated.View style={[styles.swatchTouch,{backgroundColor:this.state.hueSaturation,transform:[{scale:this.discAnim[i].interpolate({inputRange:[0,0.5,1],outputRange:[0.666,1,0.666]})}]}]}>
|
|
413
|
+
<View style={[styles.wheelImg,{backgroundColor:'#000',opacity:1-(i>=9?1:(i*11/100))}]}></View>
|
|
414
|
+
</Animated.View>
|
|
415
|
+
</TouchableWithoutFeedback>
|
|
416
|
+
</View>
|
|
417
|
+
)).reverse()
|
|
418
|
+
this.tryForceUpdate()
|
|
419
|
+
}
|
|
420
|
+
render () {
|
|
421
|
+
const {
|
|
422
|
+
style,
|
|
423
|
+
thumbSize,
|
|
424
|
+
sliderSize,
|
|
425
|
+
gapSize,
|
|
426
|
+
swatchesLast,
|
|
427
|
+
swatchesOnly,
|
|
428
|
+
sliderHidden,
|
|
429
|
+
discrete,
|
|
430
|
+
disabled,
|
|
431
|
+
editable,
|
|
432
|
+
row,
|
|
433
|
+
} = this.props
|
|
434
|
+
const swatches = !!(this.props.swatches || swatchesOnly)
|
|
435
|
+
const hsv = hsvToHex(this.color), hex = hsvToHex(this.color.h,this.color.s,100)
|
|
436
|
+
const wheelPanHandlers = this.wheelPanResponder && this.wheelPanResponder.panHandlers || {}
|
|
437
|
+
const sliderPanHandlers = this.sliderPanResponder && this.sliderPanResponder.panHandlers || {}
|
|
438
|
+
const opacity = this.state.wheelOpacity// * this.state.sliderOpacity
|
|
439
|
+
const margin = swatchesOnly ? 0 : gapSize
|
|
440
|
+
const wheelThumbStyle = {
|
|
441
|
+
width: thumbSize,
|
|
442
|
+
height: thumbSize,
|
|
443
|
+
borderRadius: thumbSize / 2,
|
|
444
|
+
backgroundColor: this.props.shadeWheelThumb === true ? hsv: hex,
|
|
445
|
+
transform: [{translateX:-thumbSize/2},{translateY:-thumbSize/2}],
|
|
446
|
+
left: this.panX,
|
|
447
|
+
top: this.panY,
|
|
448
|
+
opacity,
|
|
449
|
+
////
|
|
450
|
+
// transform: [{translateX:this.panX},{translateY:this.panY}],
|
|
451
|
+
// left: -this.props.thumbSize/2,
|
|
452
|
+
// top: -this.props.thumbSize/2,
|
|
453
|
+
// zIndex: 2,
|
|
454
|
+
}
|
|
455
|
+
const sliderThumbStyle = {
|
|
456
|
+
left: row?0:this.slideX,
|
|
457
|
+
top: row?this.slideY:0,
|
|
458
|
+
// transform: [row?{translateX:8}:{translateY:8}],
|
|
459
|
+
backgroundColor: this.props.shadeSliderThumb === true ? hsv: hex,
|
|
460
|
+
borderRadius: sliderSize/2,
|
|
461
|
+
height: sliderSize,
|
|
462
|
+
width: sliderSize,
|
|
463
|
+
opacity,
|
|
464
|
+
}
|
|
465
|
+
const sliderStyle = {
|
|
466
|
+
width:row?sliderSize:'100%',
|
|
467
|
+
height:row?'100%':sliderSize,
|
|
468
|
+
marginLeft:row?gapSize:0,
|
|
469
|
+
marginTop:row?0:gapSize,
|
|
470
|
+
borderRadius:sliderSize/2,
|
|
471
|
+
}
|
|
472
|
+
const swatchStyle = {
|
|
473
|
+
flexDirection:row?'column':'row',
|
|
474
|
+
width:row?20:'100%',
|
|
475
|
+
height:row?'100%':20,
|
|
476
|
+
marginLeft:row?margin:0,
|
|
477
|
+
marginTop:row?0:margin,
|
|
478
|
+
}
|
|
479
|
+
const swatchFirstStyle = {
|
|
480
|
+
marginTop:0,
|
|
481
|
+
marginLeft:0,
|
|
482
|
+
marginRight:row?margin:0,
|
|
483
|
+
marginBottom:row?0:margin,
|
|
484
|
+
}
|
|
485
|
+
// console.log('RENDER >>',row,thumbSize,sliderSize)
|
|
486
|
+
return (
|
|
487
|
+
<View testID="RN_ColorPickerContainer">
|
|
488
|
+
<View style={[styles.root,row?{flexDirection:'row'}:{},style]}>
|
|
489
|
+
{ swatches && !swatchesLast && <View style={[styles.swatches,swatchStyle,swatchFirstStyle]} key={'SW'}>{ this.swatches }</View> }
|
|
490
|
+
{ !swatchesOnly && <View style={[styles.wheel]} key={'$1'} onLayout={this.onSquareLayout}>
|
|
491
|
+
{ this.wheelWidth>0 && <View style={[{padding:thumbSize/2,width:this.wheelWidth,height:this.wheelWidth}]}>
|
|
492
|
+
<View style={[styles.wheelWrap]}>
|
|
493
|
+
<Image style={styles.wheelImg} source={srcWheel} />
|
|
494
|
+
<Animated.View style={[styles.wheelThumb,wheelThumbStyle,Elevations[4],{pointerEvents:'none'}]} />
|
|
495
|
+
<View style={[styles.cover]} onLayout={this.onWheelLayout} {...wheelPanHandlers} ref={r => { this.wheel = r }}></View>
|
|
496
|
+
</View>
|
|
497
|
+
</View> }
|
|
498
|
+
</View> }
|
|
499
|
+
{ !swatchesOnly && !sliderHidden && (discrete ? <View style={[styles.swatches,swatchStyle]} key={'$2'}>{ this.disc }</View> : <View style={[styles.slider,sliderStyle]} key={'$2'}>
|
|
500
|
+
<View style={[styles.grad,{backgroundColor:hex}]}>
|
|
501
|
+
<Image style={styles.sliderImg} source={row?srcSliderRotated:srcSlider} resizeMode="stretch" />
|
|
502
|
+
</View>
|
|
503
|
+
<Animated.View style={[styles.sliderThumb,sliderThumbStyle,Elevations[4],{pointerEvents:'none'}]} />
|
|
504
|
+
<View style={[styles.cover]} onLayout={this.onSliderLayout} {...sliderPanHandlers} ref={r => { this.slider = r }}></View>
|
|
505
|
+
</View>) }
|
|
506
|
+
{ swatches && swatchesLast && <View style={[styles.swatches,swatchStyle]} key={'SW'}>{ this.swatches }</View> }
|
|
507
|
+
<TextField
|
|
508
|
+
enableCopy
|
|
509
|
+
label = ''
|
|
510
|
+
editable = {editable}
|
|
511
|
+
disabled = {disabled}
|
|
512
|
+
defaultValue = {hex}
|
|
513
|
+
style = {styles.textInput}
|
|
514
|
+
onChangeText = {(value)=>{
|
|
515
|
+
if(Colors.isHex(value)){
|
|
516
|
+
this.update(value);
|
|
517
|
+
}
|
|
518
|
+
}}
|
|
519
|
+
/>
|
|
520
|
+
</View>
|
|
521
|
+
</View>
|
|
522
|
+
)
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const styles = StyleSheet.create({
|
|
527
|
+
root: {
|
|
528
|
+
flex: 1,
|
|
529
|
+
flexDirection: 'column',
|
|
530
|
+
alignItems: 'center',
|
|
531
|
+
justifyContent: 'space-between',
|
|
532
|
+
overflow: 'visible',
|
|
533
|
+
// aspectRatio: 1,
|
|
534
|
+
// backgroundColor: '#ffcccc',
|
|
535
|
+
},
|
|
536
|
+
wheel: {
|
|
537
|
+
flex: 1,
|
|
538
|
+
justifyContent: 'center',
|
|
539
|
+
alignItems: 'center',
|
|
540
|
+
position: 'relative',
|
|
541
|
+
overflow: 'visible',
|
|
542
|
+
width: '100%',
|
|
543
|
+
minWidth: 200,
|
|
544
|
+
minHeight: 200,
|
|
545
|
+
// aspectRatio: 1,
|
|
546
|
+
// backgroundColor: '#ffccff',
|
|
547
|
+
},
|
|
548
|
+
wheelWrap: {
|
|
549
|
+
width: '100%',
|
|
550
|
+
height: '100%',
|
|
551
|
+
// backgroundColor: '#ffffcc',
|
|
552
|
+
},
|
|
553
|
+
wheelImg: {
|
|
554
|
+
width: '100%',
|
|
555
|
+
height: '100%',
|
|
556
|
+
// backgroundColor: '#ffffcc',
|
|
557
|
+
},
|
|
558
|
+
wheelThumb: {
|
|
559
|
+
position: 'absolute',
|
|
560
|
+
backgroundColor: '#EEEEEE',
|
|
561
|
+
borderWidth: 3,
|
|
562
|
+
borderColor: '#EEEEEE',
|
|
563
|
+
elevation: 4,
|
|
564
|
+
shadowColor: 'rgb(46, 48, 58)',
|
|
565
|
+
shadowOffset: {width: 0, height: 2},
|
|
566
|
+
shadowOpacity: 0.8,
|
|
567
|
+
shadowRadius: 2,
|
|
568
|
+
},
|
|
569
|
+
cover: {
|
|
570
|
+
position: 'absolute',
|
|
571
|
+
top: 0,
|
|
572
|
+
left: 0,
|
|
573
|
+
width: '100%',
|
|
574
|
+
height: '100%',
|
|
575
|
+
// backgroundColor: '#ccccff88',
|
|
576
|
+
},
|
|
577
|
+
slider: {
|
|
578
|
+
width: '100%',
|
|
579
|
+
// height: 32,
|
|
580
|
+
marginTop: 16,
|
|
581
|
+
// overflow: 'hidden',
|
|
582
|
+
flexDirection: 'column-reverse',
|
|
583
|
+
// elevation: 4,
|
|
584
|
+
// backgroundColor: '#ccccff',
|
|
585
|
+
},
|
|
586
|
+
sliderImg: {
|
|
587
|
+
width: '100%',
|
|
588
|
+
height: '100%',
|
|
589
|
+
},
|
|
590
|
+
sliderThumb: {
|
|
591
|
+
position: 'absolute',
|
|
592
|
+
top: 0,
|
|
593
|
+
left: 0,
|
|
594
|
+
borderWidth: 2,
|
|
595
|
+
borderColor: '#EEEEEE',
|
|
596
|
+
elevation: 4,
|
|
597
|
+
// backgroundColor: '#f00',
|
|
598
|
+
},
|
|
599
|
+
grad: {
|
|
600
|
+
borderRadius: 100,
|
|
601
|
+
overflow: "hidden",
|
|
602
|
+
height: '100%',
|
|
603
|
+
},
|
|
604
|
+
swatches: {
|
|
605
|
+
width: '100%',
|
|
606
|
+
flexDirection: 'row',
|
|
607
|
+
justifyContent: 'space-between',
|
|
608
|
+
marginTop: 16,
|
|
609
|
+
// padding: 16,
|
|
610
|
+
},
|
|
611
|
+
swatch: {
|
|
612
|
+
width: 20,
|
|
613
|
+
height: 20,
|
|
614
|
+
borderRadius: 10,
|
|
615
|
+
// borderWidth: 1,
|
|
616
|
+
borderColor: '#8884',
|
|
617
|
+
alignItems: 'center',
|
|
618
|
+
justifyContent: 'center',
|
|
619
|
+
overflow: 'visible',
|
|
620
|
+
},
|
|
621
|
+
swatchTouch: {
|
|
622
|
+
width: 30,
|
|
623
|
+
height: 30,
|
|
624
|
+
borderRadius: 15,
|
|
625
|
+
backgroundColor: '#f004',
|
|
626
|
+
overflow: 'hidden',
|
|
627
|
+
},
|
|
628
|
+
})
|
|
629
|
+
|
|
630
|
+
const rgbToHsv = (r, g, b) => {
|
|
631
|
+
if (typeof r === 'object') {
|
|
632
|
+
const args = r
|
|
633
|
+
r = args.r; g = args.g; b = args.b;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// It converts [0,255] format, to [0,1]
|
|
637
|
+
r = (r === RGB_MAX) ? 1 : (r % RGB_MAX / parseFloat(RGB_MAX))
|
|
638
|
+
g = (g === RGB_MAX) ? 1 : (g % RGB_MAX / parseFloat(RGB_MAX))
|
|
639
|
+
b = (b === RGB_MAX) ? 1 : (b % RGB_MAX / parseFloat(RGB_MAX))
|
|
640
|
+
|
|
641
|
+
let max = Math.max(r, g, b)
|
|
642
|
+
let min = Math.min(r, g, b)
|
|
643
|
+
let h, s, v = max
|
|
644
|
+
|
|
645
|
+
let d = max - min
|
|
646
|
+
|
|
647
|
+
s = max === 0 ? 0 : d / max
|
|
648
|
+
|
|
649
|
+
if (max === min) {
|
|
650
|
+
h = 0 // achromatic
|
|
651
|
+
} else {
|
|
652
|
+
switch (max) {
|
|
653
|
+
case r:
|
|
654
|
+
h = (g - b) / d + (g < b ? 6 : 0)
|
|
655
|
+
break
|
|
656
|
+
case g:
|
|
657
|
+
h = (b - r) / d + 2
|
|
658
|
+
break
|
|
659
|
+
case b:
|
|
660
|
+
h = (r - g) / d + 4
|
|
661
|
+
break
|
|
662
|
+
}
|
|
663
|
+
h /= 6
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
return {
|
|
667
|
+
h: Math.round(h * HUE_MAX),
|
|
668
|
+
s: Math.round(s * SV_MAX),
|
|
669
|
+
v: Math.round(v * SV_MAX)
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
const hsvToRgb = (h, s, v) => {
|
|
673
|
+
if (typeof h === 'object') {
|
|
674
|
+
const args = h
|
|
675
|
+
h = args.h; s = args.s; v = args.v;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
h = normalize(h)
|
|
679
|
+
h = (h === HUE_MAX) ? 1 : (h % HUE_MAX / parseFloat(HUE_MAX) * 6)
|
|
680
|
+
s = (s === SV_MAX) ? 1 : (s % SV_MAX / parseFloat(SV_MAX))
|
|
681
|
+
v = (v === SV_MAX) ? 1 : (v % SV_MAX / parseFloat(SV_MAX))
|
|
682
|
+
|
|
683
|
+
let i = Math.floor(h)
|
|
684
|
+
let f = h - i
|
|
685
|
+
let p = v * (1 - s)
|
|
686
|
+
let q = v * (1 - f * s)
|
|
687
|
+
let t = v * (1 - (1 - f) * s)
|
|
688
|
+
let mod = i % 6
|
|
689
|
+
let r = [v, q, p, p, t, v][mod]
|
|
690
|
+
let g = [t, v, v, q, p, p][mod]
|
|
691
|
+
let b = [p, p, t, v, v, q][mod]
|
|
692
|
+
|
|
693
|
+
return {
|
|
694
|
+
r: Math.floor(r * RGB_MAX),
|
|
695
|
+
g: Math.floor(g * RGB_MAX),
|
|
696
|
+
b: Math.floor(b * RGB_MAX),
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export const hsvToHex = (h, s, v) => {
|
|
701
|
+
const rgb = hsvToRgb(h, s, v)
|
|
702
|
+
return rgb ? rgbToHex(rgb.r, rgb.g, rgb.b) : null;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export const hexToHsv = (hex) => {
|
|
706
|
+
const rgb = hexToRgb(hex)
|
|
707
|
+
return rgb ? rgbToHsv(rgb.r, rgb.g, rgb.b) : null;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
const rgbToHex = (r, g, b) => {
|
|
711
|
+
if (typeof r === 'object') {
|
|
712
|
+
const args = r
|
|
713
|
+
r = args.r; g = args.g; b = args.b;
|
|
714
|
+
}
|
|
715
|
+
r = Math.round(r).toString(16)
|
|
716
|
+
g = Math.round(g).toString(16)
|
|
717
|
+
b = Math.round(b).toString(16)
|
|
718
|
+
|
|
719
|
+
r = r.length === 1 ? '0' + r : r
|
|
720
|
+
g = g.length === 1 ? '0' + g : g
|
|
721
|
+
b = b.length === 1 ? '0' + b : b
|
|
722
|
+
|
|
723
|
+
return '#' + r + g + b
|
|
724
|
+
}
|