native-base
Version:
Essential cross-platform UI components for React Native
128 lines (123 loc) • 2.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _tools = require("../tools");
const baseStyle = props => {
const {
colorScheme
} = props;
return {
borderWidth: 2,
borderRadius: 'full',
p: 0.5,
borderColor: (0, _tools.mode)('muted.300', 'muted.600')(props),
bg: (0, _tools.mode)('muted.50', 'muted.700')(props),
// matching background color
_stack: {
direction: 'row',
alignItems: 'center',
space: 2,
_web: {
cursor: props.isDisabled ? 'not-allowed' : 'pointer'
}
},
_interactionBox: {
borderRadius: 'full',
size: 3,
position: 'absolute',
zIndex: -1,
_web: {
transition: 'height 200ms, width 200ms',
pointerEvents: 'none'
}
},
_icon: {
color: (0, _tools.mode)("".concat(colorScheme, ".600"), "".concat(colorScheme, ".200"))(props) // matching background color
},
_hover: {
_interactionBox: {
bg: 'muted.200:alpha.30',
size: 8
}
},
_focus: {
_interactionBox: {
bg: "".concat(colorScheme, ".200:alpha.50"),
size: 8
}
},
_focusVisible: {
_interactionBox: {
bg: "".concat(colorScheme, ".200:alpha.50"),
size: 8
}
},
_checked: {
borderColor: (0, _tools.mode)("".concat(colorScheme, ".600"), "".concat(colorScheme, ".200"))(props)
},
_disabled: {
opacity: 0.4,
_interactionBox: {
bg: 'transparent'
},
_icon: {
bg: 'transparent'
},
_stack: {
opacity: '0.4'
}
},
_invalid: {
borderColor: (0, _tools.mode)('error.600', 'error.400')(props)
},
_pressed: {
_interactionBox: {
bg: "".concat(colorScheme, ".200:alpha.50"),
size: 10
}
}
};
};
const sizes = {
lg: {
_icon: {
size: 4
},
// _interactionBox: { size: 5 },
_text: {
fontSize: 'lg'
}
},
md: {
_icon: {
size: 3
},
// _interactionBox: { size: 16 },
_text: {
fontSize: 'md'
}
},
sm: {
_icon: {
size: 2
},
// _interactionBox: { size: 3 },
_text: {
fontSize: 'sm'
}
}
};
const defaultProps = {
defaultIsChecked: false,
size: 'md',
colorScheme: 'primary'
};
var _default = {
baseStyle,
sizes,
defaultProps
};
exports.default = _default;
//# sourceMappingURL=radio.js.map