@jetbrains/ring-ui-built 6.0.5-beta.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.
- package/LICENSE.txt +202 -0
- package/README.md +99 -0
- package/babel.config.js +25 -0
- package/components/_helpers/_rollupPluginBabelHelpers.js +648 -0
- package/components/_helpers/anchor.js +31 -0
- package/components/_helpers/badge.js +3 -0
- package/components/_helpers/button__classes.js +34 -0
- package/components/_helpers/caption.js +31 -0
- package/components/_helpers/card.js +132 -0
- package/components/_helpers/date-picker.js +3 -0
- package/components/_helpers/dialog__body-scroll-preventer.js +54 -0
- package/components/_helpers/grid.js +3 -0
- package/components/_helpers/header.js +3 -0
- package/components/_helpers/heading.js +3 -0
- package/components/_helpers/icon__svg.js +75 -0
- package/components/_helpers/input.js +235 -0
- package/components/_helpers/island.js +3 -0
- package/components/_helpers/link.js +3 -0
- package/components/_helpers/list.js +3 -0
- package/components/_helpers/query-assist__suggestions.js +102 -0
- package/components/_helpers/select__filter.js +94 -0
- package/components/_helpers/services-link.js +48 -0
- package/components/_helpers/sidebar.js +123 -0
- package/components/_helpers/tab-link.js +34 -0
- package/components/_helpers/table.js +3 -0
- package/components/_helpers/theme.js +95 -0
- package/components/_helpers/title.js +103 -0
- package/components/alert/alert.d.ts +113 -0
- package/components/alert/alert.js +292 -0
- package/components/alert/container.d.ts +15 -0
- package/components/alert/container.js +52 -0
- package/components/alert-service/alert-service.d.ts +36 -0
- package/components/alert-service/alert-service.js +218 -0
- package/components/analytics/analytics.d.ts +18 -0
- package/components/analytics/analytics.js +31 -0
- package/components/analytics/analytics__custom-plugin.d.ts +28 -0
- package/components/analytics/analytics__custom-plugin.js +90 -0
- package/components/auth/auth.d.ts +3 -0
- package/components/auth/auth.js +130 -0
- package/components/auth/auth__core.d.ts +236 -0
- package/components/auth/auth__core.js +1650 -0
- package/components/auth/background-flow.d.ts +31 -0
- package/components/auth/background-flow.js +146 -0
- package/components/auth/down-notification.d.ts +15 -0
- package/components/auth/down-notification.js +155 -0
- package/components/auth/iframe-flow.d.ts +20 -0
- package/components/auth/iframe-flow.js +192 -0
- package/components/auth/request-builder.d.ts +47 -0
- package/components/auth/request-builder.js +101 -0
- package/components/auth/response-parser.d.ts +70 -0
- package/components/auth/response-parser.js +137 -0
- package/components/auth/storage.d.ts +112 -0
- package/components/auth/storage.js +422 -0
- package/components/auth/token-validator.d.ts +93 -0
- package/components/auth/token-validator.js +267 -0
- package/components/auth/window-flow.d.ts +26 -0
- package/components/auth/window-flow.js +153 -0
- package/components/auth-dialog/auth-dialog.d.ts +60 -0
- package/components/auth-dialog/auth-dialog.js +219 -0
- package/components/auth-dialog-service/auth-dialog-service.d.ts +6 -0
- package/components/auth-dialog-service/auth-dialog-service.js +90 -0
- package/components/avatar/avatar-example-datauri.d.ts +1 -0
- package/components/avatar/avatar-example-datauri.js +4 -0
- package/components/avatar/avatar.d.ts +52 -0
- package/components/avatar/avatar.js +180 -0
- package/components/avatar/fallback-avatar.d.ts +17 -0
- package/components/avatar/fallback-avatar.js +150 -0
- package/components/badge/badge.d.ts +24 -0
- package/components/badge/badge.js +59 -0
- package/components/button/button.d.ts +67 -0
- package/components/button/button.js +131 -0
- package/components/button/button__classes.d.ts +2 -0
- package/components/button/button__classes.js +2 -0
- package/components/button-group/button-group.d.ts +18 -0
- package/components/button-group/button-group.js +48 -0
- package/components/button-group/caption.d.ts +8 -0
- package/components/button-group/caption.js +5 -0
- package/components/button-set/button-set.d.ts +16 -0
- package/components/button-set/button-set.js +47 -0
- package/components/button-toolbar/button-toolbar.d.ts +16 -0
- package/components/button-toolbar/button-toolbar.js +46 -0
- package/components/caret/caret.d.ts +66 -0
- package/components/caret/caret.js +258 -0
- package/components/checkbox/checkbox.d.ts +45 -0
- package/components/checkbox/checkbox.js +130 -0
- package/components/clipboard/clipboard-fallback.d.ts +2 -0
- package/components/clipboard/clipboard-fallback.js +42 -0
- package/components/clipboard/clipboard.d.ts +5 -0
- package/components/clipboard/clipboard.js +183 -0
- package/components/code/code.d.ts +43 -0
- package/components/code/code.js +192 -0
- package/components/confirm/confirm.d.ts +48 -0
- package/components/confirm/confirm.js +151 -0
- package/components/confirm-service/confirm-service.d.ts +21 -0
- package/components/confirm-service/confirm-service.js +139 -0
- package/components/content-layout/content-layout.d.ts +26 -0
- package/components/content-layout/content-layout.js +79 -0
- package/components/content-layout/sidebar.d.ts +31 -0
- package/components/content-layout/sidebar.js +7 -0
- package/components/contenteditable/contenteditable.d.ts +47 -0
- package/components/contenteditable/contenteditable.js +84 -0
- package/components/control-label/control-label.d.ts +11 -0
- package/components/control-label/control-label.js +36 -0
- package/components/data-list/data-list.d.ts +85 -0
- package/components/data-list/data-list.js +246 -0
- package/components/data-list/data-list.mock.d.ts +16 -0
- package/components/data-list/data-list.mock.js +192 -0
- package/components/data-list/item.d.ts +50 -0
- package/components/data-list/item.js +234 -0
- package/components/data-list/selection.d.ts +16 -0
- package/components/data-list/selection.js +146 -0
- package/components/data-list/title.d.ts +26 -0
- package/components/data-list/title.js +28 -0
- package/components/date-picker/consts.d.ts +98 -0
- package/components/date-picker/consts.js +46 -0
- package/components/date-picker/date-input.d.ts +47 -0
- package/components/date-picker/date-input.js +177 -0
- package/components/date-picker/date-picker.d.ts +77 -0
- package/components/date-picker/date-picker.js +402 -0
- package/components/date-picker/date-popup.d.ts +55 -0
- package/components/date-picker/date-popup.js +488 -0
- package/components/date-picker/day.d.ts +30 -0
- package/components/date-picker/day.js +133 -0
- package/components/date-picker/formats.d.ts +2 -0
- package/components/date-picker/formats.js +3 -0
- package/components/date-picker/month-names.d.ts +13 -0
- package/components/date-picker/month-names.js +110 -0
- package/components/date-picker/month-slider.d.ts +29 -0
- package/components/date-picker/month-slider.js +93 -0
- package/components/date-picker/month.d.ts +14 -0
- package/components/date-picker/month.js +58 -0
- package/components/date-picker/months.d.ts +11 -0
- package/components/date-picker/months.js +133 -0
- package/components/date-picker/weekdays.d.ts +13 -0
- package/components/date-picker/weekdays.js +39 -0
- package/components/date-picker/years.d.ts +25 -0
- package/components/date-picker/years.js +134 -0
- package/components/dialog/dialog.d.ts +64 -0
- package/components/dialog/dialog.js +238 -0
- package/components/dialog/dialog__body-scroll-preventer.d.ts +9 -0
- package/components/dialog/dialog__body-scroll-preventer.js +6 -0
- package/components/dropdown/anchor.d.ts +11 -0
- package/components/dropdown/anchor.js +24 -0
- package/components/dropdown/dropdown.d.ts +87 -0
- package/components/dropdown/dropdown.js +247 -0
- package/components/dropdown-menu/dropdown-menu.d.ts +36 -0
- package/components/dropdown-menu/dropdown-menu.js +194 -0
- package/components/editable-heading/editable-heading.d.ts +32 -0
- package/components/editable-heading/editable-heading.js +245 -0
- package/components/error-bubble/error-bubble.d.ts +18 -0
- package/components/error-bubble/error-bubble.js +86 -0
- package/components/error-message/error-message.d.ts +27 -0
- package/components/error-message/error-message.js +78 -0
- package/components/footer/footer.d.ts +28 -0
- package/components/footer/footer.js +118 -0
- package/components/global/compose.d.ts +7 -0
- package/components/global/compose.js +17 -0
- package/components/global/composeRefs.d.ts +3 -0
- package/components/global/composeRefs.js +19 -0
- package/components/global/controls-height.d.ts +9 -0
- package/components/global/controls-height.js +19 -0
- package/components/global/create-stateful-context.d.ts +27 -0
- package/components/global/create-stateful-context.js +49 -0
- package/components/global/data-tests.d.ts +3 -0
- package/components/global/data-tests.js +30 -0
- package/components/global/dom.d.ts +37 -0
- package/components/global/dom.js +150 -0
- package/components/global/focus-sensor-hoc.d.ts +19 -0
- package/components/global/focus-sensor-hoc.js +165 -0
- package/components/global/fuzzy-highlight.d.ts +11 -0
- package/components/global/fuzzy-highlight.js +90 -0
- package/components/global/get-event-key.d.ts +2 -0
- package/components/global/get-event-key.js +101 -0
- package/components/global/get-uid.d.ts +1 -0
- package/components/global/get-uid.js +22 -0
- package/components/global/inject-styles.d.ts +3 -0
- package/components/global/inject-styles.js +22 -0
- package/components/global/linear-function.d.ts +6 -0
- package/components/global/linear-function.js +15 -0
- package/components/global/listeners.d.ts +8 -0
- package/components/global/listeners.js +58 -0
- package/components/global/memoize.d.ts +1 -0
- package/components/global/memoize.js +23 -0
- package/components/global/normalize-indent.d.ts +1 -0
- package/components/global/normalize-indent.js +61 -0
- package/components/global/promise-with-timeout.d.ts +5 -0
- package/components/global/promise-with-timeout.js +19 -0
- package/components/global/prop-types.d.ts +4 -0
- package/components/global/prop-types.js +9 -0
- package/components/global/react-dom-renderer.d.ts +16 -0
- package/components/global/react-dom-renderer.js +53 -0
- package/components/global/react-render-adapter.d.ts +1 -0
- package/components/global/react-render-adapter.js +6 -0
- package/components/global/rerender-hoc.d.ts +10 -0
- package/components/global/rerender-hoc.js +46 -0
- package/components/global/schedule-raf.d.ts +1 -0
- package/components/global/schedule-raf.js +28 -0
- package/components/global/sniffer.d.ts +3 -0
- package/components/global/sniffer.js +6 -0
- package/components/global/theme.d.ts +21 -0
- package/components/global/theme.js +40 -0
- package/components/global/trivial-template-tag.d.ts +1 -0
- package/components/global/trivial-template-tag.js +21 -0
- package/components/global/typescript-utils.d.ts +2 -0
- package/components/global/typescript-utils.js +8 -0
- package/components/global/url.d.ts +57 -0
- package/components/global/url.js +141 -0
- package/components/global/use-event-callback.d.ts +1 -0
- package/components/global/use-event-callback.js +17 -0
- package/components/global/variables.d.ts +89 -0
- package/components/global/variables.js +1 -0
- package/components/grid/col.d.ts +31 -0
- package/components/grid/col.js +81 -0
- package/components/grid/grid.d.ts +14 -0
- package/components/grid/grid.js +47 -0
- package/components/grid/row.d.ts +40 -0
- package/components/grid/row.js +70 -0
- package/components/group/group.d.ts +12 -0
- package/components/group/group.js +39 -0
- package/components/header/header.d.ts +34 -0
- package/components/header/header.js +184 -0
- package/components/header/logo.d.ts +14 -0
- package/components/header/logo.js +51 -0
- package/components/header/profile.d.ts +75 -0
- package/components/header/profile.js +252 -0
- package/components/header/services-link.d.ts +25 -0
- package/components/header/services-link.js +13 -0
- package/components/header/services.d.ts +33 -0
- package/components/header/services.js +172 -0
- package/components/header/smart-profile.d.ts +36 -0
- package/components/header/smart-profile.js +298 -0
- package/components/header/smart-services.d.ts +26 -0
- package/components/header/smart-services.js +189 -0
- package/components/header/tray-icon.d.ts +32 -0
- package/components/header/tray-icon.js +57 -0
- package/components/header/tray.d.ts +9 -0
- package/components/header/tray.js +41 -0
- package/components/heading/heading.d.ts +25 -0
- package/components/heading/heading.js +69 -0
- package/components/http/http.d.ts +61 -0
- package/components/http/http.js +385 -0
- package/components/http/http.mock.d.ts +20 -0
- package/components/http/http.mock.js +112 -0
- package/components/hub-source/hub-source.d.ts +44 -0
- package/components/hub-source/hub-source.js +215 -0
- package/components/hub-source/hub-source__user.d.ts +4 -0
- package/components/hub-source/hub-source__user.js +59 -0
- package/components/hub-source/hub-source__users-groups.d.ts +24 -0
- package/components/hub-source/hub-source__users-groups.js +84 -0
- package/components/i18n/i18n-context.d.ts +13 -0
- package/components/i18n/i18n-context.js +27 -0
- package/components/i18n/i18n.d.ts +59 -0
- package/components/i18n/i18n.js +139 -0
- package/components/icon/icon.d.ts +43 -0
- package/components/icon/icon.js +109 -0
- package/components/icon/icon__constants.d.ts +30 -0
- package/components/icon/icon__constants.js +34 -0
- package/components/icon/icon__svg.d.ts +15 -0
- package/components/icon/icon__svg.js +14 -0
- package/components/icon/index.d.ts +2 -0
- package/components/icon/index.js +17 -0
- package/components/input/input.d.ts +77 -0
- package/components/input/input.js +35 -0
- package/components/island/adaptive-island-hoc.d.ts +61 -0
- package/components/island/adaptive-island-hoc.js +53 -0
- package/components/island/content.d.ts +43 -0
- package/components/island/content.js +151 -0
- package/components/island/header.d.ts +8 -0
- package/components/island/header.js +99 -0
- package/components/island/island.d.ts +78 -0
- package/components/island/island.js +60 -0
- package/components/island-legacy/content-legacy.d.ts +10 -0
- package/components/island-legacy/content-legacy.js +34 -0
- package/components/island-legacy/header-legacy.d.ts +10 -0
- package/components/island-legacy/header-legacy.js +36 -0
- package/components/island-legacy/island-legacy.d.ts +12 -0
- package/components/island-legacy/island-legacy.js +36 -0
- package/components/link/clickableLink.d.ts +20 -0
- package/components/link/clickableLink.js +69 -0
- package/components/link/link.d.ts +138 -0
- package/components/link/link.js +86 -0
- package/components/list/consts.d.ts +77 -0
- package/components/list/consts.js +27 -0
- package/components/list/list.d.ts +206 -0
- package/components/list/list.js +795 -0
- package/components/list/list__custom.d.ts +6 -0
- package/components/list/list__custom.js +92 -0
- package/components/list/list__hint.d.ts +15 -0
- package/components/list/list__hint.js +33 -0
- package/components/list/list__item.d.ts +8 -0
- package/components/list/list__item.js +234 -0
- package/components/list/list__link.d.ts +9 -0
- package/components/list/list__link.js +76 -0
- package/components/list/list__separator.d.ts +5 -0
- package/components/list/list__separator.js +39 -0
- package/components/list/list__title.d.ts +5 -0
- package/components/list/list__title.js +48 -0
- package/components/list/list__users-groups-source.d.ts +27 -0
- package/components/list/list__users-groups-source.js +190 -0
- package/components/loader/loader.d.ts +28 -0
- package/components/loader/loader.js +91 -0
- package/components/loader/loader__core.d.ts +75 -0
- package/components/loader/loader__core.js +313 -0
- package/components/loader-inline/loader-inline.d.ts +18 -0
- package/components/loader-inline/loader-inline.js +50 -0
- package/components/loader-screen/loader-screen.d.ts +17 -0
- package/components/loader-screen/loader-screen.js +62 -0
- package/components/login-dialog/login-dialog.d.ts +47 -0
- package/components/login-dialog/login-dialog.js +212 -0
- package/components/login-dialog/service.d.ts +2 -0
- package/components/login-dialog/service.js +94 -0
- package/components/markdown/markdown.d.ts +12 -0
- package/components/markdown/markdown.js +43 -0
- package/components/message/message.d.ts +55 -0
- package/components/message/message.js +265 -0
- package/components/old-browsers-message/old-browsers-message.d.ts +2 -0
- package/components/old-browsers-message/old-browsers-message.js +92 -0
- package/components/old-browsers-message/old-browsers-message__stop.d.ts +1 -0
- package/components/old-browsers-message/old-browsers-message__stop.js +11 -0
- package/components/old-browsers-message/white-list.d.ts +2 -0
- package/components/old-browsers-message/white-list.js +37 -0
- package/components/pager/pager.d.ts +78 -0
- package/components/pager/pager.js +385 -0
- package/components/panel/panel.d.ts +12 -0
- package/components/panel/panel.js +39 -0
- package/components/permissions/permissions.d.ts +111 -0
- package/components/permissions/permissions.js +220 -0
- package/components/permissions/permissions__cache.d.ts +93 -0
- package/components/permissions/permissions__cache.js +257 -0
- package/components/popup/popup.consts.d.ts +37 -0
- package/components/popup/popup.consts.js +44 -0
- package/components/popup/popup.d.ts +147 -0
- package/components/popup/popup.js +419 -0
- package/components/popup/popup.target.d.ts +7 -0
- package/components/popup/popup.target.js +24 -0
- package/components/popup/position.d.ts +30 -0
- package/components/popup/position.js +270 -0
- package/components/popup-menu/popup-menu.d.ts +80 -0
- package/components/popup-menu/popup-menu.js +136 -0
- package/components/progress-bar/progress-bar.d.ts +58 -0
- package/components/progress-bar/progress-bar.js +113 -0
- package/components/query-assist/query-assist.d.ts +306 -0
- package/components/query-assist/query-assist.js +1092 -0
- package/components/query-assist/query-assist__suggestions.d.ts +29 -0
- package/components/query-assist/query-assist__suggestions.js +70 -0
- package/components/radio/radio.d.ts +18 -0
- package/components/radio/radio.js +48 -0
- package/components/radio/radio__item.d.ts +28 -0
- package/components/radio/radio__item.js +88 -0
- package/components/select/select.d.ts +276 -0
- package/components/select/select.js +1285 -0
- package/components/select/select__filter.d.ts +19 -0
- package/components/select/select__filter.js +80 -0
- package/components/select/select__popup.d.ts +166 -0
- package/components/select/select__popup.js +626 -0
- package/components/shortcuts/core.d.ts +74 -0
- package/components/shortcuts/core.js +247 -0
- package/components/shortcuts/shortcut-title.d.ts +1 -0
- package/components/shortcuts/shortcut-title.js +56 -0
- package/components/shortcuts/shortcuts-hoc.d.ts +65 -0
- package/components/shortcuts/shortcuts-hoc.js +59 -0
- package/components/shortcuts/shortcuts.d.ts +28 -0
- package/components/shortcuts/shortcuts.js +90 -0
- package/components/storage/storage.d.ts +18 -0
- package/components/storage/storage.js +89 -0
- package/components/storage/storage__fallback.d.ts +79 -0
- package/components/storage/storage__fallback.js +251 -0
- package/components/storage/storage__local.d.ts +38 -0
- package/components/storage/storage__local.js +215 -0
- package/components/style.css +1 -0
- package/components/tab-trap/tab-trap.d.ts +43 -0
- package/components/tab-trap/tab-trap.js +179 -0
- package/components/table/cell.d.ts +13 -0
- package/components/table/cell.js +37 -0
- package/components/table/disable-hover-hoc.d.ts +64 -0
- package/components/table/disable-hover-hoc.js +62 -0
- package/components/table/header-cell.d.ts +43 -0
- package/components/table/header-cell.js +109 -0
- package/components/table/header.d.ts +56 -0
- package/components/table/header.js +151 -0
- package/components/table/multitable.d.ts +25 -0
- package/components/table/multitable.js +139 -0
- package/components/table/row-with-focus-sensor.d.ts +18 -0
- package/components/table/row-with-focus-sensor.js +115 -0
- package/components/table/row.d.ts +59 -0
- package/components/table/row.js +297 -0
- package/components/table/selection-adapter.d.ts +5 -0
- package/components/table/selection-adapter.js +14 -0
- package/components/table/selection-shortcuts-hoc.d.ts +17 -0
- package/components/table/selection-shortcuts-hoc.js +204 -0
- package/components/table/selection.d.ts +47 -0
- package/components/table/selection.js +256 -0
- package/components/table/smart-table.d.ts +64 -0
- package/components/table/smart-table.js +145 -0
- package/components/table/table.d.ts +159 -0
- package/components/table/table.js +459 -0
- package/components/tabs/collapsible-more.d.ts +29 -0
- package/components/tabs/collapsible-more.js +217 -0
- package/components/tabs/collapsible-tab.d.ts +16 -0
- package/components/tabs/collapsible-tab.js +88 -0
- package/components/tabs/collapsible-tabs.d.ts +43 -0
- package/components/tabs/collapsible-tabs.js +349 -0
- package/components/tabs/custom-item.d.ts +9 -0
- package/components/tabs/custom-item.js +11 -0
- package/components/tabs/dumb-tabs.d.ts +35 -0
- package/components/tabs/dumb-tabs.js +184 -0
- package/components/tabs/smart-tabs.d.ts +20 -0
- package/components/tabs/smart-tabs.js +136 -0
- package/components/tabs/tab-link.d.ts +18 -0
- package/components/tabs/tab-link.js +13 -0
- package/components/tabs/tab.d.ts +27 -0
- package/components/tabs/tab.js +41 -0
- package/components/tabs/tabs.d.ts +7 -0
- package/components/tabs/tabs.js +94 -0
- package/components/tag/tag.d.ts +64 -0
- package/components/tag/tag.js +213 -0
- package/components/tags-input/tags-input.d.ts +138 -0
- package/components/tags-input/tags-input.js +529 -0
- package/components/tags-list/tags-list.d.ts +46 -0
- package/components/tags-list/tags-list.js +102 -0
- package/components/text/text.d.ts +23 -0
- package/components/text/text.js +57 -0
- package/components/toggle/toggle.d.ts +39 -0
- package/components/toggle/toggle.js +86 -0
- package/components/tooltip/tooltip.d.ts +65 -0
- package/components/tooltip/tooltip.js +227 -0
- package/components/user-agreement/service.d.ts +69 -0
- package/components/user-agreement/service.js +484 -0
- package/components/user-agreement/toolbox.eula.d.ts +2 -0
- package/components/user-agreement/toolbox.eula.js +3 -0
- package/components/user-agreement/user-agreement.d.ts +60 -0
- package/components/user-agreement/user-agreement.js +170 -0
- package/components/user-card/card.d.ts +70 -0
- package/components/user-card/card.js +76 -0
- package/components/user-card/smart-user-card-tooltip.d.ts +20 -0
- package/components/user-card/smart-user-card-tooltip.js +168 -0
- package/components/user-card/tooltip.d.ts +36 -0
- package/components/user-card/tooltip.js +140 -0
- package/components/user-card/user-card.d.ts +11 -0
- package/components/user-card/user-card.js +81 -0
- package/jslint-xml.js +38 -0
- package/package.json +127 -0
- package/postcss.config.js +20 -0
- package/typings.d.ts +97 -0
- package/webpack.config.js +118 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
import { createContext } from 'react';
|
2
|
+
|
3
|
+
var ControlsHeight;
|
4
|
+
(function (ControlsHeight) {
|
5
|
+
ControlsHeight["S"] = "S";
|
6
|
+
ControlsHeight["M"] = "M";
|
7
|
+
ControlsHeight["L"] = "L";
|
8
|
+
})(ControlsHeight || (ControlsHeight = {}));
|
9
|
+
var ControlsHeightContext = /*#__PURE__*/createContext(ControlsHeight.M);
|
10
|
+
var globalControlsHeight = ControlsHeight.M;
|
11
|
+
// This can be used if React Context is not applicable, for example for alertService or Auth dialog
|
12
|
+
function configureGlobalControlsHeight(value) {
|
13
|
+
globalControlsHeight = value;
|
14
|
+
}
|
15
|
+
function getGlobalControlsHeight() {
|
16
|
+
return globalControlsHeight;
|
17
|
+
}
|
18
|
+
|
19
|
+
export { ControlsHeight, ControlsHeightContext, configureGlobalControlsHeight, getGlobalControlsHeight };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React, { ReactNode } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
type Update<T> = (value: T) => void;
|
4
|
+
export interface ProviderProps {
|
5
|
+
children: ReactNode;
|
6
|
+
}
|
7
|
+
export interface UpdaterProps<T> {
|
8
|
+
value: T;
|
9
|
+
skipUpdate?: boolean;
|
10
|
+
}
|
11
|
+
export default function createStatefulContext<T>(initialValue: T, name?: string): {
|
12
|
+
ValueContext: React.Context<T>;
|
13
|
+
UpdateContext: React.Context<Update<T>>;
|
14
|
+
Provider: {
|
15
|
+
({ children }: ProviderProps): React.JSX.Element;
|
16
|
+
propTypes: {
|
17
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
18
|
+
};
|
19
|
+
displayName: string;
|
20
|
+
};
|
21
|
+
useUpdate: (value: T, skipUpdate?: boolean) => void;
|
22
|
+
Updater: React.MemoExoticComponent<{
|
23
|
+
({ value, skipUpdate }: UpdaterProps<T>): null;
|
24
|
+
displayName: string;
|
25
|
+
}>;
|
26
|
+
};
|
27
|
+
export {};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { j as _slicedToArray } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import React, { memo, createContext, useState, useContext, useEffect } from 'react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
|
5
|
+
function createStatefulContext(initialValue) {
|
6
|
+
var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
7
|
+
var ValueContext = /*#__PURE__*/createContext(initialValue);
|
8
|
+
var UpdateContext = /*#__PURE__*/createContext(function () {});
|
9
|
+
function Provider(_ref) {
|
10
|
+
var children = _ref.children;
|
11
|
+
var _useState = useState(initialValue),
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
13
|
+
value = _useState2[0],
|
14
|
+
update = _useState2[1];
|
15
|
+
return /*#__PURE__*/React.createElement(ValueContext.Provider, {
|
16
|
+
value: value
|
17
|
+
}, /*#__PURE__*/React.createElement(UpdateContext.Provider, {
|
18
|
+
value: update
|
19
|
+
}, children));
|
20
|
+
}
|
21
|
+
Provider.propTypes = {
|
22
|
+
children: PropTypes.node
|
23
|
+
};
|
24
|
+
Provider.displayName = "".concat(name, "Provider");
|
25
|
+
function useUpdate(value, skipUpdate) {
|
26
|
+
var update = useContext(UpdateContext);
|
27
|
+
useEffect(function () {
|
28
|
+
if (!skipUpdate) {
|
29
|
+
update(value);
|
30
|
+
}
|
31
|
+
}, [update, value, skipUpdate]);
|
32
|
+
}
|
33
|
+
function Updater(_ref2) {
|
34
|
+
var value = _ref2.value,
|
35
|
+
skipUpdate = _ref2.skipUpdate;
|
36
|
+
useUpdate(value, skipUpdate);
|
37
|
+
return null;
|
38
|
+
}
|
39
|
+
Updater.displayName = "".concat(name, "Updater");
|
40
|
+
return {
|
41
|
+
ValueContext,
|
42
|
+
UpdateContext,
|
43
|
+
Provider,
|
44
|
+
useUpdate,
|
45
|
+
Updater: /*#__PURE__*/memo(Updater)
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
export { createStatefulContext as default };
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { l as _toConsumableArray, j as _slicedToArray } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.reduce.js';
|
3
|
+
import 'core-js/modules/es.object.to-string.js';
|
4
|
+
import 'core-js/modules/es.object.entries.js';
|
5
|
+
import 'core-js/modules/es.array.concat.js';
|
6
|
+
|
7
|
+
function expandMap(attrsMap) {
|
8
|
+
return Object.entries(attrsMap).reduce(function (result, _ref) {
|
9
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
10
|
+
key = _ref2[0],
|
11
|
+
value = _ref2[1];
|
12
|
+
return value ? [].concat(_toConsumableArray(result), [key]) : result;
|
13
|
+
}, []);
|
14
|
+
}
|
15
|
+
function joinDataTestAttributes() {
|
16
|
+
for (var _len = arguments.length, attrs = new Array(_len), _key = 0; _key < _len; _key++) {
|
17
|
+
attrs[_key] = arguments[_key];
|
18
|
+
}
|
19
|
+
return attrs.reduce(function (result, attr) {
|
20
|
+
if (!attr) {
|
21
|
+
return result;
|
22
|
+
}
|
23
|
+
if (typeof attr === 'object') {
|
24
|
+
return [].concat(_toConsumableArray(result), _toConsumableArray(expandMap(attr)));
|
25
|
+
}
|
26
|
+
return [].concat(_toConsumableArray(result), [attr]);
|
27
|
+
}, []).join(' ');
|
28
|
+
}
|
29
|
+
|
30
|
+
export { joinDataTestAttributes as default };
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/**
|
2
|
+
* @name DOM
|
3
|
+
*/
|
4
|
+
import { SyntheticEvent } from 'react';
|
5
|
+
import type { PropertiesHyphen } from 'csstype';
|
6
|
+
export declare const getStyles: ((elt: Element, pseudoElt?: string | null | undefined) => CSSStyleDeclaration) & typeof getComputedStyle;
|
7
|
+
export declare function isMounted(node: Node | Range | null | undefined): boolean;
|
8
|
+
export interface Rect {
|
9
|
+
top: number;
|
10
|
+
right: number;
|
11
|
+
bottom: number;
|
12
|
+
left: number;
|
13
|
+
width: number;
|
14
|
+
height: number;
|
15
|
+
}
|
16
|
+
export declare function getRect(node: Element | Range | null | undefined): Rect;
|
17
|
+
export declare function getPixelRatio(): number;
|
18
|
+
export declare function getWindowHeight(): number;
|
19
|
+
export declare function getWindowWidth(): number;
|
20
|
+
export declare function isNodeInVisiblePartOfPage(node: Element | Range): boolean;
|
21
|
+
export declare function getDocumentScrollTop(): number;
|
22
|
+
export declare function getDocumentScrollLeft(): number;
|
23
|
+
export declare const applyMethodToClasses: (method: 'add' | 'remove') => (classList: DOMTokenList, classes?: string) => void;
|
24
|
+
export declare const addClasses: (classList: DOMTokenList, classes?: string) => void;
|
25
|
+
export declare const removeClasses: (classList: DOMTokenList, classes?: string) => void;
|
26
|
+
export declare const toggleClasses: (classList: DOMTokenList, classes: Record<string, boolean>) => void;
|
27
|
+
export declare function setRootStyleProperties(properties?: PropertiesHyphen): void;
|
28
|
+
export declare function resetRootStyleProperties(properties?: Partial<Record<keyof PropertiesHyphen, unknown>>): void;
|
29
|
+
export declare class Listeners {
|
30
|
+
private _all;
|
31
|
+
add<K extends keyof HTMLElementEventMap>(el: HTMLElement, event: K, handler: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
32
|
+
add<K extends keyof WindowEventMap>(el: Window, event: K, handler: (this: Window, ev: WindowEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
33
|
+
add<K extends keyof DocumentEventMap>(el: Document, event: K, handler: (this: Window, ev: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
|
34
|
+
remove(fn: () => void): void;
|
35
|
+
removeAll(): void;
|
36
|
+
}
|
37
|
+
export declare function preventDefault(e: Event | SyntheticEvent): void;
|
@@ -0,0 +1,150 @@
|
|
1
|
+
import { j as _slicedToArray, d as _createClass, c as _classCallCheck, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.object.to-string.js';
|
3
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
4
|
+
import 'core-js/modules/es.array.filter.js';
|
5
|
+
import 'core-js/modules/es.regexp.exec.js';
|
6
|
+
import 'core-js/modules/es.string.split.js';
|
7
|
+
import 'core-js/modules/es.object.entries.js';
|
8
|
+
import 'core-js/modules/es.array.iterator.js';
|
9
|
+
import 'core-js/modules/es.set.js';
|
10
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @name DOM
|
14
|
+
*/
|
15
|
+
var getStyles = window.getComputedStyle.bind(window);
|
16
|
+
function isMounted(node) {
|
17
|
+
if (node === document) {
|
18
|
+
return true;
|
19
|
+
}
|
20
|
+
return node instanceof Node && document.documentElement.contains(node.parentNode);
|
21
|
+
}
|
22
|
+
var rectStub = {
|
23
|
+
top: 0,
|
24
|
+
right: 0,
|
25
|
+
bottom: 0,
|
26
|
+
left: 0,
|
27
|
+
width: 0,
|
28
|
+
height: 0
|
29
|
+
};
|
30
|
+
function getRect(node) {
|
31
|
+
if (node instanceof Range || node != null && isMounted(node)) {
|
32
|
+
var _node$getBoundingClie = node.getBoundingClientRect(),
|
33
|
+
top = _node$getBoundingClie.top,
|
34
|
+
right = _node$getBoundingClie.right,
|
35
|
+
bottom = _node$getBoundingClie.bottom,
|
36
|
+
left = _node$getBoundingClie.left,
|
37
|
+
width = _node$getBoundingClie.width,
|
38
|
+
height = _node$getBoundingClie.height;
|
39
|
+
return {
|
40
|
+
top,
|
41
|
+
right,
|
42
|
+
bottom,
|
43
|
+
left,
|
44
|
+
width,
|
45
|
+
height
|
46
|
+
};
|
47
|
+
} else {
|
48
|
+
return Object.assign({}, rectStub);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
function getPixelRatio() {
|
52
|
+
return 'devicePixelRatio' in window ? window.devicePixelRatio : 1;
|
53
|
+
}
|
54
|
+
function getWindowHeight() {
|
55
|
+
return window.innerHeight;
|
56
|
+
}
|
57
|
+
function getWindowWidth() {
|
58
|
+
return window.innerWidth;
|
59
|
+
}
|
60
|
+
function isNodeInVisiblePartOfPage(node) {
|
61
|
+
var _getRect = getRect(node),
|
62
|
+
top = _getRect.top,
|
63
|
+
bottom = _getRect.bottom,
|
64
|
+
left = _getRect.left,
|
65
|
+
right = _getRect.right;
|
66
|
+
return !(bottom < 0 || right < 0 || getWindowHeight() - top < 0 || getWindowWidth() - left < 0);
|
67
|
+
}
|
68
|
+
function getDocumentScrollTop() {
|
69
|
+
return document.documentElement && document.documentElement.scrollTop || document.body.scrollTop;
|
70
|
+
}
|
71
|
+
function getDocumentScrollLeft() {
|
72
|
+
return document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft;
|
73
|
+
}
|
74
|
+
var applyMethodToClasses = function applyMethodToClasses(method) {
|
75
|
+
return function (classList) {
|
76
|
+
var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
77
|
+
classes.split(/\s+/g).filter(function (className) {
|
78
|
+
return !!className;
|
79
|
+
}).forEach(function (className) {
|
80
|
+
return classList[method](className);
|
81
|
+
});
|
82
|
+
};
|
83
|
+
};
|
84
|
+
var addClasses = applyMethodToClasses('add');
|
85
|
+
var removeClasses = applyMethodToClasses('remove');
|
86
|
+
var toggleClasses = function toggleClasses(classList, classes) {
|
87
|
+
return Object.entries(classes).forEach(function (_ref) {
|
88
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
89
|
+
className = _ref2[0],
|
90
|
+
on = _ref2[1];
|
91
|
+
return classList.toggle(className, on);
|
92
|
+
});
|
93
|
+
};
|
94
|
+
function setRootStyleProperties() {
|
95
|
+
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
96
|
+
var rootStyle = document.documentElement.style;
|
97
|
+
Object.entries(properties).forEach(function (_ref3) {
|
98
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
99
|
+
key = _ref4[0],
|
100
|
+
value = _ref4[1];
|
101
|
+
rootStyle.setProperty(key, value);
|
102
|
+
});
|
103
|
+
}
|
104
|
+
function resetRootStyleProperties() {
|
105
|
+
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
106
|
+
var rootStyle = document.documentElement.style;
|
107
|
+
Object.keys(properties).forEach(function (key) {
|
108
|
+
return rootStyle.removeProperty(key);
|
109
|
+
});
|
110
|
+
}
|
111
|
+
var Listeners = /*#__PURE__*/function () {
|
112
|
+
function Listeners() {
|
113
|
+
_classCallCheck(this, Listeners);
|
114
|
+
_defineProperty(this, "_all", new Set());
|
115
|
+
}
|
116
|
+
_createClass(Listeners, [{
|
117
|
+
key: "add",
|
118
|
+
value: function add(el, event, handler, options) {
|
119
|
+
el.addEventListener(event, handler, options);
|
120
|
+
var dispatchFn = function dispatchFn() {
|
121
|
+
return el.removeEventListener(event, handler, options);
|
122
|
+
};
|
123
|
+
this._all.add(dispatchFn);
|
124
|
+
return dispatchFn;
|
125
|
+
}
|
126
|
+
}, {
|
127
|
+
key: "remove",
|
128
|
+
value: function remove(fn) {
|
129
|
+
fn();
|
130
|
+
this._all.delete(fn);
|
131
|
+
}
|
132
|
+
}, {
|
133
|
+
key: "removeAll",
|
134
|
+
value: function removeAll() {
|
135
|
+
var _this = this;
|
136
|
+
this._all.forEach(function (fn) {
|
137
|
+
return _this.remove(fn);
|
138
|
+
});
|
139
|
+
}
|
140
|
+
}]);
|
141
|
+
return Listeners;
|
142
|
+
}();
|
143
|
+
// Synthetic events from Combokeys#trigger are plain objects
|
144
|
+
function preventDefault(e) {
|
145
|
+
if (e.preventDefault) {
|
146
|
+
e.preventDefault();
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
export { Listeners, addClasses, applyMethodToClasses, getDocumentScrollLeft, getDocumentScrollTop, getPixelRatio, getRect, getStyles, getWindowHeight, getWindowWidth, isMounted, isNodeInVisiblePartOfPage, preventDefault, removeClasses, resetRootStyleProperties, setRootStyleProperties, toggleClasses };
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { ComponentType, Ref } from 'react';
|
2
|
+
export interface FocusSensorOuterProps<T extends HTMLElement> {
|
3
|
+
focused?: boolean | undefined;
|
4
|
+
autofocus?: boolean | undefined;
|
5
|
+
scrollOnTableFocus?: boolean;
|
6
|
+
onFocus?: (() => void) | undefined;
|
7
|
+
onBlur?: (() => void) | undefined;
|
8
|
+
innerRef?: Ref<T> | null | undefined;
|
9
|
+
}
|
10
|
+
export interface FocusSensorAddProps<T extends HTMLElement> {
|
11
|
+
innerRef: Ref<T>;
|
12
|
+
focused: boolean;
|
13
|
+
onFocusReset: () => void;
|
14
|
+
onFocusRestore: () => void;
|
15
|
+
}
|
16
|
+
type RestProps<P, T extends HTMLElement> = Omit<P, keyof FocusSensorAddProps<T>>;
|
17
|
+
export type FocusSensorProps<P extends FocusSensorAddProps<T>, T extends HTMLElement, C extends ComponentType<P>> = RestProps<JSX.LibraryManagedAttributes<C, P>, T> & FocusSensorOuterProps<T>;
|
18
|
+
export default function focusSensorHOC<T extends HTMLElement, P extends FocusSensorAddProps<T>, C extends ComponentType<P>>(ComposedComponent: C): ComponentType<FocusSensorProps<P, T, typeof ComposedComponent>>;
|
19
|
+
export {};
|
@@ -0,0 +1,165 @@
|
|
1
|
+
import { g as _objectSpread2, e as _objectWithoutProperties, a as _inherits, b as _createSuper, c as _classCallCheck, _ as _defineProperty, k as _assertThisInitialized, d as _createClass, f as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
3
|
+
import React, { Component } from 'react';
|
4
|
+
import PropTypes from 'prop-types';
|
5
|
+
import { refObject } from './prop-types.js';
|
6
|
+
import composeRefs from './composeRefs.js';
|
7
|
+
import 'core-js/modules/es.object.to-string.js';
|
8
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
9
|
+
|
10
|
+
var _excluded = ["innerRef", "focused", "onFocusReset", "onFocusRestore"],
|
11
|
+
_excluded2 = ["autofocus", "focused", "onFocus", "onBlur", "innerRef", "scrollOnTableFocus"];
|
12
|
+
function extractPropTypes(_ref) {
|
13
|
+
var propTypes = _ref.propTypes;
|
14
|
+
if (propTypes == null) {
|
15
|
+
return propTypes;
|
16
|
+
}
|
17
|
+
propTypes.innerRef;
|
18
|
+
propTypes.focused;
|
19
|
+
propTypes.onFocusReset;
|
20
|
+
propTypes.onFocusRestore;
|
21
|
+
var restPropTypes = _objectWithoutProperties(propTypes, _excluded);
|
22
|
+
return restPropTypes;
|
23
|
+
}
|
24
|
+
function focusSensorHOC(ComposedComponent) {
|
25
|
+
var FocusSensor = /*#__PURE__*/function (_Component) {
|
26
|
+
_inherits(FocusSensor, _Component);
|
27
|
+
var _super = _createSuper(FocusSensor);
|
28
|
+
function FocusSensor() {
|
29
|
+
var _this;
|
30
|
+
_classCallCheck(this, FocusSensor);
|
31
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
32
|
+
args[_key] = arguments[_key];
|
33
|
+
}
|
34
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
36
|
+
focused: _this.props.focused
|
37
|
+
});
|
38
|
+
_defineProperty(_assertThisInitialized(_this), "node", void 0);
|
39
|
+
_defineProperty(_assertThisInitialized(_this), "_skipNextCapture", false);
|
40
|
+
_defineProperty(_assertThisInitialized(_this), "onRefUpdate", function (node) {
|
41
|
+
if (node) {
|
42
|
+
_this.node = node;
|
43
|
+
}
|
44
|
+
});
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "onFocusCapture", function (_ref2) {
|
46
|
+
var _this$node;
|
47
|
+
var target = _ref2.target;
|
48
|
+
if (_this._skipNextCapture) {
|
49
|
+
_this._skipNextCapture = false;
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
var focused = target instanceof Node && ((_this$node = _this.node) === null || _this$node === void 0 ? void 0 : _this$node.contains(target));
|
53
|
+
if (focused && !_this.state.focused) {
|
54
|
+
var _this$props$onFocus, _this$props;
|
55
|
+
_this.setState({
|
56
|
+
focused: true
|
57
|
+
});
|
58
|
+
(_this$props$onFocus = (_this$props = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props);
|
59
|
+
}
|
60
|
+
});
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "onBlurCapture", function (_ref3) {
|
62
|
+
var target = _ref3.target;
|
63
|
+
var _assertThisInitialize = _assertThisInitialized(_this),
|
64
|
+
focused = _assertThisInitialize.state.focused,
|
65
|
+
node = _assertThisInitialize.node;
|
66
|
+
if (focused) {
|
67
|
+
setTimeout(function () {
|
68
|
+
var blurred = target instanceof Node && (node === null || node === void 0 ? void 0 : node.contains(target)) && !node.contains(document.activeElement);
|
69
|
+
if (blurred) {
|
70
|
+
var _this$props$onBlur, _this$props2;
|
71
|
+
_this.setState({
|
72
|
+
focused: false
|
73
|
+
});
|
74
|
+
(_this$props$onBlur = (_this$props2 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props2);
|
75
|
+
}
|
76
|
+
}, 1);
|
77
|
+
}
|
78
|
+
});
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "onFocusRestore", function () {
|
80
|
+
var _this$node2;
|
81
|
+
_this._skipNextCapture = true;
|
82
|
+
(_this$node2 = _this.node) === null || _this$node2 === void 0 ? void 0 : _this$node2.focus({
|
83
|
+
preventScroll: !_this.props.scrollOnTableFocus
|
84
|
+
});
|
85
|
+
});
|
86
|
+
_defineProperty(_assertThisInitialized(_this), "onFocusReset", function () {
|
87
|
+
var _this$node3;
|
88
|
+
(_this$node3 = _this.node) === null || _this$node3 === void 0 ? void 0 : _this$node3.blur();
|
89
|
+
});
|
90
|
+
return _this;
|
91
|
+
}
|
92
|
+
_createClass(FocusSensor, [{
|
93
|
+
key: "componentDidMount",
|
94
|
+
value: function componentDidMount() {
|
95
|
+
var _this$props3 = this.props,
|
96
|
+
autofocus = _this$props3.autofocus,
|
97
|
+
scrollOnTableFocus = _this$props3.scrollOnTableFocus,
|
98
|
+
node = this.node;
|
99
|
+
node === null || node === void 0 ? void 0 : node.setAttribute('tabindex', '0');
|
100
|
+
if (node != null) {
|
101
|
+
node.style.outline = 'none';
|
102
|
+
}
|
103
|
+
document.addEventListener('focus', this.onFocusCapture, true);
|
104
|
+
document.addEventListener('blur', this.onBlurCapture, true);
|
105
|
+
if (autofocus) {
|
106
|
+
node === null || node === void 0 ? void 0 : node.focus({
|
107
|
+
preventScroll: !scrollOnTableFocus
|
108
|
+
});
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}, {
|
112
|
+
key: "componentDidUpdate",
|
113
|
+
value: function componentDidUpdate(prevProps) {
|
114
|
+
var focused = this.props.focused;
|
115
|
+
if (focused && !prevProps.focused) {
|
116
|
+
this.onFocusRestore();
|
117
|
+
} else if (!focused && prevProps.focused) {
|
118
|
+
this.onFocusReset();
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}, {
|
122
|
+
key: "componentWillUnmount",
|
123
|
+
value: function componentWillUnmount() {
|
124
|
+
document.removeEventListener('focus', this.onFocusCapture, true);
|
125
|
+
document.removeEventListener('blur', this.onBlurCapture, true);
|
126
|
+
}
|
127
|
+
}, {
|
128
|
+
key: "render",
|
129
|
+
value: function render() {
|
130
|
+
var _this$props4 = this.props;
|
131
|
+
_this$props4.autofocus;
|
132
|
+
_this$props4.focused;
|
133
|
+
_this$props4.onFocus;
|
134
|
+
_this$props4.onBlur;
|
135
|
+
var innerRef = _this$props4.innerRef;
|
136
|
+
_this$props4.scrollOnTableFocus;
|
137
|
+
var rest = _objectWithoutProperties(_this$props4, _excluded2);
|
138
|
+
return /*#__PURE__*/React.createElement(ComposedComponent, _extends({}, rest, {
|
139
|
+
innerRef: composeRefs(innerRef, this.onRefUpdate),
|
140
|
+
focused: this.state.focused,
|
141
|
+
onFocusReset: this.onFocusReset,
|
142
|
+
onFocusRestore: this.onFocusRestore
|
143
|
+
}));
|
144
|
+
}
|
145
|
+
}]);
|
146
|
+
return FocusSensor;
|
147
|
+
}(Component);
|
148
|
+
FocusSensor.propTypes = _objectSpread2(_objectSpread2({}, extractPropTypes(ComposedComponent)), {}, {
|
149
|
+
focused: PropTypes.bool,
|
150
|
+
autofocus: PropTypes.bool,
|
151
|
+
onFocus: PropTypes.func,
|
152
|
+
onBlur: PropTypes.func,
|
153
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, refObject(PropTypes.instanceOf(HTMLElement))])
|
154
|
+
});
|
155
|
+
FocusSensor.defaultProps = _objectSpread2(_objectSpread2({}, ComposedComponent.defaultProps), {}, {
|
156
|
+
focused: false,
|
157
|
+
autofocus: false,
|
158
|
+
scrollOnTableFocus: true,
|
159
|
+
onFocus: function onFocus() {},
|
160
|
+
onBlur: function onBlur() {}
|
161
|
+
});
|
162
|
+
return FocusSensor;
|
163
|
+
}
|
164
|
+
|
165
|
+
export { focusSensorHOC as default };
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/** https://github.com/bevacqua/fuzzysearch + highlighting with Markdown */
|
2
|
+
type Match = {
|
3
|
+
from: number;
|
4
|
+
to: number;
|
5
|
+
};
|
6
|
+
export default function fuzzyHighlight(needle: string, haystack: string, caseSensitive?: boolean): {
|
7
|
+
matched: boolean;
|
8
|
+
matches: Match[];
|
9
|
+
highlight: string;
|
10
|
+
};
|
11
|
+
export {};
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import { m as _createForOfIteratorHelper } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.slice.js';
|
3
|
+
import 'core-js/modules/es.array.concat.js';
|
4
|
+
import 'core-js/modules/es.regexp.exec.js';
|
5
|
+
|
6
|
+
/** https://github.com/bevacqua/fuzzysearch + highlighting with Markdown */
|
7
|
+
function fuzzyHighlight(needle, haystack) {
|
8
|
+
var caseSensitive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
9
|
+
var ndl = caseSensitive ? needle : needle.toLowerCase();
|
10
|
+
var hstck = caseSensitive ? haystack : haystack.toLowerCase();
|
11
|
+
var result = function result(matched) {
|
12
|
+
var matches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
13
|
+
var highlight = haystack;
|
14
|
+
if (matches.length > 0) {
|
15
|
+
highlight = '';
|
16
|
+
var prevMatch = {
|
17
|
+
to: 0
|
18
|
+
};
|
19
|
+
var _iterator = _createForOfIteratorHelper(matches),
|
20
|
+
_step;
|
21
|
+
try {
|
22
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
23
|
+
var match = _step.value;
|
24
|
+
highlight += "".concat(haystack.slice(prevMatch.to, match.from), "**").concat(haystack.slice(match.from, match.to), "**");
|
25
|
+
prevMatch = match;
|
26
|
+
}
|
27
|
+
} catch (err) {
|
28
|
+
_iterator.e(err);
|
29
|
+
} finally {
|
30
|
+
_iterator.f();
|
31
|
+
}
|
32
|
+
highlight += haystack.slice(prevMatch.to);
|
33
|
+
}
|
34
|
+
return {
|
35
|
+
matched,
|
36
|
+
matches,
|
37
|
+
highlight
|
38
|
+
};
|
39
|
+
};
|
40
|
+
var hlen = hstck.length;
|
41
|
+
var nlen = ndl.length;
|
42
|
+
if (nlen > hlen) {
|
43
|
+
return result(false);
|
44
|
+
}
|
45
|
+
if (nlen === hlen) {
|
46
|
+
var matched = ndl === hstck;
|
47
|
+
return result(matched, matched ? [{
|
48
|
+
from: 0,
|
49
|
+
to: haystack.length
|
50
|
+
}] : []);
|
51
|
+
}
|
52
|
+
var on = false;
|
53
|
+
var j = 0;
|
54
|
+
var matches = [];
|
55
|
+
var from = 0;
|
56
|
+
/* eslint-disable no-labels */
|
57
|
+
outer: for (var i = 0; i < nlen; i++) {
|
58
|
+
var nch = ndl[i];
|
59
|
+
while (j < hlen) {
|
60
|
+
var hch = hstck[j];
|
61
|
+
var match = hch === nch;
|
62
|
+
// Don't turn highlight on for space characters
|
63
|
+
var nextOn = match && /\S/.test(hch);
|
64
|
+
if (nextOn && !on) {
|
65
|
+
from = j;
|
66
|
+
} else if (!nextOn && on) {
|
67
|
+
matches.push({
|
68
|
+
from,
|
69
|
+
to: j
|
70
|
+
});
|
71
|
+
}
|
72
|
+
j++;
|
73
|
+
on = nextOn;
|
74
|
+
if (match) {
|
75
|
+
continue outer;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return result(false);
|
79
|
+
}
|
80
|
+
/* eslint-enable */
|
81
|
+
if (on) {
|
82
|
+
matches.push({
|
83
|
+
from,
|
84
|
+
to: j
|
85
|
+
});
|
86
|
+
}
|
87
|
+
return result(true, matches);
|
88
|
+
}
|
89
|
+
|
90
|
+
export { fuzzyHighlight as default };
|