@doist/reactist 12.1.0 → 14.0.0

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.
Files changed (133) hide show
  1. package/dist/reactist.cjs.development.js +95 -644
  2. package/dist/reactist.cjs.development.js.map +1 -1
  3. package/dist/reactist.cjs.production.min.js +1 -1
  4. package/dist/reactist.cjs.production.min.js.map +1 -1
  5. package/es/components/color-picker/color-picker.js +4 -4
  6. package/es/components/color-picker/color-picker.js.map +1 -1
  7. package/es/components/{dropdown → deprecated-dropdown}/dropdown.js +0 -0
  8. package/es/components/deprecated-dropdown/dropdown.js.map +1 -0
  9. package/es/components/{dropdown → deprecated-dropdown}/index.js +0 -0
  10. package/es/components/{checkbox → deprecated-dropdown}/index.js.map +0 -0
  11. package/es/components/{input → deprecated-input}/index.js +0 -0
  12. package/es/components/{dropdown → deprecated-input}/index.js.map +0 -0
  13. package/es/components/{input → deprecated-input}/input.js +0 -0
  14. package/es/components/deprecated-input/input.js.map +1 -0
  15. package/es/components/{select → deprecated-select}/index.js +0 -0
  16. package/es/components/{input → deprecated-select}/index.js.map +0 -0
  17. package/es/components/{select → deprecated-select}/select.js +0 -0
  18. package/es/components/deprecated-select/select.js.map +1 -0
  19. package/es/components/tooltip/tooltip.js +12 -6
  20. package/es/components/tooltip/tooltip.js.map +1 -1
  21. package/es/index.js +3 -7
  22. package/es/index.js.map +1 -1
  23. package/es/new-components/base-button/base-button.js +12 -9
  24. package/es/new-components/base-button/base-button.js.map +1 -1
  25. package/es/new-components/base-button/base-button.module.css.js +1 -1
  26. package/es/new-components/tabs/tabs.js +25 -15
  27. package/es/new-components/tabs/tabs.js.map +1 -1
  28. package/es/new-components/tabs/tabs.module.css.js +1 -1
  29. package/es/new-components/text-field/text-field.module.css.js +1 -1
  30. package/lib/components/color-picker/color-picker.js +1 -1
  31. package/lib/components/color-picker/color-picker.js.map +1 -1
  32. package/lib/components/{dropdown → deprecated-dropdown}/dropdown.d.ts +0 -0
  33. package/lib/components/{dropdown → deprecated-dropdown}/dropdown.js +0 -0
  34. package/lib/components/deprecated-dropdown/dropdown.js.map +1 -0
  35. package/lib/components/{dropdown → deprecated-dropdown}/dropdown.test.d.ts +0 -0
  36. package/lib/components/{dropdown → deprecated-dropdown}/index.d.ts +0 -0
  37. package/lib/components/{dropdown → deprecated-dropdown}/index.js +0 -0
  38. package/lib/components/{checkbox → deprecated-dropdown}/index.js.map +0 -0
  39. package/lib/components/{input → deprecated-input}/index.d.ts +0 -0
  40. package/lib/components/{input → deprecated-input}/index.js +0 -0
  41. package/lib/components/{dropdown → deprecated-input}/index.js.map +0 -0
  42. package/lib/components/{input → deprecated-input}/input.d.ts +0 -0
  43. package/lib/components/{input → deprecated-input}/input.js +0 -0
  44. package/lib/components/deprecated-input/input.js.map +1 -0
  45. package/lib/components/{input → deprecated-input}/input.test.d.ts +0 -0
  46. package/lib/components/{select → deprecated-select}/index.d.ts +0 -0
  47. package/lib/components/{select → deprecated-select}/index.js +0 -0
  48. package/lib/components/{input → deprecated-select}/index.js.map +0 -0
  49. package/lib/components/{select → deprecated-select}/select.d.ts +0 -0
  50. package/lib/components/{select → deprecated-select}/select.js +0 -0
  51. package/lib/components/deprecated-select/select.js.map +1 -0
  52. package/lib/components/{select → deprecated-select}/select.test.d.ts +0 -0
  53. package/lib/components/tooltip/tooltip.d.ts +1 -1
  54. package/lib/components/tooltip/tooltip.js +1 -1
  55. package/lib/components/tooltip/tooltip.js.map +1 -1
  56. package/lib/index.d.ts +3 -7
  57. package/lib/index.js +1 -1
  58. package/lib/new-components/base-button/base-button.d.ts +7 -4
  59. package/lib/new-components/base-button/base-button.js +1 -1
  60. package/lib/new-components/base-button/base-button.js.map +1 -1
  61. package/lib/new-components/base-button/base-button.module.css.js +1 -1
  62. package/lib/new-components/tabs/tabs.d.ts +5 -10
  63. package/lib/new-components/tabs/tabs.js +1 -1
  64. package/lib/new-components/tabs/tabs.js.map +1 -1
  65. package/lib/new-components/tabs/tabs.module.css.js +1 -1
  66. package/lib/new-components/text-field/text-field.module.css.js +1 -1
  67. package/package.json +1 -1
  68. package/styles/alert.css +1 -1
  69. package/styles/base-button.css +1 -1
  70. package/styles/base-button.module.css.css +1 -1
  71. package/styles/modal.css +1 -1
  72. package/styles/password-field.css +1 -1
  73. package/styles/reactist.css +6 -10
  74. package/styles/tabs.css +3 -3
  75. package/styles/tabs.module.css.css +1 -1
  76. package/styles/text-field.css +1 -1
  77. package/styles/text-field.module.css.css +1 -1
  78. package/es/components/checkbox/checkbox.js +0 -24
  79. package/es/components/checkbox/checkbox.js.map +0 -1
  80. package/es/components/checkbox/index.js +0 -6
  81. package/es/components/deprecated-loading/deprecated-loading.js +0 -39
  82. package/es/components/deprecated-loading/deprecated-loading.js.map +0 -1
  83. package/es/components/deprecated-modal/deprecated-modal.js +0 -207
  84. package/es/components/deprecated-modal/deprecated-modal.js.map +0 -1
  85. package/es/components/deprecated-modal/index.js +0 -11
  86. package/es/components/deprecated-modal/index.js.map +0 -1
  87. package/es/components/dropdown/dropdown.js.map +0 -1
  88. package/es/components/input/input.js.map +0 -1
  89. package/es/components/popover/index.js +0 -6
  90. package/es/components/popover/index.js.map +0 -1
  91. package/es/components/popover/popover.js +0 -206
  92. package/es/components/popover/popover.js.map +0 -1
  93. package/es/components/popover/positioning-utils.js +0 -104
  94. package/es/components/popover/positioning-utils.js.map +0 -1
  95. package/es/components/select/index.js.map +0 -1
  96. package/es/components/select/select.js.map +0 -1
  97. package/lib/components/checkbox/checkbox.d.ts +0 -13
  98. package/lib/components/checkbox/checkbox.js +0 -2
  99. package/lib/components/checkbox/checkbox.js.map +0 -1
  100. package/lib/components/checkbox/checkbox.test.d.ts +0 -1
  101. package/lib/components/checkbox/index.d.ts +0 -2
  102. package/lib/components/checkbox/index.js +0 -2
  103. package/lib/components/deprecated-loading/deprecated-loading.d.ts +0 -19
  104. package/lib/components/deprecated-loading/deprecated-loading.js +0 -2
  105. package/lib/components/deprecated-loading/deprecated-loading.js.map +0 -1
  106. package/lib/components/deprecated-loading/deprecated-loading.test.d.ts +0 -1
  107. package/lib/components/deprecated-loading/index.d.ts +0 -1
  108. package/lib/components/deprecated-modal/deprecated-modal.d.ts +0 -88
  109. package/lib/components/deprecated-modal/deprecated-modal.js +0 -2
  110. package/lib/components/deprecated-modal/deprecated-modal.js.map +0 -1
  111. package/lib/components/deprecated-modal/deprecated-modal.test.d.ts +0 -1
  112. package/lib/components/deprecated-modal/index.d.ts +0 -10
  113. package/lib/components/deprecated-modal/index.js +0 -2
  114. package/lib/components/deprecated-modal/index.js.map +0 -1
  115. package/lib/components/dropdown/dropdown.js.map +0 -1
  116. package/lib/components/input/input.js.map +0 -1
  117. package/lib/components/popover/index.d.ts +0 -2
  118. package/lib/components/popover/index.js +0 -2
  119. package/lib/components/popover/index.js.map +0 -1
  120. package/lib/components/popover/popover.d.ts +0 -54
  121. package/lib/components/popover/popover.js +0 -2
  122. package/lib/components/popover/popover.js.map +0 -1
  123. package/lib/components/popover/popover.test.d.ts +0 -1
  124. package/lib/components/popover/positioning-utils.d.ts +0 -19
  125. package/lib/components/popover/positioning-utils.js +0 -2
  126. package/lib/components/popover/positioning-utils.js.map +0 -1
  127. package/lib/components/popover/positioning-utils.test.d.ts +0 -1
  128. package/lib/components/select/index.js.map +0 -1
  129. package/lib/components/select/select.js.map +0 -1
  130. package/styles/checkbox.css +0 -1
  131. package/styles/deprecated-loading.css +0 -1
  132. package/styles/deprecated-modal.css +0 -1
  133. package/styles/popover.css +0 -1
