UNPKG

2.28 kBJavaScriptView Raw
1import { css } from 'reakit/styled';
2import { theme, palette } from 'styled-tools';
3import styled from './styled/index.js';
4import Input from 'reakit/Input';
5
6function HiddenInput(_ref) {
7 var Icon = _ref.Icon,
8 checkedCss = _ref.checkedCss,
9 disabledCheckedCss = _ref.disabledCheckedCss,
10 disabledCheckedIconCss = _ref.disabledCheckedIconCss,
11 disabledUncheckedIconCss = _ref.disabledUncheckedIconCss,
12 checkedIconCss = _ref.checkedIconCss,
13 uncheckedIconCss = _ref.uncheckedIconCss,
14 themePrefix = _ref.themePrefix;
15 // @ts-ignore
16 return styled(Input).withConfig({
17 displayName: "HiddenInput",
18 componentId: "sc-1k1k2p-0"
19 })(["clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;position:absolute;width:1px;& + ", "{&::before{", ";&{", ";}}}&[disabled] + ", "{background-color:", ";box-shadow:unset;&::before{", ";&{", ";}}&{", ";}}&:checked:focus + ", "{border-color:", ";box-shadow:", " 0px 0px 0px 1px !important;&{", ";}}&:focus + ", "{border-color:", ";box-shadow:", " 0px 0px 0px 1px !important;&{", ";}}&:not([disabled]):checked + ", "{border-color:", ";", ";}&:checked + ", "{", ";&{", ";}&::before{", ";", ";}&{", ";}}&[disabled]:checked + ", "::before{", ";&{", ";}}"], Icon, uncheckedIconCss, theme("fannypack." + themePrefix + ".icon.unchecked"), Icon, palette('white700'), disabledUncheckedIconCss, theme("fannypack." + themePrefix + ".icon.uncheckedDisabled"), theme("fannypack." + themePrefix + ".disabled"), Icon, function (props) {
20 return palette("" + (props.palette || 'primary'));
21 }, function (props) {
22 return palette("" + (props.palette || 'primary'));
23 }, theme("fannypack." + themePrefix + ".focusChecked"), Icon, palette('primary'), palette('primary'), theme("fannypack." + themePrefix + ".focus"), Icon, function (props) {
24 return palette("" + (props.palette || 'primary'));
25 }, checkedCss, Icon, disabledCheckedCss, function (props) {
26 return props.state && css(["box-shadow:", " 0px 0px 0px 1px !important;"], palette('primary'));
27 }, checkedIconCss, theme("fannypack." + themePrefix + ".icon.checked"), theme("fannypack." + themePrefix + ".checked"), Icon, disabledCheckedIconCss, theme("fannypack." + themePrefix + ".icon.checkedDisabled"));
28}
29
30export { HiddenInput as a };