index.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = void 0;
  7. var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
  8. var _internal = require("../../theme/internal");
  9. var _style = require("../../style");
  10. const genQRCodeStyle = token => {
  11. const {
  12. componentCls
  13. } = token;
  14. return {
  15. [componentCls]: (0, _extends2.default)((0, _extends2.default)({}, (0, _style.resetComponent)(token)), {
  16. display: 'flex',
  17. justifyContent: 'center',
  18. alignItems: 'center',
  19. padding: token.paddingSM,
  20. backgroundColor: token.colorWhite,
  21. borderRadius: token.borderRadiusLG,
  22. border: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
  23. position: 'relative',
  24. width: '100%',
  25. height: '100%',
  26. overflow: 'hidden',
  27. [`& > ${componentCls}-mask`]: {
  28. position: 'absolute',
  29. insetBlockStart: 0,
  30. insetInlineStart: 0,
  31. zIndex: 10,
  32. display: 'flex',
  33. flexDirection: 'column',
  34. justifyContent: 'center',
  35. alignItems: 'center',
  36. width: '100%',
  37. height: '100%',
  38. color: token.colorText,
  39. lineHeight: token.lineHeight,
  40. background: token.QRCodeMaskBackgroundColor,
  41. textAlign: 'center',
  42. [`& > ${componentCls}-expired , & > ${componentCls}-scanned`]: {
  43. color: token.QRCodeTextColor
  44. }
  45. },
  46. '&-icon': {
  47. marginBlockEnd: token.marginXS,
  48. fontSize: token.controlHeight
  49. }
  50. }),
  51. [`${componentCls}-borderless`]: {
  52. borderColor: 'transparent'
  53. }
  54. };
  55. };
  56. var _default = exports.default = (0, _internal.genComponentStyleHook)('QRCode', token => genQRCodeStyle((0, _internal.mergeToken)(token, {
  57. QRCodeTextColor: 'rgba(0, 0, 0, 0.88)',
  58. QRCodeMaskBackgroundColor: 'rgba(255, 255, 255, 0.96)'
  59. })));