@@ -1,207 +0,0 @@
1
- import React__default from 'react';
2
- import classNames from 'classnames';
3
- import ReactDOM from 'react-dom';
4
- import CloseIcon from '../icons/CloseIcon.svg.js';
5
-
6
- /** @deprecated */
7
-
8
- class Box extends React__default.Component {
9
- constructor(...args) {
10
- super(...args);
11
-
12
- this._closeModal = () => {
13
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
14
- const modalElement = document.getElementById('modal_box');
15
- ReactDOM.unmountComponentAtNode(modalElement);
16
- };
17
-
18
- this._handleKeyDown = event => {
19
- if (event.keyCode === 27) {
20
- // ESC
21
- this._closeModal();
22
-
23
- if (event.preventDefault) event.preventDefault();
24
- }
25
- };
26
-
27
- this._handleOverlayClick = event => {
28
- if (event.target instanceof Element && (event.target.id === 'reactist-overlay' || event.target.id === 'reactist-overlay-inner')) {
29
- this._closeModal();
30
- }
31
- };
32
- }
33
-
34
- componentDidMount() {
35
- window.addEventListener('keydown', this._handleKeyDown);
36
- }
37
-
38
- componentWillUnmount() {
39
- window.removeEventListener('keydown', this._handleKeyDown);
40
- }
41
-
42
- render() {
43
- const {
44
- large,
45
- medium,
46
- style,
47
- children,
48
- closeOnOverlayClick
49
- } = this.props;
50
- const className = classNames('reactist_modal_box', {
51
- large,
52
- medium
53
- }, this.props.className);
54
- return /*#__PURE__*/React__default.createElement("div", {
55
- className: "reactist_overlay",
56
- id: "reactist-overlay",
57
- onClick: closeOnOverlayClick ? this._handleOverlayClick : undefined
58
- }, /*#__PURE__*/React__default.createElement("div", {
59
- className: "reactist_overlay_inner",
60
- id: "reactist-overlay-inner"
61
- }, /*#__PURE__*/React__default.createElement("div", {
62
- style: style,
63
- className: className
64
- }, children)));
65
- }
66
-
67
- }
68
-
69
- Box.displayName = void 0;
70
- Box.defaultProps = void 0;
71
- Box.displayName = 'Modal.Box';
72
- Box.defaultProps = {
73
- large: false,
74
- closeOnOverlayClick: false
75
- };
76
- /** @deprecated */
77
-
78
- class Header extends React__default.Component {
79
- _closeModal(event) {
80
- event.preventDefault();
81
-
82
- if (typeof this.props.beforeClose === 'function') {
83
- this.props.beforeClose();
84
- } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
85
-
86
-
87
- const modalElement = document.getElementById('modal_box');
88
- ReactDOM.unmountComponentAtNode(modalElement);
89
- }
90
-
91
- render() {
92
- return (
93
- /*#__PURE__*/
94
-
95
- /* eslint-disable jsx-a11y/anchor-is-valid */
96
- React__default.createElement("div", {
97
- className: "reactist_modal_box__header"
98
- }, /*#__PURE__*/React__default.createElement("p", null, this.props.title && /*#__PURE__*/React__default.createElement("span", {
99
- className: "title"
100
- }, this.props.title), this.props.subtitle && /*#__PURE__*/React__default.createElement("span", {
101
- className: "subtitle"
102
- }, this.props.subtitle), this.props.children), /*#__PURE__*/React__default.createElement("a", {
103
- className: "close",
104
- onClick: this._closeModal.bind(this),
105
- href: "#"
106
- }, /*#__PURE__*/React__default.createElement(CloseIcon, null)))
107
- /* eslint-enable jsx-a11y/anchor-is-valid */
108
-
109
- );
110
- }
111
-
112
- }
113
-
114
- Header.displayName = void 0;
115
- Header.defaultProps = void 0;
116
- Header.displayName = 'Modal.Header';
117
- /** @deprecated */
118
-
119
- class Body extends React__default.Component {
120
- _closeModal(event) {
121
- event.preventDefault(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
122
-
123
- const modalElement = document.getElementById('modal_box');
124
- ReactDOM.unmountComponentAtNode(modalElement);
125
- }
126
-
127
- render() {
128
- const {
129
- icon,
130
- plain,
131
- children,
132
- style,
133
- showCloseIcon
134
- } = this.props;
135
- const className = classNames('reactist_modal_box__body', {
136
- plain
137
- }, this.props.className);
138
- return (
139
- /*#__PURE__*/
140
-
141
- /* eslint-disable jsx-a11y/anchor-is-valid */
142
- React__default.createElement("div", {
143
- className: className,
144
- style: style
145
- }, showCloseIcon && /*#__PURE__*/React__default.createElement("a", {
146
- className: "close",
147
- onClick: this._closeModal.bind(this),
148
- href: "#"
149
- }, /*#__PURE__*/React__default.createElement(CloseIcon, null)), icon ? /*#__PURE__*/React__default.createElement("div", {
150
- className: "dialog"
151
- }, /*#__PURE__*/React__default.createElement("div", {
152
- className: "reactist_icon"
153
- }, icon), /*#__PURE__*/React__default.createElement("div", {
154
- className: "content"
155
- }, children)) : children)
156
- /* eslint-enable jsx-a11y/anchor-is-valid */
157
-
158
- );
159
- }
160
-
161
- }
162
-
163
- Body.displayName = void 0;
164
- Body.defaultProps = void 0;
165
- Body.displayName = 'Modal.Body';
166
- Body.defaultProps = {
167
- showCloseIcon: false
168
- };
169
- /** @deprecated */
170
-
171
- class Actions extends React__default.Component {
172
- _onClick(onClick) {
173
- if (onClick) {
174
- onClick();
175
- } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
176
-
177
-
178
- const modalElement = document.getElementById('modal_box');
179
- ReactDOM.unmountComponentAtNode(modalElement);
180
- }
181
-
182
- render() {
183
- const children = React__default.Children.map( // see: https://github.com/microsoft/TypeScript/issues/21699
184
- // @ts-expect-error Children cannot be typed properly yet in React
185
- this.props.children, child => {
186
- var _child$props;
187
-
188
- if (child != null && (_child$props = child.props) != null && _child$props.close) {
189
- return /*#__PURE__*/React__default.cloneElement(child, {
190
- onClick: () => this._onClick(child.props.onClick)
191
- });
192
- } else {
193
- return child ? /*#__PURE__*/React__default.cloneElement(child) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
194
- }
195
- });
196
- return /*#__PURE__*/React__default.createElement("div", {
197
- className: "reactist_modal_box__actions"
198
- }, children);
199
- }
200
-
201
- }
202
-
203
- Actions.displayName = void 0;
204
- Actions.displayName = 'Modal.Actions';
205
-
206
- export { Actions, Body, Box, Header };
207
- //# sourceMappingURL=deprecated-modal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deprecated-modal.js","sources":["../../../src/components/deprecated-modal/deprecated-modal.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport classnames from 'classnames'\n\nimport CloseIcon from '../icons/CloseIcon.svg'\n\nimport './deprecated-modal.less'\n\ntype Props = {\n /** Additional css class applied to the Modal.Box. */\n className?: string\n /** Sometimes a class name is not enough so you can use this to set the style directly. */\n style?: React.CSSProperties\n /** Large style. */\n large: boolean\n /** Medium size syle. */\n medium?: boolean\n /** Close the Modal when clicking on the overlay. */\n closeOnOverlayClick: boolean\n}\n\n/** @deprecated */\nclass Box extends React.Component<React.PropsWithChildren<Props>> {\n public static displayName: string\n public static defaultProps: Props\n\n componentDidMount() {\n window.addEventListener('keydown', this._handleKeyDown)\n }\n\n componentWillUnmount() {\n window.removeEventListener('keydown', this._handleKeyDown)\n }\n\n _closeModal = () => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n _handleKeyDown = (event: Partial<KeyboardEvent>) => {\n if (event.keyCode === 27) {\n // ESC\n this._closeModal()\n if (event.preventDefault) event.preventDefault()\n }\n }\n\n _handleOverlayClick = (event: React.MouseEvent<Element>) => {\n if (\n event.target instanceof Element &&\n (event.target.id === 'reactist-overlay' || event.target.id === 'reactist-overlay-inner')\n ) {\n this._closeModal()\n }\n }\n\n render() {\n const { large, medium, style, children, closeOnOverlayClick } = this.props\n\n const className = classnames('reactist_modal_box', { large, medium }, this.props.className)\n\n return (\n <div\n className=\"reactist_overlay\"\n id=\"reactist-overlay\"\n onClick={closeOnOverlayClick ? this._handleOverlayClick : undefined}\n >\n <div className=\"reactist_overlay_inner\" id=\"reactist-overlay-inner\">\n <div style={style} className={className}>\n {children}\n </div>\n </div>\n </div>\n )\n }\n}\nBox.displayName = 'Modal.Box'\nBox.defaultProps = {\n large: false,\n closeOnOverlayClick: false,\n}\n\ntype HeaderProps = {\n /** Title of the Modal.Header. */\n title?: string | React.ReactNode\n /** Subtitle of the Modal.Header. */\n subtitle?: string | React.ReactNode\n /** Function that is called right before the Modal unmounts itself. */\n beforeClose?: () => void\n}\n\n/** @deprecated */\nclass Header extends React.Component<React.PropsWithChildren<HeaderProps>> {\n public static displayName: string\n public static defaultProps: HeaderProps\n\n _closeModal(event: React.MouseEvent) {\n event.preventDefault()\n if (typeof this.props.beforeClose === 'function') {\n this.props.beforeClose()\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n render() {\n return (\n /* eslint-disable jsx-a11y/anchor-is-valid */\n <div className=\"reactist_modal_box__header\">\n <p>\n {this.props.title && <span className=\"title\">{this.props.title}</span>}\n {this.props.subtitle && <span className=\"subtitle\">{this.props.subtitle}</span>}\n {this.props.children}\n </p>\n <a className=\"close\" onClick={this._closeModal.bind(this)} href=\"#\">\n <CloseIcon />\n </a>\n </div>\n /* eslint-enable jsx-a11y/anchor-is-valid */\n )\n }\n}\nHeader.displayName = 'Modal.Header'\n\ntype BodyProps = {\n /** Display an icon (or basically any component) on the right hand side of the Modal.Body. */\n icon?: React.ReactNode\n /** Applies less styles on the body (e.g. no padding) */\n plain?: boolean\n /** Sometimes a class name is not enough so you can use this to set the style directly. */\n style?: React.CSSProperties\n /** Additionall css class applied to the Modal.Body. */\n className?: string\n /**\n * Render a close icon in the top right corner of the Modal.Body.\n * Recommended to use when no Modal.Header is used.\n */\n showCloseIcon?: boolean\n}\n\n/** @deprecated */\nclass Body extends React.Component<React.PropsWithChildren<BodyProps>> {\n public static displayName: string\n public static defaultProps: BodyProps\n\n _closeModal(event: React.MouseEvent) {\n event.preventDefault()\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n render() {\n const { icon, plain, children, style, showCloseIcon } = this.props\n const className = classnames('reactist_modal_box__body', { plain }, this.props.className)\n\n return (\n /* eslint-disable jsx-a11y/anchor-is-valid */\n <div className={className} style={style}>\n {showCloseIcon && (\n <a className=\"close\" onClick={this._closeModal.bind(this)} href=\"#\">\n <CloseIcon />\n </a>\n )}\n {icon ? (\n <div className=\"dialog\">\n <div className=\"reactist_icon\">{icon}</div>\n <div className=\"content\">{children}</div>\n </div>\n ) : (\n children\n )}\n </div>\n /* eslint-enable jsx-a11y/anchor-is-valid */\n )\n }\n}\nBody.displayName = 'Modal.Body'\nBody.defaultProps = {\n showCloseIcon: false,\n}\n\ntype ActionProps = {\n /**\n * Children to render inside the Modal.Actions. They can have an optional `close` property (boolean).\n * When that is supplied and set to true it will close the modal after the onClick function\n */\n children?: React.ReactNode\n}\n\ntype ActionChildrenProps = {\n close?: boolean\n onClick?: () => void\n}\n\n/** @deprecated */\nclass Actions extends React.Component<ActionProps> {\n public static displayName: string\n\n _onClick(onClick: ActionChildrenProps['onClick']) {\n if (onClick) {\n onClick()\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const modalElement = document.getElementById('modal_box')!\n ReactDOM.unmountComponentAtNode(modalElement)\n }\n\n render() {\n const children = React.Children.map(\n // see: https://github.com/microsoft/TypeScript/issues/21699\n // @ts-expect-error Children cannot be typed properly yet in React\n this.props.children,\n (child: React.ReactElement<ActionChildrenProps>) => {\n if (child?.props?.close) {\n return React.cloneElement(child, {\n onClick: () => this._onClick(child.props.onClick),\n })\n } else {\n return child ? React.cloneElement(child) : <></>\n }\n },\n )\n\n return <div className=\"reactist_modal_box__actions\">{children}</div>\n }\n}\n\nActions.displayName = 'Modal.Actions'\n\n/** @deprecated */\ntype Modal = {\n Box: Box\n Header: Header\n Body: Body\n Actions: Actions\n}\n\nexport type { Modal }\n\nexport { Box, Header, Body, Actions }\n"],"names":["Box","React","Component","_closeModal","modalElement","document","getElementById","ReactDOM","unmountComponentAtNode","_handleKeyDown","event","keyCode","preventDefault","_handleOverlayClick","target","Element","id","componentDidMount","window","addEventListener","componentWillUnmount","removeEventListener","render","large","medium","style","children","closeOnOverlayClick","props","className","classnames","onClick","undefined","displayName","defaultProps","Header","beforeClose","title","subtitle","bind","href","CloseIcon","Body","icon","plain","showCloseIcon","Actions","_onClick","Children","map","child","close","cloneElement"],"mappings":";;;;;AAqBA;;AACA,MAAMA,GAAN,SAAkBC,cAAK,CAACC,SAAxB;;;;SAYIC,cAAc;;MAEV,MAAMC,YAAY,GAAGC,QAAQ,CAACC,cAAT,CAAwB,WAAxB,CAArB;MACAC,QAAQ,CAACC,sBAAT,CAAgCJ,YAAhC;;;SAGJK,iBAAkBC,KAAD;MACb,IAAIA,KAAK,CAACC,OAAN,KAAkB,EAAtB,EAA0B;;QAEtB,KAAKR,WAAL;;QACA,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OAAO,EAAE,MAAM,KAAKgB,QAAL,CAAcG,KAAK,CAACtB,KAAN,CAAYG,OAA1B;SADZ,CAAP;OADJ,MAIO;QACH,OAAOmB,KAAK,gBAAGjD,cAAK,CAACmD,YAAN,CAAmBF,KAAnB,CAAH,gBAA+BjD,4BAAA,wBAAA,MAAA,CAA3C;;KAVK,CAAjB;IAeA,oBAAOA,4BAAA,MAAA;MAAK4B,SAAS,EAAC;KAAf,EAA8CH,QAA9C,CAAP;;;;;AA5BFoB,QACYb;AA+BlBa,OAAO,CAACb,WAAR,GAAsB,eAAtB;;;;"}
@@ -1,11 +0,0 @@
1
- import { Box, Header, Body, Actions } from './deprecated-modal.js';
2
-
3
- var index = {
4
- Box,
5
- Header,
6
- Body,
7
- Actions
8
- };
9
-
10
- export default index;
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/deprecated-modal/index.ts"],"sourcesContent":["import { Box, Header, Body, Actions } from './deprecated-modal'\nimport type { Modal } from './deprecated-modal'\n\nexport default { Box, Header, Body, Actions }\nexport type { Modal }\n"],"names":["Box","Header","Body","Actions"],"mappings":";;AAGA,YAAe;EAAEA,GAAF;EAAOC,MAAP;EAAeC,IAAf;EAAqBC;AAArB,CAAf;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dropdown.js","sources":["../../../src/components/dropdown/dropdown.tsx"],"sourcesContent":["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport classNames from 'classnames'\n\nimport Button from '../deprecated-button'\n\nimport './dropdown.less'\n\ntype BoxProps = {\n onShowBody?: () => void\n onHideBody?: () => void\n allowBodyInteractions?: boolean\n top?: boolean\n right?: boolean\n scrolling_parent?: string\n children?: [\n React.ReactElement<TriggerProps>,\n React.ReactElement<BodyProps> | ((props: BodyProps) => JSX.Element),\n ]\n className?: string\n}\n\ntype BoxState = {\n top: boolean\n showBody: boolean\n}\n\nclass Box extends React.Component<React.PropsWithChildren<BoxProps>, BoxState> {\n public static displayName: string\n\n constructor(props: BoxProps, context: React.Context<unknown>) {\n super(props, context)\n this.state = {\n showBody: false,\n top: props.top || false,\n }\n\n this._timeout = undefined\n }\n\n componentWillUnmount() {\n document.removeEventListener('click', this._handleClickOutside, true)\n if (this._timeout) {\n clearTimeout(this._timeout)\n }\n }\n _timeout?: ReturnType<typeof setTimeout>\n\n _handleClickOutside = (event: MouseEvent) => {\n const dropdownDOMNode = ReactDOM.findDOMNode(this)\n\n if (dropdownDOMNode && !dropdownDOMNode.contains(event.target as Node))\n this._toggleShowBody()\n else if (!this.props.allowBodyInteractions) {\n // won't close when body interactions are allowed\n this._timeout = setTimeout(() => {\n if (this.state.showBody) {\n this._toggleShowBody()\n }\n }, 100)\n }\n }\n\n _toggleShowBody = () => {\n if (!this.state.showBody) {\n // will show\n if (this.props.onShowBody) this.props.onShowBody()\n document.addEventListener('click', this._handleClickOutside, true)\n } else {\n // will hide\n if (this.props.onHideBody) this.props.onHideBody()\n document.removeEventListener('click', this._handleClickOutside, true)\n }\n\n this.setState({\n showBody: !this.state.showBody,\n })\n }\n\n _getTriggerComponent() {\n const _trigger = this.props.children?.[0]\n return _trigger\n ? React.cloneElement(_trigger, { onClick: this._toggleShowBody })\n : undefined\n }\n\n // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components\n _setPosition = (body: HTMLElement | null) => {\n if (body) {\n const scrollingParent = document.getElementById(\n this.props.scrolling_parent ? this.props.scrolling_parent : '',\n )\n\n if (scrollingParent) {\n const dropdown = ReactDOM.findDOMNode(this)\n if (!dropdown) {\n return\n }\n const dropdownVerticalPosition = (ReactDOM.findDOMNode(this) as HTMLElement)\n .offsetTop\n const dropdownTrigger = (dropdown as Element).querySelector('.trigger')\n if (!dropdownTrigger) {\n return\n }\n const dropdownTriggerHeight = dropdownTrigger.clientHeight\n const dropdownBodyHeight = body.clientHeight\n\n const scrollingParentHeight = scrollingParent.clientHeight\n const scrollingParentOffset = scrollingParent.scrollTop\n\n const bottomOffset =\n scrollingParentHeight +\n scrollingParentOffset -\n dropdownVerticalPosition -\n dropdownTriggerHeight\n\n const top = bottomOffset < dropdownBodyHeight\n\n if (top !== this.state.top) {\n this.setState({ top })\n }\n }\n }\n }\n\n _getBodyComponent() {\n if (!this.state.showBody) {\n return null\n }\n const { top } = this.state\n const { right = false, children } = this.props\n const props = { top, right, setPosition: this._setPosition }\n\n const className = classNames({\n body_wrapper: true,\n with_arrow: true,\n top: top,\n bottom: !top,\n })\n\n const body = children?.[1]\n\n const contentMarkup =\n typeof body === 'function'\n ? body(props)\n : body\n ? React.cloneElement(body, props)\n : undefined\n return (\n <div className={className} style={{ position: 'relative' }}>\n {contentMarkup}\n </div>\n )\n }\n\n render() {\n const className = classNames('reactist_dropdown', this.props.className)\n const { top } = this.state\n\n return (\n <div style={{ display: 'inline-block' }} className={className}>\n {top && this._getBodyComponent()}\n {this._getTriggerComponent()}\n {!top && this._getBodyComponent()}\n </div>\n )\n }\n}\n\nBox.displayName = 'Dropdown.Box'\n\ntype NativeButtonProps = React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>\n\ntype TriggerProps = Omit<NativeButtonProps, 'title'> & {\n tooltip?: React.ReactNode\n}\n\nconst Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(function Trigger(\n { children, onClick, tooltip, className, ...props },\n ref,\n) {\n function handleClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {\n event.preventDefault()\n event.stopPropagation()\n if (onClick) onClick(event)\n }\n\n return (\n <Button\n {...props}\n className={classNames('trigger', className)}\n onClick={handleClick}\n tooltip={tooltip}\n ref={ref}\n >\n {children}\n </Button>\n )\n})\n\nTrigger.displayName = 'Dropdown.Trigger'\n\ntype BodyProps = {\n setPosition?: React.Ref<HTMLDivElement>\n children?: React.ReactNode\n top?: boolean\n right?: boolean\n}\n\nfunction Body({ top, right, children, setPosition }: BodyProps) {\n const style: React.CSSProperties = { position: 'absolute', right: 0, top: 0 }\n\n if (top) {\n style.top = 'auto'\n style.bottom = 0\n }\n\n if (right) {\n style.right = 'auto'\n style.left = 0\n }\n\n return (\n <div ref={setPosition} style={style} className=\"body\" id=\"reactist-dropdown-body\">\n {children}\n </div>\n )\n}\n\nBody.displayName = 'Dropdown.Body'\n\nconst Dropdown = {\n Box,\n Trigger,\n Body,\n}\n\nexport { Dropdown }\n"],"names":["Box","React","Component","constructor","props","context","_timeout","_handleClickOutside","event","dropdownDOMNode","ReactDOM","findDOMNode","contains","target","_toggleShowBody","allowBodyInteractions","setTimeout","state","showBody","onShowBody","document","addEventListener","onHideBody","removeEventListener","setState","_setPosition","body","scrollingParent","getElementById","scrolling_parent","dropdown","dropdownVerticalPosition","offsetTop","dropdownTrigger","querySelector","dropdownTriggerHeight","clientHeight","dropdownBodyHeight","scrollingParentHeight","scrollingParentOffset","scrollTop","bottomOffset","top","undefined","componentWillUnmount","clearTimeout","_getTriggerComponent","_trigger","children","cloneElement","onClick","_getBodyComponent","right","setPosition","className","classNames","body_wrapper","with_arrow","bottom","contentMarkup","style","position","render","display","displayName","Trigger","forwardRef","ref","tooltip","handleClick","preventDefault","stopPropagation","Button","Body","left","id","Dropdown"],"mappings":";;;;;;;;AA2BA,MAAMA,GAAN,SAAkBC,cAAK,CAACC,SAAxB;EAGIC,YAAYC,OAAiBC;IACzB,MAAMD,KAAN,EAAaC,OAAb;SAeJC;;SAEAC,sBAAuBC,KAAD;MAClB,MAAMC,eAAe,GAAGC,QAAQ,CAACC,WAAT,CAAqB,IAArB,CAAxB;MAEA,IAAIF,eAAe,IAAI,CAACA,eAAe,CAACG,QAAhB,CAAyBJ,KAAK,CAACK,MAA/B,CAAxB,EACI,KAAKC,eAAL,GADJ,KAEK,IAAI,CAAC,KAAKV,KAAL,CAAWW,qBAAhB,EAAuC;;QAExC,KAAKT,QAAL,GAAgBU,UAAU,CAAC;UACvB,IAAI,KAAKC,KAAL,CAAWC,QAAf,EAAyB;YACrB,KAAKJ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,OAAO,EAAEA,OAJb;IAKID,GAAG,EAAEA;MAEJnB,QAPL,CADJ;AAWH,CArBe,CAAhB;AAuBAiB,OAAO,CAACD,WAAR,GAAsB,kBAAtB;;AASA,SAASS,IAAT,CAAc;EAAE/B,GAAF;EAAOU,KAAP;EAAcJ,QAAd;EAAwBK;AAAxB,CAAd;EACI,MAAMO,KAAK,GAAwB;IAAEC,QAAQ,EAAE,UAAZ;IAAwBT,KAAK,EAAE,CAA/B;IAAkCV,GAAG,EAAE;GAA1E;;EAEA,IAAIA,GAAJ,EAAS;IACLkB,KAAK,CAAClB,GAAN,GAAY,MAAZ;IACAkB,KAAK,CAACF,MAAN,GAAe,CAAf;;;EAGJ,IAAIN,KAAJ,EAAW;IACPQ,KAAK,CAACR,KAAN,GAAc,MAAd;IACAQ,KAAK,CAACc,IAAN,GAAa,CAAb;;;EAGJ,oBACIzE,4BAAA,MAAA;IAAKkE,GAAG,EAAEd;IAAaO,KAAK,EAAEA;IAAON,SAAS,EAAC;IAAOqB,EAAE,EAAC;GAAzD,EACK3B,QADL,CADJ;AAKH;;AAEDyB,IAAI,CAACT,WAAL,GAAmB,eAAnB;MAEMY,QAAQ,GAAG;EACb5E,GADa;EAEbiE,OAFa;EAGbQ;AAHa;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.js","sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport './input.less'\n\ntype InputProps = {\n /** Additional css class applied to the input. */\n className?: string\n ref?: React.Ref<HTMLInputElement>\n}\n\ntype Props = InputProps & React.InputHTMLAttributes<HTMLInputElement>\n\nconst Input: React.FC<React.PropsWithRef<Props>> = React.forwardRef(\n (props: Props, ref: React.Ref<HTMLInputElement>) => {\n const className = classNames('reactist_input', props.className)\n return <input {...props} className={className} ref={ref} />\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n"],"names":["Input","React","forwardRef","props","ref","className","classNames","displayName"],"mappings":";;;;MAaMA,KAAK,gBAAwCC,cAAK,CAACC,UAAN,CAC/C,CAACC,KAAD,EAAeC,GAAf;EACI,MAAMC,SAAS,GAAGC,UAAU,CAAC,gBAAD,EAAmBH,KAAK,CAACE,SAAzB,CAA5B;EACA,oBAAOJ,4BAAA,QAAA,oCAAWE,KAAX;IAAkBE,SAAS,EAAEA,SAA7B;IAAwCD,GAAG,EAAEA;KAApD;AACH,CAJ8C;AAMnDJ,KAAK,CAACO,WAAN,GAAoB,OAApB;;;;"}
@@ -1,6 +0,0 @@
1
- import { Popover } from './popover.js';
2
-
3
-
4
-
5
- export default Popover;
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,206 +0,0 @@
1
- import React__default from 'react';
2
- import classNames from 'classnames';
3
- import { hasEnoughSpace, calculatePosition } from './positioning-utils.js';
4
-
5
- class Popover extends React__default.Component {
6
- constructor(...args) {
7
- super(...args);
8
- this.popover = void 0;
9
- this.wrapper = void 0;
10
-
11
- this._updatePopoverPosition = () => {
12
- const {
13
- position,
14
- allowVaguePositioning,
15
- gapSize
16
- } = this.props;
17
- const wrapperRect = this.wrapper.getBoundingClientRect();
18
- const popoverRect = this.popover.getBoundingClientRect(); // Instead of using the documentElement find the nearest absolutely positioned element
19
-
20
- const documentEl = document.documentElement;
21
- let node = this.wrapper;
22
- let foundParent = false;
23
-
24
- while (!foundParent) {
25
- const styles = getComputedStyle(node);
26
- const position = styles.getPropertyValue('position');
27
-
28
- if (position === 'absolute' || node === documentEl || !node.parentElement) {
29
- foundParent = true;
30
- } else {
31
- node = node.parentElement;
32
- }
33
- }
34
-
35
- const nodeRect = node.getBoundingClientRect();
36
- const windowDimensions = {
37
- height: nodeRect.height,
38
- width: nodeRect.width
39
- };
40
- const popoverDimensions = {
41
- height: popoverRect.height,
42
- width: popoverRect.width
43
- };
44
- const wrapperDimensions = {
45
- height: wrapperRect.height,
46
- width: wrapperRect.width
47
- };
48
- const wrapperPositionRelative = {
49
- x: wrapperRect.left - nodeRect.left,
50
- y: wrapperRect.top - nodeRect.top
51
- };
52
- const wrapperPositionAbsolute = {
53
- x: wrapperRect.left,
54
- y: wrapperRect.top
55
- };
56
- const positionsToTry = position === 'auto' ? ['top', 'right', 'bottom', 'left', 'top'] : position === 'vertical' ? ['top', 'bottom'] : position === 'horizontal' ? ['left', 'right'] : [position];
57
-
58
- for (let index = 0; index < positionsToTry.length; index++) {
59
- const currentPosition = positionsToTry[index];
60
- const enoughSpaceAtPosition = currentPosition != null ? hasEnoughSpace(windowDimensions, popoverDimensions, wrapperDimensions, wrapperPositionRelative, currentPosition, gapSize) : false;
61
-
62
- if (enoughSpaceAtPosition || index === positionsToTry.length - 1) {
63
- const popoverPosition = currentPosition != null ? calculatePosition(currentPosition, wrapperDimensions, wrapperPositionAbsolute, popoverDimensions, gapSize) : wrapperPositionAbsolute;
64
- this.popover.style.top = popoverPosition.y + "px";
65
- this.popover.style.left = popoverPosition.x + "px";
66
- /**
67
- * Correct placement if vague positioning is allowed.
68
- * When it's not allowed we "cut off" popovers and display them
69
- * out of the viewport to maintain their centered position.
70
- */
71
-
72
- if (allowVaguePositioning) {
73
- // correct horizontally
74
- if (popoverPosition.x < 0) {
75
- this.popover.style.left = 2 * gapSize + "px";
76
- } // correct vertically
77
-
78
-
79
- if (popoverPosition.y + popoverDimensions.height > windowDimensions.height) {
80
- this.popover.style.top = windowDimensions.height - popoverDimensions.height - 2 * gapSize + "px";
81
- }
82
- }
83
-
84
- if (currentPosition !== position) {
85
- this.popover.className = this._getClassNameForPosition(currentPosition);
86
- }
87
-
88
- break;
89
- }
90
- }
91
- };
92
-
93
- this._getClassNameForPosition = position => {
94
- const {
95
- visible,
96
- withArrow,
97
- arrowClassName
98
- } = this.props;
99
- const className = classNames('reactist_popover', {
100
- visible
101
- });
102
-
103
- if (visible && withArrow) {
104
- return classNames(className, arrowClassName, {
105
- arrow_top: position === 'bottom',
106
- arrow_right: position === 'left',
107
- arrow_bottom: position === 'auto' || position === 'top',
108
- arrow_left: position === 'right'
109
- });
110
- }
111
-
112
- return className;
113
- };
114
-
115
- this._updatePopoverRef = popover => {
116
- this.popover = popover;
117
-
118
- if (typeof this.props.popoverRef === 'function') {
119
- this.props.popoverRef(popover);
120
- }
121
- };
122
-
123
- this._updateWrapperRef = wrapper => {
124
- this.wrapper = wrapper;
125
-
126
- if (typeof this.props.wrapperRef === 'function') {
127
- this.props.wrapperRef(wrapper);
128
- }
129
- };
130
- }
131
-
132
- componentDidMount() {
133
- if (this.props.visible) {
134
- this._updatePopoverPosition();
135
- }
136
- }
137
-
138
- componentDidUpdate(prevProps) {
139
- if (this.wrapper && this.props.visible) {
140
- const positionChanged = prevProps.position !== this.props.position;
141
- const vaguePositioningChanged = prevProps.allowVaguePositioning !== this.props.allowVaguePositioning;
142
- const visibilityChanged = prevProps.visible !== this.props.visible;
143
- const arrowChanged = prevProps.withArrow !== this.props.withArrow;
144
- const gapSizeChanged = prevProps.gapSize !== this.props.gapSize;
145
- const contentChanged = prevProps.content !== this.props.content;
146
-
147
- if (positionChanged || vaguePositioningChanged || visibilityChanged || arrowChanged || gapSizeChanged || contentChanged) {
148
- this._updatePopoverPosition();
149
- }
150
- }
151
- }
152
-
153
- render() {
154
- const {
155
- position,
156
- wrapperClassName,
157
- popoverClassName,
158
- onMouseEnter,
159
- onMouseLeave,
160
- onClick,
161
- trigger,
162
- content
163
- } = this.props;
164
- const popoverClass = position ? this._getClassNameForPosition(position) : '';
165
- const popoverContentClass = classNames('reactist_popover__content', popoverClassName);
166
- const wrapperClass = classNames('reactist_popover__wrapper', wrapperClassName);
167
- const triggerElement = React__default.Children.only(trigger);
168
-
169
- function handleTriggerClick(event) {
170
- // @ts-expect-error This is temporary while we revisit the Popover interface
171
- if (onClick) onClick(event); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
172
-
173
- if (typeof triggerElement.props.onClick === 'function') {
174
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
175
- triggerElement.props.onClick(event);
176
- }
177
- }
178
-
179
- return /*#__PURE__*/React__default.createElement("span", {
180
- className: wrapperClass,
181
- onMouseEnter: onMouseEnter,
182
- onMouseLeave: onMouseLeave,
183
- ref: this._updateWrapperRef
184
- }, /*#__PURE__*/React__default.cloneElement(triggerElement, {
185
- onClick: handleTriggerClick
186
- }), /*#__PURE__*/React__default.createElement("span", {
187
- className: popoverClass,
188
- ref: this._updatePopoverRef
189
- }, this.props.visible ? /*#__PURE__*/React__default.createElement("span", {
190
- className: popoverContentClass
191
- }, typeof content === 'function' ? content() : content) : null));
192
- }
193
-
194
- }
195
-
196
- Popover.displayName = void 0;
197
- Popover.defaultProps = void 0;
198
- Popover.displayName = 'Popover';
199
- Popover.defaultProps = {
200
- position: 'auto',
201
- gapSize: 5 // default size of the arrow (see `tooltip.less`)
202
-
203
- };
204
-
205
- export { Popover };
206
- //# sourceMappingURL=popover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"popover.js","sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["import React from 'react'\nimport classNames from 'classnames'\n\nimport { hasEnoughSpace, calculatePosition, RelativePosition } from './positioning-utils'\n\nimport './popover.less'\n\n/**\n * Position of the popover. Defaults to `auto`.\n * `auto` tries to position the tooltip to the top,\n * if there's not enough space it tries to position the tooltip clockwise (right, bottom, left).\n * Setting a distinct value like `right` will always position the popover right, regardless of available space.\n * Specifying `horizontal` will only try to position the tooltip left and right in that order.\n * Specifying `vertical` will only try to position the tooltip top and bottom in that order.\n */\ntype Position = 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal' | 'auto'\n\ntype Props = {\n visible?: boolean\n /** ref of the popover in case you need to manipulate it. */\n popoverRef?: React.Ref<HTMLElement>\n /** ref of the wrapper in case you need to manipulate it. */\n wrapperRef?: React.Ref<HTMLElement>\n /** Function to be called when the mouse enters the trigger. */\n onMouseEnter?: React.MouseEventHandler\n /** Function to be called when the mouse leaves the trigger. */\n onMouseLeave?: React.MouseEventHandler\n onClick?: React.MouseEventHandler\n /** Additional css class that is applied to the wrapper element. */\n wrapperClassName?: string\n /** Additional css class that is applied to the popover element. */\n popoverClassName?: string\n /** Additional css class that is applied to style the arrow. Not applied when `withArrow` is false. */\n arrowClassName?: string\n /** Content prop of the popover. */\n content?: (() => React.ReactNode) | React.ReactNode\n trigger?: React.ReactNode\n position: Position\n withArrow?: boolean\n /**\n * Whether vague positioning is allowed. When set to true the popover prefers to be fully visible over being correctly centered.\n */\n allowVaguePositioning?: boolean\n /** Gap between the popover wrapper and the arrow. */\n gapSize: number\n}\n\nclass Popover extends React.Component<Props> {\n public static displayName: string\n public static defaultProps: Props\n\n componentDidMount() {\n if (this.props.visible) {\n this._updatePopoverPosition()\n }\n }\n\n componentDidUpdate(prevProps: Props) {\n if (this.wrapper && this.props.visible) {\n const positionChanged = prevProps.position !== this.props.position\n const vaguePositioningChanged =\n prevProps.allowVaguePositioning !== this.props.allowVaguePositioning\n const visibilityChanged = prevProps.visible !== this.props.visible\n const arrowChanged = prevProps.withArrow !== this.props.withArrow\n const gapSizeChanged = prevProps.gapSize !== this.props.gapSize\n const contentChanged = prevProps.content !== this.props.content\n if (\n positionChanged ||\n vaguePositioningChanged ||\n visibilityChanged ||\n arrowChanged ||\n gapSizeChanged ||\n contentChanged\n ) {\n this._updatePopoverPosition()\n }\n }\n }\n\n popover!: HTMLElement\n wrapper!: HTMLElement\n\n _updatePopoverPosition = () => {\n const { position, allowVaguePositioning, gapSize } = this.props\n const wrapperRect = this.wrapper.getBoundingClientRect()\n const popoverRect = this.popover.getBoundingClientRect()\n\n // Instead of using the documentElement find the nearest absolutely positioned element\n const documentEl = document.documentElement\n let node = this.wrapper\n let foundParent = false\n while (!foundParent) {\n const styles = getComputedStyle(node)\n const position = styles.getPropertyValue('position')\n if (position === 'absolute' || node === documentEl || !node.parentElement) {\n foundParent = true\n } else {\n node = node.parentElement\n }\n }\n const nodeRect = node.getBoundingClientRect()\n const windowDimensions = {\n height: nodeRect.height,\n width: nodeRect.width,\n }\n\n const popoverDimensions = {\n height: popoverRect.height,\n width: popoverRect.width,\n }\n const wrapperDimensions = {\n height: wrapperRect.height,\n width: wrapperRect.width,\n }\n const wrapperPositionRelative = {\n x: wrapperRect.left - nodeRect.left,\n y: wrapperRect.top - nodeRect.top,\n }\n const wrapperPositionAbsolute = {\n x: wrapperRect.left,\n y: wrapperRect.top,\n }\n\n const positionsToTry: RelativePosition[] =\n position === 'auto'\n ? ['top', 'right', 'bottom', 'left', 'top']\n : position === 'vertical'\n ? ['top', 'bottom']\n : position === 'horizontal'\n ? ['left', 'right']\n : [position]\n\n for (let index = 0; index < positionsToTry.length; index++) {\n const currentPosition = positionsToTry[index]\n const enoughSpaceAtPosition =\n currentPosition != null\n ? hasEnoughSpace(\n windowDimensions,\n popoverDimensions,\n wrapperDimensions,\n wrapperPositionRelative,\n currentPosition,\n gapSize,\n )\n : false\n\n if (enoughSpaceAtPosition || index === positionsToTry.length - 1) {\n const popoverPosition =\n currentPosition != null\n ? calculatePosition(\n currentPosition,\n wrapperDimensions,\n wrapperPositionAbsolute,\n popoverDimensions,\n gapSize,\n )\n : wrapperPositionAbsolute\n this.popover.style.top = `${popoverPosition.y}px`\n this.popover.style.left = `${popoverPosition.x}px`\n\n /**\n * Correct placement if vague positioning is allowed.\n * When it's not allowed we \"cut off\" popovers and display them\n * out of the viewport to maintain their centered position.\n */\n if (allowVaguePositioning) {\n // correct horizontally\n if (popoverPosition.x < 0) {\n this.popover.style.left = `${2 * gapSize}px`\n }\n // correct vertically\n if (popoverPosition.y + popoverDimensions.height > windowDimensions.height) {\n this.popover.style.top = `${\n windowDimensions.height - popoverDimensions.height - 2 * gapSize\n }px`\n }\n }\n\n if (currentPosition !== position) {\n this.popover.className = this._getClassNameForPosition(currentPosition)\n }\n break\n }\n }\n }\n\n _getClassNameForPosition = (position: Position | undefined) => {\n const { visible, withArrow, arrowClassName } = this.props\n const className = classNames('reactist_popover', { visible })\n\n if (visible && withArrow) {\n return classNames(className, arrowClassName, {\n arrow_top: position === 'bottom',\n arrow_right: position === 'left',\n arrow_bottom: position === 'auto' || position === 'top',\n arrow_left: position === 'right',\n })\n }\n return className\n }\n\n _updatePopoverRef = (popover: HTMLElement) => {\n this.popover = popover\n if (typeof this.props.popoverRef === 'function') {\n this.props.popoverRef(popover)\n }\n }\n\n _updateWrapperRef = (wrapper: HTMLElement) => {\n this.wrapper = wrapper\n if (typeof this.props.wrapperRef === 'function') {\n this.props.wrapperRef(wrapper)\n }\n }\n\n render() {\n const {\n position,\n wrapperClassName,\n popoverClassName,\n onMouseEnter,\n onMouseLeave,\n onClick,\n trigger,\n content,\n } = this.props\n const popoverClass = position ? this._getClassNameForPosition(position) : ''\n const popoverContentClass = classNames('reactist_popover__content', popoverClassName)\n const wrapperClass = classNames('reactist_popover__wrapper', wrapperClassName)\n const triggerElement = React.Children.only<React.ReactElement>(\n trigger as React.ReactElement,\n )\n\n function handleTriggerClick(event: React.SyntheticEvent) {\n // @ts-expect-error This is temporary while we revisit the Popover interface\n if (onClick) onClick(event)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (typeof triggerElement.props.onClick === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n triggerElement.props.onClick(event)\n }\n }\n\n return (\n <span\n className={wrapperClass}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n ref={this._updateWrapperRef}\n >\n {React.cloneElement(triggerElement, { onClick: handleTriggerClick })}\n <span className={popoverClass} ref={this._updatePopoverRef}>\n {this.props.visible ? (\n <span className={popoverContentClass}>\n {typeof content === 'function' ? content() : content}\n </span>\n ) : null}\n </span>\n </span>\n )\n }\n}\nPopover.displayName = 'Popover'\nPopover.defaultProps = {\n position: 'auto',\n gapSize: 5, // default size of the arrow (see `tooltip.less`)\n}\n\nexport { Popover }\n"],"names":["Popover","React","Component","popover","wrapper","_updatePopoverPosition","position","allowVaguePositioning","gapSize","props","wrapperRect","getBoundingClientRect","popoverRect","documentEl","document","documentElement","node","foundParent","styles","getComputedStyle","getPropertyValue","parentElement","nodeRect","windowDimensions","height","width","popoverDimensions","wrapperDimensions","wrapperPositionRelative","x","left","y","top","wrapperPositionAbsolute","positionsToTry","index","length","currentPosition","enoughSpaceAtPosition","hasEnoughSpace","popoverPosition","calculatePosition","style","className","_getClassNameForPosition","visible","withArrow","arrowClassName","classNames","arrow_top","arrow_right","arrow_bottom","arrow_left","_updatePopoverRef","popoverRef","_updateWrapperRef","wrapperRef","componentDidMount","componentDidUpdate","prevProps","positionChanged","vaguePositioningChanged","visibilityChanged","arrowChanged","gapSizeChanged","contentChanged","content","render","wrapperClassName","popoverClassName","onMouseEnter","onMouseLeave","onClick","trigger","popoverClass","popoverContentClass","wrapperClass","triggerElement","Children","only","handleTriggerClick","event","ref","cloneElement","displayName","defaultProps"],"mappings":";;;;AA+CA,MAAMA,OAAN,SAAsBC,cAAK,CAACC,SAA5B;;;SAgCIC;SACAC;;SAEAC,yBAAyB;MACrB,MAAM;QAAEC,QAAF;QAAYC,qBAAZ;QAAmCC;UAAY,KAAKC,KAA1D;MACA,MAAMC,WAAW,GAAG,KAAKN,OAAL,CAAaO,qBAAb,EAApB;MACA,MAAMC,WAAW,GAAG,KAAKT,OAAL,CAAaQ,qBAAb,EAApB;;MAGA,MAAME,UAAU,GAAGC,QAAQ,CAACC,eAA5B;MACA,IAAIC,IAAI,GAAG,KAAKZ,OAAhB;MACA,IAAIa,WAAW,GAAG,KAAlB;;MACA,OAAO,CAACA,WAAR,EAAqB;QACjB,MAAMC,MAAM,GAAGC,gBAAgB,CAACH,IAAD,CAA/B;QACA,MAAMV,QAAQ,GAAGY,MAAM,CAACE,gBAAP,CAAwB,UAAxB,CAAjB;;QACA,IAAId,QAAQ,KAAK,UAAb,IAA2BU,IAAI,KAAKH,UAApC,IAAkD,CAACG,IAAI,CAACK,aAA5D,EAA2E;UACvEJ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G5C,4BAAA,OAAA;MAAM0C,SAAS,EAAEgC;KAAjB,EACK,OAAOT,OAAP,KAAmB,UAAnB,GAAgCA,OAAO,EAAvC,GAA4CA,OADjD,CADH,GAIG,IALR,CAPJ,CADJ;;;;;AApMFlE,QACYoF;AADZpF,QAEYqF;AAqNlBrF,OAAO,CAACoF,WAAR,GAAsB,SAAtB;AACApF,OAAO,CAACqF,YAAR,GAAuB;EACnB/E,QAAQ,EAAE,MADS;EAEnBE,OAAO,EAAE,CAFU;;AAAA,CAAvB;;;;"}
@@ -1,104 +0,0 @@
1
- const hasEnoughSpace = (windowDimensions, elementDimensions, wrapperDimensions, wrapperPosition, position, gap = 0) => {
2
- const {
3
- height: windowHeight,
4
- width: windowWidth
5
- } = windowDimensions;
6
- const {
7
- height: elementHeight,
8
- width: elementWidth
9
- } = elementDimensions;
10
- const {
11
- height: wrapperHeight,
12
- width: wrapperWidth
13
- } = wrapperDimensions;
14
- const {
15
- x: wrapperX,
16
- y: wrapperY
17
- } = wrapperPosition;
18
-
19
- const verticalPosition = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
20
-
21
- const horizontalPosition = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
22
-
23
- const canPlaceVertically = verticalPosition >= 0 && verticalPosition + elementWidth <= windowWidth;
24
- const canPlaceHorizontally = horizontalPosition >= 0 && horizontalPosition + elementHeight <= windowHeight;
25
-
26
- if (position === 'top') {
27
- return canPlaceVertically && wrapperY - elementHeight - gap >= 0;
28
- } else if (position === 'right') {
29
- return canPlaceHorizontally && wrapperX + wrapperWidth + elementWidth + gap <= windowWidth;
30
- } else if (position === 'left') {
31
- return canPlaceHorizontally && wrapperX - elementWidth - gap >= 0;
32
- } else if (position === 'bottom') {
33
- return canPlaceVertically && wrapperY + wrapperHeight + elementHeight + gap <= windowHeight;
34
- }
35
-
36
- return false;
37
- };
38
-
39
- function _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions) {
40
- return wrapperPosition.x + (wrapperDimensions.width - elementDimensions.width) / 2;
41
- }
42
-
43
- function _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions) {
44
- return wrapperPosition.y + (wrapperDimensions.height - elementDimensions.height) / 2;
45
- }
46
-
47
- const calculateTopCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
48
- const x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
49
-
50
- const y = wrapperPosition.y - elementDimensions.height - gap;
51
- return {
52
- x,
53
- y
54
- };
55
- };
56
-
57
- const calculateBottomCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
58
- const x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
59
-
60
- const y = wrapperPosition.y + wrapperDimensions.height + gap;
61
- return {
62
- x,
63
- y
64
- };
65
- };
66
-
67
- const calculateRightCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
68
- const x = wrapperPosition.x + wrapperDimensions.width + gap;
69
-
70
- const y = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
71
-
72
- return {
73
- x,
74
- y
75
- };
76
- };
77
-
78
- const calculateLeftCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
79
- const x = wrapperPosition.x - elementDimensions.width - gap;
80
-
81
- const y = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
82
-
83
- return {
84
- x,
85
- y
86
- };
87
- };
88
-
89
- const calculatePosition = (position, wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
90
- if (position === 'top') {
91
- return calculateTopCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap);
92
- } else if (position === 'right') {
93
- return calculateRightCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap);
94
- } else if (position === 'bottom') {
95
- return calculateBottomCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap);
96
- } else if (position === 'left') {
97
- return calculateLeftCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap);
98
- }
99
-
100
- return wrapperPosition;
101
- };
102
-
103
- export { calculateBottomCenterPosition, calculateLeftCenterPosition, calculatePosition, calculateRightCenterPosition, calculateTopCenterPosition, hasEnoughSpace };
104
- //# sourceMappingURL=positioning-utils.js.map