{`react-tiny-fab`}\n {` v3 now relies on React version 16.8 and up because it is implemented using `}\n {`React Hooks`}
\n\n
\n
{`Want to use a Floating Action Button without having to import the whole Material Design Components library? Weighing in\nat only around 671 bytes gzipped, React Tiny FAB is a great solution. It is a lightweight, fast, and flexible component.`}
{`If you find an issue, head over to the `}\n {`Issues`}\n {` section and let me\nknow about it. If you want to be super cool, you can submit a PR that fixes the issue.`}
\n\n ;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}
--------------------------------------------------------------------------------
/docs/component---readme-md-2f9e9842a608be8f9491.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"7OsV":function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return b})),n.d(t,"default",(function(){return s}));var i=n("Fcif"),a=n("+I+c"),o=n("/FXl"),c=n("TjRS"),b=(n("aD51"),{});void 0!==b&&b&&b===Object(b)&&Object.isExtensible(b)&&!b.hasOwnProperty("__filemeta")&&Object.defineProperty(b,"__filemeta",{configurable:!0,value:{name:"_frontmatter",filename:"README.md"}});var r=c.a;function s(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(o.b)(r,Object(i.a)({},n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("p",null,''),Object(o.b)("blockquote",null,Object(o.b)("p",{parentName:"blockquote"},"A tiny (~700 byte gzip) WAI-ARIA compliant Floating Action Button for React")),Object(o.b)("blockquote",null,Object(o.b)("p",{parentName:"blockquote"},Object(o.b)("inlineCode",{parentName:"p"},"react-tiny-fab")," v3 now relies on React version 16.8 and up because it is implemented using ",Object(o.b)("a",{href:"https://reactjs.org/docs/hooks-intro.html",parentName:"p"},"React Hooks"))),Object(o.b)("p",null,"Want to use a Floating Action Button without having to import the whole Material Design Components library? Weighing in\nat only around 671 bytes gzipped, React Tiny FAB is a great solution. It is a lightweight, fast, and flexible component."),Object(o.b)("p",null,''),Object(o.b)("h2",{id:"docs"},"Docs"),Object(o.b)("p",null,"Please visit here for docs: ",Object(o.b)("a",{href:"https://dericgw.github.io/react-tiny-fab",parentName:"p"},"https://dericgw.github.io/react-tiny-fab")),Object(o.b)("h2",{id:"issues"},"Issues"),Object(o.b)("p",null,"If you find an issue, head over to the ",Object(o.b)("a",{href:"https://github.com/dericgw/react-tiny-fab/issues",parentName:"p"},"Issues")," section and let me\nknow about it. If you want to be super cool, you can submit a PR that fixes the issue."),Object(o.b)("h2",{id:"license-mit"},"License (MIT)"),Object(o.b)("p",null,Object(o.b)("a",{href:"https://github.com/dericgw/react-tiny-fab/blob/master/LICENSE",parentName:"p"},"Check it out here.")))}void 0!==s&&s&&s===Object(s)&&Object.isExtensible(s)&&!s.hasOwnProperty("__filemeta")&&Object.defineProperty(s,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"README.md"}}),s.isMDXComponent=!0}}]);
2 | //# sourceMappingURL=component---readme-md-2f9e9842a608be8f9491.js.map
--------------------------------------------------------------------------------
/docs/component---readme-md-2f9e9842a608be8f9491.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///../README.md"],"names":["_frontmatter","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","isMDXComponent"],"mappings":"6OAMaA,G,UAAe,S,2LAE5B,IAKMC,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,EACF,8BACD,OAAO,YAACJ,EAAD,eAAeI,EAAf,CAAsBD,WAAYA,EAAYE,QAAQ,cAC3D,oIACA,8BAEE,gBAAO,CACL,WAAc,cADhB,gFAKF,8BAEE,gBAAO,CACL,WAAc,cACb,yBAAgB,CACf,WAAc,KADf,kBAFH,+EAME,gBAAO,CACL,KAAQ,4CACR,WAAc,KAFhB,iBAMJ,0QAEA,mIACA,iBAAQ,CACN,GAAM,QADR,QAGA,oDACE,gBAAO,CACL,KAAQ,2CACR,WAAc,KAFhB,6CAIF,iBAAQ,CACN,GAAM,UADR,UAGA,+DACE,gBAAO,CACL,KAAQ,mDACR,WAAc,KAFhB,UADF,+GAOA,iBAAQ,CACN,GAAM,eADR,iBAGA,qBAAG,gBAAO,CACN,KAAQ,gEACR,WAAc,KAFf,6B,yLAQPH,EAAWI,gBAAiB","file":"component---readme-md-2f9e9842a608be8f9491.js","sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/home/dan/code/github.com/dericgw/react-tiny-fab/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return ;\n};\n\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n
{`react-tiny-fab`}\n {` v3 now relies on React version 16.8 and up because it is implemented using `}\n {`React Hooks`}
\n\n
\n
{`Want to use a Floating Action Button without having to import the whole Material Design Components library? Weighing in\nat only around 671 bytes gzipped, React Tiny FAB is a great solution. It is a lightweight, fast, and flexible component.`}
{`If you find an issue, head over to the `}\n {`Issues`}\n {` section and let me\nknow about it. If you want to be super cool, you can submit a PR that fixes the issue.`}
\n\n ;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}
--------------------------------------------------------------------------------
/docs/component---readme-md-a3123d65121581c36ef2.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"7OsV":function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return b})),n.d(t,"default",(function(){return s}));var i=n("Fcif"),a=n("+I+c"),o=n("/FXl"),c=n("TjRS"),b=(n("aD51"),{});void 0!==b&&b&&b===Object(b)&&Object.isExtensible(b)&&!b.hasOwnProperty("__filemeta")&&Object.defineProperty(b,"__filemeta",{configurable:!0,value:{name:"_frontmatter",filename:"README.md"}});var r=c.a;function s(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(o.b)(r,Object(i.a)({},n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("p",null,''),Object(o.b)("blockquote",null,Object(o.b)("p",{parentName:"blockquote"},"A tiny (~700 byte gzip) WAI-ARIA compliant Floating Action Button for React")),Object(o.b)("blockquote",null,Object(o.b)("p",{parentName:"blockquote"},Object(o.b)("inlineCode",{parentName:"p"},"react-tiny-fab")," v3 now relies on React version 16.8 and up because it is implemented using ",Object(o.b)("a",{href:"https://reactjs.org/docs/hooks-intro.html",parentName:"p"},"React Hooks"))),Object(o.b)("p",null,"Want to use a Floating Action Button without having to import the whole Material Design Components library? Weighing in\nat only around 671 bytes gzipped, React Tiny FAB is a great solution. It is a lightweight, fast, and flexible component."),Object(o.b)("p",null,''),Object(o.b)("h2",{id:"docs"},"Docs"),Object(o.b)("p",null,"Please visit here for docs: ",Object(o.b)("a",{href:"https://dericgw.github.io/react-tiny-fab",parentName:"p"},"https://dericgw.github.io/react-tiny-fab")),Object(o.b)("h2",{id:"issues"},"Issues"),Object(o.b)("p",null,"If you find an issue, head over to the ",Object(o.b)("a",{href:"https://github.com/dericgw/react-tiny-fab/issues",parentName:"p"},"Issues")," section and let me\nknow about it. If you want to be super cool, you can submit a PR that fixes the issue."),Object(o.b)("h2",{id:"license-mit"},"License (MIT)"),Object(o.b)("p",null,Object(o.b)("a",{href:"https://github.com/dericgw/react-tiny-fab/blob/master/LICENSE",parentName:"p"},"Check it out here.")))}void 0!==s&&s&&s===Object(s)&&Object.isExtensible(s)&&!s.hasOwnProperty("__filemeta")&&Object.defineProperty(s,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"README.md"}}),s.isMDXComponent=!0}}]);
2 | //# sourceMappingURL=component---readme-md-a3123d65121581c36ef2.js.map
--------------------------------------------------------------------------------
/docs/component---readme-md-a3123d65121581c36ef2.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///../README.md"],"names":["_frontmatter","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","isMDXComponent"],"mappings":"6OAMaA,G,UAAe,S,2LAE5B,IAKMC,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,EACF,8BACD,OAAO,YAACJ,EAAD,eAAeI,EAAf,CAAsBD,WAAYA,EAAYE,QAAQ,cAC3D,oIACA,8BAEE,gBAAO,CACL,WAAc,cADhB,gFAKF,8BAEE,gBAAO,CACL,WAAc,cACb,yBAAgB,CACf,WAAc,KADf,kBAFH,+EAME,gBAAO,CACL,KAAQ,4CACR,WAAc,KAFhB,iBAMJ,0QAEA,mIACA,iBAAQ,CACN,GAAM,QADR,QAGA,oDACE,gBAAO,CACL,KAAQ,2CACR,WAAc,KAFhB,6CAIF,iBAAQ,CACN,GAAM,UADR,UAGA,+DACE,gBAAO,CACL,KAAQ,mDACR,WAAc,KAFhB,UADF,+GAOA,iBAAQ,CACN,GAAM,eADR,iBAGA,qBAAG,gBAAO,CACN,KAAQ,gEACR,WAAc,KAFf,6B,yLAQPH,EAAWI,gBAAiB","file":"component---readme-md-a3123d65121581c36ef2.js","sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/dericcain/Code/react-tiny-fab/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return ;\n};\n\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return \n
{`react-tiny-fab`}\n {` v3 now relies on React version 16.8 and up because it is implemented using `}\n {`React Hooks`}
\n\n
\n
{`Want to use a Floating Action Button without having to import the whole Material Design Components library? Weighing in\nat only around 671 bytes gzipped, React Tiny FAB is a great solution. It is a lightweight, fast, and flexible component.`}
{`If you find an issue, head over to the `}\n {`Issues`}\n {` section and let me\nknow about it. If you want to be super cool, you can submit a PR that fixes the issue.`}
\n\n ;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}
--------------------------------------------------------------------------------
/docs/component---src-example-mdx-2ca459289afad6a2a1a8.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[5],{WDWg:function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return i})),n.d(t,"default",(function(){return p}));var a=n("Fcif"),o=n("+I+c"),b=n("/FXl"),r=n("TjRS"),c=n("3re2"),i=(n("RD2v"),n("aD51"),{});void 0!==i&&i&&i===Object(i)&&Object.isExtensible(i)&&!i.hasOwnProperty("__filemeta")&&Object.defineProperty(i,"__filemeta",{configurable:!0,value:{name:"_frontmatter",filename:"src/example.mdx"}});var l=r.a;function p(e){var t=e.components,n=Object(o.a)(e,["components"]);return Object(b.b)(l,Object(a.a)({},n,{components:t,mdxType:"MDXLayout"}),Object(b.b)("img",{src:"https://raw.githubusercontent.com/dericgw/react-tiny-fab/master/logo.png"}),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"A tiny (~700 byte gzip) WAI-ARIA compliant Floating Action Button for React")),Object(b.b)("h2",{id:"install"},"Install"),Object(b.b)("pre",null,Object(b.b)("code",{parentName:"pre"},"npm install react-tiny-fab\nyarn add react-tiny-fab\n")),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},Object(b.b)("inlineCode",{parentName:"p"},"react-tiny-fab")," v3 and up now relies on React version 16.8 and up because it is implemented using ",Object(b.b)("a",{href:"https://reactjs.org/docs/hooks-intro.html",parentName:"p"},"React Hooks"))),Object(b.b)("h2",{id:"usage"},"Usage"),Object(b.b)("p",null,"There are two components available for import - ",Object(b.b)("inlineCode",{parentName:"p"},"Fab")," and ",Object(b.b)("inlineCode",{parentName:"p"},"Action"),". You import them like this:"),Object(b.b)("pre",null,Object(b.b)("code",{parentName:"pre"},"import { Fab, Action } from 'react-tiny-fab';\nimport 'react-tiny-fab/dist/styles.css';\n")),Object(b.b)("h2",{id:"example"},"Example"),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"Check the bottom right of the screen")),Object(b.b)(c.b,{icon:Object(b.b)("span",null,"+"),mainButtonStyles:{backgroundColor:"#e74c3c"},mdxType:"Fab"},Object(b.b)(c.a,{text:"Add Something",style:{backgroundColor:"#3498db"},onClick:function(){return alert("It works!")},mdxType:"Action"},Object(b.b)("p",null,"+")),Object(b.b)(c.a,{text:"Assign Something",style:{backgroundColor:"#3498db"},onClick:function(){return alert("It still works!")},mdxType:"Action"},Object(b.b)("p",null,"="))),Object(b.b)("p",null,"Here is an example of how you would use the components:"),Object(b.b)("pre",null,Object(b.b)("code",{className:"language-js",parentName:"pre"},'// The Fab is the main button. Pass any component to the icon prop and choose\n// either click or hover for the event (default is hover)\n}\n event={event}\n alwaysShowTitle={true}\n onClick={someFunctionForTheMainButton}\n>\n // The Action components are the "buttons" that appear when the Fab is open. You can use the out-of-the-box Action\n // component or you can use a custom component of any type and style it any way that you\'d like. The "text" prop\n // is the popup label that appears when the Action component is hovered.\n \n \n \n \n // Using a custom component for this one. See another example in "example/src/index.js"\n \n \n \n\n')),Object(b.b)("h2",{id:"components"},"Components"),Object(b.b)("h3",{id:"fab-"},Object(b.b)("inlineCode",{parentName:"h3"},"")),Object(b.b)("p",null,"This is the main component that controls the Floating Action Button."),Object(b.b)("h4",{id:"props"},"Props"),Object(b.b)("table",null,Object(b.b)("thead",{parentName:"table"},Object(b.b)("tr",{parentName:"thead"},Object(b.b)("th",{parentName:"tr"},"Prop"),Object(b.b)("th",{parentName:"tr"},"Type"),Object(b.b)("th",{parentName:"tr"},"Default"),Object(b.b)("th",{parentName:"tr"},"Required"),Object(b.b)("th",{parentName:"tr"},"Description"))),Object(b.b)("tbody",{parentName:"table"},Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"mainButtonStyles")),Object(b.b)("td",{parentName:"tr"},"React.CSSProperties"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This object is passed to the main button's ",Object(b.b)("inlineCode",{parentName:"td"},"style")," prop so use React styles to style the button.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"style")),Object(b.b)("td",{parentName:"tr"},"React.CSSProperties"),Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"{ bottom: 24, right: 24 }")),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"How do you want to style the FAB, specifically the position of the FAB? Use ",Object(b.b)("inlineCode",{parentName:"td"},"top"),", ",Object(b.b)("inlineCode",{parentName:"td"},"left"),", ",Object(b.b)("inlineCode",{parentName:"td"},"bottom"),", ",Object(b.b)("inlineCode",{parentName:"td"},"right")," properties to declare where you want the FAB to be positioned as well as any other styles.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"icon")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"true"),Object(b.b)("td",{parentName:"tr"},"This element/component will be the used as the icon for the main button. This can be text, or a Font Awesome icon, or any other component.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"event")),Object(b.b)("td",{parentName:"tr"},"'hover'"),Object(b.b)("td",{parentName:"tr"},"'click'"),Object(b.b)("td",{parentName:"tr"},"'hover'"),Object(b.b)("td",{parentName:"tr"},"false")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"children")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This is the children that will be mapped and rendered. This can be anything. There can be up to 6, but no more than 6. An ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," component is provided out of the box.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"alwaysShowTitle")),Object(b.b)("td",{parentName:"tr"},"boolean"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If the title of the ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," component should always be shown (not just on hover), set this to true and the title will always be shown")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"onClick")),Object(b.b)("td",{parentName:"tr"},"function"),Object(b.b)("td",{parentName:"tr"},"null"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If you only need to use the main button for something, then you can attach an ",Object(b.b)("inlineCode",{parentName:"td"},"onClick")," handler to the main button. The React Synthetic Event will be passed in just like a normal ",Object(b.b)("inlineCode",{parentName:"td"},"onClick"))),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"text")),Object(b.b)("td",{parentName:"tr"},"string"),Object(b.b)("td",{parentName:"tr"},"null"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If you attach an ",Object(b.b)("inlineCode",{parentName:"td"},"onClick")," handler to the main button, then the original ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," components would not show. Instead you can attach ",Object(b.b)("inlineCode",{parentName:"td"},"text")," to display while user hover the FAB")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"...props")),Object(b.b)("td",{parentName:"tr"},"Anything"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"Anything you can add to a React component, you can add here.")))),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"Based on the ",Object(b.b)("inlineCode",{parentName:"p"},"position")," prop, the FAB will figure out the direction of the ",Object(b.b)("inlineCode",{parentName:"p"},"")," ",Object(b.b)("inlineCode",{parentName:"p"},"text")," and also which way to\nexpand when hovered/clicked (up or down).")),Object(b.b)("h3",{id:"action-"},Object(b.b)("inlineCode",{parentName:"h3"},"")),Object(b.b)("p",null,'This component represents the smaller buttons that appear when the main button is hovered/clicked. Now, you do not have\nto use this component. You can use your own custom component(s) and create something totally different than a Floating\nAction Button. For instance, you could create your own "Support Button" that when clicked, will display a chat box or\nsome type of form that submits a contact request.'),Object(b.b)("h4",{id:"props-1"},"Props"),Object(b.b)("table",null,Object(b.b)("thead",{parentName:"table"},Object(b.b)("tr",{parentName:"thead"},Object(b.b)("th",{parentName:"tr"},"Prop"),Object(b.b)("th",{parentName:"tr"},"Type"),Object(b.b)("th",{parentName:"tr"},"Default"),Object(b.b)("th",{parentName:"tr"},"Required"),Object(b.b)("th",{parentName:"tr"},"Description"))),Object(b.b)("tbody",{parentName:"table"},Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"text")),Object(b.b)("td",{parentName:"tr"},"string"),Object(b.b)("td",{parentName:"tr"},'""'),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This is the text that will be displayed when one of the actions is hovered.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"children")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This will be the icon/text for the action.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"...props")),Object(b.b)("td",{parentName:"tr"},"Anything"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"Anything you can add to a React component, you can add here, e.g. (",Object(b.b)("inlineCode",{parentName:"td"},"onClick"),", ",Object(b.b)("inlineCode",{parentName:"td"},"style"),", etc.)")))),Object(b.b)("h2",{id:"demo"},"Demo"),Object(b.b)("p",null,"Check out the ",Object(b.b)("inlineCode",{parentName:"p"},"index.html")," file in the ",Object(b.b)("inlineCode",{parentName:"p"},"example")," folder for an example of the traditional FAB and also a form pop-up that could be used to send contact information, or something else."),Object(b.b)("h2",{id:"contributing"},"Contributing"),Object(b.b)("p",null,"If you find a bug, submit an issue with enough information to reproduce the bug. If you have a fix, please do not hesitate to submit a PR. If you feel that the API needs to be modified, open an issue so that we can discuss it first."),Object(b.b)("h3",{id:"running-the-dev-environment"},"Running the dev environment"),Object(b.b)("ol",null,Object(b.b)("li",{parentName:"ol"},"Clone the repo - ",Object(b.b)("inlineCode",{parentName:"li"},"git clone https://github.com/dericgw/react-tiny-fab.git")," && ",Object(b.b)("inlineCode",{parentName:"li"},"cd react-tiny-fab")),Object(b.b)("li",{parentName:"ol"},"Install the dependencies - ",Object(b.b)("inlineCode",{parentName:"li"},"npm i")),Object(b.b)("li",{parentName:"ol"},"Run the example - ",Object(b.b)("inlineCode",{parentName:"li"},"npm start")," ",Object(b.b)("em",{parentName:"li"},"Visit http://localhost:5000"))),Object(b.b)("p",null,"Once you get that going, you should be able to make changes and the page should refresh automatically when those changes are saved."),Object(b.b)("h3",{id:"testing"},"Testing"),Object(b.b)("p",null,"This package is only one JS file and it is tested pretty good. Make sure that none of the tests are breaking if changes\nare made. Also, if you add new functionality and it ",Object(b.b)("em",{parentName:"p"},"warrants")," testing, please add tests. If you need help with this, I\nwill gladly help."),Object(b.b)("h2",{id:"issues"},"Issues"),Object(b.b)("p",null,"If you find an issue, head over to the Issues section and let me know about it. If you want to be super cool, you can submit a PR that fixes the issue."),Object(b.b)("h2",{id:"license-mit"},"License (MIT)"),Object(b.b)("p",null,Object(b.b)("a",{href:"https://github.com/dericgw/react-tiny-fab/blob/master/LICENSE",parentName:"p"},"Check it out here.")))}void 0!==p&&p&&p===Object(p)&&Object.isExtensible(p)&&!p.hasOwnProperty("__filemeta")&&Object.defineProperty(p,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"src/example.mdx"}}),p.isMDXComponent=!0}}]);
2 | //# sourceMappingURL=component---src-example-mdx-2ca459289afad6a2a1a8.js.map
--------------------------------------------------------------------------------
/docs/component---src-example-mdx-b9cf3f6add7edaadb8b5.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[5],{WDWg:function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return i})),n.d(t,"default",(function(){return p}));var a=n("Fcif"),o=n("+I+c"),b=n("/FXl"),r=n("TjRS"),c=n("3re2"),i=(n("RD2v"),n("aD51"),{});void 0!==i&&i&&i===Object(i)&&Object.isExtensible(i)&&!i.hasOwnProperty("__filemeta")&&Object.defineProperty(i,"__filemeta",{configurable:!0,value:{name:"_frontmatter",filename:"src/example.mdx"}});var l=r.a;function p(e){var t=e.components,n=Object(o.a)(e,["components"]);return Object(b.b)(l,Object(a.a)({},n,{components:t,mdxType:"MDXLayout"}),Object(b.b)("img",{src:"https://raw.githubusercontent.com/dericgw/react-tiny-fab/master/logo.png"}),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"A tiny (~700 byte gzip) WAI-ARIA compliant Floating Action Button for React")),Object(b.b)("h2",{id:"install"},"Install"),Object(b.b)("pre",null,Object(b.b)("code",{parentName:"pre"},"npm install react-tiny-fab\nyarn add react-tiny-fab\n")),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},Object(b.b)("inlineCode",{parentName:"p"},"react-tiny-fab")," v3 and up now relies on React version 16.8 and up because it is implemented using ",Object(b.b)("a",{href:"https://reactjs.org/docs/hooks-intro.html",parentName:"p"},"React Hooks"))),Object(b.b)("h2",{id:"usage"},"Usage"),Object(b.b)("p",null,"There are two components available for import - ",Object(b.b)("inlineCode",{parentName:"p"},"Fab")," and ",Object(b.b)("inlineCode",{parentName:"p"},"Action"),". You import them like this:"),Object(b.b)("pre",null,Object(b.b)("code",{parentName:"pre"},"import { Fab, Action } from 'react-tiny-fab';\nimport 'react-tiny-fab/dist/styles.css';\n")),Object(b.b)("h2",{id:"example"},"Example"),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"Check the bottom right of the screen")),Object(b.b)(c.b,{icon:Object(b.b)("span",null,"+"),mainButtonStyles:{backgroundColor:"#e74c3c"},mdxType:"Fab"},Object(b.b)(c.a,{text:"Add Something",style:{backgroundColor:"#3498db"},onClick:function(){return alert("It works!")},mdxType:"Action"},Object(b.b)("p",null,"+")),Object(b.b)(c.a,{text:"Assign Something",style:{backgroundColor:"#3498db"},onClick:function(){return alert("It still works!")},mdxType:"Action"},Object(b.b)("p",null,"="))),Object(b.b)("p",null,"Here is an example of how you would use the components:"),Object(b.b)("pre",null,Object(b.b)("code",{className:"language-js",parentName:"pre"},'// The Fab is the main button. Pass any component to the icon prop and choose\n// either click or hover for the event (default is hover)\n}\n event={event}\n alwaysShowTitle={true}\n onClick={someFunctionForTheMainButton}\n>\n // The Action components are the "buttons" that appear when the Fab is open. You can use the out-of-the-box Action\n // component or you can use a custom component of any type and style it any way that you\'d like. The "text" prop\n // is the popup label that appears when the Action component is hovered.\n \n \n \n \n // Using a custom component for this one. See another example in "example/src/index.js"\n \n \n \n\n')),Object(b.b)("h2",{id:"components"},"Components"),Object(b.b)("h3",{id:"fab-"},Object(b.b)("inlineCode",{parentName:"h3"},"")),Object(b.b)("p",null,"This is the main component that controls the Floating Action Button."),Object(b.b)("h4",{id:"props"},"Props"),Object(b.b)("table",null,Object(b.b)("thead",{parentName:"table"},Object(b.b)("tr",{parentName:"thead"},Object(b.b)("th",{parentName:"tr"},"Prop"),Object(b.b)("th",{parentName:"tr"},"Type"),Object(b.b)("th",{parentName:"tr"},"Default"),Object(b.b)("th",{parentName:"tr"},"Required"),Object(b.b)("th",{parentName:"tr"},"Description"))),Object(b.b)("tbody",{parentName:"table"},Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"mainButtonStyles")),Object(b.b)("td",{parentName:"tr"},"React.CSSProperties"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This object is passed to the main button's ",Object(b.b)("inlineCode",{parentName:"td"},"style")," prop so use React styles to style the button.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"style")),Object(b.b)("td",{parentName:"tr"},"React.CSSProperties"),Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"{ bottom: 24, right: 24 }")),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"How do you want to style the FAB, specifically the position of the FAB? Use ",Object(b.b)("inlineCode",{parentName:"td"},"top"),", ",Object(b.b)("inlineCode",{parentName:"td"},"left"),", ",Object(b.b)("inlineCode",{parentName:"td"},"bottom"),", ",Object(b.b)("inlineCode",{parentName:"td"},"right")," properties to declare where you want the FAB to be positioned as well as any other styles.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"icon")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"true"),Object(b.b)("td",{parentName:"tr"},"This element/component will be the used as the icon for the main button. This can be text, or a Font Awesome icon, or any other component.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"event")),Object(b.b)("td",{parentName:"tr"},"'hover'"),Object(b.b)("td",{parentName:"tr"},"'click'"),Object(b.b)("td",{parentName:"tr"},"'hover'"),Object(b.b)("td",{parentName:"tr"},"false")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"children")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This is the children that will be mapped and rendered. This can be anything. There can be up to 6, but no more than 6. An ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," component is provided out of the box.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"alwaysShowTitle")),Object(b.b)("td",{parentName:"tr"},"boolean"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If the title of the ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," component should always be shown (not just on hover), set this to true and the title will always be shown")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"onClick")),Object(b.b)("td",{parentName:"tr"},"function"),Object(b.b)("td",{parentName:"tr"},"null"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If you only need to use the main button for something, then you can attach an ",Object(b.b)("inlineCode",{parentName:"td"},"onClick")," handler to the main button. The React Synthetic Event will be passed in just like a normal ",Object(b.b)("inlineCode",{parentName:"td"},"onClick"))),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"text")),Object(b.b)("td",{parentName:"tr"},"string"),Object(b.b)("td",{parentName:"tr"},"null"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If you attach an ",Object(b.b)("inlineCode",{parentName:"td"},"onClick")," handler to the main button, then the original ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," components would not show. Instead you can attach ",Object(b.b)("inlineCode",{parentName:"td"},"text")," to display while user hover the FAB")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"...props")),Object(b.b)("td",{parentName:"tr"},"Anything"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"Anything you can add to a React component, you can add here.")))),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"Based on the ",Object(b.b)("inlineCode",{parentName:"p"},"position")," prop, the FAB will figure out the direction of the ",Object(b.b)("inlineCode",{parentName:"p"},"")," ",Object(b.b)("inlineCode",{parentName:"p"},"text")," and also which way to\nexpand when hovered/clicked (up or down).")),Object(b.b)("h3",{id:"action-"},Object(b.b)("inlineCode",{parentName:"h3"},"")),Object(b.b)("p",null,'This component represents the smaller buttons that appear when the main button is hovered/clicked. Now, you do not have\nto use this component. You can use your own custom component(s) and create something totally different than a Floating\nAction Button. For instance, you could create your own "Support Button" that when clicked, will display a chat box or\nsome type of form that submits a contact request.'),Object(b.b)("h4",{id:"props-1"},"Props"),Object(b.b)("table",null,Object(b.b)("thead",{parentName:"table"},Object(b.b)("tr",{parentName:"thead"},Object(b.b)("th",{parentName:"tr"},"Prop"),Object(b.b)("th",{parentName:"tr"},"Type"),Object(b.b)("th",{parentName:"tr"},"Default"),Object(b.b)("th",{parentName:"tr"},"Required"),Object(b.b)("th",{parentName:"tr"},"Description"))),Object(b.b)("tbody",{parentName:"table"},Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"text")),Object(b.b)("td",{parentName:"tr"},"string"),Object(b.b)("td",{parentName:"tr"},'""'),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This is the text that will be displayed when one of the actions is hovered.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"children")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This will be the icon/text for the action.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"...props")),Object(b.b)("td",{parentName:"tr"},"Anything"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"Anything you can add to a React component, you can add here, e.g. (",Object(b.b)("inlineCode",{parentName:"td"},"onClick"),", ",Object(b.b)("inlineCode",{parentName:"td"},"style"),", etc.)")))),Object(b.b)("h2",{id:"demo"},"Demo"),Object(b.b)("p",null,"Check out the ",Object(b.b)("inlineCode",{parentName:"p"},"index.html")," file in the ",Object(b.b)("inlineCode",{parentName:"p"},"example")," folder for an example of the traditional FAB and also a form pop-up that could be used to send contact information, or something else."),Object(b.b)("h2",{id:"contributing"},"Contributing"),Object(b.b)("p",null,"If you find a bug, submit an issue with enough information to reproduce the bug. If you have a fix, please do not hesitate to submit a PR. If you feel that the API needs to be modified, open an issue so that we can discuss it first."),Object(b.b)("h3",{id:"running-the-dev-environment"},"Running the dev environment"),Object(b.b)("ol",null,Object(b.b)("li",{parentName:"ol"},"Clone the repo - ",Object(b.b)("inlineCode",{parentName:"li"},"git clone https://github.com/dericgw/react-tiny-fab.git")," && ",Object(b.b)("inlineCode",{parentName:"li"},"cd react-tiny-fab")),Object(b.b)("li",{parentName:"ol"},"Install the dependencies - ",Object(b.b)("inlineCode",{parentName:"li"},"npm i")),Object(b.b)("li",{parentName:"ol"},"Run the example - ",Object(b.b)("inlineCode",{parentName:"li"},"npm start")," ",Object(b.b)("em",{parentName:"li"},"Visit http://localhost:5000"))),Object(b.b)("p",null,"Once you get that going, you should be able to make changes and the page should refresh automatically when those changes are saved."),Object(b.b)("h3",{id:"testing"},"Testing"),Object(b.b)("p",null,"This package is only one JS file and it is tested pretty good. Make sure that none of the tests are breaking if changes\nare made. Also, if you add new functionality and it ",Object(b.b)("em",{parentName:"p"},"warrants")," testing, please add tests. If you need help with this, I\nwill gladly help."),Object(b.b)("h2",{id:"issues"},"Issues"),Object(b.b)("p",null,"If you find an issue, head over to the Issues section and let me know about it. If you want to be super cool, you can submit a PR that fixes the issue."),Object(b.b)("h2",{id:"license-mit"},"License (MIT)"),Object(b.b)("p",null,Object(b.b)("a",{href:"https://github.com/dericgw/react-tiny-fab/blob/master/LICENSE",parentName:"p"},"Check it out here.")))}void 0!==p&&p&&p===Object(p)&&Object.isExtensible(p)&&!p.hasOwnProperty("__filemeta")&&Object.defineProperty(p,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"src/example.mdx"}}),p.isMDXComponent=!0}}]);
2 | //# sourceMappingURL=component---src-example-mdx-b9cf3f6add7edaadb8b5.js.map
--------------------------------------------------------------------------------
/docs/component---src-example-mdx-c81acfe01c5586ee5c53.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[5],{WDWg:function(e,t,n){"use strict";n.r(t),n.d(t,"_frontmatter",(function(){return i})),n.d(t,"default",(function(){return p}));var a=n("Fcif"),o=n("+I+c"),b=n("/FXl"),r=n("TjRS"),c=n("3re2"),i=(n("RD2v"),n("aD51"),{});void 0!==i&&i&&i===Object(i)&&Object.isExtensible(i)&&!i.hasOwnProperty("__filemeta")&&Object.defineProperty(i,"__filemeta",{configurable:!0,value:{name:"_frontmatter",filename:"src/example.mdx"}});var l=r.a;function p(e){var t=e.components,n=Object(o.a)(e,["components"]);return Object(b.b)(l,Object(a.a)({},n,{components:t,mdxType:"MDXLayout"}),Object(b.b)("img",{src:"https://raw.githubusercontent.com/dericgw/react-tiny-fab/master/logo.png"}),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"A tiny (~700 byte gzip) WAI-ARIA compliant Floating Action Button for React")),Object(b.b)("h2",{id:"install"},"Install"),Object(b.b)("pre",null,Object(b.b)("code",{parentName:"pre"},"npm install react-tiny-fab\nyarn add react-tiny-fab\n")),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},Object(b.b)("inlineCode",{parentName:"p"},"react-tiny-fab")," v3 and up now relies on React version 16.8 and up because it is implemented using ",Object(b.b)("a",{href:"https://reactjs.org/docs/hooks-intro.html",parentName:"p"},"React Hooks"))),Object(b.b)("h2",{id:"usage"},"Usage"),Object(b.b)("p",null,"There are two components available for import - ",Object(b.b)("inlineCode",{parentName:"p"},"Fab")," and ",Object(b.b)("inlineCode",{parentName:"p"},"Action"),". You import them like this:"),Object(b.b)("pre",null,Object(b.b)("code",{parentName:"pre"},"import { Fab, Action } from 'react-tiny-fab';\nimport 'react-tiny-fab/dist/styles.css';\n")),Object(b.b)("h2",{id:"example"},"Example"),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"Check the bottom right of the screen")),Object(b.b)(c.b,{icon:Object(b.b)("span",null,"+"),mainButtonStyles:{backgroundColor:"#e74c3c"},mdxType:"Fab"},Object(b.b)(c.a,{text:"Add Something",style:{backgroundColor:"#3498db"},onClick:function(){return alert("It works!")},mdxType:"Action"},Object(b.b)("p",null,"+")),Object(b.b)(c.a,{text:"Assign Something",style:{backgroundColor:"#3498db"},onClick:function(){return alert("It still works!")},mdxType:"Action"},Object(b.b)("p",null,"="))),Object(b.b)("p",null,"Here is an example of how you would use the components:"),Object(b.b)("pre",null,Object(b.b)("code",{className:"language-js",parentName:"pre"},'// The Fab is the main button. Pass any component to the icon prop and choose \n// either click or hover for the event (default is hover)\n}\n event={event}\n alwaysShowTitle={true}\n onClick={someFunctionForTheMainButton}\n>\n // The Action components are the "buttons" that appear when the Fab is open. You can use the out-of-the-box Action \n // component or you can use a custom component of any type and style it any way that you\'d like. The "text" prop\n // is the popup label that appears when the Action component is hovered.\n \n \n \n \n // Using a custom component for this one. See another example in "example/src/index.js"\n \n \n \n\n')),Object(b.b)("h2",{id:"components"},"Components"),Object(b.b)("h3",{id:"fab-"},Object(b.b)("inlineCode",{parentName:"h3"},"")),Object(b.b)("p",null,"This is the main component that controls the Floating Action Button."),Object(b.b)("h4",{id:"props"},"Props"),Object(b.b)("table",null,Object(b.b)("thead",{parentName:"table"},Object(b.b)("tr",{parentName:"thead"},Object(b.b)("th",{parentName:"tr"},"Prop"),Object(b.b)("th",{parentName:"tr"},"Type"),Object(b.b)("th",{parentName:"tr"},"Default"),Object(b.b)("th",{parentName:"tr"},"Required"),Object(b.b)("th",{parentName:"tr"},"Description"))),Object(b.b)("tbody",{parentName:"table"},Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"mainButtonStyles")),Object(b.b)("td",{parentName:"tr"},"React.CSSProperties"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This object is passed to the main button's ",Object(b.b)("inlineCode",{parentName:"td"},"style")," prop so use React styles to style the button.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"style")),Object(b.b)("td",{parentName:"tr"},"React.CSSProperties"),Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"{ bottom: 24, right: 24 }")),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"How do you want to style the FAB, specifically the position of the FAB? Use ",Object(b.b)("inlineCode",{parentName:"td"},"top"),", ",Object(b.b)("inlineCode",{parentName:"td"},"left"),", ",Object(b.b)("inlineCode",{parentName:"td"},"bottom"),", ",Object(b.b)("inlineCode",{parentName:"td"},"right")," properties to declare where you want the FAB to be positioned as well as any other styles.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"icon")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"true"),Object(b.b)("td",{parentName:"tr"},"This element/component will be the used as the icon for the main button. This can be text, or a Font Awesome icon, or any other component.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"event")),Object(b.b)("td",{parentName:"tr"},"'hover'"),Object(b.b)("td",{parentName:"tr"},"'click'"),Object(b.b)("td",{parentName:"tr"},"'hover'"),Object(b.b)("td",{parentName:"tr"},"false")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"children")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This is the children that will be mapped and rendered. This can be anything. There can be up to 6, but no more than 6. An ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," component is provided out of the box.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"alwaysShowTitle")),Object(b.b)("td",{parentName:"tr"},"boolean"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If the title of the ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," component should always be shown (not just on hover), set this to true and the title will always be shown")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"onClick")),Object(b.b)("td",{parentName:"tr"},"function"),Object(b.b)("td",{parentName:"tr"},"null"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If you only need to use the main button for something, then you can attach an ",Object(b.b)("inlineCode",{parentName:"td"},"onClick")," handler to the main button. The React Synthetic Event will be passed in just like a normal ",Object(b.b)("inlineCode",{parentName:"td"},"onClick"))),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"text")),Object(b.b)("td",{parentName:"tr"},"string"),Object(b.b)("td",{parentName:"tr"},"null"),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"If you attach an ",Object(b.b)("inlineCode",{parentName:"td"},"onClick")," handler to the main button, then the original ",Object(b.b)("inlineCode",{parentName:"td"},"Action")," components would not show. Instead you can attach ",Object(b.b)("inlineCode",{parentName:"td"},"text")," to display while user hover the FAB")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"...props")),Object(b.b)("td",{parentName:"tr"},"Anything"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"Anything you can add to a React component, you can add here.")))),Object(b.b)("blockquote",null,Object(b.b)("p",{parentName:"blockquote"},"Based on the ",Object(b.b)("inlineCode",{parentName:"p"},"position")," prop, the FAB will figure out the direction of the ",Object(b.b)("inlineCode",{parentName:"p"},"")," ",Object(b.b)("inlineCode",{parentName:"p"},"text")," and also which way to\nexpand when hovered/clicked (up or down).")),Object(b.b)("h3",{id:"action-"},Object(b.b)("inlineCode",{parentName:"h3"},"")),Object(b.b)("p",null,'This component represents the smaller buttons that appear when the main button is hovered/clicked. Now, you do not have\nto use this component. You can use your own custom component(s) and create something totally different than a Floating\nAction Button. For instance, you could create your own "Support Button" that when clicked, will display a chat box or\nsome type of form that submits a contact request.'),Object(b.b)("h4",{id:"props-1"},"Props"),Object(b.b)("table",null,Object(b.b)("thead",{parentName:"table"},Object(b.b)("tr",{parentName:"thead"},Object(b.b)("th",{parentName:"tr"},"Prop"),Object(b.b)("th",{parentName:"tr"},"Type"),Object(b.b)("th",{parentName:"tr"},"Default"),Object(b.b)("th",{parentName:"tr"},"Required"),Object(b.b)("th",{parentName:"tr"},"Description"))),Object(b.b)("tbody",{parentName:"table"},Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"text")),Object(b.b)("td",{parentName:"tr"},"string"),Object(b.b)("td",{parentName:"tr"},'""'),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This is the text that will be displayed when one of the actions is hovered.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"children")),Object(b.b)("td",{parentName:"tr"},"React Element/Component"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"This will be the icon/text for the action.")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",{parentName:"tr"},Object(b.b)("inlineCode",{parentName:"td"},"...props")),Object(b.b)("td",{parentName:"tr"},"Anything"),Object(b.b)("td",{parentName:"tr"}),Object(b.b)("td",{parentName:"tr"},"false"),Object(b.b)("td",{parentName:"tr"},"Anything you can add to a React component, you can add here, e.g. (",Object(b.b)("inlineCode",{parentName:"td"},"onClick"),", ",Object(b.b)("inlineCode",{parentName:"td"},"style"),", etc.)")))),Object(b.b)("h2",{id:"demo"},"Demo"),Object(b.b)("p",null,"Check out the ",Object(b.b)("inlineCode",{parentName:"p"},"index.html")," file in the ",Object(b.b)("inlineCode",{parentName:"p"},"example")," folder for an example of the traditional FAB and also a form pop-up that could be used to send contact information, or something else."),Object(b.b)("h2",{id:"contributing"},"Contributing"),Object(b.b)("p",null,"If you find a bug, submit an issue with enough information to reproduce the bug. If you have a fix, please do not hesitate to submit a PR. If you feel that the API needs to be modified, open an issue so that we can discuss it first."),Object(b.b)("h3",{id:"running-the-dev-environment"},"Running the dev environment"),Object(b.b)("ol",null,Object(b.b)("li",{parentName:"ol"},"Clone the repo - ",Object(b.b)("inlineCode",{parentName:"li"},"git clone https://github.com/dericgw/react-tiny-fab.git")," && ",Object(b.b)("inlineCode",{parentName:"li"},"cd react-tiny-fab")),Object(b.b)("li",{parentName:"ol"},"Install the dependencies - ",Object(b.b)("inlineCode",{parentName:"li"},"npm i")),Object(b.b)("li",{parentName:"ol"},"Run the example - ",Object(b.b)("inlineCode",{parentName:"li"},"npm start")," ",Object(b.b)("em",{parentName:"li"},"Visit http://localhost:5000"))),Object(b.b)("p",null,"Once you get that going, you should be able to make changes and the page should refresh automatically when those changes are saved."),Object(b.b)("h3",{id:"testing"},"Testing"),Object(b.b)("p",null,"This package is only one JS file and it is tested pretty good. Make sure that none of the tests are breaking if changes\nare made. Also, if you add new functionality and it ",Object(b.b)("em",{parentName:"p"},"warrants")," testing, please add tests. If you need help with this, I\nwill gladly help."),Object(b.b)("h2",{id:"issues"},"Issues"),Object(b.b)("p",null,"If you find an issue, head over to the Issues section and let me know about it. If you want to be super cool, you can submit a PR that fixes the issue."),Object(b.b)("h2",{id:"license-mit"},"License (MIT)"),Object(b.b)("p",null,Object(b.b)("a",{href:"./LICENSE.md",parentName:"p"},"Check it out here.")))}void 0!==p&&p&&p===Object(p)&&Object.isExtensible(p)&&!p.hasOwnProperty("__filemeta")&&Object.defineProperty(p,"__filemeta",{configurable:!0,value:{name:"MDXContent",filename:"src/example.mdx"}}),p.isMDXComponent=!0}}]);
2 | //# sourceMappingURL=component---src-example-mdx-c81acfe01c5586ee5c53.js.map
--------------------------------------------------------------------------------
/docs/component---src-pages-404-js-ec5d679138bb835ff77f.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[6],{w2l6:function(t,e,n){"use strict";n.r(e);var i=n("aD51");e.default=function(){return Object(i.c)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",fontSize:32}},"Not Found")}}}]);
2 | //# sourceMappingURL=component---src-pages-404-js-ec5d679138bb835ff77f.js.map
--------------------------------------------------------------------------------
/docs/component---src-pages-404-js-ec5d679138bb835ff77f.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///./src/pages/404.js"],"names":["style","display","alignItems","justifyContent","height","width","fontSize"],"mappings":"kHAeA,UAbiB,WAUf,OAAO,mBAAKA,MATE,CACZC,QADY,OAEZC,WAFY,SAGZC,eAHY,SAIZC,OAJY,QAKZC,MALY,QAMZC,SAAU,KAGZ","file":"component---src-pages-404-js-ec5d679138bb835ff77f.js","sourcesContent":["import * as React from 'react'\n\nconst NotFound = () => {\n const style = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n height: '100vh',\n width: '100vw',\n fontSize: 32,\n }\n\n return
Not Found
\n}\n\nexport default NotFound\n"],"sourceRoot":""}
--------------------------------------------------------------------------------
/docs/framework-e2acee0b7afcb49ae215.js.LICENSE.txt:
--------------------------------------------------------------------------------
1 | /** @license React v0.19.1
2 | * scheduler.production.min.js
3 | *
4 | * Copyright (c) Facebook, Inc. and its affiliates.
5 | *
6 | * This source code is licensed under the MIT license found in the
7 | * LICENSE file in the root directory of this source tree.
8 | */
9 |
10 | /** @license React v16.13.1
11 | * react-dom.production.min.js
12 | *
13 | * Copyright (c) Facebook, Inc. and its affiliates.
14 | *
15 | * This source code is licensed under the MIT license found in the
16 | * LICENSE file in the root directory of this source tree.
17 | */
18 |
19 | /** @license React v16.13.1
20 | * react.production.min.js
21 | *
22 | * Copyright (c) Facebook, Inc. and its affiliates.
23 | *
24 | * This source code is licensed under the MIT license found in the
25 | * LICENSE file in the root directory of this source tree.
26 | */
27 |
--------------------------------------------------------------------------------
/docs/page-data/404.html/page-data.json:
--------------------------------------------------------------------------------
1 | {"componentChunkName":"component---src-pages-404-js","path":"/404.html","result":{"pageContext":{}},"staticQueryHashes":[]}
--------------------------------------------------------------------------------
/docs/page-data/404/page-data.json:
--------------------------------------------------------------------------------
1 | {"componentChunkName":"component---src-pages-404-js","path":"/404/","result":{"pageContext":{}},"staticQueryHashes":[]}
--------------------------------------------------------------------------------
/docs/page-data/app-data.json:
--------------------------------------------------------------------------------
1 | {"webpackCompilationHash":"07f321a89cc9eb321fc2"}
2 |
--------------------------------------------------------------------------------
/docs/page-data/index/page-data.json:
--------------------------------------------------------------------------------
1 | {"componentChunkName":"component---src-example-mdx","path":"/","result":{"pageContext":{"frontmatter":{"name":"React Tiny Fab","route":"/"},"entry":{"id":"d3be5c520c8cc3bdd6ff5a49f9353d7b","filepath":"src/example.mdx","fullpath":"/Users/dericcain/Code/react-tiny-fab/src/example.mdx","route":"/","slug":"src-example","name":"React Tiny Fab","menu":"","headings":[{"slug":"install","depth":2,"value":"Install"},{"slug":"usage","depth":2,"value":"Usage"},{"slug":"example","depth":2,"value":"Example"},{"slug":"components","depth":2,"value":"Components"},{"slug":"fab-","depth":3,"value":""},{"slug":"props","depth":4,"value":"Props"},{"slug":"action-","depth":3,"value":""},{"slug":"props-1","depth":4,"value":"Props"},{"slug":"demo","depth":2,"value":"Demo"},{"slug":"contributing","depth":2,"value":"Contributing"},{"slug":"running-the-dev-environment","depth":3,"value":"Running the dev environment"},{"slug":"testing","depth":3,"value":"Testing"},{"slug":"issues","depth":2,"value":"Issues"},{"slug":"license-mit","depth":2,"value":"License (MIT)"}]}}},"staticQueryHashes":["1635659820"]}
--------------------------------------------------------------------------------
/docs/page-data/readme/page-data.json:
--------------------------------------------------------------------------------
1 | {"componentChunkName":"component---readme-md","path":"/readme","result":{"pageContext":{"frontmatter":{},"entry":{"id":"04c6e90faac2675aa89e2176d2eec7d8","filepath":"README.md","fullpath":"/Users/dericcain/Code/react-tiny-fab/README.md","route":"/readme","slug":"readme","name":"Readme","menu":"","headings":[{"slug":"docs","depth":2,"value":"Docs"},{"slug":"issues","depth":2,"value":"Issues"},{"slug":"license-mit","depth":2,"value":"License (MIT)"}]}}},"staticQueryHashes":["1635659820"]}
--------------------------------------------------------------------------------
/docs/readme/index.html:
--------------------------------------------------------------------------------
1 | Readme | React Tiny Fab
A tiny (~700 byte gzip) WAI-ARIA compliant Floating Action Button for React
react-tiny-fab v3 now relies on React version 16.8 and up because it is implemented using React Hooks
Want to use a Floating Action Button without having to import the whole Material Design Components library? Weighing in
2 | at only around 671 bytes gzipped, React Tiny FAB is a great solution. It is a lightweight, fast, and flexible component.
If you find an issue, head over to the Issues section and let me
3 | know about it. If you want to be super cool, you can submit a PR that fixes the issue.
--------------------------------------------------------------------------------
/docs/static/css/src-example.6a6391bdacfae9c0dcbe.css:
--------------------------------------------------------------------------------
1 | .rtf{box-sizing:border-box;margin:25px;position:fixed;white-space:nowrap;z-index:9998;padding-left:0;list-style:none}.rtf.open .rtf--mb>*{transform-origin:center center;transform:rotate(315deg);transition:transform .2s ease-in-out}.rtf.open .rtf--mb>ul{list-style:none;margin:0;padding:0}.rtf.open .rtf--ab__c:hover>span,.rtf.open .rtf--ab__c>span.always-show{transition:opacity .2s ease-in-out;opacity:.9}.rtf.open .rtf--ab__c:first-child{transform:translateY(-60px) scale(1);transition-delay:.03s}.rtf.open .rtf--ab__c:first-child.top{transform:translateY(60px) scale(1)}.rtf.open .rtf--ab__c:nth-child(2){transform:translateY(-120px) scale(1);transition-delay:.09s}.rtf.open .rtf--ab__c:nth-child(2).top{transform:translateY(120px) scale(1)}.rtf.open .rtf--ab__c:nth-child(3){transform:translateY(-180px) scale(1);transition-delay:.12s}.rtf.open .rtf--ab__c:nth-child(3).top{transform:translateY(180px) scale(1)}.rtf.open .rtf--ab__c:nth-child(4){transform:translateY(-240px) scale(1);transition-delay:.15s}.rtf.open .rtf--ab__c:nth-child(4).top{transform:translateY(240px) scale(1)}.rtf.open .rtf--ab__c:nth-child(5){transform:translateY(-300px) scale(1);transition-delay:.18s}.rtf.open .rtf--ab__c:nth-child(5).top{transform:translateY(300px) scale(1)}.rtf.open .rtf--ab__c:nth-child(6){transform:translateY(-360px) scale(1);transition-delay:.21s}.rtf.open .rtf--ab__c:nth-child(6).top{transform:translateY(360px) scale(1)}.rtf--mb__c{padding:25px;margin:-25px}.rtf--mb__c :last-child{margin-bottom:0}.rtf--mb__c:hover>span,.rtf--mb__c>span.always-show{transition:opacity .2s ease-in-out;opacity:.9}.rtf--mb__c>span{opacity:0;transition:opacity .2s ease-in-out;position:absolute;top:50%;transform:translateY(-50%);margin-right:6px;margin-left:4px;background:rgba(0,0,0,.75);padding:2px 4px;border-radius:2px;color:#fff;font-size:13px;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28)}.rtf--mb__c>span.right{right:100%}.rtf--mb{height:56px;width:56px;z-index:9999;background-color:#666;display:inline-flex;justify-content:center;align-items:center;position:relative;border:none;border-radius:50%;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28);cursor:pointer;outline:none;padding:0;-webkit-user-drag:none;font-weight:700;color:#f1f1f1;font-size:18px}.rtf--ab__c,.rtf--mb>*{transition:transform .2s ease-in-out}.rtf--ab__c{display:block;position:absolute;top:0;right:1px;padding:10px 0;margin:-10px 0}.rtf--ab__c>span{opacity:0;transition:opacity .2s ease-in-out;position:absolute;top:50%;transform:translateY(-50%);margin-right:6px;background:rgba(0,0,0,.75);padding:2px 4px;border-radius:2px;color:#fff;font-size:13px;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28)}.rtf--ab__c>span.right{right:100%}.rtf--ab__c:first-child{transform:translateY(-60px) scale(0);transition-delay:.21s}.rtf--ab__c:first-child.top{transform:translateY(60px) scale(0)}.rtf--ab__c:nth-child(2){transform:translateY(-120px) scale(0);transition-delay:.18s}.rtf--ab__c:nth-child(2).top{transform:translateY(120px) scale(0)}.rtf--ab__c:nth-child(3){transform:translateY(-180px) scale(0);transition-delay:.15s}.rtf--ab__c:nth-child(3).top{transform:translateY(180px) scale(0)}.rtf--ab__c:nth-child(4){transform:translateY(-240px) scale(0);transition-delay:.12s}.rtf--ab__c:nth-child(4).top{transform:translateY(240px) scale(0)}.rtf--ab__c:nth-child(5){transform:translateY(-300px) scale(0);transition-delay:.09s}.rtf--ab__c:nth-child(5).top{transform:translateY(300px) scale(0)}.rtf--ab__c:nth-child(6){transform:translateY(-360px) scale(0);transition-delay:.03s}.rtf--ab__c:nth-child(6).top{transform:translateY(360px) scale(0)}.rtf--ab{height:48px;width:48px;background-color:#aaa;display:inline-flex;justify-content:center;align-items:center;position:relative;border:none;border-radius:50%;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28);cursor:pointer;outline:none;padding:0;-webkit-user-drag:none;font-weight:700;color:#f1f1f1;margin-right:4px;font-size:16px;z-index:10000}
--------------------------------------------------------------------------------
/docs/static/js/app.6a6391bdacfae9c0dcbe.js:
--------------------------------------------------------------------------------
1 | !function(e){function n(n){for(var r,o,i=n[0],a=n[1],c=n[2],d=n[3]||[],s=0,u=[];s=0&&t._disposeHandlers.splice(n,1)},invalidate:function(){switch(this._selfInvalidated=!0,p){case"idle":(v={})[n]=e[n],f("ready");break;case"ready":I(n);break;case"prepare":case"check":case"dispose":case"apply":(y=y||[]).push(n)}},check:_,apply:D,status:function(e){if(!e)return p;l.push(e)},addStatusHandler:function(e){l.push(e)},removeStatusHandler:function(e){var n=l.indexOf(e);n>=0&&l.splice(n,1)},data:c[n]};return o=void 0,t}var l=[],p="idle";function f(e){p=e;for(var n=0;n0;){var o=r.pop(),i=o.id,a=o.chain;if((u=A[i])&&(!u.hot._selfAccepted||u.hot._selfInvalidated)){if(u.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:i};if(u.hot._main)return{type:"unaccepted",chain:a,moduleId:i};for(var c=0;c ")),j.type){case"self-declined":t.onDeclined&&t.onDeclined(j),t.ignoreDeclined||(P=new Error("Aborted because of self decline: "+j.moduleId+H));break;case"declined":t.onDeclined&&t.onDeclined(j),t.ignoreDeclined||(P=new Error("Aborted because of declined dependency: "+j.moduleId+" in "+j.parentId+H));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(j),t.ignoreUnaccepted||(P=new Error("Aborted because "+l+" is not accepted"+H));break;case"accepted":t.onAccepted&&t.onAccepted(j),D=!0;break;case"disposed":t.onDisposed&&t.onDisposed(j),I=!0;break;default:throw new Error("Unexception type "+j.type)}if(P)return f("abort"),Promise.reject(P);if(D)for(l in w[l]=v[l],h(b,j.outdatedModules),j.outdatedDependencies)Object.prototype.hasOwnProperty.call(j.outdatedDependencies,l)&&(g[l]||(g[l]=[]),h(g[l],j.outdatedDependencies[l]));I&&(h(b,[j.moduleId]),w[l]=O)}var M,T=[];for(i=0;i0;)if(l=U.pop(),u=A[l]){var N={},z=u.hot._disposeHandlers;for(s=0;s=0&&L.parents.splice(M,1))}}for(l in g)if(Object.prototype.hasOwnProperty.call(g,l)&&(u=A[l]))for(R=g[l],s=0;s=0&&u.children.splice(M,1);f("apply"),void 0!==m&&(a=m,m=void 0);for(l in v=void 0,w)Object.prototype.hasOwnProperty.call(w,l)&&(e[l]=w[l]);var B=null;for(l in g)if(Object.prototype.hasOwnProperty.call(g,l)&&(u=A[l])){R=g[l];var F=[];for(i=0;i"},{"slug":"props","depth":4,"value":"Props"},{"slug":"action-","depth":3,"value":""},{"slug":"props-1","depth":4,"value":"Props"},{"slug":"demo","depth":2,"value":"Demo"},{"slug":"contributing","depth":2,"value":"Contributing"},{"slug":"running-the-dev-environment","depth":3,"value":"Running the dev environment"},{"slug":"testing","depth":3,"value":"Testing"},{"slug":"issues","depth":2,"value":"Issues"},{"slug":"license-mit","depth":2,"value":"License (MIT)"}]}}]}')},"./.docz/app/index.jsx":function(e,n,t){"use strict";t.r(n);var r=t("./node_modules/react/index.js"),o=t.n(r),i=t("./node_modules/react-dom/index.js"),a=t.n(i),c=t("./node_modules/docz/dist/index.esm.js"),d=t("./node_modules/docz-theme-default/dist/index.esm.js"),s={"src/example.mdx":function(){return Promise.all([t.e(0),t.e(2)]).then(t.bind(null,"./src/example.mdx"))}},u=t("./.docz/app/db.json"),l=function(){return o.a.createElement(d.a,{linkComponent:c.b,db:u},o.a.createElement(c.d,{imports:s}))},p=[],f=[],h=function(){return p.forEach((function(e){return e&&e()}))},v=function(){return f.forEach((function(e){return e&&e()}))},m=document.querySelector("#root");!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l;h(),a.a.render(o.a.createElement(e,null),m,v)}(l)},0:function(e,n,t){e.exports=t("./.docz/app/index.jsx")}});
2 | //# sourceMappingURL=app.6a6391bdacfae9c0dcbe.js.map
--------------------------------------------------------------------------------
/docs/styles-bc72ca78f9bad9fb1f45.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[9],[]]);
2 | //# sourceMappingURL=styles-bc72ca78f9bad9fb1f45.js.map
--------------------------------------------------------------------------------
/docs/styles-bc72ca78f9bad9fb1f45.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"styles-bc72ca78f9bad9fb1f45.js","sourceRoot":""}
--------------------------------------------------------------------------------
/docs/styles.dfd529f93c706bbf78a0.css:
--------------------------------------------------------------------------------
1 | @import url(https://fonts.googleapis.com/css?family=Inconsolata&display=swap);@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap);.rtf{box-sizing:border-box;margin:25px;position:fixed;white-space:nowrap;z-index:9998;padding-left:0;list-style:none}.rtf.open .rtf--mb>*{transform-origin:center center;transform:rotate(315deg);transition:transform .2s ease-in-out}.rtf.open .rtf--mb>ul{list-style:none;margin:0;padding:0}.rtf.open .rtf--ab__c:hover>span,.rtf.open .rtf--ab__c>span.always-show{transition:opacity .2s ease-in-out;opacity:.9}.rtf.open .rtf--ab__c:first-child{transform:translateY(-60px) scale(1);transition-delay:.03s}.rtf.open .rtf--ab__c:first-child.top{transform:translateY(60px) scale(1)}.rtf.open .rtf--ab__c:nth-child(2){transform:translateY(-120px) scale(1);transition-delay:.09s}.rtf.open .rtf--ab__c:nth-child(2).top{transform:translateY(120px) scale(1)}.rtf.open .rtf--ab__c:nth-child(3){transform:translateY(-180px) scale(1);transition-delay:.12s}.rtf.open .rtf--ab__c:nth-child(3).top{transform:translateY(180px) scale(1)}.rtf.open .rtf--ab__c:nth-child(4){transform:translateY(-240px) scale(1);transition-delay:.15s}.rtf.open .rtf--ab__c:nth-child(4).top{transform:translateY(240px) scale(1)}.rtf.open .rtf--ab__c:nth-child(5){transform:translateY(-300px) scale(1);transition-delay:.18s}.rtf.open .rtf--ab__c:nth-child(5).top{transform:translateY(300px) scale(1)}.rtf.open .rtf--ab__c:nth-child(6){transform:translateY(-360px) scale(1);transition-delay:.21s}.rtf.open .rtf--ab__c:nth-child(6).top{transform:translateY(360px) scale(1)}.rtf--mb__c{padding:25px;margin:-25px}.rtf--mb__c :last-child{margin-bottom:0}.rtf--mb__c:hover>span,.rtf--mb__c>span.always-show{transition:opacity .2s ease-in-out;opacity:.9}.rtf--mb__c>span{opacity:0;transition:opacity .2s ease-in-out;position:absolute;top:50%;transform:translateY(-50%);margin-right:6px;margin-left:4px;background:rgba(0,0,0,.75);padding:2px 4px;border-radius:2px;color:#fff;font-size:13px;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28)}.rtf--mb__c>span.right{right:100%}.rtf--mb{height:56px;width:56px;z-index:9999;background-color:#666;display:inline-flex;justify-content:center;align-items:center;position:relative;border:none;border-radius:50%;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28);cursor:pointer;outline:none;padding:0;-webkit-user-drag:none;font-weight:700;color:#f1f1f1;font-size:18px}.rtf--ab__c,.rtf--mb>*{transition:transform .2s ease-in-out}.rtf--ab__c{display:block;position:absolute;top:0;right:1px;padding:10px 0;margin:-10px 0}.rtf--ab__c>span{opacity:0;transition:opacity .2s ease-in-out;position:absolute;top:50%;transform:translateY(-50%);margin-right:6px;background:rgba(0,0,0,.75);padding:2px 4px;border-radius:2px;color:#fff;font-size:13px;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28)}.rtf--ab__c>span.right{right:100%}.rtf--ab__c:first-child{transform:translateY(-60px) scale(0);transition-delay:.21s}.rtf--ab__c:first-child.top{transform:translateY(60px) scale(0)}.rtf--ab__c:nth-child(2){transform:translateY(-120px) scale(0);transition-delay:.18s}.rtf--ab__c:nth-child(2).top{transform:translateY(120px) scale(0)}.rtf--ab__c:nth-child(3){transform:translateY(-180px) scale(0);transition-delay:.15s}.rtf--ab__c:nth-child(3).top{transform:translateY(180px) scale(0)}.rtf--ab__c:nth-child(4){transform:translateY(-240px) scale(0);transition-delay:.12s}.rtf--ab__c:nth-child(4).top{transform:translateY(240px) scale(0)}.rtf--ab__c:nth-child(5){transform:translateY(-300px) scale(0);transition-delay:.09s}.rtf--ab__c:nth-child(5).top{transform:translateY(300px) scale(0)}.rtf--ab__c:nth-child(6){transform:translateY(-360px) scale(0);transition-delay:.03s}.rtf--ab__c:nth-child(6).top{transform:translateY(360px) scale(0)}.rtf--ab{height:48px;width:48px;background-color:#aaa;display:inline-flex;justify-content:center;align-items:center;position:relative;border:none;border-radius:50%;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28);cursor:pointer;outline:none;padding:0;-webkit-user-drag:none;font-weight:700;color:#f1f1f1;margin-right:4px;font-size:16px;z-index:10000}
--------------------------------------------------------------------------------
/docs/webpack-runtime-195f415acf43a6365648.js:
--------------------------------------------------------------------------------
1 | !function(e){function r(r){for(var n,c,u=r[0],i=r[1],f=r[2],p=0,d=[];p
2 |
3 |
4 |
5 |
6 | React Tiny FAB Example
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
44 |
49 |
221 |
222 |
223 |
--------------------------------------------------------------------------------
/example/serve.json:
--------------------------------------------------------------------------------
1 | {
2 | "cleanUrls": true,
3 | "renderSingle": true
4 | }
5 |
--------------------------------------------------------------------------------
/fab.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dericcain/react-tiny-fab/58f780e1cfe71976ab57983e30801e6b104b697c/fab.gif
--------------------------------------------------------------------------------
/gatsby-config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: ['gatsby-plugin-sass', 'gatsby-theme-docz'],
3 | }
4 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | moduleNameMapper: {
3 | "\\.scss$": "/__mocks__/styles.js",
4 | },
5 | };
6 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dericcain/react-tiny-fab/58f780e1cfe71976ab57983e30801e6b104b697c/logo.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-tiny-fab",
3 | "description": "A tiny Floating Action Button for React.",
4 | "version": "4.0.4",
5 | "license": "MIT",
6 | "author": "Deric Cain ",
7 | "repository": {
8 | "type": "git",
9 | "url": "https://github.com/dericgw/react-tiny-fab.git"
10 | },
11 | "bugs": {
12 | "url": "https://github.com/dericgw/react-tiny-fab/issues"
13 | },
14 | "homepage": "https://github.com/dericgw/react-tiny-fab",
15 | "keywords": [
16 | "react",
17 | "material",
18 | "fab",
19 | "floating action button",
20 | "material design",
21 | "components",
22 | "floating button"
23 | ],
24 | "main": "dist/index.js",
25 | "typings": "dist/index.d.ts",
26 | "files": [
27 | "dist",
28 | "src"
29 | ],
30 | "engines": {
31 | "node": ">=10"
32 | },
33 | "scripts": {
34 | "start": "tsdx watch",
35 | "build": "tsdx build",
36 | "test": "tsdx test --passWithNoTests",
37 | "lint": "tsdx lint",
38 | "prepare": "tsdx build",
39 | "size": "size-limit",
40 | "analyze": "size-limit --why",
41 | "docs": "docz dev",
42 | "docs:build": "docz build",
43 | "prestart:example": "tsdx build",
44 | "start:example": "serve example"
45 | },
46 | "peerDependencies": {
47 | "react": ">=16.8"
48 | },
49 | "husky": {
50 | "hooks": {
51 | "pre-commit": "tsdx lint --fix && git add ."
52 | }
53 | },
54 | "prettier": {
55 | "printWidth": 100,
56 | "semi": true,
57 | "singleQuote": true,
58 | "trailingComma": "all"
59 | },
60 | "module": "dist/react-tiny-fab.esm.js",
61 | "size-limit": [
62 | {
63 | "path": "dist/react-tiny-fab.cjs.production.min.js",
64 | "limit": "2 KB"
65 | },
66 | {
67 | "path": "dist/react-tiny-fab.esm.js",
68 | "limit": "2 KB"
69 | }
70 | ],
71 | "devDependencies": {
72 | "@size-limit/preset-small-lib": "^4.6.0",
73 | "@testing-library/jest-dom": "^5.11.4",
74 | "@testing-library/react": "^11.0.4",
75 | "@types/react": "^16.9.49",
76 | "@types/react-dom": "^16.9.8",
77 | "docz": "^2.3.1",
78 | "docz-theme-default": "^1.2.0",
79 | "gatsby-plugin-sass": "^2.3.14",
80 | "gatsby-theme-docz": "^2.3.1",
81 | "husky": "^4.3.0",
82 | "identity-obj-proxy": "^3.0.0",
83 | "node-sass": "^4.14.1",
84 | "react": "16.13.1",
85 | "react-dom": "16.13.1",
86 | "rollup-plugin-postcss": "^3.1.8",
87 | "rollup-plugin-scss": "^2.6.1",
88 | "serve": "^11.3.2",
89 | "size-limit": "^4.6.0",
90 | "tsdx": "^0.14.0",
91 | "tslib": "^2.0.1",
92 | "typescript": "^4.0.3"
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/example.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | name: React Tiny Fab
3 | route: /
4 | ---
5 |
6 | import { Fab, Action } from './index.tsx';
7 | import './styles.scss';
8 |
9 |
10 |
11 | > A tiny (~700 byte gzip) WAI-ARIA compliant Floating Action Button for React
12 |
13 | ## Install
14 | ```
15 | npm install react-tiny-fab
16 | yarn add react-tiny-fab
17 | ```
18 |
19 | > `react-tiny-fab` v3 and up now relies on React version 16.8 and up because it is implemented using [React Hooks](https://reactjs.org/docs/hooks-intro.html)
20 |
21 | ## Usage
22 | There are two components available for import - `Fab` and `Action`. You import them like this:
23 | ```
24 | import { Fab, Action } from 'react-tiny-fab';
25 | import 'react-tiny-fab/dist/styles.css';
26 | ```
27 |
28 | ## Example
29 |
30 | > Check the bottom right of the screen
31 |
32 | +} mainButtonStyles={{backgroundColor: '#e74c3c'}}>
33 | alert('It works!')}>
34 | +
35 |
36 | alert('It still works!')}>
37 | =
38 |
39 |
40 |
41 | Here is an example of how you would use the components:
42 | ```js
43 | // The Fab is the main button. Pass any component to the icon prop and choose
44 | // either click or hover for the event (default is hover)
45 | }
50 | event={event}
51 | alwaysShowTitle={true}
52 | onClick={someFunctionForTheMainButton}
53 | >
54 | // The Action components are the "buttons" that appear when the Fab is open. You can use the out-of-the-box Action
55 | // component or you can use a custom component of any type and style it any way that you'd like. The "text" prop
56 | // is the popup label that appears when the Action component is hovered.
57 |
61 |
65 |
66 |
67 | // Using a custom component for this one. See another example in "example/src/index.js"
68 |
72 |
73 |
74 |
75 | ```
76 |
77 | ## Components
78 | ### ``
79 | This is the main component that controls the Floating Action Button.
80 |
81 | #### Props
82 | | Prop | Type | Default | Required | Description |
83 | |----------------------|----------------------------|-------------------------- |----------|--------------------------------------------------------------------------------------------------------------------------------------------|
84 | | `mainButtonStyles` | React.CSSProperties | {} | false | This object is passed to the main button's `style` prop so use React styles to style the button. |
85 | | `style` | React.CSSProperties | `{ bottom: 24, right: 24 }` | false | How do you want to style the FAB, specifically the position of the FAB? Use `top`, `left`, `bottom`, `right` properties to declare where you want the FAB to be positioned as well as any other styles. |
86 | | `icon` | React Element/Component | | true | This element/component will be the used as the icon for the main button. This can be text, or a Font Awesome icon, or any other component. |
87 | | `event` | 'hover' | 'click' | 'hover' | false | What type of event do you want to make the FAB menu active? This can be either `click` or `hover`. |
88 | | `children` | React Element/Component | | false | This is the children that will be mapped and rendered. This can be anything. There can be up to 6, but no more than 6. An `Action` component is provided out of the box. |
89 | | `alwaysShowTitle` | boolean | false | false | If the title of the `Action` component should always be shown (not just on hover), set this to true and the title will always be shown |
90 | | `onClick` | function | null | false | If you only need to use the main button for something, then you can attach an `onClick` handler to the main button. The React Synthetic Event will be passed in just like a normal `onClick` |
91 | | `text` | string | null | false | If you attach an `onClick` handler to the main button, then the original `Action` components would not show. Instead you can attach `text` to display while user hover the FAB |
92 | | `...props` | Anything | | false | Anything you can add to a React component, you can add here. |
93 | > Based on the `position` prop, the FAB will figure out the direction of the `` `text` and also which way to
94 | > expand when hovered/clicked (up or down).
95 |
96 | ### ``
97 | This component represents the smaller buttons that appear when the main button is hovered/clicked. Now, you do not have
98 | to use this component. You can use your own custom component(s) and create something totally different than a Floating
99 | Action Button. For instance, you could create your own "Support Button" that when clicked, will display a chat box or
100 | some type of form that submits a contact request.
101 |
102 | #### Props
103 | | Prop | Type | Default | Required | Description |
104 | |------------|-------------------------|---------|----------|------------------------------------------------------------------------------|
105 | | `text` | string | "" | false | This is the text that will be displayed when one of the actions is hovered. |
106 | | `children` | React Element/Component | | false | This will be the icon/text for the action. |
107 | | `...props` | Anything | | false | Anything you can add to a React component, you can add here, e.g. (`onClick`, `style`, etc.) |
108 |
109 | ## Demo
110 | Check out the `index.html` file in the `example` folder for an example of the traditional FAB and also a form pop-up that could be used to send contact information, or something else.
111 |
112 | ## Contributing
113 | If you find a bug, submit an issue with enough information to reproduce the bug. If you have a fix, please do not hesitate to submit a PR. If you feel that the API needs to be modified, open an issue so that we can discuss it first.
114 |
115 | ### Running the dev environment
116 |
117 | 1. Clone the repo - `git clone https://github.com/dericgw/react-tiny-fab.git` && `cd react-tiny-fab`
118 | 2. Install the dependencies - `npm i`
119 | 3. Run the example - `npm start` _Visit http://localhost:5000_
120 |
121 | Once you get that going, you should be able to make changes and the page should refresh automatically when those changes are saved.
122 |
123 | ### Testing
124 | This package is only one JS file and it is tested pretty good. Make sure that none of the tests are breaking if changes
125 | are made. Also, if you add new functionality and it *warrants* testing, please add tests. If you need help with this, I
126 | will gladly help.
127 |
128 | ## Issues
129 | If you find an issue, head over to the Issues section and let me know about it. If you want to be super cool, you can submit a PR that fixes the issue.
130 |
131 | ## License (MIT)
132 | [Check it out here.](https://github.com/dericgw/react-tiny-fab/blob/master/LICENSE)
133 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | import './styles.scss';
4 |
5 | interface ABProps extends React.HTMLAttributes {
6 | text?: string;
7 | onClick?: (e: React.FormEvent) => void;
8 | 'data-testid'?: string;
9 | }
10 |
11 | const AB: React.FC = ({ children, ...p }) => (
12 |
15 | );
16 |
17 | interface MBProps extends Omit, 'tabIndex'> {
18 | tabIndex?: number;
19 | }
20 |
21 | export const MB: React.FC = ({ children, ...p }) => (
22 |
25 | );
26 |
27 | const defaultStyles: React.CSSProperties = { bottom: 24, right: 24 };
28 |
29 | interface FabProps {
30 | event?: 'hover' | 'click';
31 | style?: React.CSSProperties;
32 | alwaysShowTitle?: boolean;
33 | icon?: React.ReactNode;
34 | mainButtonStyles?: React.CSSProperties;
35 | onClick?: (e: React.FormEvent) => void;
36 | text?: string;
37 | children?: React.ReactNode;
38 | }
39 |
40 | const Fab: React.FC = ({
41 | event = 'hover',
42 | style = defaultStyles,
43 | alwaysShowTitle = false,
44 | children,
45 | icon,
46 | mainButtonStyles,
47 | onClick,
48 | text,
49 | ...p
50 | }) => {
51 | const [isOpen, setIsOpen] = useState(false);
52 | const ariaHidden = alwaysShowTitle || !isOpen;
53 | const interpolatedEvent = typeof window !== 'undefined' ? 'ontouchstart' in window ? 'click' : event : event;
54 | const open = () => setIsOpen(true);
55 | const close = () => setIsOpen(false);
56 | const enter = () => interpolatedEvent === 'hover' && open();
57 | const leave = () => interpolatedEvent === 'hover' && close();
58 | const toggle = (e: React.FormEvent) => {
59 | if (onClick) {
60 | return onClick(e);
61 | }
62 | e.persist();
63 | return interpolatedEvent === 'click' ? (isOpen ? close() : open()) : null;
64 | };
65 |
66 | const actionOnClick = (e: React.FormEvent, userFunc: (e: React.FormEvent) => void) => {
67 | e.persist();
68 | setIsOpen(false);
69 | setTimeout(() => {
70 | userFunc(e);
71 | }, 1);
72 | };
73 |
74 | const rc = () =>
75 | React.Children.map(children, (ch, i) => {
76 | if (React.isValidElement(ch)) {
77 | return (
78 |