@skbkontur/react-ui 3.12.0 → 3.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.12.3](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@3.12.2...@skbkontur/react-ui@3.12.3) (2022-04-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **Tooltip:** do not call onOpen after close ([#2849](https://github.com/skbkontur/retail-ui/issues/2849)) ([b1fa877](https://github.com/skbkontur/retail-ui/commit/b1fa877506c122276ebcaee043787031df839d20)), closes [#2848](https://github.com/skbkontur/retail-ui/issues/2848)
12
+
13
+
14
+
15
+
16
+
17
+ ## [3.12.2](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@3.12.1...@skbkontur/react-ui@3.12.2) (2022-03-18)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **DatePicker:** scroll to date ([#2830](https://github.com/skbkontur/retail-ui/issues/2830)) ([9fbd169](https://github.com/skbkontur/retail-ui/commit/9fbd1694199f71ad9337f2e89626320b78bd4e47))
23
+ * **DropdownContainer:** position with relative body (lts) ([#2828](https://github.com/skbkontur/retail-ui/issues/2828)) ([8db4e1c](https://github.com/skbkontur/retail-ui/commit/8db4e1cc6214f2a1bc9d8f02a071881a29f711d0))
24
+
25
+
26
+
27
+
28
+
29
+ ## [3.12.1](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@3.12.0...@skbkontur/react-ui@3.12.1) (2022-03-01)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * **Popup:** correct DOM node extraction ([#2811](https://github.com/skbkontur/retail-ui/issues/2811)) ([#2796](https://github.com/skbkontur/retail-ui/issues/2796)) ([01f951d](https://github.com/skbkontur/retail-ui/commit/01f951d872e2b59a1b049509a9882b24990bbb0e))
35
+
36
+
37
+
38
+
39
+
6
40
  # [3.12.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@3.11.0...@skbkontur/react-ui@3.12.0) (2022-02-22)
7
41
 
8
42
 
@@ -100,9 +100,6 @@ export declare class DatePicker extends React.PureComponent<DatePickerProps<Date
100
100
  state: DatePickerState;
101
101
  private input;
102
102
  private focused;
103
- private internalDate?;
104
- private minDate?;
105
- private maxDate?;
106
103
  private setRootNode;
107
104
  componentDidMount(): void;
108
105
  componentDidUpdate(): void;
@@ -174,9 +174,6 @@ DatePicker = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/fu
174
174
 
175
175
  input = null;_this.
176
176
  focused = false;_this.
177
- internalDate = _this.parseValueToDate(_this.props.value);_this.
178
- minDate = _this.parseValueToDate(_this.props.minDate);_this.
179
- maxDate = _this.parseValueToDate(_this.props.maxDate);_this.
180
177
  setRootNode = void 0;_this.
181
178
 
182
179
 
@@ -237,19 +234,27 @@ DatePicker = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/fu
237
234
 
238
235
 
239
236
 
237
+ renderMain = function (props) {
238
+ var picker = null;var _this$props =
240
239
 
240
+ _this.props,value = _this$props.value,minDate = _this$props.minDate,maxDate = _this$props.maxDate;
241
241
 
242
+ var internalDate = _this.parseValueToDate(value);
243
+ var date = internalDate ? internalDate.toNativeFormat() : null;
244
+
245
+ var parsedMinDate = _this.parseValueToDate(minDate);
246
+ var formattedMinDate = parsedMinDate && parsedMinDate.toNativeFormat() || undefined;
247
+
248
+ var parsedMaxDate = _this.parseValueToDate(maxDate);
249
+ var formattedMaxDate = parsedMaxDate && parsedMaxDate.toNativeFormat() || undefined;
242
250
 
243
- renderMain = function (props) {
244
- var picker = null;
245
- var date = _this.internalDate ? _this.internalDate.toNativeFormat() : null;
246
251
  if (_this.state.opened) {
247
252
  picker = /*#__PURE__*/
248
253
  _react.default.createElement(_DropdownContainer.DropdownContainer, { getParent: _this.getParent, offsetY: 2, align: _this.props.menuAlign }, /*#__PURE__*/
249
254
  _react.default.createElement(_Picker.Picker, {
250
255
  value: date,
251
- minDate: _this.minDate && _this.minDate.toNativeFormat() || undefined,
252
- maxDate: _this.maxDate && _this.maxDate.toNativeFormat() || undefined,
256
+ minDate: formattedMinDate,
257
+ maxDate: formattedMaxDate,
253
258
  onPick: _this.handlePick,
254
259
  onSelect: _this.handleSelect,
255
260
  enableTodayLink: _this.props.enableTodayLink,
@@ -359,7 +364,7 @@ DatePicker = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/fu
359
364
  isHoliday = function (_ref2) {var date = _ref2.date,month = _ref2.month,year = _ref2.year,isWeekend = _ref2.isWeekend;
360
365
  var dateString = _InternalDateTransformer.InternalDateTransformer.dateToInternalString({ date: date, month: month + 1, year: year });
361
366
  return _this.props.isHoliday(dateString, isWeekend);
362
- };return _this;}var _proto = DatePicker.prototype;_proto.componentDidMount = function componentDidMount() {if (this.props.useMobileNativeDatePicker && _client.isMobile) {this.setState({ canUseMobileNativeDatePicker: true });}if (this.props.autoFocus) {this.focus();}};_proto.componentDidUpdate = function componentDidUpdate() {var _this$props = this.props,disabled = _this$props.disabled,value = _this$props.value,minDate = _this$props.minDate,maxDate = _this$props.maxDate;var opened = this.state.opened;if (disabled && opened) {this.close();}this.internalDate = this.parseValueToDate(value);this.minDate = this.parseValueToDate(minDate);this.maxDate = this.parseValueToDate(maxDate);} /**
367
+ };return _this;}var _proto = DatePicker.prototype;_proto.componentDidMount = function componentDidMount() {if (this.props.useMobileNativeDatePicker && _client.isMobile) {this.setState({ canUseMobileNativeDatePicker: true });}if (this.props.autoFocus) {this.focus();}};_proto.componentDidUpdate = function componentDidUpdate() {var disabled = this.props.disabled;var opened = this.state.opened;if (disabled && opened) {this.close();}} /**
363
368
  * @public
364
369
  */;_proto.blur = function blur() {if (this.input) {this.input.blur();}this.handleBlur();} /**
365
370
  * @public
@@ -1 +1 @@
1
- {"version":3,"sources":["DatePicker.tsx"],"names":["INPUT_PASS_PROPS","autoFocus","disabled","warning","error","size","onKeyDown","MIN_WIDTH","DatePicker","rootNode","state","opened","canUseMobileNativeDatePicker","input","focused","internalDate","parseValueToDate","props","value","minDate","maxDate","setRootNode","renderMain","picker","date","toNativeFormat","getParent","menuAlign","undefined","handlePick","handleSelect","enableTodayLink","isHoliday","styles","root","getRootStyle","onMouseEnter","onMouseLeave","onMouseOver","getInputRef","handleBlur","handleFocus","onValueChange","width","minWidth","ref","setState","onFocus","close","onBlur","dateShape","blur","month","year","InternalDateTransformer","dateToInternalString","isWeekend","dateString","componentDidMount","useMobileNativeDatePicker","isMobile","focus","componentDidUpdate","render","InternalDate","validate","checks","InternalDateValidateCheck","NotNull","Native","React","PureComponent","__KONTUR_REACT_UI__","propTypes","PropTypes","bool","string","isRequired","oneOf","oneOfType","number","func","defaultProps","MIN_FULLDATE","MAX_FULLDATE","_day","range","order","InternalDateOrder","DMY","separator","InternalDateSeparator","Dot","setRangeStart","setRangeEnd","parseValue","Number","Limits","Range"],"mappings":"0cAAA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iD;;AAEA,IAAMA,gBAAgB,GAAG;AACvBC,EAAAA,SAAS,EAAE,IADY;AAEvBC,EAAAA,QAAQ,EAAE,IAFa;AAGvBC,EAAAA,OAAO,EAAE,IAHc;AAIvBC,EAAAA,KAAK,EAAE,IAJgB;AAKvBC,EAAAA,IAAI,EAAE,IALiB;AAMvBC,EAAAA,SAAS,EAAE,IANY,EAAzB;;;AASO,IAAMC,SAAS,GAAG,GAAlB,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DMC,U,OADZC,kB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFQC,IAAAA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JkB,CAIJ,IAAI7B,0BAAJ,CAAiB,EAAE9C,KAAK,EAAEC,OAAT,EAAjB,CAJI,EAKlB2E,WALkB,CAKN,IAAI9B,0BAAJ,CAAiB,EAAE9C,KAAK,EAAEE,OAAT,EAAjB,CALM,EAMlB2E,UANkB,CAMP7E,KANO,CAArB,CAQA,OAAOH,YAAY,CAACkD,QAAb,CAAsB,EAC3BC,MAAM,EAAE,CACNC,iCAA0BC,OADpB,EAEND,iCAA0B6B,MAFpB,EAGN7B,iCAA0BE,MAHpB,EAINF,iCAA0B8B,MAJpB,EAKN9B,iCAA0B+B,KALpB,CADmB,EAAtB,CAAP,CASD,C","sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { InternalDate } from '../../lib/date/InternalDate';\nimport { InternalDateTransformer } from '../../lib/date/InternalDateTransformer';\nimport { MAX_FULLDATE, MIN_FULLDATE } from '../../lib/date/constants';\nimport { InternalDateOrder, InternalDateSeparator, InternalDateValidateCheck } from '../../lib/date/types';\nimport { Nullable } from '../../typings/utility-types';\nimport { CalendarDateShape } from '../../internal/Calendar';\nimport { DateInput } from '../DateInput';\nimport { DropdownContainer } from '../../internal/DropdownContainer';\nimport { filterProps } from '../../lib/filterProps';\nimport { CommonWrapper, CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { isMobile } from '../../lib/client';\nimport { NativeDateInput } from '../../internal/NativeDateInput';\nimport { getRootNode, rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { isNonNullable } from '../../lib/utils';\n\nimport { Picker } from './Picker';\nimport { styles } from './DatePicker.styles';\n\nconst INPUT_PASS_PROPS = {\n autoFocus: true,\n disabled: true,\n warning: true,\n error: true,\n size: true,\n onKeyDown: true,\n};\n\nexport const MIN_WIDTH = 120;\n\nexport interface DatePickerProps<T> extends CommonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n enableTodayLink?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n minDate: T;\n maxDate: T;\n menuAlign?: 'left' | 'right';\n size?: 'small' | 'medium' | 'large';\n value?: T | null;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: number | string;\n onBlur?: () => void;\n /**\n * Вызывается при изменении `value`\n *\n * @param value - строка в формате `dd.mm.yyyy`.\n */\n onValueChange: (value: T) => void;\n onFocus?: () => void;\n onKeyDown?: (e: React.KeyboardEvent<any>) => void;\n onMouseEnter?: (e: React.MouseEvent<any>) => void;\n onMouseLeave?: (e: React.MouseEvent<any>) => void;\n onMouseOver?: (e: React.MouseEvent<any>) => void;\n /**\n * Использовать на мобильных устройствах нативный календарь для выбора дат.\n *\n * - На iOS нативный календарь не умеет работать с minDate и maxDate\n */\n useMobileNativeDatePicker?: boolean;\n\n /**\n * Функция для определения праздничных дней\n * @default (_day, isWeekend) => isWeekend\n * @param {T} day - строка в формате `dd.mm.yyyy`\n * @param {boolean} isWeekend - флаг выходного (суббота или воскресенье)\n *\n * @returns {boolean} `true` для выходного или `false` для рабочего дня\n */\n isHoliday: (day: T, isWeekend: boolean) => boolean;\n}\n\nexport interface DatePickerState {\n opened: boolean;\n canUseMobileNativeDatePicker: boolean;\n}\n\ntype DatePickerValue = string;\n\n@rootNode\nexport class DatePicker extends React.PureComponent<DatePickerProps<DatePickerValue>, DatePickerState> {\n public static __KONTUR_REACT_UI__ = 'DatePicker';\n\n public static propTypes = {\n autoFocus: PropTypes.bool,\n\n disabled: PropTypes.bool,\n\n /**\n * Включает кнопку сегодня в календаре\n */\n enableTodayLink: PropTypes.bool,\n\n error: PropTypes.bool,\n\n /**\n * Максимальная дата в календаре.\n */\n maxDate: PropTypes.string.isRequired,\n\n menuAlign: PropTypes.oneOf(['left', 'right'] as Array<'left' | 'right'>),\n\n /**\n * Минимальная дата в календаре.\n */\n minDate: PropTypes.string.isRequired,\n\n /**\n * Строка формата `dd.mm.yyyy`\n */\n value: PropTypes.string,\n\n warning: PropTypes.bool,\n\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n\n onBlur: PropTypes.func,\n\n onValueChange: PropTypes.func.isRequired,\n\n onFocus: PropTypes.func,\n\n onKeyDown: PropTypes.func,\n\n onMouseEnter: PropTypes.func,\n\n onMouseLeave: PropTypes.func,\n\n onMouseOver: PropTypes.func,\n\n isHoliday: PropTypes.func.isRequired,\n };\n\n public static defaultProps = {\n minDate: MIN_FULLDATE,\n maxDate: MAX_FULLDATE,\n isHoliday: (_day: DatePickerValue, isWeekend: boolean) => isWeekend,\n };\n\n public static validate = (value: Nullable<string>, range: { minDate?: string; maxDate?: string } = {}) => {\n if (!value) {\n return false;\n }\n\n const { minDate = MIN_FULLDATE, maxDate = MAX_FULLDATE } = range;\n const internalDate = new InternalDate({\n order: InternalDateOrder.DMY,\n separator: InternalDateSeparator.Dot,\n })\n .setRangeStart(new InternalDate({ value: minDate }))\n .setRangeEnd(new InternalDate({ value: maxDate }))\n .parseValue(value);\n\n return internalDate.validate({\n checks: [\n InternalDateValidateCheck.NotNull,\n InternalDateValidateCheck.Number,\n InternalDateValidateCheck.Native,\n InternalDateValidateCheck.Limits,\n InternalDateValidateCheck.Range,\n ],\n });\n };\n\n public state: DatePickerState = { opened: false, canUseMobileNativeDatePicker: false };\n\n private input: DateInput | null = null;\n private focused = false;\n private internalDate?: InternalDate = this.parseValueToDate(this.props.value);\n private minDate?: InternalDate = this.parseValueToDate(this.props.minDate);\n private maxDate?: InternalDate = this.parseValueToDate(this.props.maxDate);\n private setRootNode!: TSetRootNode;\n\n public componentDidMount() {\n if (this.props.useMobileNativeDatePicker && isMobile) {\n this.setState({\n canUseMobileNativeDatePicker: true,\n });\n }\n if (this.props.autoFocus) {\n this.focus();\n }\n }\n\n public componentDidUpdate() {\n const { disabled, value, minDate, maxDate } = this.props;\n const { opened } = this.state;\n if (disabled && opened) {\n this.close();\n }\n this.internalDate = this.parseValueToDate(value);\n this.minDate = this.parseValueToDate(minDate);\n this.maxDate = this.parseValueToDate(maxDate);\n }\n\n /**\n * @public\n */\n public blur() {\n if (this.input) {\n this.input.blur();\n }\n this.handleBlur();\n }\n\n /**\n * @public\n */\n public focus() {\n if (this.props.disabled) {\n return;\n }\n if (this.input) {\n this.input.focus();\n }\n this.handleFocus();\n }\n\n /**\n * Закрывает выпадашку выбора дня\n * @public\n */\n public close() {\n this.setState({ opened: false });\n }\n\n public render() {\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n {this.renderMain}\n </CommonWrapper>\n );\n }\n\n public renderMain = (props: CommonWrapperRestProps<DatePickerProps<DatePickerValue>>) => {\n let picker = null;\n const date = this.internalDate ? this.internalDate.toNativeFormat() : null;\n if (this.state.opened) {\n picker = (\n <DropdownContainer getParent={this.getParent} offsetY={2} align={this.props.menuAlign}>\n <Picker\n value={date}\n minDate={(this.minDate && this.minDate.toNativeFormat()) || undefined}\n maxDate={(this.maxDate && this.maxDate.toNativeFormat()) || undefined}\n onPick={this.handlePick}\n onSelect={this.handleSelect}\n enableTodayLink={this.props.enableTodayLink}\n isHoliday={this.isHoliday}\n />\n </DropdownContainer>\n );\n }\n\n return (\n <label\n className={styles.root()}\n style={this.getRootStyle()}\n onMouseEnter={this.props.onMouseEnter}\n onMouseLeave={this.props.onMouseLeave}\n onMouseOver={this.props.onMouseOver}\n >\n <DateInput\n {...filterProps(props, INPUT_PASS_PROPS)}\n ref={this.getInputRef}\n value={this.props.value || ''}\n width=\"100%\"\n withIcon\n minDate={this.props.minDate}\n maxDate={this.props.maxDate}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onValueChange={this.props.onValueChange}\n />\n {this.state.canUseMobileNativeDatePicker && (\n <NativeDateInput\n onValueChange={this.props.onValueChange}\n value={this.props.value || ''}\n minDate={this.props.minDate}\n maxDate={this.props.maxDate}\n disabled={this.props.disabled}\n />\n )}\n {!this.state.canUseMobileNativeDatePicker && picker}\n </label>\n );\n };\n\n public getParent = () => {\n return getRootNode(this);\n };\n\n private getRootStyle = () => {\n const { width } = this.props;\n return isNonNullable(width) ? { width } : { minWidth: MIN_WIDTH };\n };\n\n private getInputRef = (ref: DateInput | null) => {\n this.input = ref;\n };\n\n private parseValueToDate(value?: Nullable<string>): InternalDate | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n const date = new InternalDate({ value });\n if (date.validate({ checks: [InternalDateValidateCheck.NotNull, InternalDateValidateCheck.Native] })) {\n return date;\n }\n return undefined;\n }\n\n private handleFocus = () => {\n if (this.focused) {\n return;\n }\n\n this.focused = true;\n\n this.setState({ opened: true });\n\n if (this.props.onFocus) {\n this.props.onFocus();\n }\n };\n\n private handleBlur = () => {\n if (!this.focused) {\n return;\n }\n\n this.focused = false;\n this.close();\n\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n };\n\n private handlePick = (dateShape: CalendarDateShape) => {\n this.handleSelect(dateShape);\n this.blur();\n };\n\n private handleSelect = ({ date, month, year }: CalendarDateShape) => {\n const value = InternalDateTransformer.dateToInternalString({ date, month: month + 1, year });\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n };\n\n private isHoliday = ({ date, month, year, isWeekend }: CalendarDateShape & { isWeekend: boolean }) => {\n const dateString = InternalDateTransformer.dateToInternalString({ date, month: month + 1, year });\n return this.props.isHoliday(dateString, isWeekend);\n };\n}\n"]}
1
+ {"version":3,"sources":["DatePicker.tsx"],"names":["INPUT_PASS_PROPS","autoFocus","disabled","warning","error","size","onKeyDown","MIN_WIDTH","DatePicker","rootNode","state","opened","canUseMobileNativeDatePicker","input","focused","setRootNode","renderMain","props","picker","value","minDate","maxDate","internalDate","parseValueToDate","date","toNativeFormat","parsedMinDate","formattedMinDate","undefined","parsedMaxDate","formattedMaxDate","getParent","menuAlign","handlePick","handleSelect","enableTodayLink","isHoliday","styles","root","getRootStyle","onMouseEnter","onMouseLeave","onMouseOver","getInputRef","handleBlur","handleFocus","onValueChange","width","minWidth","ref","setState","onFocus","close","onBlur","dateShape","blur","month","year","InternalDateTransformer","dateToInternalString","isWeekend","dateString","componentDidMount","useMobileNativeDatePicker","isMobile","focus","componentDidUpdate","render","InternalDate","validate","checks","InternalDateValidateCheck","NotNull","Native","React","PureComponent","__KONTUR_REACT_UI__","propTypes","PropTypes","bool","string","isRequired","oneOf","oneOfType","number","func","defaultProps","MIN_FULLDATE","MAX_FULLDATE","_day","range","order","InternalDateOrder","DMY","separator","InternalDateSeparator","Dot","setRangeStart","setRangeEnd","parseValue","Number","Limits","Range"],"mappings":"0cAAA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iD;;AAEA,IAAMA,gBAAgB,GAAG;AACvBC,EAAAA,SAAS,EAAE,IADY;AAEvBC,EAAAA,QAAQ,EAAE,IAFa;AAGvBC,EAAAA,OAAO,EAAE,IAHc;AAIvBC,EAAAA,KAAK,EAAE,IAJgB;AAKvBC,EAAAA,IAAI,EAAE,IALiB;AAMvBC,EAAAA,SAAS,EAAE,IANY,EAAzB;;;AASO,IAAMC,SAAS,GAAG,GAAlB,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DMC,U,OADZC,kB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFQC,IAAAA,K,GAAyB,EAAEC,MAAM,EAAE,KAAV,EAAiBC,4BAA4B,EAAE,KAA/C,E;;AAExBC,IAAAA,K,GAA0B,I;AAC1BC,IAAAA,O,GAAU,K;AACVC,IAAAA,W;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DDC,IAAAA,U,GAAa,UAACC,KAAD,EAAqE;AACvF,UAAIC,MAAM,GAAG,IAAb,CADuF;;AAGnD,YAAKD,KAH8C,CAG/EE,KAH+E,eAG/EA,KAH+E,CAGxEC,OAHwE,eAGxEA,OAHwE,CAG/DC,OAH+D,eAG/DA,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mBAAUO,IA3CA,EA6CxB3C,WAAW,EAAEoC,mBAAUO,IA7CC,EA+CxBjD,SAAS,EAAE0C,mBAAUO,IAAV,CAAeJ,UA/CF,E,UAkDZK,Y,GAAe,EAC3BlE,OAAO,EAAEmE,uBADkB,EAE3BlE,OAAO,EAAEmE,uBAFkB,EAG3BpD,SAAS,EAAE,mBAACqD,IAAD,EAAwB7B,SAAxB,UAA+CA,SAA/C,EAHgB,E,UAMfS,Q,GAAW,UAAClD,KAAD,EAA0BuE,KAA1B,EAAiF,KAAvDA,KAAuD,cAAvDA,KAAuD,GAAP,EAAO,EACxG,IAAI,CAACvE,KAAL,EAAY,CACV,OAAO,KAAP,CACD,CAHuG,aAK7CuE,KAL6C,yBAKhGtE,OALgG,CAKhGA,OALgG,+BAKtFmE,uBALsF,0CAKxElE,OALwE,CAKxEA,OALwE,+BAK9DmE,uBAL8D,kBAMxG,IAAMlE,YAAY,GAAG,IAAI8C,0BAAJ,CAAiB,EACpCuB,KAAK,EAAEC,yBAAkBC,GADW,EAEpCC,SAAS,EAAEC,6BAAsBC,GAFG,EAAjB,EAIlBC,aAJkB,CAIJ,IAAI7B,0BAAJ,CAAiB,EAAEjD,KAAK,EAAEC,OAAT,EAAjB,CAJI,EAKlB8E,WALkB,CAKN,IAAI9B,0BAAJ,CAAiB,EAAEjD,KAAK,EAAEE,OAAT,EAAjB,CALM,EAMlB8E,UANkB,CAMPhF,KANO,CAArB,CAQA,OAAOG,YAAY,CAAC+C,QAAb,CAAsB,EAC3BC,MAAM,EAAE,CACNC,iCAA0BC,OADpB,EAEND,iCAA0B6B,MAFpB,EAGN7B,iCAA0BE,MAHpB,EAINF,iCAA0B8B,MAJpB,EAKN9B,iCAA0B+B,KALpB,CADmB,EAAtB,CAAP,CASD,C","sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { InternalDate } from '../../lib/date/InternalDate';\nimport { InternalDateTransformer } from '../../lib/date/InternalDateTransformer';\nimport { MAX_FULLDATE, MIN_FULLDATE } from '../../lib/date/constants';\nimport { InternalDateOrder, InternalDateSeparator, InternalDateValidateCheck } from '../../lib/date/types';\nimport { Nullable } from '../../typings/utility-types';\nimport { CalendarDateShape } from '../../internal/Calendar';\nimport { DateInput } from '../DateInput';\nimport { DropdownContainer } from '../../internal/DropdownContainer';\nimport { filterProps } from '../../lib/filterProps';\nimport { CommonWrapper, CommonProps, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { isMobile } from '../../lib/client';\nimport { NativeDateInput } from '../../internal/NativeDateInput';\nimport { getRootNode, rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { isNonNullable } from '../../lib/utils';\n\nimport { Picker } from './Picker';\nimport { styles } from './DatePicker.styles';\n\nconst INPUT_PASS_PROPS = {\n autoFocus: true,\n disabled: true,\n warning: true,\n error: true,\n size: true,\n onKeyDown: true,\n};\n\nexport const MIN_WIDTH = 120;\n\nexport interface DatePickerProps<T> extends CommonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n enableTodayLink?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n minDate: T;\n maxDate: T;\n menuAlign?: 'left' | 'right';\n size?: 'small' | 'medium' | 'large';\n value?: T | null;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: number | string;\n onBlur?: () => void;\n /**\n * Вызывается при изменении `value`\n *\n * @param value - строка в формате `dd.mm.yyyy`.\n */\n onValueChange: (value: T) => void;\n onFocus?: () => void;\n onKeyDown?: (e: React.KeyboardEvent<any>) => void;\n onMouseEnter?: (e: React.MouseEvent<any>) => void;\n onMouseLeave?: (e: React.MouseEvent<any>) => void;\n onMouseOver?: (e: React.MouseEvent<any>) => void;\n /**\n * Использовать на мобильных устройствах нативный календарь для выбора дат.\n *\n * - На iOS нативный календарь не умеет работать с minDate и maxDate\n */\n useMobileNativeDatePicker?: boolean;\n\n /**\n * Функция для определения праздничных дней\n * @default (_day, isWeekend) => isWeekend\n * @param {T} day - строка в формате `dd.mm.yyyy`\n * @param {boolean} isWeekend - флаг выходного (суббота или воскресенье)\n *\n * @returns {boolean} `true` для выходного или `false` для рабочего дня\n */\n isHoliday: (day: T, isWeekend: boolean) => boolean;\n}\n\nexport interface DatePickerState {\n opened: boolean;\n canUseMobileNativeDatePicker: boolean;\n}\n\ntype DatePickerValue = string;\n\n@rootNode\nexport class DatePicker extends React.PureComponent<DatePickerProps<DatePickerValue>, DatePickerState> {\n public static __KONTUR_REACT_UI__ = 'DatePicker';\n\n public static propTypes = {\n autoFocus: PropTypes.bool,\n\n disabled: PropTypes.bool,\n\n /**\n * Включает кнопку сегодня в календаре\n */\n enableTodayLink: PropTypes.bool,\n\n error: PropTypes.bool,\n\n /**\n * Максимальная дата в календаре.\n */\n maxDate: PropTypes.string.isRequired,\n\n menuAlign: PropTypes.oneOf(['left', 'right'] as Array<'left' | 'right'>),\n\n /**\n * Минимальная дата в календаре.\n */\n minDate: PropTypes.string.isRequired,\n\n /**\n * Строка формата `dd.mm.yyyy`\n */\n value: PropTypes.string,\n\n warning: PropTypes.bool,\n\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n\n onBlur: PropTypes.func,\n\n onValueChange: PropTypes.func.isRequired,\n\n onFocus: PropTypes.func,\n\n onKeyDown: PropTypes.func,\n\n onMouseEnter: PropTypes.func,\n\n onMouseLeave: PropTypes.func,\n\n onMouseOver: PropTypes.func,\n\n isHoliday: PropTypes.func.isRequired,\n };\n\n public static defaultProps = {\n minDate: MIN_FULLDATE,\n maxDate: MAX_FULLDATE,\n isHoliday: (_day: DatePickerValue, isWeekend: boolean) => isWeekend,\n };\n\n public static validate = (value: Nullable<string>, range: { minDate?: string; maxDate?: string } = {}) => {\n if (!value) {\n return false;\n }\n\n const { minDate = MIN_FULLDATE, maxDate = MAX_FULLDATE } = range;\n const internalDate = new InternalDate({\n order: InternalDateOrder.DMY,\n separator: InternalDateSeparator.Dot,\n })\n .setRangeStart(new InternalDate({ value: minDate }))\n .setRangeEnd(new InternalDate({ value: maxDate }))\n .parseValue(value);\n\n return internalDate.validate({\n checks: [\n InternalDateValidateCheck.NotNull,\n InternalDateValidateCheck.Number,\n InternalDateValidateCheck.Native,\n InternalDateValidateCheck.Limits,\n InternalDateValidateCheck.Range,\n ],\n });\n };\n\n public state: DatePickerState = { opened: false, canUseMobileNativeDatePicker: false };\n\n private input: DateInput | null = null;\n private focused = false;\n private setRootNode!: TSetRootNode;\n\n public componentDidMount() {\n if (this.props.useMobileNativeDatePicker && isMobile) {\n this.setState({\n canUseMobileNativeDatePicker: true,\n });\n }\n if (this.props.autoFocus) {\n this.focus();\n }\n }\n\n public componentDidUpdate() {\n const { disabled } = this.props;\n const { opened } = this.state;\n if (disabled && opened) {\n this.close();\n }\n }\n\n /**\n * @public\n */\n public blur() {\n if (this.input) {\n this.input.blur();\n }\n this.handleBlur();\n }\n\n /**\n * @public\n */\n public focus() {\n if (this.props.disabled) {\n return;\n }\n if (this.input) {\n this.input.focus();\n }\n this.handleFocus();\n }\n\n /**\n * Закрывает выпадашку выбора дня\n * @public\n */\n public close() {\n this.setState({ opened: false });\n }\n\n public render() {\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n {this.renderMain}\n </CommonWrapper>\n );\n }\n\n public renderMain = (props: CommonWrapperRestProps<DatePickerProps<DatePickerValue>>) => {\n let picker = null;\n\n const { value, minDate, maxDate } = this.props;\n\n const internalDate = this.parseValueToDate(value);\n const date = internalDate ? internalDate.toNativeFormat() : null;\n\n const parsedMinDate = this.parseValueToDate(minDate);\n const formattedMinDate = (parsedMinDate && parsedMinDate.toNativeFormat()) || undefined;\n\n const parsedMaxDate = this.parseValueToDate(maxDate);\n const formattedMaxDate = (parsedMaxDate && parsedMaxDate.toNativeFormat()) || undefined;\n\n if (this.state.opened) {\n picker = (\n <DropdownContainer getParent={this.getParent} offsetY={2} align={this.props.menuAlign}>\n <Picker\n value={date}\n minDate={formattedMinDate}\n maxDate={formattedMaxDate}\n onPick={this.handlePick}\n onSelect={this.handleSelect}\n enableTodayLink={this.props.enableTodayLink}\n isHoliday={this.isHoliday}\n />\n </DropdownContainer>\n );\n }\n\n return (\n <label\n className={styles.root()}\n style={this.getRootStyle()}\n onMouseEnter={this.props.onMouseEnter}\n onMouseLeave={this.props.onMouseLeave}\n onMouseOver={this.props.onMouseOver}\n >\n <DateInput\n {...filterProps(props, INPUT_PASS_PROPS)}\n ref={this.getInputRef}\n value={this.props.value || ''}\n width=\"100%\"\n withIcon\n minDate={this.props.minDate}\n maxDate={this.props.maxDate}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onValueChange={this.props.onValueChange}\n />\n {this.state.canUseMobileNativeDatePicker && (\n <NativeDateInput\n onValueChange={this.props.onValueChange}\n value={this.props.value || ''}\n minDate={this.props.minDate}\n maxDate={this.props.maxDate}\n disabled={this.props.disabled}\n />\n )}\n {!this.state.canUseMobileNativeDatePicker && picker}\n </label>\n );\n };\n\n public getParent = () => {\n return getRootNode(this);\n };\n\n private getRootStyle = () => {\n const { width } = this.props;\n return isNonNullable(width) ? { width } : { minWidth: MIN_WIDTH };\n };\n\n private getInputRef = (ref: DateInput | null) => {\n this.input = ref;\n };\n\n private parseValueToDate(value?: Nullable<string>): InternalDate | undefined {\n if (value === undefined || value === null) {\n return undefined;\n }\n const date = new InternalDate({ value });\n if (date.validate({ checks: [InternalDateValidateCheck.NotNull, InternalDateValidateCheck.Native] })) {\n return date;\n }\n return undefined;\n }\n\n private handleFocus = () => {\n if (this.focused) {\n return;\n }\n\n this.focused = true;\n\n this.setState({ opened: true });\n\n if (this.props.onFocus) {\n this.props.onFocus();\n }\n };\n\n private handleBlur = () => {\n if (!this.focused) {\n return;\n }\n\n this.focused = false;\n this.close();\n\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n };\n\n private handlePick = (dateShape: CalendarDateShape) => {\n this.handleSelect(dateShape);\n this.blur();\n };\n\n private handleSelect = ({ date, month, year }: CalendarDateShape) => {\n const value = InternalDateTransformer.dateToInternalString({ date, month: month + 1, year });\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n };\n\n private isHoliday = ({ date, month, year, isWeekend }: CalendarDateShape & { isWeekend: boolean }) => {\n const dateString = InternalDateTransformer.dateToInternalString({ date, month: month + 1, year });\n return this.props.isHoliday(dateString, isWeekend);\n };\n}\n"]}
@@ -270,7 +270,7 @@ class AnchorTooltipExample extends React.Component {
270
270
  return (
271
271
  <>
272
272
  {this.state.anchor ? (
273
- <Tooltip anchorElement={this.state.anchor} render={() => 'Hello React'} trigger="opened" />
273
+ <Tooltip anchorElement={this.state.anchor} render={() => 'Hello React'} trigger="hover" />
274
274
  ) : null}
275
275
  <div style={containerStyle}>
276
276
  {this.state.blocks.map(({ top, left }, i) => (
@@ -28,10 +28,10 @@ export declare class DropdownContainer extends React.PureComponent<DropdownConta
28
28
  offsetX: number;
29
29
  offsetY: number;
30
30
  };
31
- state: DropdownContainerState;
32
31
  private getProps;
33
32
  private dom;
34
33
  private layoutSub;
34
+ constructor(props: DropdownContainerProps);
35
35
  componentDidMount(): void;
36
36
  componentWillUnmount(): void;
37
37
  render(): JSX.Element;
@@ -33,7 +33,7 @@ var _DropdownContainer = require("./DropdownContainer.styles");var
33
33
 
34
34
 
35
35
 
36
- DropdownContainer = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.default)(DropdownContainer, _React$PureComponent);function DropdownContainer() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;_this.
36
+ DropdownContainer = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.default)(DropdownContainer, _React$PureComponent);
37
37
 
38
38
 
39
39
 
@@ -43,22 +43,13 @@ DropdownContainer = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsL
43
43
 
44
44
 
45
45
 
46
- state = {
47
- position: null,
48
- minWidth: 0,
49
- isDocumentElementRoot: true };_this.
50
-
51
-
52
- getProps = (0, _createPropsGetter.createPropsGetter)(DropdownContainer.defaultProps);_this.
53
-
54
- dom = void 0;_this.
55
- layoutSub = void 0;_this.
56
-
57
46
 
58
47
 
59
48
 
60
49
 
61
50
 
51
+ function DropdownContainer(props) {var _this;
52
+ _this = _React$PureComponent.call(this, props) || this;_this.getProps = (0, _createPropsGetter.createPropsGetter)(DropdownContainer.defaultProps);_this.dom = void 0;_this.layoutSub = void 0;_this.
62
53
 
63
54
 
64
55
 
@@ -207,4 +198,15 @@ DropdownContainer = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsL
207
198
  left: offsetX,
208
199
  right: null };
209
200
 
210
- };return _this;}var _proto = DropdownContainer.prototype;_proto.componentDidMount = function componentDidMount() {this.position();this.layoutSub = LayoutEvents.addListener(this.position);var _document2 = document,body = _document2.body,docEl = _document2.documentElement;var htmlPosition = getComputedStyle(docEl).position;var bodyPosition = getComputedStyle(body).position;var hasLimitedHeightRoot = body.scrollHeight > body.clientHeight;var hasStaticRoot = htmlPosition === 'static' && bodyPosition === 'static';this.setState({ isDocumentElementRoot: hasLimitedHeightRoot || hasStaticRoot });};_proto.componentWillUnmount = function componentWillUnmount() {if (this.layoutSub) {this.layoutSub.remove();}};_proto.render = function render() {var _cx;var style = { position: 'absolute', top: '0' };if (this.state.position) {var _this$state$position = this.state.position,top = _this$state$position.top,bottom = _this$state$position.bottom,left = _this$state$position.left,right = _this$state$position.right;style = (0, _extends2.default)({}, style, { top: top !== null ? top : undefined, bottom: bottom !== null ? bottom : undefined, left: left !== null ? left : undefined, right: right !== null ? right : undefined, minWidth: this.state.minWidth, maxWidth: this.props.hasFixedWidth ? this.state.minWidth : undefined });}var content = /*#__PURE__*/_react.default.createElement(_ZIndex.ZIndex, { priority: 'DropdownContainer', wrapperRef: this.ZIndexRef, style: style, className: (0, _Emotion.cx)((_cx = {}, _cx[_DropdownContainer.styles.alignRight()] = this.props.align === 'right' && !_client.isIE11, _cx)) }, this.props.children);return this.props.disablePortal ? content : /*#__PURE__*/_react.default.createElement(_RenderContainer.RenderContainer, null, content);};return DropdownContainer;}(_react.default.PureComponent);exports.DropdownContainer = DropdownContainer;DropdownContainer.__KONTUR_REACT_UI__ = 'DropdownContainer';DropdownContainer.defaultProps = { align: 'left', disablePortal: false, offsetX: 0, offsetY: -1 };
201
+ };_this.state = { position: null, minWidth: 0, isDocumentElementRoot: getIsDocumentElementRoot() };return _this;}var _proto = DropdownContainer.prototype;_proto.componentDidMount = function componentDidMount() {this.position();this.layoutSub = LayoutEvents.addListener(this.position);};_proto.componentWillUnmount = function componentWillUnmount() {if (this.layoutSub) {this.layoutSub.remove();}};_proto.render = function render() {var _cx;var style = { position: 'absolute', top: '0' };if (this.state.position) {var _this$state$position = this.state.position,top = _this$state$position.top,bottom = _this$state$position.bottom,left = _this$state$position.left,right = _this$state$position.right;style = (0, _extends2.default)({}, style, { top: top !== null ? top : undefined, bottom: bottom !== null ? bottom : undefined, left: left !== null ? left : undefined, right: right !== null ? right : undefined, minWidth: this.state.minWidth, maxWidth: this.props.hasFixedWidth ? this.state.minWidth : undefined });}var content = /*#__PURE__*/_react.default.createElement(_ZIndex.ZIndex, { priority: 'DropdownContainer', wrapperRef: this.ZIndexRef, style: style, className: (0, _Emotion.cx)((_cx = {}, _cx[_DropdownContainer.styles.alignRight()] = this.props.align === 'right' && !_client.isIE11, _cx)) }, this.props.children);return this.props.disablePortal ? content : /*#__PURE__*/_react.default.createElement(_RenderContainer.RenderContainer, null, content);};return DropdownContainer;}(_react.default.PureComponent);exports.DropdownContainer = DropdownContainer;DropdownContainer.__KONTUR_REACT_UI__ = 'DropdownContainer';DropdownContainer.defaultProps = { align: 'left', disablePortal: false, offsetX: 0, offsetY: -1 };
202
+
203
+
204
+ var getIsDocumentElementRoot = function getIsDocumentElementRoot() {var _document2 =
205
+ document,body = _document2.body,documentElement = _document2.documentElement;
206
+ var htmlPosition = getComputedStyle(documentElement).position;
207
+ var bodyPosition = getComputedStyle(body).position;
208
+
209
+ var hasLimitedHeightRoot = body.scrollHeight > body.clientHeight;
210
+ var hasStaticRoot = htmlPosition === 'static' && bodyPosition === 'static';
211
+ return hasLimitedHeightRoot || hasStaticRoot;
212
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["DropdownContainer.tsx"],"names":["DropdownContainer","state","position","minWidth","isDocumentElementRoot","getProps","defaultProps","dom","layoutSub","ZIndexRef","element","isElement","node","Element","target","props","getParent","targetRect","getBoundingClientRect","document","body","docEl","documentElement","Error","scrollX","window","pageXOffset","scrollLeft","scrollY","pageYOffset","scrollTop","left","right","align","docWidth","offsetWidth","offsetX","offsetY","bottom","top","distanceToBottom","clientHeight","dropdownHeight","getHeight","scrollHeight","setState","getMinWidth","disablePortal","convertToRelativePosition","child","children","item","height","width","targetHeight","componentDidMount","LayoutEvents","addListener","htmlPosition","getComputedStyle","bodyPosition","hasLimitedHeightRoot","hasStaticRoot","componentWillUnmount","remove","render","style","undefined","maxWidth","hasFixedWidth","content","styles","alignRight","isIE11","React","PureComponent","__KONTUR_REACT_UI__"],"mappings":"saAAA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,+D;;;;;;;;;;;;;;;;;;;;;;;;;AAyBaA,iB;;;;;;;;;;AAUJC,IAAAA,K,GAAgC;AACrCC,MAAAA,QAAQ,EAAE,IAD2B;AAErCC,MAAAA,QAAQ,EAAE,CAF2B;AAGrCC,MAAAA,qBAAqB,EAAE,IAHc,E;;;AAM/BC,IAAAA,Q,GAAW,0CAAkBL,iBAAiB,CAACM,YAApC,C;;AAEXC,IAAAA,G;AACAC,IAAAA,S;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDAC,IAAAA,S,GAAY,UAACC,OAAD,EAAuC;AACzD,YAAKH,GAAL,GAAWG,OAAX;AACD,K;;AAEOC,IAAAA,S,GAAY,UAACC,IAAD,EAA8C;AAChE,aAAOA,IAAI,YAAYC,OAAvB;AACD,K;;AAEMX,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K,EAAEA,KAAK,KAAK,IAAV,GAAiBA,KAAjB,GAAyBmC,SAL7B,EAMHhE,QAAQ,EAAE,KAAKF,KAAL,CAAWE,QANlB,EAOHiE,QAAQ,EAAE,KAAKrD,KAAL,CAAWsD,aAAX,GAA2B,KAAKpE,KAAL,CAAWE,QAAtC,GAAiDgE,SAPxD,GAAL,CASD,CAED,IAAMG,OAAO,gBACX,6BAAC,cAAD,IACE,QAAQ,EAAE,mBADZ,EAEE,UAAU,EAAE,KAAK7D,SAFnB,EAGE,KAAK,EAAEyD,KAHT,EAIE,SAAS,EAAE,gCACRK,0BAAOC,UAAP,EADQ,IACc,KAAKzD,KAAL,CAAWkB,KAAX,KAAqB,OAArB,IAAgC,CAACwC,cAD/C,OAJb,IAQG,KAAK1D,KAAL,CAAWmC,QARd,CADF,CAaA,OAAO,KAAKnC,KAAL,CAAWgC,aAAX,GAA2BuB,OAA3B,gBAAqC,6BAAC,gCAAD,QAAkBA,OAAlB,CAA5C,CACD,C,4BAzEoCI,eAAMC,a,gDAAhC3E,iB,CACG4E,mB,GAAsB,mB,CADzB5E,iB,CAGGM,Y,GAAe,EAC3B2B,KAAK,EAAE,MADoB,EAE3Bc,aAAa,EAAE,KAFY,EAG3BX,OAAO,EAAE,CAHkB,EAI3BC,OAAO,EAAE,CAAC,CAJiB,E","sourcesContent":["import React from 'react';\n\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { RenderContainer } from '../RenderContainer';\nimport { ZIndex } from '../ZIndex';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { Nullable } from '../../typings/utility-types';\nimport { cx } from '../../lib/theming/Emotion';\nimport { isIE11 } from '../../lib/client';\n\nimport { styles } from './DropdownContainer.styles';\n\nexport interface DropdownContainerPosition {\n top: Nullable<number>;\n bottom: Nullable<number>;\n left: Nullable<number>;\n right: Nullable<number>;\n}\n\nexport interface DropdownContainerProps {\n align?: 'left' | 'right';\n getParent: () => Nullable<HTMLElement>;\n children?: React.ReactNode;\n disablePortal?: boolean;\n offsetY?: number;\n offsetX?: number;\n hasFixedWidth?: boolean;\n}\n\nexport interface DropdownContainerState {\n position: Nullable<DropdownContainerPosition>;\n minWidth: number;\n isDocumentElementRoot?: boolean;\n}\n\nexport class DropdownContainer extends React.PureComponent<DropdownContainerProps, DropdownContainerState> {\n public static __KONTUR_REACT_UI__ = 'DropdownContainer';\n\n public static defaultProps = {\n align: 'left',\n disablePortal: false,\n offsetX: 0,\n offsetY: -1,\n };\n\n public state: DropdownContainerState = {\n position: null,\n minWidth: 0,\n isDocumentElementRoot: true,\n };\n\n private getProps = createPropsGetter(DropdownContainer.defaultProps);\n\n private dom: Nullable<HTMLDivElement>;\n private layoutSub: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n\n public componentDidMount() {\n this.position();\n this.layoutSub = LayoutEvents.addListener(this.position);\n\n const { body, documentElement: docEl } = document;\n const htmlPosition = getComputedStyle(docEl).position;\n const bodyPosition = getComputedStyle(body).position;\n\n const hasLimitedHeightRoot = body.scrollHeight > body.clientHeight;\n const hasStaticRoot = htmlPosition === 'static' && bodyPosition === 'static';\n\n this.setState({ isDocumentElementRoot: hasLimitedHeightRoot || hasStaticRoot });\n }\n\n public componentWillUnmount() {\n if (this.layoutSub) {\n this.layoutSub.remove();\n }\n }\n\n public render() {\n let style: React.CSSProperties = {\n position: 'absolute',\n top: '0',\n };\n if (this.state.position) {\n const { top, bottom, left, right } = this.state.position;\n style = {\n ...style,\n top: top !== null ? top : undefined,\n bottom: bottom !== null ? bottom : undefined,\n left: left !== null ? left : undefined,\n right: right !== null ? right : undefined,\n minWidth: this.state.minWidth,\n maxWidth: this.props.hasFixedWidth ? this.state.minWidth : undefined,\n };\n }\n\n const content = (\n <ZIndex\n priority={'DropdownContainer'}\n wrapperRef={this.ZIndexRef}\n style={style}\n className={cx({\n [styles.alignRight()]: this.props.align === 'right' && !isIE11,\n })}\n >\n {this.props.children}\n </ZIndex>\n );\n\n return this.props.disablePortal ? content : <RenderContainer>{content}</RenderContainer>;\n }\n\n private ZIndexRef = (element: Nullable<HTMLDivElement>) => {\n this.dom = element;\n };\n\n private isElement = (node: Nullable<Element>): node is Element => {\n return node instanceof Element;\n };\n\n public position = () => {\n const target = this.props.getParent();\n const dom = this.dom;\n\n if (target && this.isElement(target) && dom) {\n const targetRect = target.getBoundingClientRect();\n const { body, documentElement: docEl } = document;\n\n if (!docEl) {\n throw Error('There is no \"documentElement\" in \"document\"');\n }\n\n const scrollX = window.pageXOffset || docEl.scrollLeft || 0;\n const scrollY = window.pageYOffset || docEl.scrollTop || 0;\n\n let left = null;\n let right = null;\n\n if (this.props.align === 'right') {\n const docWidth = docEl.offsetWidth || 0;\n right = docWidth - (targetRect.right + scrollX) + this.getProps().offsetX;\n } else {\n left = targetRect.left + scrollX + this.getProps().offsetX;\n }\n\n const { offsetY = 0 } = this.props;\n let bottom = null;\n let top: number | null = targetRect.bottom + scrollY + offsetY;\n\n const distanceToBottom = docEl.clientHeight - targetRect.bottom;\n const dropdownHeight = this.getHeight();\n\n if (distanceToBottom < dropdownHeight && targetRect.top > dropdownHeight) {\n const clientHeight = this.state.isDocumentElementRoot ? docEl.clientHeight : body.scrollHeight;\n\n top = null;\n bottom = clientHeight + offsetY - scrollY - targetRect.top;\n }\n\n const position = {\n top,\n left,\n right,\n bottom,\n };\n\n this.setState({\n minWidth: this.getMinWidth(),\n position: this.props.disablePortal ? this.convertToRelativePosition(position) : position,\n });\n }\n };\n\n private getHeight = () => {\n if (!this.isElement(this.dom)) {\n return 0;\n }\n const child = this.dom.children.item(0);\n if (!child) {\n return 0;\n }\n return child.getBoundingClientRect().height;\n };\n\n private getMinWidth = () => {\n const target = this.props.getParent();\n if (!target || !this.isElement(target)) {\n return 0;\n }\n return target.getBoundingClientRect().width;\n };\n\n private convertToRelativePosition = (position: DropdownContainerPosition): DropdownContainerPosition => {\n const target = this.props.getParent();\n const { offsetX = 0, offsetY = 0 } = this.props;\n const { top, bottom, left, right } = position;\n if (target && this.isElement(target)) {\n const targetHeight = target.getBoundingClientRect().height;\n return {\n top: top !== null ? targetHeight + offsetY : null,\n bottom: bottom !== null ? targetHeight + offsetY : null,\n left: left !== null ? offsetX : null,\n right: right !== null ? offsetX : null,\n };\n }\n return {\n top: offsetY,\n bottom: null,\n left: offsetX,\n right: null,\n };\n };\n}\n"]}
1
+ {"version":3,"sources":["DropdownContainer.tsx"],"names":["DropdownContainer","props","getProps","defaultProps","dom","layoutSub","ZIndexRef","element","isElement","node","Element","position","target","getParent","targetRect","getBoundingClientRect","document","body","docEl","documentElement","Error","scrollX","window","pageXOffset","scrollLeft","scrollY","pageYOffset","scrollTop","left","right","align","docWidth","offsetWidth","offsetX","offsetY","bottom","top","distanceToBottom","clientHeight","dropdownHeight","getHeight","state","isDocumentElementRoot","scrollHeight","setState","minWidth","getMinWidth","disablePortal","convertToRelativePosition","child","children","item","height","width","targetHeight","getIsDocumentElementRoot","componentDidMount","LayoutEvents","addListener","componentWillUnmount","remove","render","style","undefined","maxWidth","hasFixedWidth","content","styles","alignRight","isIE11","React","PureComponent","__KONTUR_REACT_UI__","htmlPosition","getComputedStyle","bodyPosition","hasLimitedHeightRoot","hasStaticRoot"],"mappings":"saAAA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,+D;;;;;;;;;;;;;;;;;;;;;;;;;AAyBaA,iB;;;;;;;;;;;;;;;AAeX,6BAAYC,KAAZ,EAA2C;AACzC,4CAAMA,KAAN,UADyC,MALnCC,QAKmC,GALxB,0CAAkBF,iBAAiB,CAACG,YAApC,CAKwB,OAHnCC,GAGmC,gBAFnCC,SAEmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDnCC,IAAAA,SAnDmC,GAmDvB,UAACC,OAAD,EAAuC;AACzD,YAAKH,GAAL,GAAWG,OAAX;AACD,KArD0C;;AAuDnCC,IAAAA,SAvDmC,GAuDvB,UAACC,IAAD,EAA8C;AAChE,aAAOA,IAAI,YAAYC,OAAvB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ED,IAAMG,OAAO,gBACX,6BAAC,cAAD,IACE,QAAQ,EAAE,mBADZ,EAEE,UAAU,EAAE,KAAK5D,SAFnB,EAGE,KAAK,EAAEwD,KAHT,EAIE,SAAS,EAAE,gCACRK,0BAAOC,UAAP,EADQ,IACc,KAAKnE,KAAL,CAAW6B,KAAX,KAAqB,OAArB,IAAgC,CAACuC,cAD/C,OAJb,IAQG,KAAKpE,KAAL,CAAWiD,QARd,CADF,CAaA,OAAO,KAAKjD,KAAL,CAAW8C,aAAX,GAA2BmB,OAA3B,gBAAqC,6BAAC,gCAAD,QAAkBA,OAAlB,CAA5C,CACD,C,4BAhEoCI,eAAMC,a,gDAAhCvE,iB,CACGwE,mB,GAAsB,mB,CADzBxE,iB,CAGGG,Y,GAAe,EAC3B2B,KAAK,EAAE,MADoB,EAE3BiB,aAAa,EAAE,KAFY,EAG3Bd,OAAO,EAAE,CAHkB,EAI3BC,OAAO,EAAE,CAAC,CAJiB,E;;;AAqK/B,IAAMqB,wBAAwB,GAAG,SAA3BA,wBAA2B,GAAM;AACHvC,EAAAA,QADG,CAC7BC,IAD6B,cAC7BA,IAD6B,CACvBE,eADuB,cACvBA,eADuB;AAErC,MAAMsD,YAAY,GAAGC,gBAAgB,CAACvD,eAAD,CAAhB,CAAkCR,QAAvD;AACA,MAAMgE,YAAY,GAAGD,gBAAgB,CAACzD,IAAD,CAAhB,CAAuBN,QAA5C;;AAEA,MAAMiE,oBAAoB,GAAG3D,IAAI,CAAC0B,YAAL,GAAoB1B,IAAI,CAACqB,YAAtD;AACA,MAAMuC,aAAa,GAAGJ,YAAY,KAAK,QAAjB,IAA6BE,YAAY,KAAK,QAApE;AACA,SAAOC,oBAAoB,IAAIC,aAA/B;AACD,CARD","sourcesContent":["import React from 'react';\n\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { RenderContainer } from '../RenderContainer';\nimport { ZIndex } from '../ZIndex';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { Nullable } from '../../typings/utility-types';\nimport { cx } from '../../lib/theming/Emotion';\nimport { isIE11 } from '../../lib/client';\n\nimport { styles } from './DropdownContainer.styles';\n\nexport interface DropdownContainerPosition {\n top: Nullable<number>;\n bottom: Nullable<number>;\n left: Nullable<number>;\n right: Nullable<number>;\n}\n\nexport interface DropdownContainerProps {\n align?: 'left' | 'right';\n getParent: () => Nullable<HTMLElement>;\n children?: React.ReactNode;\n disablePortal?: boolean;\n offsetY?: number;\n offsetX?: number;\n hasFixedWidth?: boolean;\n}\n\nexport interface DropdownContainerState {\n position: Nullable<DropdownContainerPosition>;\n minWidth: number;\n isDocumentElementRoot?: boolean;\n}\n\nexport class DropdownContainer extends React.PureComponent<DropdownContainerProps, DropdownContainerState> {\n public static __KONTUR_REACT_UI__ = 'DropdownContainer';\n\n public static defaultProps = {\n align: 'left',\n disablePortal: false,\n offsetX: 0,\n offsetY: -1,\n };\n\n private getProps = createPropsGetter(DropdownContainer.defaultProps);\n\n private dom: Nullable<HTMLDivElement>;\n private layoutSub: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n\n constructor(props: DropdownContainerProps) {\n super(props);\n\n this.state = { position: null, minWidth: 0, isDocumentElementRoot: getIsDocumentElementRoot() };\n }\n\n public componentDidMount() {\n this.position();\n this.layoutSub = LayoutEvents.addListener(this.position);\n }\n\n public componentWillUnmount() {\n if (this.layoutSub) {\n this.layoutSub.remove();\n }\n }\n\n public render() {\n let style: React.CSSProperties = {\n position: 'absolute',\n top: '0',\n };\n if (this.state.position) {\n const { top, bottom, left, right } = this.state.position;\n style = {\n ...style,\n top: top !== null ? top : undefined,\n bottom: bottom !== null ? bottom : undefined,\n left: left !== null ? left : undefined,\n right: right !== null ? right : undefined,\n minWidth: this.state.minWidth,\n maxWidth: this.props.hasFixedWidth ? this.state.minWidth : undefined,\n };\n }\n\n const content = (\n <ZIndex\n priority={'DropdownContainer'}\n wrapperRef={this.ZIndexRef}\n style={style}\n className={cx({\n [styles.alignRight()]: this.props.align === 'right' && !isIE11,\n })}\n >\n {this.props.children}\n </ZIndex>\n );\n\n return this.props.disablePortal ? content : <RenderContainer>{content}</RenderContainer>;\n }\n\n private ZIndexRef = (element: Nullable<HTMLDivElement>) => {\n this.dom = element;\n };\n\n private isElement = (node: Nullable<Element>): node is Element => {\n return node instanceof Element;\n };\n\n public position = () => {\n const target = this.props.getParent();\n const dom = this.dom;\n\n if (target && this.isElement(target) && dom) {\n const targetRect = target.getBoundingClientRect();\n const { body, documentElement: docEl } = document;\n\n if (!docEl) {\n throw Error('There is no \"documentElement\" in \"document\"');\n }\n\n const scrollX = window.pageXOffset || docEl.scrollLeft || 0;\n const scrollY = window.pageYOffset || docEl.scrollTop || 0;\n\n let left = null;\n let right = null;\n\n if (this.props.align === 'right') {\n const docWidth = docEl.offsetWidth || 0;\n right = docWidth - (targetRect.right + scrollX) + this.getProps().offsetX;\n } else {\n left = targetRect.left + scrollX + this.getProps().offsetX;\n }\n\n const { offsetY = 0 } = this.props;\n let bottom = null;\n let top: number | null = targetRect.bottom + scrollY + offsetY;\n\n const distanceToBottom = docEl.clientHeight - targetRect.bottom;\n const dropdownHeight = this.getHeight();\n\n if (distanceToBottom < dropdownHeight && targetRect.top > dropdownHeight) {\n const clientHeight = this.state.isDocumentElementRoot ? docEl.clientHeight : body.scrollHeight;\n\n top = null;\n bottom = clientHeight + offsetY - scrollY - targetRect.top;\n }\n\n const position = {\n top,\n left,\n right,\n bottom,\n };\n\n this.setState({\n minWidth: this.getMinWidth(),\n position: this.props.disablePortal ? this.convertToRelativePosition(position) : position,\n });\n }\n };\n\n private getHeight = () => {\n if (!this.isElement(this.dom)) {\n return 0;\n }\n const child = this.dom.children.item(0);\n if (!child) {\n return 0;\n }\n return child.getBoundingClientRect().height;\n };\n\n private getMinWidth = () => {\n const target = this.props.getParent();\n if (!target || !this.isElement(target)) {\n return 0;\n }\n return target.getBoundingClientRect().width;\n };\n\n private convertToRelativePosition = (position: DropdownContainerPosition): DropdownContainerPosition => {\n const target = this.props.getParent();\n const { offsetX = 0, offsetY = 0 } = this.props;\n const { top, bottom, left, right } = position;\n if (target && this.isElement(target)) {\n const targetHeight = target.getBoundingClientRect().height;\n return {\n top: top !== null ? targetHeight + offsetY : null,\n bottom: bottom !== null ? targetHeight + offsetY : null,\n left: left !== null ? offsetX : null,\n right: right !== null ? offsetX : null,\n };\n }\n return {\n top: offsetY,\n bottom: null,\n left: offsetX,\n right: null,\n };\n };\n}\n\nconst getIsDocumentElementRoot = () => {\n const { body, documentElement } = document;\n const htmlPosition = getComputedStyle(documentElement).position;\n const bodyPosition = getComputedStyle(body).position;\n\n const hasLimitedHeightRoot = body.scrollHeight > body.clientHeight;\n const hasStaticRoot = htmlPosition === 'static' && bodyPosition === 'static';\n return hasLimitedHeightRoot || hasStaticRoot;\n};\n"]}
@@ -285,6 +285,8 @@ Popup = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functio
285
285
 
286
286
 
287
287
 
288
+
289
+
288
290
 
289
291
 
290
292
 
@@ -494,12 +496,12 @@ Popup = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functio
494
496
  }
495
497
  };return _this;}var _proto = Popup.prototype;_proto.componentDidMount = function componentDidMount() {this.updateLocation();this.layoutEventsToken = LayoutEvents.addListener(this.handleLayoutEvent);};Popup.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {/**
496
498
  * Delaying updateLocation to ensure it happens after props update
497
- */if (props.opened) {if (!state.location) {return { location: DUMMY_LOCATION };}} else if (state.location) {return { location: DUMMY_LOCATION };}return state;};_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {var hadNoLocation = prevState.location === DUMMY_LOCATION;var hasLocation = this.state.location !== DUMMY_LOCATION;var wasClosed = prevProps.opened && !this.props.opened;if (hadNoLocation && hasLocation && this.props.onOpen) {this.props.onOpen();}if (wasClosed && !hasLocation && this.props.onClose) {this.props.onClose();}if (this.props.opened) {this.delayUpdateLocation();}};_proto.componentWillUnmount = function componentWillUnmount() {this.cancelDelayedUpdateLocation();this.removeEventListeners(this.anchorElement);if (this.layoutEventsToken) {this.layoutEventsToken.remove();this.layoutEventsToken = null;}if (this.state.location && this.props.onClose) {this.props.onClose();}};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _this3 = this;var location = this.state.location;var _this$props = this.props,anchorElement = _this$props.anchorElement,useWrapper = _this$props.useWrapper;var anchor = null;if ((0, _SSRSafe.isHTMLElement)(anchorElement)) {this.updateAnchorElement(anchorElement);} else if ( /*#__PURE__*/_react.default.isValidElement(anchorElement)) {anchor = useWrapper ? /*#__PURE__*/_react.default.createElement("span", null, anchorElement) : anchorElement;} else {anchor = /*#__PURE__*/_react.default.createElement("span", null, anchorElement);}var anchorWithRef = anchor && /*#__PURE__*/_react.default.isValidElement(anchor) && (0, _utils.isRefableElement)(anchor) ? /*#__PURE__*/_react.default.cloneElement(anchor, { ref: function ref(instance) {var _anchor;_this3.updateAnchorElement(instance);var originalRef = (_anchor = anchor) == null ? void 0 : _anchor.ref;originalRef && (0, _callChildRef.callChildRef)(originalRef, instance);} }) : null; // we need to get anchor's DOM node
499
+ */if (props.opened) {if (!state.location) {return { location: DUMMY_LOCATION };}} else if (state.location) {return { location: DUMMY_LOCATION };}return state;};_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {var hadNoLocation = prevState.location === DUMMY_LOCATION;var hasLocation = this.state.location !== DUMMY_LOCATION;var wasClosed = prevProps.opened && !this.props.opened;if (this.props.opened && hadNoLocation && hasLocation && this.props.onOpen) {this.props.onOpen();}if (wasClosed && !hasLocation && this.props.onClose) {this.props.onClose();}if (this.props.opened) {this.delayUpdateLocation();}};_proto.componentWillUnmount = function componentWillUnmount() {this.cancelDelayedUpdateLocation();this.removeEventListeners(this.anchorElement);if (this.layoutEventsToken) {this.layoutEventsToken.remove();this.layoutEventsToken = null;}if (this.state.location && this.props.onClose) {this.props.onClose();}};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _this3 = this;var location = this.state.location;var _this$props = this.props,anchorElement = _this$props.anchorElement,useWrapper = _this$props.useWrapper;var anchor = null;if ((0, _SSRSafe.isHTMLElement)(anchorElement)) {this.updateAnchorElement(anchorElement);} else if ( /*#__PURE__*/_react.default.isValidElement(anchorElement)) {anchor = useWrapper ? /*#__PURE__*/_react.default.createElement("span", null, anchorElement) : anchorElement;} else {anchor = /*#__PURE__*/_react.default.createElement("span", null, anchorElement);}var anchorWithRef = anchor && /*#__PURE__*/_react.default.isValidElement(anchor) && (0, _utils.isRefableElement)(anchor) ? /*#__PURE__*/_react.default.cloneElement(anchor, { ref: function ref(instance) {var _anchor;_this3.updateAnchorElement(instance);var originalRef = (_anchor = anchor) == null ? void 0 : _anchor.ref;originalRef && (0, _callChildRef.callChildRef)(originalRef, instance);} }) : null; // we need to get anchor's DOM node
498
500
  // so we either set our own ref on it via cloning
