@sentry/scraps 0.4.0 → 0.5.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/README.md +6 -5
- package/dist/alert/alert.js +0 -3
- package/dist/badge/badge.js +1 -2
- package/dist/badge/tag.js +0 -2
- package/dist/button/index.d.ts +0 -1
- package/dist/button/index.js +0 -1
- package/dist/clipboard/copyToClipboardButton.d.ts +15 -0
- package/dist/clipboard/copyToClipboardButton.js +32 -0
- package/dist/clipboard/index.d.ts +1 -0
- package/dist/clipboard/index.js +1 -0
- package/dist/code/index.d.ts +1 -0
- package/dist/code/index.js +1 -0
- package/dist/codeBlock/codeBlock.d.ts +68 -0
- package/dist/codeBlock/codeBlock.js +242 -0
- package/dist/codeBlock/index.d.ts +2 -0
- package/dist/codeBlock/index.js +2 -0
- package/dist/codeBlock/prism.d.ts +11 -0
- package/dist/codeBlock/prism.js +101 -0
- package/dist/codeBlock/styles.d.ts +2 -0
- package/dist/codeBlock/styles.js +133 -0
- package/dist/compactSelect/compactSelect.d.ts +21 -0
- package/dist/compactSelect/compactSelect.js +150 -0
- package/dist/compactSelect/composite.d.ts +54 -0
- package/dist/compactSelect/composite.js +101 -0
- package/dist/compactSelect/control.d.ts +112 -0
- package/dist/compactSelect/control.js +354 -0
- package/dist/compactSelect/fzf.d.ts +8 -0
- package/dist/compactSelect/fzf.js +151 -0
- package/dist/compactSelect/gridList/index.d.ts +46 -0
- package/dist/compactSelect/gridList/index.js +102 -0
- package/dist/compactSelect/gridList/option.d.ts +15 -0
- package/dist/compactSelect/gridList/option.js +111 -0
- package/dist/compactSelect/gridList/section.d.ts +15 -0
- package/dist/compactSelect/gridList/section.js +58 -0
- package/dist/compactSelect/highlightText.d.ts +6 -0
- package/dist/compactSelect/highlightText.js +33 -0
- package/dist/compactSelect/index.d.ts +9 -0
- package/dist/compactSelect/index.js +8 -0
- package/dist/compactSelect/list.d.ts +94 -0
- package/dist/compactSelect/list.js +167 -0
- package/dist/compactSelect/listBox/index.d.ts +84 -0
- package/dist/compactSelect/listBox/index.js +175 -0
- package/dist/compactSelect/listBox/option.d.ts +19 -0
- package/dist/compactSelect/listBox/option.js +101 -0
- package/dist/compactSelect/listBox/section.d.ts +21 -0
- package/dist/compactSelect/listBox/section.js +58 -0
- package/dist/compactSelect/menuComponents.d.ts +89 -0
- package/dist/compactSelect/menuComponents.js +117 -0
- package/dist/compactSelect/selectFilterContext.d.ts +2 -0
- package/dist/compactSelect/selectFilterContext.js +3 -0
- package/dist/compactSelect/styles.d.ts +39 -0
- package/dist/compactSelect/styles.js +155 -0
- package/dist/compactSelect/types.d.ts +1 -0
- package/dist/compactSelect/types.js +0 -0
- package/dist/compactSelect/useVirtualizedItems.d.ts +52 -0
- package/dist/compactSelect/useVirtualizedItems.js +74 -0
- package/dist/compactSelect/utils.d.ts +80 -0
- package/dist/compactSelect/utils.js +268 -0
- package/dist/confirm/index.d.ts +153 -0
- package/dist/confirm/index.js +132 -0
- package/dist/descriptionList/descriptionList.js +4 -3
- package/dist/disclosure/disclosure.js +2 -2
- package/dist/dragHandle/dragHandle.d.ts +3 -1
- package/dist/dragHandle/dragHandle.js +8 -5
- package/dist/drawer/components.d.ts +46 -0
- package/dist/drawer/components.js +265 -0
- package/dist/drawer/globalDrawer.d.ts +106 -0
- package/dist/drawer/globalDrawer.js +173 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/drawer/index.js +2 -0
- package/dist/drawer/useDrawerResizing.d.ts +19 -0
- package/dist/drawer/useDrawerResizing.js +111 -0
- package/dist/drawer/useDrawerWidth.d.ts +1 -0
- package/dist/drawer/useDrawerWidth.js +42 -0
- package/dist/dropdownMenu/content.d.ts +1 -0
- package/dist/dropdownMenu/content.js +1 -0
- package/dist/dropdownMenu/context.d.ts +24 -0
- package/dist/dropdownMenu/context.js +3 -0
- package/dist/dropdownMenu/dropdownMenu.d.ts +70 -0
- package/dist/dropdownMenu/dropdownMenu.js +103 -0
- package/dist/dropdownMenu/index.d.ts +2 -0
- package/dist/dropdownMenu/index.js +1 -0
- package/dist/dropdownMenu/item.d.ts +136 -0
- package/dist/dropdownMenu/item.js +182 -0
- package/dist/dropdownMenu/list.d.ts +59 -0
- package/dist/dropdownMenu/list.js +410 -0
- package/dist/dropdownMenu/search.d.ts +16 -0
- package/dist/dropdownMenu/search.js +16 -0
- package/dist/dropdownMenu/section.d.ts +21 -0
- package/dist/dropdownMenu/section.js +40 -0
- package/dist/dropdownMenu/separator.d.ts +7 -0
- package/dist/dropdownMenu/separator.js +15 -0
- package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +260 -0
- package/dist/dropdownMenu/useDropdownMenuKeyboard.js +55 -0
- package/dist/dropdownMenu/useDropdownMenuRowLayout.d.ts +29 -0
- package/dist/dropdownMenu/useDropdownMenuRowLayout.js +64 -0
- package/dist/dropdownMenu/useSafetyTriangle.d.ts +12 -0
- package/dist/dropdownMenu/useSafetyTriangle.js +119 -0
- package/dist/dropdownMenu/utils.d.ts +21 -0
- package/dist/dropdownMenu/utils.js +57 -0
- package/dist/form/FormSearch.d.ts +19 -0
- package/dist/form/FormSearch.js +4 -0
- package/dist/form/autoSaveForm.d.ts +110 -0
- package/dist/form/autoSaveForm.js +100 -0
- package/dist/{formPresentation → form}/displayField.js +2 -2
- package/dist/form/field/baseField.d.ts +23 -0
- package/dist/form/field/baseField.js +116 -0
- package/dist/form/field/checkboxField.d.ts +11 -0
- package/dist/form/field/checkboxField.js +42 -0
- package/dist/form/field/checkboxGroupField.d.ts +16 -0
- package/dist/form/field/checkboxGroupField.js +80 -0
- package/dist/form/field/compactSelectField.d.ts +19 -0
- package/dist/form/field/compactSelectField.js +77 -0
- package/dist/{formPresentation → form/field}/fieldIds.js +1 -1
- package/dist/form/field/inputField.d.ts +19 -0
- package/dist/form/field/inputField.js +31 -0
- package/dist/{formPresentation → form/field}/meta.js +6 -6
- package/dist/form/field/numberField.d.ts +5 -0
- package/dist/form/field/numberField.js +11 -0
- package/dist/form/field/passwordField.d.ts +3 -0
- package/dist/form/field/passwordField.js +27 -0
- package/dist/form/field/radioGroupField.d.ts +16 -0
- package/dist/form/field/radioGroupField.js +92 -0
- package/dist/form/field/rangeField.d.ts +8 -0
- package/dist/form/field/rangeField.js +34 -0
- package/dist/form/field/selectAsyncField.d.ts +31 -0
- package/dist/form/field/selectAsyncField.js +22 -0
- package/dist/form/field/selectField.d.ts +9 -0
- package/dist/form/field/selectField.js +72 -0
- package/dist/form/field/switchField.d.ts +7 -0
- package/dist/form/field/switchField.js +37 -0
- package/dist/form/field/textAreaField.d.ts +7 -0
- package/dist/form/field/textAreaField.js +25 -0
- package/dist/{formPresentation → form}/formContext.js +1 -1
- package/dist/form/formErrorContext/index.d.ts +9 -0
- package/dist/form/formErrorContext/index.js +7 -0
- package/dist/form/index.d.ts +9 -0
- package/dist/form/index.js +8 -0
- package/dist/{formPresentation → form/layout}/base.d.ts +1 -1
- package/dist/{formPresentation → form/layout}/base.js +1 -1
- package/dist/form/layout/fieldGroup.d.ts +6 -0
- package/dist/form/layout/fieldGroup.js +60 -0
- package/dist/{formPresentation/fieldLayout.d.ts → form/layout/index.d.ts} +1 -1
- package/dist/{formPresentation/fieldLayout.js → form/layout/index.js} +3 -3
- package/dist/{formPresentation → form/layout}/useStackedLayout.js +1 -1
- package/dist/form/scrapsForm.d.ts +220 -0
- package/dist/form/scrapsForm.js +126 -0
- package/dist/hotkey/hotkey.d.ts +9 -8
- package/dist/hotkey/hotkey.js +13 -6
- package/dist/hotkey/index.d.ts +2 -1
- package/dist/hotkey/index.js +2 -1
- package/dist/hotkey/keyMappings.d.ts +1 -15
- package/dist/hotkey/keyMappings.js +29 -174
- package/dist/hotkey/useHotkeys.d.ts +3 -47
- package/dist/hotkey/useHotkeys.js +8 -42
- package/dist/image/image.js +2 -1
- package/dist/info/infoTip.d.ts +1 -1
- package/dist/info/infoTip.js +4 -3
- package/dist/input/index.d.ts +0 -3
- package/dist/input/index.js +0 -2
- package/dist/input/input.d.ts +2 -0
- package/dist/input/input.js +2 -0
- package/dist/input/passwordManagerIgnoreProps.d.ts +11 -0
- package/dist/input/passwordManagerIgnoreProps.js +8 -0
- package/dist/layout/index.d.ts +2 -2
- package/dist/layout/index.js +1 -1
- package/dist/link/link.js +4 -3
- package/dist/link/linkBehaviorContext.d.ts +2 -0
- package/dist/link/linkBehaviorContext.js +17 -10
- package/dist/menu/index.d.ts +1 -1
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.d.ts +14 -6
- package/dist/menu/menu.js +160 -56
- package/dist/modal/components.d.ts +19 -0
- package/dist/modal/components.js +99 -0
- package/dist/modal/errorBoundary.d.ts +2 -0
- package/dist/modal/errorBoundary.js +35 -0
- package/dist/modal/index.d.ts +33 -0
- package/dist/modal/index.js +260 -0
- package/dist/modal/portal.d.ts +1 -0
- package/dist/modal/portal.js +10 -0
- package/dist/modal/state.d.ts +17 -0
- package/dist/modal/state.js +41 -0
- package/dist/modal/types.d.ts +75 -0
- package/dist/modal/types.js +0 -0
- package/dist/numberInput/index.d.ts +3 -0
- package/dist/numberInput/index.js +2 -0
- package/dist/{input → numberInput}/numberDragInput.d.ts +1 -1
- package/dist/{input → numberInput}/numberDragInput.js +1 -1
- package/dist/{input → numberInput}/numberInput.d.ts +1 -1
- package/dist/{input → numberInput}/numberInput.js +1 -1
- package/dist/overlayContext.d.ts +29 -0
- package/dist/overlayContext.js +7 -0
- package/dist/pagination/index.d.ts +1 -0
- package/dist/pagination/index.js +1 -0
- package/dist/pagination/pagination.d.ts +24 -0
- package/dist/pagination/pagination.js +63 -0
- package/dist/pictureInPicture/index.d.ts +2 -0
- package/dist/pictureInPicture/index.js +2 -0
- package/dist/pictureInPicture/pictureInPicture.d.ts +47 -0
- package/dist/pictureInPicture/pictureInPicture.js +100 -0
- package/dist/pictureInPicture/pictureInPicturePortal.d.ts +16 -0
- package/dist/pictureInPicture/pictureInPicturePortal.js +46 -0
- package/dist/pictureInPicture/portalContext.d.ts +2 -0
- package/dist/pictureInPicture/portalContext.js +3 -0
- package/dist/revealOnHover/revealOnHover.js +1 -1
- package/dist/segmentedControl/segmentedControl.js +1 -1
- package/dist/select/filter.d.ts +4 -0
- package/dist/select/filter.js +12 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.js +2 -0
- package/dist/select/option.d.ts +16 -0
- package/dist/select/option.js +81 -0
- package/dist/select/reactSelectWrapper.d.ts +8 -0
- package/dist/select/reactSelectWrapper.js +25 -0
- package/dist/select/select.d.ts +79 -0
- package/dist/select/select.js +454 -0
- package/dist/select/styles.d.ts +9 -0
- package/dist/select/styles.js +27 -0
- package/dist/select/types.d.ts +60 -0
- package/dist/select/types.js +0 -0
- package/dist/select/virtualizedMenuList.d.ts +24 -0
- package/dist/select/virtualizedMenuList.js +123 -0
- package/dist/slideOverPanel.d.ts +20 -0
- package/dist/slideOverPanel.js +141 -0
- package/dist/splitPanel/splitPanel.d.ts +3 -1
- package/dist/splitPanel/splitPanel.js +2 -1
- package/dist/table/table.d.ts +1 -1
- package/dist/table/table.js +39 -20
- package/dist/table/useColumnResize.d.ts +6 -5
- package/dist/table/useColumnResize.js +5 -4
- package/dist/tabs/index.d.ts +4 -0
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/item.d.ts +13 -0
- package/dist/tabs/item.js +4 -0
- package/dist/tabs/tab.d.ts +22 -0
- package/dist/tabs/tab.js +205 -0
- package/dist/tabs/tabList.d.ts +18 -0
- package/dist/tabs/tabList.js +256 -0
- package/dist/tabs/tabPanels.d.ts +14 -0
- package/dist/tabs/tabPanels.js +62 -0
- package/dist/tabs/tabs.d.ts +38 -0
- package/dist/tabs/tabs.js +56 -0
- package/dist/tabs/utils.d.ts +3 -0
- package/dist/tabs/utils.js +6 -0
- package/dist/text/heading.d.ts +1 -1
- package/dist/text/heading.js +1 -1
- package/dist/text/styles.js +1 -1
- package/dist/text/text.d.ts +1 -1
- package/dist/text/text.js +1 -1
- package/dist/theme/dark.js +9 -9
- package/dist/theme/light.js +9 -9
- package/dist/tooltip/tooltip.js +2 -5
- package/dist/useMedia.d.ts +15 -0
- package/dist/useMedia.js +24 -0
- package/dist/useOnClickOutside.d.ts +2 -0
- package/dist/useOnClickOutside.js +22 -0
- package/dist/useOverlay.d.ts +1 -0
- package/dist/useOverlay.js +1 -0
- package/dist/useVirtualCollection.d.ts +154 -0
- package/dist/useVirtualCollection.js +143 -0
- package/dist/useVirtualRows.d.ts +26 -0
- package/dist/useVirtualRows.js +26 -0
- package/dist/virtualCollectionLayout.d.ts +51 -0
- package/dist/virtualCollectionLayout.js +49 -0
- package/package.json +115 -16
- package/dist/formPresentation/index.d.ts +0 -8
- package/dist/formPresentation/index.js +0 -8
- package/dist/interactionStateLayer/index.d.ts +0 -1
- package/dist/interactionStateLayer/index.js +0 -1
- package/dist/interactionStateLayer/interactionStateLayer.d.ts +0 -23
- package/dist/interactionStateLayer/interactionStateLayer.js +0 -67
- package/dist/unreachable.d.ts +0 -1
- package/dist/unreachable.js +0 -4
- /package/dist/{formPresentation → form}/autoSaveContext.d.ts +0 -0
- /package/dist/{formPresentation → form}/autoSaveContext.js +0 -0
- /package/dist/{formPresentation → form}/displayField.d.ts +0 -0
- /package/dist/{formPresentation → form/field}/fieldIds.d.ts +0 -0
- /package/dist/{formPresentation → form/field}/groupContext.d.ts +0 -0
- /package/dist/{formPresentation → form/field}/groupContext.js +0 -0
- /package/dist/{formPresentation → form/field}/meta.d.ts +0 -0
- /package/dist/{formPresentation → form}/formContext.d.ts +0 -0
- /package/dist/{formPresentation → form}/icons.d.ts +0 -0
- /package/dist/{formPresentation → form}/icons.js +0 -0
- /package/dist/{formPresentation → form/layout}/useStackedLayout.d.ts +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { PictureInPicturePortalContext } from "./portalContext.js";
|
|
4
|
+
const PictureInPictureContext = /*#__PURE__*/ createContext(null);
|
|
5
|
+
const NON_RELATIVE_URL = /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;
|
|
6
|
+
function resolveCssUrls(cssText, baseHref) {
|
|
7
|
+
return cssText.replace(/url\((['"]?)([^'")]*)\1\)/g, (match, quote, url)=>{
|
|
8
|
+
if (!url || NON_RELATIVE_URL.test(url)) return match;
|
|
9
|
+
try {
|
|
10
|
+
return `url(${quote}${new URL(url, baseHref).href}${quote})`;
|
|
11
|
+
} catch {
|
|
12
|
+
return match;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function copyStyles(source, target) {
|
|
17
|
+
for (const sheet of Array.from(source.styleSheets)){
|
|
18
|
+
const owner = sheet.ownerNode;
|
|
19
|
+
if (!(owner instanceof HTMLStyleElement) || !owner.dataset.emotion) try {
|
|
20
|
+
const cssText = Array.from(sheet.cssRules).map((rule)=>rule.cssText).join('');
|
|
21
|
+
const style = target.document.createElement('style');
|
|
22
|
+
style.textContent = resolveCssUrls(cssText, sheet.href ?? source.baseURI);
|
|
23
|
+
target.document.head.appendChild(style);
|
|
24
|
+
} catch {
|
|
25
|
+
if (owner) target.document.head.appendChild(owner.cloneNode(true));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function PictureInPictureProvider({ children, onWindowOpen, renderPortalContent }) {
|
|
30
|
+
const [pipWindow, setPipWindow] = useState(null);
|
|
31
|
+
const documentPictureInPicture = "u" > typeof window && 'documentPictureInPicture' in window ? window.documentPictureInPicture : null;
|
|
32
|
+
const pipWindowRef = useRef(null);
|
|
33
|
+
const handleClose = useCallback(()=>{
|
|
34
|
+
pipWindowRef.current = null;
|
|
35
|
+
setPipWindow(null);
|
|
36
|
+
}, []);
|
|
37
|
+
const requestPipWindow = useCallback(async ({ width, height, preferInitialWindowPlacement } = {})=>{
|
|
38
|
+
if (!documentPictureInPicture) return;
|
|
39
|
+
if (pipWindowRef.current && !pipWindowRef.current.closed) return;
|
|
40
|
+
const pip = await documentPictureInPicture.requestWindow({
|
|
41
|
+
width,
|
|
42
|
+
height,
|
|
43
|
+
preferInitialWindowPlacement
|
|
44
|
+
});
|
|
45
|
+
try {
|
|
46
|
+
copyStyles(document, pip);
|
|
47
|
+
onWindowOpen?.(pip);
|
|
48
|
+
pip.addEventListener('pagehide', handleClose, {
|
|
49
|
+
once: true
|
|
50
|
+
});
|
|
51
|
+
pipWindowRef.current = pip;
|
|
52
|
+
setPipWindow(pip);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
pip.close();
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}, [
|
|
58
|
+
documentPictureInPicture,
|
|
59
|
+
handleClose,
|
|
60
|
+
onWindowOpen
|
|
61
|
+
]);
|
|
62
|
+
const closePipWindow = useCallback(()=>{
|
|
63
|
+
const pip = pipWindowRef.current;
|
|
64
|
+
if (pip && !pip.closed) pip.close();
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(()=>()=>{
|
|
67
|
+
const pip = pipWindowRef.current;
|
|
68
|
+
if (pip && !pip.closed) {
|
|
69
|
+
pip.removeEventListener('pagehide', handleClose);
|
|
70
|
+
pip.close();
|
|
71
|
+
}
|
|
72
|
+
pipWindowRef.current = null;
|
|
73
|
+
}, [
|
|
74
|
+
handleClose
|
|
75
|
+
]);
|
|
76
|
+
const value = useMemo(()=>({
|
|
77
|
+
pipWindow,
|
|
78
|
+
isSupported: !!documentPictureInPicture,
|
|
79
|
+
requestPipWindow,
|
|
80
|
+
closePipWindow
|
|
81
|
+
}), [
|
|
82
|
+
pipWindow,
|
|
83
|
+
documentPictureInPicture,
|
|
84
|
+
requestPipWindow,
|
|
85
|
+
closePipWindow
|
|
86
|
+
]);
|
|
87
|
+
return /*#__PURE__*/ jsx(PictureInPictureContext.Provider, {
|
|
88
|
+
value: value,
|
|
89
|
+
children: /*#__PURE__*/ jsx(PictureInPicturePortalContext, {
|
|
90
|
+
value: renderPortalContent,
|
|
91
|
+
children: children
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function usePictureInPicture() {
|
|
96
|
+
const context = useContext(PictureInPictureContext);
|
|
97
|
+
if (!context) throw new Error('usePictureInPicture must be used within a PictureInPictureProvider');
|
|
98
|
+
return context;
|
|
99
|
+
}
|
|
100
|
+
export { PictureInPictureProvider, usePictureInPicture };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
export interface PictureInPicturePortalProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* The picture-in-picture window to render into. Obtain one via
|
|
6
|
+
* `usePictureInPicture`.
|
|
7
|
+
*/
|
|
8
|
+
pipWindow: Window;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Renders children into a Document Picture-in-Picture window with the full
|
|
12
|
+
* styling context wired up: a PiP-scoped emotion cache, the theme,
|
|
13
|
+
* and a tooltip container override so overlays render in the PiP window
|
|
14
|
+
* rather than the main one.
|
|
15
|
+
*/
|
|
16
|
+
export declare function PictureInPicturePortal({ children, pipWindow, }: PictureInPicturePortalProps): React.ReactPortal;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useContext, useEffect, useMemo } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import _emotion_cache from "@emotion/cache";
|
|
5
|
+
import { CacheProvider, ThemeProvider, useTheme } from "@emotion/react";
|
|
6
|
+
import { TooltipContext } from "../tooltip/index.js";
|
|
7
|
+
import { PictureInPicturePortalContext } from "./portalContext.js";
|
|
8
|
+
function PictureInPicturePortal({ children, pipWindow }) {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const renderPortalContent = useContext(PictureInPicturePortalContext);
|
|
11
|
+
const cache = useMemo(()=>{
|
|
12
|
+
const pipCache = _emotion_cache({
|
|
13
|
+
key: 'scraps-pip',
|
|
14
|
+
container: pipWindow.document.head,
|
|
15
|
+
stylisPlugins: []
|
|
16
|
+
});
|
|
17
|
+
pipCache.compat = true;
|
|
18
|
+
return pipCache;
|
|
19
|
+
}, [
|
|
20
|
+
pipWindow
|
|
21
|
+
]);
|
|
22
|
+
useEffect(()=>{
|
|
23
|
+
const { documentElement, body } = pipWindow.document;
|
|
24
|
+
documentElement.style.height = '100%';
|
|
25
|
+
body.style.height = '100%';
|
|
26
|
+
body.style.margin = '0';
|
|
27
|
+
}, [
|
|
28
|
+
pipWindow
|
|
29
|
+
]);
|
|
30
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(CacheProvider, {
|
|
31
|
+
value: cache,
|
|
32
|
+
children: /*#__PURE__*/ jsx(ThemeProvider, {
|
|
33
|
+
theme: theme,
|
|
34
|
+
children: /*#__PURE__*/ jsxs(TooltipContext, {
|
|
35
|
+
value: {
|
|
36
|
+
container: pipWindow.document.body
|
|
37
|
+
},
|
|
38
|
+
children: [
|
|
39
|
+
renderPortalContent?.(pipWindow),
|
|
40
|
+
children
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
}), pipWindow.document.body);
|
|
45
|
+
}
|
|
46
|
+
export { PictureInPicturePortal };
|
|
@@ -7,7 +7,7 @@ import { Item, useCollection } from "@react-stately/collections";
|
|
|
7
7
|
import { ListCollection } from "@react-stately/list";
|
|
8
8
|
import { useRadioGroupState } from "@react-stately/radio";
|
|
9
9
|
import { LayoutGroup } from "framer-motion";
|
|
10
|
-
import { DO_NOT_USE_getButtonStyles } from "../button/
|
|
10
|
+
import { DO_NOT_USE_getButtonStyles } from "../button/styles.js";
|
|
11
11
|
import { Tooltip } from "../tooltip/index.js";
|
|
12
12
|
const getChildTransforms = (count)=>Array.from({
|
|
13
13
|
length: count
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createFilter } from "./reactSelectWrapper.js";
|
|
2
|
+
function filter_createFilter(config) {
|
|
3
|
+
const filter = createFilter({
|
|
4
|
+
stringify: ({ data })=>config?.stringify(data) ?? data.textValue ?? `${'string' == typeof data.label || 'number' == typeof data.label ? data.label : ''} ${data.value}`
|
|
5
|
+
});
|
|
6
|
+
return (option, input)=>filter({
|
|
7
|
+
data: option,
|
|
8
|
+
label: 'string' == typeof option.label ? option.label : '',
|
|
9
|
+
value: String(option.value)
|
|
10
|
+
}, input);
|
|
11
|
+
}
|
|
12
|
+
export { filter_createFilter as createFilter };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { components as selectComponents } from './reactSelectWrapper.js';
|
|
3
|
+
import type { BaseSelectProps } from './select.js';
|
|
4
|
+
import type { SelectValue } from './types.js';
|
|
5
|
+
type Props<TValue, TOption extends SelectValue<TValue>> = Omit<React.ComponentProps<typeof selectComponents.Option>, 'selectProps' | 'data'> & {
|
|
6
|
+
data: TOption & {
|
|
7
|
+
__isNew__?: boolean;
|
|
8
|
+
selectionMode?: 'single' | 'multiple';
|
|
9
|
+
};
|
|
10
|
+
selectProps: Pick<BaseSelectProps<TValue, TOption>, 'showCreateOptionIcon' | 'showDividers'> & {
|
|
11
|
+
contentComponents?: BaseSelectProps<TValue, TOption>['components'];
|
|
12
|
+
size?: BaseSelectProps<TValue, TOption>['size'];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function SelectOption<TValue, TOption extends SelectValue<TValue>>(props: Props<TValue, TOption>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { ClassNames } from "@emotion/react";
|
|
4
|
+
import styled from "@emotion/styled";
|
|
5
|
+
import { IconAdd } from "@sentry/icons/add";
|
|
6
|
+
import { IconCheckmark } from "@sentry/icons/checkmark";
|
|
7
|
+
import { ListItem } from "../menu/index.js";
|
|
8
|
+
import { CheckWrap } from "./styles.js";
|
|
9
|
+
function SelectOption(props) {
|
|
10
|
+
const { label, data, selectProps, isMulti, isSelected, isFocused, isDisabled, innerProps, innerRef } = props;
|
|
11
|
+
const { showDividers, size = 'md' } = selectProps;
|
|
12
|
+
const leadingItems = 'function' == typeof data.leadingItems ? data.leadingItems({
|
|
13
|
+
disabled: isDisabled,
|
|
14
|
+
isFocused,
|
|
15
|
+
isSelected
|
|
16
|
+
}) : data.leadingItems;
|
|
17
|
+
const OptionLabel = selectProps.contentComponents?.OptionLabel;
|
|
18
|
+
const renderedLabel = OptionLabel ? /*#__PURE__*/ jsx(OptionLabel, {
|
|
19
|
+
option: data
|
|
20
|
+
}) : label;
|
|
21
|
+
const { value, selectionMode, priority, ...itemProps } = data;
|
|
22
|
+
const isMultiple = null == selectionMode ? isMulti : 'multiple' === selectionMode;
|
|
23
|
+
const itemPriority = priority ?? 'default';
|
|
24
|
+
const innerWrapProps = {
|
|
25
|
+
'data-test-id': null == value ? void 0 : String(value)
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/ jsx(ClassNames, {
|
|
28
|
+
children: ({ cx })=>/*#__PURE__*/ jsx(ListItem, {
|
|
29
|
+
...itemProps,
|
|
30
|
+
...innerProps,
|
|
31
|
+
role: isMultiple ? 'menuitemcheckbox' : 'menuitemradio',
|
|
32
|
+
'aria-checked': isSelected,
|
|
33
|
+
className: cx({
|
|
34
|
+
option: true,
|
|
35
|
+
'option--is-disabled': isDisabled,
|
|
36
|
+
'option--is-focused': isFocused,
|
|
37
|
+
'option--is-selected': isSelected
|
|
38
|
+
}),
|
|
39
|
+
value,
|
|
40
|
+
showDivider: showDividers,
|
|
41
|
+
ref: innerRef,
|
|
42
|
+
as: "div",
|
|
43
|
+
label: renderedLabel,
|
|
44
|
+
disabled: isDisabled,
|
|
45
|
+
isFocused: isFocused,
|
|
46
|
+
priority: itemPriority,
|
|
47
|
+
size: size,
|
|
48
|
+
innerWrapProps: innerWrapProps,
|
|
49
|
+
labelProps: {
|
|
50
|
+
as: 'string' == typeof renderedLabel ? 'p' : 'div'
|
|
51
|
+
},
|
|
52
|
+
leadingItems: itemProps.__isNew__ && false !== selectProps.showCreateOptionIcon ? /*#__PURE__*/ jsxs(Fragment, {
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ jsx(IconAdd, {
|
|
55
|
+
size: "sm"
|
|
56
|
+
}),
|
|
57
|
+
leadingItems
|
|
58
|
+
]
|
|
59
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ jsx(CheckWrap, {
|
|
62
|
+
isMultiple: isMultiple,
|
|
63
|
+
isSelected: isSelected,
|
|
64
|
+
size: size,
|
|
65
|
+
children: isSelected && /*#__PURE__*/ jsx(StyledIconCheckmark, {
|
|
66
|
+
size: isMultiple ? 'xs' : 'sm',
|
|
67
|
+
isMultiple: isMultiple
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
leadingItems
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const StyledIconCheckmark = styled(IconCheckmark, {
|
|
77
|
+
shouldForwardProp: (prop)=>'isMultiple' !== prop
|
|
78
|
+
})`
|
|
79
|
+
color: ${(p)=>p.isMultiple ? p.theme.colors.white : void 0};
|
|
80
|
+
`;
|
|
81
|
+
export { SelectOption };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import ReactSelectModule, { components } from 'react-select';
|
|
2
|
+
import type CreatableComponent from 'react-select/creatable';
|
|
3
|
+
declare const ReactSelect: typeof ReactSelectModule;
|
|
4
|
+
declare const Creatable: typeof CreatableComponent;
|
|
5
|
+
declare const ReactSelectWrapper: typeof ReactSelect;
|
|
6
|
+
export { ReactSelectWrapper as ReactSelect, Creatable, components };
|
|
7
|
+
export { createFilter, mergeStyles } from 'react-select';
|
|
8
|
+
export type { NamedProps as Props, StylesConfig, OptionsType, ValueType, } from 'react-select';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import react_select, { components, createFilter, mergeStyles } from "react-select";
|
|
3
|
+
import react_select_cjs from "react-select/creatable/dist/react-select.cjs.js";
|
|
4
|
+
function unwrapDefault(value) {
|
|
5
|
+
return 'object' == typeof value && null !== value && 'default' in value ? value.default : value;
|
|
6
|
+
}
|
|
7
|
+
const ReactSelect = unwrapDefault(react_select);
|
|
8
|
+
const Creatable = unwrapDefault(react_select_cjs);
|
|
9
|
+
const reactSelectDefaultProps = {
|
|
10
|
+
...ReactSelect.defaultProps
|
|
11
|
+
};
|
|
12
|
+
ReactSelect.defaultProps = void 0;
|
|
13
|
+
components.MultiValue.defaultProps = void 0;
|
|
14
|
+
components.NoOptionsMessage.defaultProps = void 0;
|
|
15
|
+
components.LoadingMessage.defaultProps = void 0;
|
|
16
|
+
components.LoadingIndicator.defaultProps = void 0;
|
|
17
|
+
const ReactSelectWrapper = function({ ref, ...props }) {
|
|
18
|
+
return /*#__PURE__*/ jsx(ReactSelect, {
|
|
19
|
+
...reactSelectDefaultProps,
|
|
20
|
+
...props,
|
|
21
|
+
ref: ref,
|
|
22
|
+
menuPlacement: "auto"
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export { Creatable, ReactSelectWrapper as ReactSelect, components, createFilter, mergeStyles };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { FormSize } from '../theme/index.js';
|
|
3
|
+
import type { SelectComponents, SelectHandle, SelectSelectionProps, SelectValue, StylesConfig } from './types.js';
|
|
4
|
+
/** Props shared by form fields and standalone selects. Implementation components stay private. */
|
|
5
|
+
export interface BaseSelectProps<TValue, TOption extends SelectValue<TValue> = SelectValue<TValue>> {
|
|
6
|
+
options: ReadonlyArray<(TOption & SelectValue<TValue>) | {
|
|
7
|
+
options: ReadonlyArray<TOption & SelectValue<TValue>>;
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
'aria-describedby'?: string;
|
|
11
|
+
'aria-invalid'?: boolean;
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
'aria-labelledby'?: string;
|
|
14
|
+
autoFocus?: boolean;
|
|
15
|
+
/** Blur after selection. Defaults to true for single selects, false for multiple. */
|
|
16
|
+
blurInputOnSelect?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Customize content while Select retains input, option, and chip behavior. */
|
|
19
|
+
components?: SelectComponents<TOption>;
|
|
20
|
+
/** Content inside the control, before the selected value and input. */
|
|
21
|
+
controlLeadingItems?: React.ReactNode;
|
|
22
|
+
/** Allow values that are not in `options`. */
|
|
23
|
+
creatable?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Set to null to hide the dropdown indicator. */
|
|
26
|
+
dropdownIndicator?: React.ReactNode;
|
|
27
|
+
filterOption?: ((option: TOption, input: string) => boolean) | null;
|
|
28
|
+
formatCreateLabel?: (input: string) => React.ReactNode;
|
|
29
|
+
/** ID of the native input, for association with a label. */
|
|
30
|
+
id?: string;
|
|
31
|
+
/** Ref to the native search input. */
|
|
32
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
33
|
+
inputValue?: string;
|
|
34
|
+
isInsideModal?: boolean;
|
|
35
|
+
isLoading?: boolean;
|
|
36
|
+
/** Controlled menu state. */
|
|
37
|
+
isOpen?: boolean;
|
|
38
|
+
/** Compare object values. Values are compared with === by default. */
|
|
39
|
+
isValueEqual?: (a: TValue, b: TValue) => boolean;
|
|
40
|
+
loadingMessage?: () => React.ReactNode;
|
|
41
|
+
maxMenuHeight?: number;
|
|
42
|
+
maxMenuWidth?: number | string;
|
|
43
|
+
/** Content after the options, outside the scroll container. */
|
|
44
|
+
menuFooter?: React.ReactNode;
|
|
45
|
+
menuPortalTarget?: HTMLElement | null;
|
|
46
|
+
minMenuHeight?: number;
|
|
47
|
+
name?: string;
|
|
48
|
+
noOptionsMessage?: (state: {
|
|
49
|
+
inputValue: string;
|
|
50
|
+
}) => React.ReactNode;
|
|
51
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
52
|
+
onCreateOption?: (input: string) => void;
|
|
53
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
54
|
+
/** Search text changes, including resets after selection, blur, or menu close. */
|
|
55
|
+
onInputChange?: (input: string, reason: 'input' | 'reset') => void;
|
|
56
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
57
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
58
|
+
openMenuOnClick?: boolean;
|
|
59
|
+
openMenuOnFocus?: boolean;
|
|
60
|
+
placeholder?: React.ReactNode;
|
|
61
|
+
ref?: React.Ref<SelectHandle>;
|
|
62
|
+
searchable?: boolean;
|
|
63
|
+
showCreateOptionIcon?: boolean;
|
|
64
|
+
showDividers?: boolean;
|
|
65
|
+
size?: FormSize;
|
|
66
|
+
styles?: StylesConfig<NoInfer<TValue>, NoInfer<TOption>>;
|
|
67
|
+
tabIndex?: number;
|
|
68
|
+
/** Virtualize large lists, including lists with sections. */
|
|
69
|
+
virtualized?: boolean;
|
|
70
|
+
}
|
|
71
|
+
type DisabledSelectionProps<Props extends {
|
|
72
|
+
onChange: unknown;
|
|
73
|
+
}> = Props extends unknown ? Omit<Props, 'onChange'> & {
|
|
74
|
+
disabled: true;
|
|
75
|
+
onChange?: Props['onChange'];
|
|
76
|
+
} : never;
|
|
77
|
+
export type ControlProps<TValue, TOption extends SelectValue<TValue> = SelectValue<TValue>> = (SelectSelectionProps<TValue, TOption> | DisabledSelectionProps<SelectSelectionProps<TValue, TOption>>) & BaseSelectProps<TValue, TOption>;
|
|
78
|
+
export declare function Select<TValue, TOption extends SelectValue<TValue> = SelectValue<TValue>>(props: ControlProps<TValue, TOption>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
79
|
+
export {};
|