index.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.genPlaceholderStyle = exports.genInputStyle = exports.genInputSmallStyle = exports.genInputGroupStyle = exports.genBasicInputStyle = exports.genAffixStyle = exports.genActiveStyle = exports.default = void 0;
  6. Object.defineProperty(exports, "initComponentToken", {
  7. enumerable: true,
  8. get: function () {
  9. return _token.initComponentToken;
  10. }
  11. });
  12. Object.defineProperty(exports, "initInputToken", {
  13. enumerable: true,
  14. get: function () {
  15. return _token.initInputToken;
  16. }
  17. });
  18. exports.useSharedStyle = void 0;
  19. var _cssinjs = require("@ant-design/cssinjs");
  20. var _style = require("../../style");
  21. var _compactItem = require("../../style/compact-item");
  22. var _internal = require("../../theme/internal");
  23. var _token = require("./token");
  24. var _variants = require("./variants");
  25. const genPlaceholderStyle = color => ({
  26. // Firefox
  27. '&::-moz-placeholder': {
  28. opacity: 1
  29. },
  30. '&::placeholder': {
  31. color,
  32. userSelect: 'none' // https://github.com/ant-design/ant-design/pull/32639
  33. },
  34. '&:placeholder-shown': {
  35. textOverflow: 'ellipsis'
  36. }
  37. });
  38. exports.genPlaceholderStyle = genPlaceholderStyle;
  39. const genActiveStyle = token => ({
  40. borderColor: token.activeBorderColor,
  41. boxShadow: token.activeShadow,
  42. outline: 0,
  43. backgroundColor: token.activeBg
  44. });
  45. exports.genActiveStyle = genActiveStyle;
  46. const genInputLargeStyle = token => {
  47. const {
  48. paddingBlockLG,
  49. lineHeightLG,
  50. borderRadiusLG,
  51. paddingInlineLG
  52. } = token;
  53. return {
  54. padding: `${(0, _cssinjs.unit)(paddingBlockLG)} ${(0, _cssinjs.unit)(paddingInlineLG)}`,
  55. fontSize: token.inputFontSizeLG,
  56. lineHeight: lineHeightLG,
  57. borderRadius: borderRadiusLG
  58. };
  59. };
  60. const genInputSmallStyle = token => ({
  61. padding: `${(0, _cssinjs.unit)(token.paddingBlockSM)} ${(0, _cssinjs.unit)(token.paddingInlineSM)}`,
  62. fontSize: token.inputFontSizeSM,
  63. borderRadius: token.borderRadiusSM
  64. });
  65. exports.genInputSmallStyle = genInputSmallStyle;
  66. const genBasicInputStyle = token => Object.assign(Object.assign({
  67. position: 'relative',
  68. display: 'inline-block',
  69. width: '100%',
  70. minWidth: 0,
  71. padding: `${(0, _cssinjs.unit)(token.paddingBlock)} ${(0, _cssinjs.unit)(token.paddingInline)}`,
  72. color: token.colorText,
  73. fontSize: token.inputFontSize,
  74. lineHeight: token.lineHeight,
  75. borderRadius: token.borderRadius,
  76. transition: `all ${token.motionDurationMid}`
  77. }, genPlaceholderStyle(token.colorTextPlaceholder)), {
  78. // Size
  79. '&-lg': Object.assign({}, genInputLargeStyle(token)),
  80. '&-sm': Object.assign({}, genInputSmallStyle(token)),
  81. // RTL
  82. '&-rtl, &-textarea-rtl': {
  83. direction: 'rtl'
  84. }
  85. });
  86. exports.genBasicInputStyle = genBasicInputStyle;
  87. const genInputGroupStyle = token => {
  88. const {
  89. componentCls,
  90. antCls
  91. } = token;
  92. return {
  93. position: 'relative',
  94. display: 'table',
  95. width: '100%',
  96. borderCollapse: 'separate',
  97. borderSpacing: 0,
  98. // Undo padding and float of grid classes
  99. "&[class*='col-']": {
  100. paddingInlineEnd: token.paddingXS,
  101. '&:last-child': {
  102. paddingInlineEnd: 0
  103. }
  104. },
  105. // Sizing options
  106. [`&-lg ${componentCls}, &-lg > ${componentCls}-group-addon`]: Object.assign({}, genInputLargeStyle(token)),
  107. [`&-sm ${componentCls}, &-sm > ${componentCls}-group-addon`]: Object.assign({}, genInputSmallStyle(token)),
  108. // Fix https://github.com/ant-design/ant-design/issues/5754
  109. [`&-lg ${antCls}-select-single ${antCls}-select-selector`]: {
  110. height: token.controlHeightLG
  111. },
  112. [`&-sm ${antCls}-select-single ${antCls}-select-selector`]: {
  113. height: token.controlHeightSM
  114. },
  115. [`> ${componentCls}`]: {
  116. display: 'table-cell',
  117. '&:not(:first-child):not(:last-child)': {
  118. borderRadius: 0
  119. }
  120. },
  121. [`${componentCls}-group`]: {
  122. '&-addon, &-wrap': {
  123. display: 'table-cell',
  124. width: 1,
  125. whiteSpace: 'nowrap',
  126. verticalAlign: 'middle',
  127. '&:not(:first-child):not(:last-child)': {
  128. borderRadius: 0
  129. }
  130. },
  131. '&-wrap > *': {
  132. display: 'block !important'
  133. },
  134. '&-addon': {
  135. position: 'relative',
  136. padding: `0 ${(0, _cssinjs.unit)(token.paddingInline)}`,
  137. color: token.colorText,
  138. fontWeight: 'normal',
  139. fontSize: token.inputFontSize,
  140. textAlign: 'center',
  141. borderRadius: token.borderRadius,
  142. transition: `all ${token.motionDurationSlow}`,
  143. lineHeight: 1,
  144. // Reset Select's style in addon
  145. [`${antCls}-select`]: {
  146. margin: `${(0, _cssinjs.unit)(token.calc(token.paddingBlock).add(1).mul(-1).equal())} ${(0, _cssinjs.unit)(token.calc(token.paddingInline).mul(-1).equal())}`,
  147. [`&${antCls}-select-single:not(${antCls}-select-customize-input):not(${antCls}-pagination-size-changer)`]: {
  148. [`${antCls}-select-selector`]: {
  149. backgroundColor: 'inherit',
  150. border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} transparent`,
  151. boxShadow: 'none'
  152. }
  153. }
  154. },
  155. // https://github.com/ant-design/ant-design/issues/31333
  156. [`${antCls}-cascader-picker`]: {
  157. margin: `-9px ${(0, _cssinjs.unit)(token.calc(token.paddingInline).mul(-1).equal())}`,
  158. backgroundColor: 'transparent',
  159. [`${antCls}-cascader-input`]: {
  160. textAlign: 'start',
  161. border: 0,
  162. boxShadow: 'none'
  163. }
  164. }
  165. }
  166. },
  167. [componentCls]: {
  168. width: '100%',
  169. marginBottom: 0,
  170. textAlign: 'inherit',
  171. '&:focus': {
  172. zIndex: 1,
  173. // Fix https://gw.alipayobjects.com/zos/rmsportal/DHNpoqfMXSfrSnlZvhsJ.png
  174. borderInlineEndWidth: 1
  175. },
  176. '&:hover': {
  177. zIndex: 1,
  178. borderInlineEndWidth: 1,
  179. [`${componentCls}-search-with-button &`]: {
  180. zIndex: 0
  181. }
  182. }
  183. },
  184. // Reset rounded corners
  185. [`> ${componentCls}:first-child, ${componentCls}-group-addon:first-child`]: {
  186. borderStartEndRadius: 0,
  187. borderEndEndRadius: 0,
  188. // Reset Select's style in addon
  189. [`${antCls}-select ${antCls}-select-selector`]: {
  190. borderStartEndRadius: 0,
  191. borderEndEndRadius: 0
  192. }
  193. },
  194. [`> ${componentCls}-affix-wrapper`]: {
  195. [`&:not(:first-child) ${componentCls}`]: {
  196. borderStartStartRadius: 0,
  197. borderEndStartRadius: 0
  198. },
  199. [`&:not(:last-child) ${componentCls}`]: {
  200. borderStartEndRadius: 0,
  201. borderEndEndRadius: 0
  202. }
  203. },
  204. [`> ${componentCls}:last-child, ${componentCls}-group-addon:last-child`]: {
  205. borderStartStartRadius: 0,
  206. borderEndStartRadius: 0,
  207. // Reset Select's style in addon
  208. [`${antCls}-select ${antCls}-select-selector`]: {
  209. borderStartStartRadius: 0,
  210. borderEndStartRadius: 0
  211. }
  212. },
  213. [`${componentCls}-affix-wrapper`]: {
  214. '&:not(:last-child)': {
  215. borderStartEndRadius: 0,
  216. borderEndEndRadius: 0,
  217. [`${componentCls}-search &`]: {
  218. borderStartStartRadius: token.borderRadius,
  219. borderEndStartRadius: token.borderRadius
  220. }
  221. },
  222. [`&:not(:first-child), ${componentCls}-search &:not(:first-child)`]: {
  223. borderStartStartRadius: 0,
  224. borderEndStartRadius: 0
  225. }
  226. },
  227. [`&${componentCls}-group-compact`]: Object.assign(Object.assign({
  228. display: 'block'
  229. }, (0, _style.clearFix)()), {
  230. [`${componentCls}-group-addon, ${componentCls}-group-wrap, > ${componentCls}`]: {
  231. '&:not(:first-child):not(:last-child)': {
  232. borderInlineEndWidth: token.lineWidth,
  233. '&:hover, &:focus': {
  234. zIndex: 1
  235. }
  236. }
  237. },
  238. '& > *': {
  239. display: 'inline-flex',
  240. float: 'none',
  241. verticalAlign: 'top',
  242. // https://github.com/ant-design/ant-design-pro/issues/139
  243. borderRadius: 0
  244. },
  245. [`
  246. & > ${componentCls}-affix-wrapper,
  247. & > ${componentCls}-number-affix-wrapper,
  248. & > ${antCls}-picker-range
  249. `]: {
  250. display: 'inline-flex'
  251. },
  252. '& > *:not(:last-child)': {
  253. marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal(),
  254. borderInlineEndWidth: token.lineWidth
  255. },
  256. // Undo float for .ant-input-group .ant-input
  257. [componentCls]: {
  258. float: 'none'
  259. },
  260. // reset border for Select, DatePicker, AutoComplete, Cascader, Mention, TimePicker, Input
  261. [`& > ${antCls}-select > ${antCls}-select-selector,
  262. & > ${antCls}-select-auto-complete ${componentCls},
  263. & > ${antCls}-cascader-picker ${componentCls},
  264. & > ${componentCls}-group-wrapper ${componentCls}`]: {
  265. borderInlineEndWidth: token.lineWidth,
  266. borderRadius: 0,
  267. '&:hover, &:focus': {
  268. zIndex: 1
  269. }
  270. },
  271. [`& > ${antCls}-select-focused`]: {
  272. zIndex: 1
  273. },
  274. // update z-index for arrow icon
  275. [`& > ${antCls}-select > ${antCls}-select-arrow`]: {
  276. zIndex: 1 // https://github.com/ant-design/ant-design/issues/20371
  277. },
  278. [`& > *:first-child,
  279. & > ${antCls}-select:first-child > ${antCls}-select-selector,
  280. & > ${antCls}-select-auto-complete:first-child ${componentCls},
  281. & > ${antCls}-cascader-picker:first-child ${componentCls}`]: {
  282. borderStartStartRadius: token.borderRadius,
  283. borderEndStartRadius: token.borderRadius
  284. },
  285. [`& > *:last-child,
  286. & > ${antCls}-select:last-child > ${antCls}-select-selector,
  287. & > ${antCls}-cascader-picker:last-child ${componentCls},
  288. & > ${antCls}-cascader-picker-focused:last-child ${componentCls}`]: {
  289. borderInlineEndWidth: token.lineWidth,
  290. borderStartEndRadius: token.borderRadius,
  291. borderEndEndRadius: token.borderRadius
  292. },
  293. // https://github.com/ant-design/ant-design/issues/12493
  294. [`& > ${antCls}-select-auto-complete ${componentCls}`]: {
  295. verticalAlign: 'top'
  296. },
  297. [`${componentCls}-group-wrapper + ${componentCls}-group-wrapper`]: {
  298. marginInlineStart: token.calc(token.lineWidth).mul(-1).equal(),
  299. [`${componentCls}-affix-wrapper`]: {
  300. borderRadius: 0
  301. }
  302. },
  303. [`${componentCls}-group-wrapper:not(:last-child)`]: {
  304. [`&${componentCls}-search > ${componentCls}-group`]: {
  305. [`& > ${componentCls}-group-addon > ${componentCls}-search-button`]: {
  306. borderRadius: 0
  307. },
  308. [`& > ${componentCls}`]: {
  309. borderStartStartRadius: token.borderRadius,
  310. borderStartEndRadius: 0,
  311. borderEndEndRadius: 0,
  312. borderEndStartRadius: token.borderRadius
  313. }
  314. }
  315. }
  316. })
  317. };
  318. };
  319. exports.genInputGroupStyle = genInputGroupStyle;
  320. const genInputStyle = token => {
  321. const {
  322. componentCls,
  323. controlHeightSM,
  324. lineWidth,
  325. calc
  326. } = token;
  327. const FIXED_CHROME_COLOR_HEIGHT = 16;
  328. const colorSmallPadding = calc(controlHeightSM).sub(calc(lineWidth).mul(2)).sub(FIXED_CHROME_COLOR_HEIGHT).div(2).equal();
  329. return {
  330. [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), genBasicInputStyle(token)), (0, _variants.genOutlinedStyle)(token)), (0, _variants.genFilledStyle)(token)), (0, _variants.genBorderlessStyle)(token)), (0, _variants.genUnderlinedStyle)(token)), {
  331. '&[type="color"]': {
  332. height: token.controlHeight,
  333. [`&${componentCls}-lg`]: {
  334. height: token.controlHeightLG
  335. },
  336. [`&${componentCls}-sm`]: {
  337. height: controlHeightSM,
  338. paddingTop: colorSmallPadding,
  339. paddingBottom: colorSmallPadding
  340. }
  341. },
  342. '&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration': {
  343. appearance: 'none'
  344. }
  345. })
  346. };
  347. };
  348. exports.genInputStyle = genInputStyle;
  349. const genAllowClearStyle = token => {
  350. const {
  351. componentCls
  352. } = token;
  353. return {
  354. // ========================= Input =========================
  355. [`${componentCls}-clear-icon`]: {
  356. margin: 0,
  357. padding: 0,
  358. lineHeight: 0,
  359. color: token.colorTextQuaternary,
  360. fontSize: token.fontSizeIcon,
  361. verticalAlign: -1,
  362. // https://github.com/ant-design/ant-design/pull/18151
  363. // https://codesandbox.io/s/wizardly-sun-u10br
  364. cursor: 'pointer',
  365. transition: `color ${token.motionDurationSlow}`,
  366. border: 'none',
  367. outline: 'none',
  368. backgroundColor: 'transparent',
  369. '&:hover': {
  370. color: token.colorIcon
  371. },
  372. '&:active': {
  373. color: token.colorText
  374. },
  375. '&-hidden': {
  376. visibility: 'hidden'
  377. },
  378. '&-has-suffix': {
  379. margin: `0 ${(0, _cssinjs.unit)(token.inputAffixPadding)}`
  380. }
  381. }
  382. };
  383. };
  384. const genAffixStyle = token => {
  385. const {
  386. componentCls,
  387. inputAffixPadding,
  388. colorTextDescription,
  389. motionDurationSlow,
  390. colorIcon,
  391. colorIconHover,
  392. iconCls
  393. } = token;
  394. const affixCls = `${componentCls}-affix-wrapper`;
  395. const affixClsDisabled = `${componentCls}-affix-wrapper-disabled`;
  396. return {
  397. [affixCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, genBasicInputStyle(token)), {
  398. display: 'inline-flex',
  399. [`&:not(${componentCls}-disabled):hover`]: {
  400. zIndex: 1,
  401. [`${componentCls}-search-with-button &`]: {
  402. zIndex: 0
  403. }
  404. },
  405. '&-focused, &:focus': {
  406. zIndex: 1
  407. },
  408. [`> input${componentCls}`]: {
  409. padding: 0
  410. },
  411. [`> input${componentCls}, > textarea${componentCls}`]: {
  412. fontSize: 'inherit',
  413. border: 'none',
  414. borderRadius: 0,
  415. outline: 'none',
  416. background: 'transparent',
  417. color: 'inherit',
  418. '&::-ms-reveal': {
  419. display: 'none'
  420. },
  421. '&:focus': {
  422. boxShadow: 'none !important'
  423. }
  424. },
  425. '&::before': {
  426. display: 'inline-block',
  427. width: 0,
  428. visibility: 'hidden',
  429. content: '"\\a0"'
  430. },
  431. [componentCls]: {
  432. '&-prefix, &-suffix': {
  433. display: 'flex',
  434. flex: 'none',
  435. alignItems: 'center',
  436. '> *:not(:last-child)': {
  437. marginInlineEnd: token.paddingXS
  438. }
  439. },
  440. '&-show-count-suffix': {
  441. color: colorTextDescription,
  442. direction: 'ltr'
  443. },
  444. '&-show-count-has-suffix': {
  445. marginInlineEnd: token.paddingXXS
  446. },
  447. '&-prefix': {
  448. marginInlineEnd: inputAffixPadding
  449. },
  450. '&-suffix': {
  451. marginInlineStart: inputAffixPadding
  452. }
  453. }
  454. }), genAllowClearStyle(token)), {
  455. // password
  456. [`${iconCls}${componentCls}-password-icon`]: {
  457. color: colorIcon,
  458. cursor: 'pointer',
  459. transition: `all ${motionDurationSlow}`,
  460. '&:hover': {
  461. color: colorIconHover
  462. }
  463. }
  464. }),
  465. // 覆盖 affix-wrapper borderRadius!
  466. [`${componentCls}-underlined`]: {
  467. borderRadius: 0
  468. },
  469. [affixClsDisabled]: {
  470. // password disabled
  471. [`${iconCls}${componentCls}-password-icon`]: {
  472. color: colorIcon,
  473. cursor: 'not-allowed',
  474. '&:hover': {
  475. color: colorIcon
  476. }
  477. }
  478. }
  479. };
  480. };
  481. exports.genAffixStyle = genAffixStyle;
  482. const genGroupStyle = token => {
  483. const {
  484. componentCls,
  485. borderRadiusLG,
  486. borderRadiusSM
  487. } = token;
  488. return {
  489. [`${componentCls}-group`]: Object.assign(Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), genInputGroupStyle(token)), {
  490. '&-rtl': {
  491. direction: 'rtl'
  492. },
  493. '&-wrapper': Object.assign(Object.assign(Object.assign({
  494. display: 'inline-block',
  495. width: '100%',
  496. textAlign: 'start',
  497. verticalAlign: 'top',
  498. '&-rtl': {
  499. direction: 'rtl'
  500. },
  501. // Size
  502. '&-lg': {
  503. [`${componentCls}-group-addon`]: {
  504. borderRadius: borderRadiusLG,
  505. fontSize: token.inputFontSizeLG
  506. }
  507. },
  508. '&-sm': {
  509. [`${componentCls}-group-addon`]: {
  510. borderRadius: borderRadiusSM
  511. }
  512. }
  513. }, (0, _variants.genOutlinedGroupStyle)(token)), (0, _variants.genFilledGroupStyle)(token)), {
  514. // '&-disabled': {
  515. // [`${componentCls}-group-addon`]: {
  516. // ...genDisabledStyle(token),
  517. // },
  518. // },
  519. // Fix the issue of using icons in Space Compact mode
  520. // https://github.com/ant-design/ant-design/issues/42122
  521. [`&:not(${componentCls}-compact-first-item):not(${componentCls}-compact-last-item)${componentCls}-compact-item`]: {
  522. [`${componentCls}, ${componentCls}-group-addon`]: {
  523. borderRadius: 0
  524. }
  525. },
  526. [`&:not(${componentCls}-compact-last-item)${componentCls}-compact-first-item`]: {
  527. [`${componentCls}, ${componentCls}-group-addon`]: {
  528. borderStartEndRadius: 0,
  529. borderEndEndRadius: 0
  530. }
  531. },
  532. [`&:not(${componentCls}-compact-first-item)${componentCls}-compact-last-item`]: {
  533. [`${componentCls}, ${componentCls}-group-addon`]: {
  534. borderStartStartRadius: 0,
  535. borderEndStartRadius: 0
  536. }
  537. },
  538. // Fix the issue of input use show-count param in space compact mode
  539. // https://github.com/ant-design/ant-design/issues/46872
  540. [`&:not(${componentCls}-compact-last-item)${componentCls}-compact-item`]: {
  541. [`${componentCls}-affix-wrapper`]: {
  542. borderStartEndRadius: 0,
  543. borderEndEndRadius: 0
  544. }
  545. },
  546. // Fix the issue of input use `addonAfter` param in space compact mode
  547. // https://github.com/ant-design/ant-design/issues/52483
  548. [`&:not(${componentCls}-compact-first-item)${componentCls}-compact-item`]: {
  549. [`${componentCls}-affix-wrapper`]: {
  550. borderStartStartRadius: 0,
  551. borderEndStartRadius: 0
  552. }
  553. }
  554. })
  555. })
  556. };
  557. };
  558. const genSearchInputStyle = token => {
  559. const {
  560. componentCls,
  561. antCls
  562. } = token;
  563. const searchPrefixCls = `${componentCls}-search`;
  564. return {
  565. [searchPrefixCls]: {
  566. [componentCls]: {
  567. '&:not([disabled]):hover, &:not([disabled]):focus': {
  568. [`+ ${componentCls}-group-addon ${searchPrefixCls}-button:not(${antCls}-btn-color-primary):not(${antCls}-btn-variant-text)`]: {
  569. borderInlineStartColor: token.colorPrimaryHover
  570. }
  571. }
  572. },
  573. [`${componentCls}-affix-wrapper`]: {
  574. height: token.controlHeight,
  575. borderRadius: 0
  576. },
  577. // fix slight height diff in Firefox:
  578. // https://ant.design/components/auto-complete-cn/#auto-complete-demo-certain-category
  579. [`${componentCls}-lg`]: {
  580. lineHeight: token.calc(token.lineHeightLG).sub(0.0002).equal()
  581. },
  582. [`> ${componentCls}-group`]: {
  583. [`> ${componentCls}-group-addon:last-child`]: {
  584. insetInlineStart: -1,
  585. padding: 0,
  586. border: 0,
  587. [`${searchPrefixCls}-button`]: {
  588. // Fix https://github.com/ant-design/ant-design/issues/47150
  589. marginInlineEnd: -1,
  590. borderStartStartRadius: 0,
  591. borderEndStartRadius: 0,
  592. boxShadow: 'none'
  593. },
  594. [`${searchPrefixCls}-button:not(${antCls}-btn-color-primary)`]: {
  595. color: token.colorTextDescription,
  596. '&:not([disabled]):hover': {
  597. color: token.colorPrimaryHover
  598. },
  599. '&:active': {
  600. color: token.colorPrimaryActive
  601. },
  602. [`&${antCls}-btn-loading::before`]: {
  603. inset: 0
  604. }
  605. }
  606. }
  607. },
  608. [`${searchPrefixCls}-button`]: {
  609. height: token.controlHeight,
  610. '&:hover, &:focus': {
  611. zIndex: 1
  612. }
  613. },
  614. '&-large': {
  615. [`${componentCls}-affix-wrapper, ${searchPrefixCls}-button`]: {
  616. height: token.controlHeightLG
  617. }
  618. },
  619. '&-small': {
  620. [`${componentCls}-affix-wrapper, ${searchPrefixCls}-button`]: {
  621. height: token.controlHeightSM
  622. }
  623. },
  624. '&-rtl': {
  625. direction: 'rtl'
  626. },
  627. // ===================== Compact Item Customized Styles =====================
  628. [`&${componentCls}-compact-item`]: {
  629. [`&:not(${componentCls}-compact-last-item)`]: {
  630. [`${componentCls}-group-addon`]: {
  631. [`${componentCls}-search-button`]: {
  632. marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal(),
  633. borderRadius: 0
  634. }
  635. }
  636. },
  637. [`&:not(${componentCls}-compact-first-item)`]: {
  638. [`${componentCls},${componentCls}-affix-wrapper`]: {
  639. borderRadius: 0
  640. }
  641. },
  642. [`> ${componentCls}-group-addon ${componentCls}-search-button,
  643. > ${componentCls},
  644. ${componentCls}-affix-wrapper`]: {
  645. '&:hover, &:focus, &:active': {
  646. zIndex: 2
  647. }
  648. },
  649. [`> ${componentCls}-affix-wrapper-focused`]: {
  650. zIndex: 2
  651. }
  652. }
  653. }
  654. };
  655. };
  656. // ============================== Range ===============================
  657. const genRangeStyle = token => {
  658. const {
  659. componentCls
  660. } = token;
  661. return {
  662. [`${componentCls}-out-of-range`]: {
  663. [`&, & input, & textarea, ${componentCls}-show-count-suffix, ${componentCls}-data-count`]: {
  664. color: token.colorError
  665. }
  666. }
  667. };
  668. };
  669. // ============================== Export ==============================
  670. const useSharedStyle = exports.useSharedStyle = (0, _internal.genStyleHooks)(['Input', 'Shared'], token => {
  671. const inputToken = (0, _internal.mergeToken)(token, (0, _token.initInputToken)(token));
  672. return [genInputStyle(inputToken), genAffixStyle(inputToken)];
  673. }, _token.initComponentToken, {
  674. resetFont: false
  675. });
  676. var _default = exports.default = (0, _internal.genStyleHooks)(['Input', 'Component'], token => {
  677. const inputToken = (0, _internal.mergeToken)(token, (0, _token.initInputToken)(token));
  678. return [genGroupStyle(inputToken), genSearchInputStyle(inputToken), genRangeStyle(inputToken),
  679. // =====================================================
  680. // == Space Compact ==
  681. // =====================================================
  682. (0, _compactItem.genCompactItemStyle)(inputToken)];
  683. }, _token.initComponentToken, {
  684. resetFont: false
  685. });