499
501
  // or relay on findDOMNode (inside getRootNode)
500
502
  // which should be called with RenderContainer's ref
501
503
  // in the case when the anchor is not refable
502
- return /*#__PURE__*/_react.default.createElement(_RenderContainer.RenderContainer, { anchor: anchorWithRef || anchor, ref: anchorWithRef ? null : this.renderContainerRef }, location && this.renderContent(location));};_proto.updateAnchorElement = function updateAnchorElement(childInstance) {var childDomNode = (0, _rootNode.getRootNode)(childInstance);var anchorElement = this.anchorElement;if (childDomNode !== anchorElement) {this.removeEventListeners(anchorElement);this.anchorElement = childDomNode;this.addEventListeners(childDomNode);this.setRootNode(childDomNode);}};_proto.addEventListeners = function addEventListeners(element) {if (element && (0, _SSRSafe.isHTMLElement)(element)) {element.addEventListener('mouseenter', this.handleMouseEnter);element.addEventListener('mouseleave', this.handleMouseLeave);element.addEventListener('click', this.handleClick);element.addEventListener('focusin', this.handleFocus);element.addEventListener('focusout', this.handleBlur);}};_proto.removeEventListeners = function removeEventListeners(element) {if (element && (0, _SSRSafe.isHTMLElement)(element)) {element.removeEventListener('mouseenter', this.handleMouseEnter);element.removeEventListener('mouseleave', this.handleMouseLeave);element.removeEventListener('click', this.handleClick);element.removeEventListener('focusin', this.handleFocus);element.removeEventListener('focusout', this.handleBlur);}};_proto.renderContent = function renderContent(location) {var _this4 = this;var _this$props2 = this.props,backgroundColor = _this$props2.backgroundColor,disableAnimations = _this$props2.disableAnimations,maxWidth = _this$props2.maxWidth,hasShadow = _this$props2.hasShadow,ignoreHover = _this$props2.ignoreHover,opened = _this$props2.opened,width = _this$props2.width;var children = this.renderChildren();var _PopupHelper$getPosit = _PopupHelper.PopupHelper.getPositionObject(location.position),direction = _PopupHelper$getPosit.direction;var rootStyle = (0, _extends3.default)({}, location.coordinates, { maxWidth: maxWidth });var shouldFallbackShadow = _client.isIE11 || _client.isEdge || _client.isSafari;return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.Transition, { timeout: TRANSITION_TIMEOUT, appear: !disableAnimations, in: Boolean(opened && children), mountOnEnter: true, unmountOnExit: true, enter: !disableAnimations, exit: !disableAnimations, onExited: this.resetLocation, nodeRef: this.refForTransition }, function (state) {var _extends2, _ref;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, _this4.props, /*#__PURE__*/_react.default.createElement(_ZIndex.ZIndex, { wrapperRef: _this4.refPopupElement, priority: 'Popup', className: (0, _Emotion.cx)((0, _extends3.default)((_extends2 = {}, _extends2[_Popup.styles.popup(_this4.theme)] = true, _extends2[_Popup.styles.shadow(_this4.theme)] = hasShadow && !shouldFallbackShadow, _extends2[_Popup.styles.shadowFallback(_this4.theme)] = hasShadow && shouldFallbackShadow, _extends2[_Popup.styles.popupIgnoreHover()] = ignoreHover, _extends2), disableAnimations ? {} : (_ref = {}, _ref[_Popup.styles["transition-enter-" + direction](_this4.theme)] = true, _ref[_Popup.styles.transitionEnter()] = state === 'entering', _ref[_Popup.styles.transitionEnterActive()] = state === 'entered', _ref[_Popup.styles.transitionExit()] = state === 'exiting', _ref))), style: rootStyle, onMouseEnter: _this4.handleMouseEnter, onMouseLeave: _this4.handleMouseLeave }, /*#__PURE__*/_react.default.createElement("div", { className: _Popup.styles.content(_this4.theme), "data-tid": 'PopupContent', ref: _this4.refForTransition }, /*#__PURE__*/_react.default.createElement("div", { className: _Popup.styles.contentInner(_this4.theme), style: { backgroundColor: backgroundColor, width: _this4.calculateWidth(width) }, "data-tid": 'PopupContentInner' }, children)), _this4.renderPin(location.position)));});};_proto.renderChildren = function renderChildren() {return (0, _utils.isFunction)(this.props.children) ? this.props.children() : this.props.children;};_proto.renderPin = function renderPin(positionName) {/**
504
+ var canGetAnchorNode = !!anchorWithRef || (0, _SSRSafe.isHTMLElement)(anchorElement);return /*#__PURE__*/_react.default.createElement(_RenderContainer.RenderContainer, { anchor: anchorWithRef || anchor, ref: canGetAnchorNode ? null : this.renderContainerRef }, location && this.renderContent(location));};_proto.updateAnchorElement = function updateAnchorElement(childInstance) {var childDomNode = (0, _rootNode.getRootNode)(childInstance);var anchorElement = this.anchorElement;if (childDomNode !== anchorElement) {this.removeEventListeners(anchorElement);this.anchorElement = childDomNode;this.addEventListeners(childDomNode);this.setRootNode(childDomNode);}};_proto.addEventListeners = function addEventListeners(element) {if (element && (0, _SSRSafe.isHTMLElement)(element)) {element.addEventListener('mouseenter', this.handleMouseEnter);element.addEventListener('mouseleave', this.handleMouseLeave);element.addEventListener('click', this.handleClick);element.addEventListener('focusin', this.handleFocus);element.addEventListener('focusout', this.handleBlur);}};_proto.removeEventListeners = function removeEventListeners(element) {if (element && (0, _SSRSafe.isHTMLElement)(element)) {element.removeEventListener('mouseenter', this.handleMouseEnter);element.removeEventListener('mouseleave', this.handleMouseLeave);element.removeEventListener('click', this.handleClick);element.removeEventListener('focusin', this.handleFocus);element.removeEventListener('focusout', this.handleBlur);}};_proto.renderContent = function renderContent(location) {var _this4 = this;var _this$props2 = this.props,backgroundColor = _this$props2.backgroundColor,disableAnimations = _this$props2.disableAnimations,maxWidth = _this$props2.maxWidth,hasShadow = _this$props2.hasShadow,ignoreHover = _this$props2.ignoreHover,opened = _this$props2.opened,width = _this$props2.width;var children = this.renderChildren();var _PopupHelper$getPosit = _PopupHelper.PopupHelper.getPositionObject(location.position),direction = _PopupHelper$getPosit.direction;var rootStyle = (0, _extends3.default)({}, location.coordinates, { maxWidth: maxWidth });var shouldFallbackShadow = _client.isIE11 || _client.isEdge || _client.isSafari;return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.Transition, { timeout: TRANSITION_TIMEOUT, appear: !disableAnimations, in: Boolean(opened && children), mountOnEnter: true, unmountOnExit: true, enter: !disableAnimations, exit: !disableAnimations, onExited: this.resetLocation, nodeRef: this.refForTransition }, function (state) {var _extends2, _ref;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, _this4.props, /*#__PURE__*/_react.default.createElement(_ZIndex.ZIndex, { wrapperRef: _this4.refPopupElement, priority: 'Popup', className: (0, _Emotion.cx)((0, _extends3.default)((_extends2 = {}, _extends2[_Popup.styles.popup(_this4.theme)] = true, _extends2[_Popup.styles.shadow(_this4.theme)] = hasShadow && !shouldFallbackShadow, _extends2[_Popup.styles.shadowFallback(_this4.theme)] = hasShadow && shouldFallbackShadow, _extends2[_Popup.styles.popupIgnoreHover()] = ignoreHover, _extends2), disableAnimations ? {} : (_ref = {}, _ref[_Popup.styles["transition-enter-" + direction](_this4.theme)] = true, _ref[_Popup.styles.transitionEnter()] = state === 'entering', _ref[_Popup.styles.transitionEnterActive()] = state === 'entered', _ref[_Popup.styles.transitionExit()] = state === 'exiting', _ref))), style: rootStyle, onMouseEnter: _this4.handleMouseEnter, onMouseLeave: _this4.handleMouseLeave }, /*#__PURE__*/_react.default.createElement("div", { className: _Popup.styles.content(_this4.theme), "data-tid": 'PopupContent', ref: _this4.refForTransition }, /*#__PURE__*/_react.default.createElement("div", { className: _Popup.styles.contentInner(_this4.theme), style: { backgroundColor: backgroundColor, width: _this4.calculateWidth(width) }, "data-tid": 'PopupContentInner' }, children)), _this4.renderPin(location.position)));});};_proto.renderChildren = function renderChildren() {return (0, _utils.isFunction)(this.props.children) ? this.props.children() : this.props.children;};_proto.renderPin = function renderPin(positionName) {/**
503
505
  * Box-shadow does not appear under the pin. Borders are used instead.
504
506
  * In non-ie browsers drop-shadow filter is used. It is applying
505
507
  * shadow to the pin too.