@sentry/scraps 0.2.0 → 0.4.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/dist/button/buttonBar.js +7 -1
- package/dist/dragHandle/dragHandle.d.ts +34 -0
- package/dist/dragHandle/dragHandle.js +115 -0
- package/dist/dragHandle/index.d.ts +4 -0
- package/dist/dragHandle/index.js +4 -0
- package/dist/dragHandle/setDocumentDragging.d.ts +9 -0
- package/dist/dragHandle/setDocumentDragging.js +6 -0
- package/dist/dragHandle/useDragMove.d.ts +244 -0
- package/dist/dragHandle/useDragMove.js +66 -0
- package/dist/dragHandle/useDragSeparator.d.ts +256 -0
- package/dist/dragHandle/useDragSeparator.js +36 -0
- package/dist/formPresentation/autoSaveContext.d.ts +23 -0
- package/dist/formPresentation/autoSaveContext.js +13 -0
- package/dist/formPresentation/base.d.ts +11 -0
- package/dist/formPresentation/base.js +37 -0
- package/dist/formPresentation/displayField.d.ts +17 -0
- package/dist/formPresentation/displayField.js +69 -0
- package/dist/formPresentation/fieldIds.d.ts +3 -0
- package/dist/formPresentation/fieldIds.js +14 -0
- package/dist/formPresentation/fieldLayout.d.ts +23 -0
- package/dist/formPresentation/fieldLayout.js +76 -0
- package/dist/formPresentation/formContext.d.ts +4 -0
- package/dist/formPresentation/formContext.js +6 -0
- package/dist/formPresentation/groupContext.d.ts +24 -0
- package/dist/formPresentation/groupContext.js +22 -0
- package/dist/formPresentation/icons.d.ts +11 -0
- package/dist/formPresentation/icons.js +61 -0
- package/dist/formPresentation/index.d.ts +8 -0
- package/dist/formPresentation/index.js +8 -0
- package/dist/formPresentation/meta.d.ts +18 -0
- package/dist/formPresentation/meta.js +88 -0
- package/dist/formPresentation/useStackedLayout.d.ts +1 -0
- package/dist/formPresentation/useStackedLayout.js +9 -0
- package/dist/input/index.d.ts +8 -0
- package/dist/input/index.js +6 -0
- package/dist/input/input.d.ts +19 -0
- package/dist/input/input.js +14 -0
- package/dist/input/inputGroup.d.ts +29 -0
- package/dist/input/inputGroup.js +167 -0
- package/dist/input/inputStyles.d.ts +13 -0
- package/dist/input/inputStyles.js +52 -0
- package/dist/input/numberDragInput.d.ts +20 -0
- package/dist/input/numberDragInput.js +97 -0
- package/dist/input/numberInput.d.ts +10 -0
- package/dist/input/numberInput.js +94 -0
- package/dist/input/otpInput.d.ts +28 -0
- package/dist/input/otpInput.js +81 -0
- package/dist/input/useAutosizeInput.d.ts +17 -0
- package/dist/input/useAutosizeInput.js +56 -0
- package/dist/layout/styles.d.ts +1 -1
- package/dist/menu/controlContext.d.ts +32 -0
- package/dist/menu/controlContext.js +7 -0
- package/dist/menu/dropdownButton.d.ts +18 -0
- package/dist/menu/dropdownButton.js +66 -0
- package/dist/menu/index.d.ts +7 -0
- package/dist/menu/index.js +3 -0
- package/dist/menu/menu.d.ts +159 -0
- package/dist/menu/menu.js +464 -0
- package/dist/menu/selectTypes.d.ts +96 -0
- package/dist/menu/selectTypes.js +0 -0
- package/dist/menu/selectValue.d.ts +13 -0
- package/dist/menu/selectValue.js +0 -0
- package/dist/overlayPositioning.d.ts +10 -1
- package/dist/overlayPositioning.js +15 -2
- package/dist/overlayTrigger.d.ts +22 -0
- package/dist/overlayTrigger.js +30 -0
- package/dist/slot/knownContexts.d.ts +1 -1
- package/dist/spinner/index.d.ts +1 -0
- package/dist/spinner/index.js +1 -0
- package/dist/spinner/spinner.d.ts +14 -0
- package/dist/spinner/spinner.js +126 -0
- package/dist/splitPanel/index.d.ts +1 -0
- package/dist/splitPanel/index.js +1 -0
- package/dist/splitPanel/splitPanel.d.ts +36 -0
- package/dist/splitPanel/splitPanel.js +144 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.js +3 -0
- package/dist/table/sortableHeaderCell.d.ts +36 -0
- package/dist/table/sortableHeaderCell.js +99 -0
- package/dist/table/styles.d.ts +46 -0
- package/dist/table/styles.js +93 -0
- package/dist/table/table.d.ts +64 -0
- package/dist/table/table.js +228 -0
- package/dist/table/useColumnResize.d.ts +27 -0
- package/dist/table/useColumnResize.js +62 -0
- package/dist/table/useObservedColumnSize.d.ts +12 -0
- package/dist/table/useObservedColumnSize.js +74 -0
- package/dist/text/heading.d.ts +1 -1
- package/dist/text/text.d.ts +7 -0
- package/dist/text/text.js +1 -1
- package/dist/textarea/index.d.ts +1 -0
- package/dist/textarea/index.js +1 -0
- package/dist/textarea/textarea.d.ts +22 -0
- package/dist/textarea/textarea.js +77 -0
- package/dist/toast/index.d.ts +5 -0
- package/dist/toast/index.js +4 -0
- package/dist/toast/toast.d.ts +10 -0
- package/dist/toast/toast.js +182 -0
- package/dist/toast/toastApi.d.ts +10 -0
- package/dist/toast/toastApi.js +53 -0
- package/dist/toast/toaster.d.ts +4 -0
- package/dist/toast/toaster.js +42 -0
- package/dist/toast/types.d.ts +17 -0
- package/dist/toast/types.js +2 -0
- package/dist/toggleCard/index.d.ts +1 -0
- package/dist/toggleCard/index.js +1 -0
- package/dist/toggleCard/toggleCard.d.ts +32 -0
- package/dist/toggleCard/toggleCard.js +301 -0
- package/dist/useDimensions.d.ts +12 -0
- package/dist/useDimensions.js +31 -0
- package/dist/useOverlay.js +2 -1
- package/dist/useResizableDrawer.d.ts +72 -0
- package/dist/useResizableDrawer.js +136 -0
- package/package.json +60 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { SelectValue } from './selectValue.js';
|
|
3
|
+
export type ListItemBase = object & {
|
|
4
|
+
showToggleAllButton?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type SelectKey = string | number;
|
|
7
|
+
export interface SelectOption<Value extends SelectKey> extends SelectValue<Value> {
|
|
8
|
+
/**
|
|
9
|
+
* Whether to hide the checkbox/checkmark. Available for backward compatibility only.
|
|
10
|
+
* If true, an alternative selection state indicator must be present.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
14
|
+
hideCheck?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface SelectSection<Value extends SelectKey> {
|
|
17
|
+
options: Array<SelectOption<Value>>;
|
|
18
|
+
/**
|
|
19
|
+
* When true, all options inside this section will be disabled.
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Optional key to identify this section. If not specified, the section's index will
|
|
24
|
+
* be used.
|
|
25
|
+
*/
|
|
26
|
+
key?: SelectKey;
|
|
27
|
+
/**
|
|
28
|
+
* Title to display in the section header.
|
|
29
|
+
*/
|
|
30
|
+
label?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to show a "Select All"/"Unselect All" button in the section header (only
|
|
33
|
+
* applicable in multiple-selection mode).
|
|
34
|
+
*/
|
|
35
|
+
showToggleAllButton?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type SelectOptionOrSection<Value extends SelectKey> = SelectOption<Value> | SelectSection<Value>;
|
|
38
|
+
/**
|
|
39
|
+
* The result of a custom `searchMatcher` function. Returning this (instead of a plain
|
|
40
|
+
* boolean) allows callers to influence how matching options are sorted: options with a
|
|
41
|
+
* higher `score` are shown first. To hide an option, return `{score: 0}.
|
|
42
|
+
*/
|
|
43
|
+
export interface SearchMatchResult {
|
|
44
|
+
/**
|
|
45
|
+
* Match quality score. Higher values cause the option to appear earlier in the list.
|
|
46
|
+
* Options that match but return no score maintain their original order relative to
|
|
47
|
+
* each other.
|
|
48
|
+
*/
|
|
49
|
+
score: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Configuration for CompactSelect's search/filter behavior. Providing this prop
|
|
53
|
+
* implicitly enables the search input.
|
|
54
|
+
*/
|
|
55
|
+
export interface SearchConfig<Value extends SelectKey> {
|
|
56
|
+
/**
|
|
57
|
+
* Controls client-side option filtering:
|
|
58
|
+
* - Omitted: default fuzzy (fzf) filter, results sorted by match score
|
|
59
|
+
* - Function: custom matcher (receives option + search string, returns SearchMatchResult)
|
|
60
|
+
* - `false`: disables client-side filtering entirely (use with `onChange` for server-side search)
|
|
61
|
+
*/
|
|
62
|
+
filter?: ((option: SelectOptionWithKey<Value>, search: string) => SearchMatchResult) | false;
|
|
63
|
+
/**
|
|
64
|
+
* When true, the matched contiguous substring of each option's (string) label will be
|
|
65
|
+
* visually highlighted as the user types. Paired best with a substring-based `filter` function.
|
|
66
|
+
*/
|
|
67
|
+
highlight?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Called when the search input value changes.
|
|
70
|
+
*/
|
|
71
|
+
onChange?: (value: string) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Placeholder text for the search input. Defaults to 'Search…'.
|
|
74
|
+
*/
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface SelectOptionWithKey<Value extends SelectKey> extends SelectOption<Value> {
|
|
78
|
+
/**
|
|
79
|
+
* Key to identify this section. If not specified, the section's index will
|
|
80
|
+
* be used.
|
|
81
|
+
*/
|
|
82
|
+
key: SelectKey;
|
|
83
|
+
}
|
|
84
|
+
export interface SelectSectionWithKey<Value extends SelectKey> extends SelectSection<Value> {
|
|
85
|
+
/**
|
|
86
|
+
* Key to identify this section. If not specified, the section's index will
|
|
87
|
+
* be used.
|
|
88
|
+
*/
|
|
89
|
+
key: SelectKey;
|
|
90
|
+
options: Array<SelectOptionWithKey<Value>>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Select option/section type used for internal selection manager. DO NOT import in
|
|
94
|
+
* other components. Import `SelectOptionOrSection` instead.
|
|
95
|
+
*/
|
|
96
|
+
export type SelectOptionOrSectionWithKey<Value extends SelectKey> = SelectOptionWithKey<Value> | SelectSectionWithKey<Value>;
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ListItemProps } from './menu.js';
|
|
2
|
+
/**
|
|
3
|
+
* The option format used by react-select based components
|
|
4
|
+
*/
|
|
5
|
+
export interface SelectValue<T> extends ListItemProps {
|
|
6
|
+
value: T;
|
|
7
|
+
/**
|
|
8
|
+
* In scenarios where you're using a react element as the label react-select
|
|
9
|
+
* will be unable to filter to that label. Use this to specify the plain text of
|
|
10
|
+
* the label.
|
|
11
|
+
*/
|
|
12
|
+
textValue?: string;
|
|
13
|
+
}
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
import type { FlipOptions, Middleware, Padding, Placement, ShiftOptions } from '@floating-ui/react-dom';
|
|
2
|
+
import type { FlipOptions, Middleware, Padding, Placement, Platform, ShiftOptions } from '@floating-ui/react-dom';
|
|
3
3
|
/**
|
|
4
4
|
* Where to place an overlay relative to its trigger. The `auto` positions
|
|
5
5
|
* pick whichever side has the most space.
|
|
@@ -59,3 +59,12 @@ export interface ShiftOverlayOptions extends ShiftOptions {
|
|
|
59
59
|
* offset that already places the overlay away from its trigger is kept.
|
|
60
60
|
*/
|
|
61
61
|
export declare function shiftOverlay(options?: ShiftOverlayOptions): Middleware;
|
|
62
|
+
/**
|
|
63
|
+
* Floating UI's platform, except that the default `clippingAncestors` boundary
|
|
64
|
+
* only includes ancestors that contain the overlay's offset parent, as Popper
|
|
65
|
+
* did. Floating UI treats a positioned `display: contents` element as the
|
|
66
|
+
* overlay's containing block, even though it has no box. Overflow ancestors
|
|
67
|
+
* between it and the real containing block then clamp the overlay's size
|
|
68
|
+
* without clipping it, e.g. a `DropdownMenu` inside a `ButtonBar`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const overlayPlatform: Platform;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arrow, autoPlacement, flip, limitShift, shift } from "@floating-ui/react-dom";
|
|
1
|
+
import { arrow, autoPlacement, flip, getOverflowAncestors, limitShift, platform as react_dom_platform, shift } from "@floating-ui/react-dom";
|
|
2
2
|
function placementMiddleware(position, flipOptions = {}) {
|
|
3
3
|
if ('auto' === position || 'auto-start' === position || 'auto-end' === position) {
|
|
4
4
|
const { mainAxis: _mainAxis, crossAxis: _crossAxis, fallbackPlacements: _fallbackPlacements, fallbackStrategy: _fallbackStrategy, fallbackAxisSideDirection: _fallbackAxisSideDirection, flipAlignment = true, ...detectOverflowOptions } = flipOptions;
|
|
@@ -123,4 +123,17 @@ function tetherLimiter(origin, arrowElement) {
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
const overlayPlatform = {
|
|
127
|
+
...react_dom_platform,
|
|
128
|
+
getClippingRect (args) {
|
|
129
|
+
const { element, boundary, strategy } = args;
|
|
130
|
+
const offsetParent = element instanceof HTMLElement && 'absolute' === strategy ? element.offsetParent : null;
|
|
131
|
+
if ('clippingAncestors' !== boundary || !offsetParent) return react_dom_platform.getClippingRect.call(this, args);
|
|
132
|
+
const clippingAncestors = getOverflowAncestors(element, [], false).filter((ancestor)=>ancestor instanceof Element && ancestor !== element.ownerDocument.body && ancestor.contains(offsetParent));
|
|
133
|
+
return react_dom_platform.getClippingRect.call(this, {
|
|
134
|
+
...args,
|
|
135
|
+
boundary: clippingAncestors
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
export { anchorOverlay, anchoredStyles, arrowOverlay, flipOverlay, overlayPlatform, placementMiddleware, shiftOverlay };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { DistributedOmit, SetRequired } from 'type-fest';
|
|
3
|
+
import { type DropdownButtonProps } from './menu/dropdownButton.js';
|
|
4
|
+
type TriggerEl = HTMLButtonElement | (Omit<HTMLButtonElement, 'ELEMENT_NODE'> & {
|
|
5
|
+
ELEMENT_NODE: 'only use `OverlayTrigger.Button` or `OverlayTrigger.IconButton` for the trigger prop!';
|
|
6
|
+
});
|
|
7
|
+
export type TriggerProps = Omit<React.HTMLAttributes<TriggerEl>, 'children'> & {
|
|
8
|
+
children: NonNullable<React.ReactNode>;
|
|
9
|
+
ref?: React.Ref<TriggerEl>;
|
|
10
|
+
};
|
|
11
|
+
export type OverlayTriggerButtonProps = DistributedOmit<DropdownButtonProps, 'ref' | 'children' | 'onClick'> & {
|
|
12
|
+
children: NonNullable<React.ReactNode>;
|
|
13
|
+
ref?: React.Ref<TriggerEl> | React.Ref<HTMLButtonElement>;
|
|
14
|
+
};
|
|
15
|
+
export type OverlayTriggerIconButtonProps = SetRequired<DistributedOmit<DropdownButtonProps, 'ref' | 'showChevron' | 'onClick'>, 'aria-label' | 'icon'> & {
|
|
16
|
+
ref?: React.Ref<TriggerEl> | React.Ref<HTMLButtonElement>;
|
|
17
|
+
};
|
|
18
|
+
export declare const OverlayTrigger: {
|
|
19
|
+
Button({ ref, ...props }: OverlayTriggerButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
+
IconButton({ ref, children: _, ...props }: OverlayTriggerIconButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { ControlContext } from "./menu/controlContext.js";
|
|
3
|
+
import { DropdownButton } from "./menu/dropdownButton.js";
|
|
4
|
+
import * as __rspack_external_react from "react";
|
|
5
|
+
const useContextProps = ()=>{
|
|
6
|
+
const selectContext = __rspack_external_react.useContext(ControlContext);
|
|
7
|
+
return {
|
|
8
|
+
size: selectContext.size,
|
|
9
|
+
isOpen: selectContext.overlayIsOpen,
|
|
10
|
+
disabled: selectContext.disabled
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const OverlayTrigger = {
|
|
14
|
+
Button ({ ref, ...props }) {
|
|
15
|
+
return /*#__PURE__*/ jsx(DropdownButton, {
|
|
16
|
+
...useContextProps(),
|
|
17
|
+
...props,
|
|
18
|
+
ref: ref
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
IconButton ({ ref, children: _, ...props }) {
|
|
22
|
+
return /*#__PURE__*/ jsx(DropdownButton, {
|
|
23
|
+
...useContextProps(),
|
|
24
|
+
...props,
|
|
25
|
+
showChevron: false,
|
|
26
|
+
ref: ref
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export { OverlayTrigger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const KNOWN_BRIDGED_CONTEXTS: readonly [import("react").Context<("xs" | "sm" | "md") | undefined>, import("react").Context<"
|
|
1
|
+
export declare const KNOWN_BRIDGED_CONTEXTS: readonly [import("react").Context<("xs" | "sm" | "md") | undefined>, import("react").Context<"2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "zero" | "3xs" | "5xl" | null>];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Spinner, type SpinnerProps } from './spinner.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Spinner } from "./spinner.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
export interface SpinnerProps {
|
|
3
|
+
children?: NonNullable<React.ReactNode>;
|
|
4
|
+
className?: string;
|
|
5
|
+
['data-test-id']?: string;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `size` instead.
|
|
8
|
+
*/
|
|
9
|
+
mini?: boolean;
|
|
10
|
+
relative?: boolean;
|
|
11
|
+
size?: number;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
export declare function Spinner(props: SpinnerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { keyframes } from "@emotion/react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
function Spinner(props) {
|
|
6
|
+
return /*#__PURE__*/ jsxs(Container, {
|
|
7
|
+
className: classnames('scraps-spinner', props.className, {
|
|
8
|
+
'scraps-spinner-mini': props.mini
|
|
9
|
+
}),
|
|
10
|
+
style: props.style,
|
|
11
|
+
"data-test-id": props['data-test-id'] ?? 'loading-indicator',
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsx("div", {
|
|
14
|
+
className: classnames('scraps-spinner-container', {
|
|
15
|
+
'scraps-spinner-relative': props.relative
|
|
16
|
+
}),
|
|
17
|
+
style: {
|
|
18
|
+
width: props.size,
|
|
19
|
+
height: props.size
|
|
20
|
+
},
|
|
21
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
22
|
+
className: "scraps-spinner-ring",
|
|
23
|
+
style: props.size ? {
|
|
24
|
+
width: props.size - 1,
|
|
25
|
+
height: props.size - 1,
|
|
26
|
+
borderWidth: getSpinnerBorderWidth(props.size)
|
|
27
|
+
} : void 0
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
props.children && /*#__PURE__*/ jsx("div", {
|
|
31
|
+
className: "scraps-spinner-message",
|
|
32
|
+
children: props.children
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function getSpinnerBorderWidth(size) {
|
|
38
|
+
if (!size) return;
|
|
39
|
+
if (size > 64) return 6;
|
|
40
|
+
return 2 + (size - 24) / 40 * 4;
|
|
41
|
+
}
|
|
42
|
+
const loading = keyframes`
|
|
43
|
+
from { transform: rotate(0deg); }
|
|
44
|
+
to { transform: rotate(360deg); }
|
|
45
|
+
`;
|
|
46
|
+
const Container = styled('div')`
|
|
47
|
+
margin: 6em auto;
|
|
48
|
+
position: relative;
|
|
49
|
+
|
|
50
|
+
.scraps-spinner-container {
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
position: relative;
|
|
53
|
+
width: fit-content;
|
|
54
|
+
margin: 0 auto;
|
|
55
|
+
padding: 0.5px;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.scraps-spinner-ring {
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
position: relative;
|
|
62
|
+
background: transparent;
|
|
63
|
+
/* oxlint-disable-next-line @sentry/scraps/use-semantic-token -- Preserve the existing light-theme loader colors. */
|
|
64
|
+
border: 6px solid
|
|
65
|
+
${(p)=>'dark' === p.theme.type ? p.theme.tokens.border.transparent.neutral.muted : '#e6e9ec'};
|
|
66
|
+
/* oxlint-disable-next-line @sentry/scraps/use-semantic-token -- Preserve the existing light-theme loader colors. */
|
|
67
|
+
border-left-color: ${(p)=>'dark' === p.theme.type ? p.theme.tokens.border.accent.vibrant : '#6c5fc7'};
|
|
68
|
+
animation: ${loading} 0.55s infinite linear;
|
|
69
|
+
margin: 0 auto;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.scraps-spinner-ring,
|
|
73
|
+
.scraps-spinner-ring::after {
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
width: 63px;
|
|
76
|
+
height: 63px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.scraps-spinner-message {
|
|
80
|
+
margin-top: 20px;
|
|
81
|
+
text-align: center;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.scraps-spinner-mini {
|
|
85
|
+
margin: 4px 0;
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
height: 24px;
|
|
88
|
+
width: 24px;
|
|
89
|
+
|
|
90
|
+
.scraps-spinner-container {
|
|
91
|
+
position: absolute;
|
|
92
|
+
left: 0;
|
|
93
|
+
top: 0;
|
|
94
|
+
width: 24px;
|
|
95
|
+
height: 24px;
|
|
96
|
+
|
|
97
|
+
&.scraps-spinner-relative {
|
|
98
|
+
position: relative;
|
|
99
|
+
left: auto;
|
|
100
|
+
top: auto;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.scraps-spinner-ring {
|
|
105
|
+
margin: 0;
|
|
106
|
+
width: 23px;
|
|
107
|
+
height: 23px;
|
|
108
|
+
border-width: 2px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.scraps-spinner-message {
|
|
112
|
+
padding-left: 30px;
|
|
113
|
+
margin-top: 1px;
|
|
114
|
+
display: inline-block;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media (prefers-reduced-motion) {
|
|
119
|
+
.scraps-spinner-ring {
|
|
120
|
+
animation-delay: -1ms !important;
|
|
121
|
+
animation-duration: 0ms !important;
|
|
122
|
+
animation-iteration-count: 1 !important;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
export { Spinner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SplitPanel, type SplitPanelHandle } from './splitPanel.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SplitPanel } from "./splitPanel.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type Responsive } from '../layout/index.js';
|
|
3
|
+
export interface SplitPanelHandle {
|
|
4
|
+
/**
|
|
5
|
+
* Imperatively set the `sized` pane's size (px). Useful to seed the size from
|
|
6
|
+
* a measurement the parent takes after mount, without remounting (and thus
|
|
7
|
+
* without the parent gating the whole panel on its own measurement).
|
|
8
|
+
*/
|
|
9
|
+
setSize: (size: number, userEvent?: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
interface SplitPanelProps {
|
|
12
|
+
/** Initial size of the `sized` pane in pixels; restored on double-click. */
|
|
13
|
+
defaultSize: number;
|
|
14
|
+
/** The pane with a draggable size. */
|
|
15
|
+
sized: React.ReactNode;
|
|
16
|
+
/** The pane that fills the remaining space. Omit to render a single pane. */
|
|
17
|
+
fill?: React.ReactNode;
|
|
18
|
+
/** Minimum size of the `fill` pane in pixels. */
|
|
19
|
+
fillMinSize?: number;
|
|
20
|
+
/** Starting size, e.g. restored from persistence. Defaults to `defaultSize`. */
|
|
21
|
+
initialSize?: number;
|
|
22
|
+
maxSize?: number;
|
|
23
|
+
minSize?: number;
|
|
24
|
+
/** Fires once when a drag ends. */
|
|
25
|
+
onResizeEnd?: (payload: {
|
|
26
|
+
direction: 'increase' | 'decrease';
|
|
27
|
+
endSize: number;
|
|
28
|
+
startSize: number;
|
|
29
|
+
}) => void;
|
|
30
|
+
/** Layout direction. Accepts a responsive value. */
|
|
31
|
+
orientation?: Responsive<'horizontal' | 'vertical'>;
|
|
32
|
+
/** Imperative handle exposing `setSize`. */
|
|
33
|
+
ref?: React.Ref<SplitPanelHandle>;
|
|
34
|
+
}
|
|
35
|
+
export declare function SplitPanel({ sized, fill, ref, orientation: orientationProp, defaultSize, initialSize, minSize, maxSize, fillMinSize, onResizeEnd, }: SplitPanelProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useCallback, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { DRAG_HANDLE_SIZE, DragHandle } from "../dragHandle/index.js";
|
|
5
|
+
import { Flex, Stack } from "../layout/index.js";
|
|
6
|
+
import { useResponsivePropValue } from "../layout/styles.js";
|
|
7
|
+
import { useTranslation } from "../translation/useTranslation.js";
|
|
8
|
+
import { useDimensions } from "../useDimensions.js";
|
|
9
|
+
import { useResizableDrawer } from "../useResizableDrawer.js";
|
|
10
|
+
function Pane({ size, children }) {
|
|
11
|
+
const isFilling = null === size;
|
|
12
|
+
return /*#__PURE__*/ jsx(Stack, {
|
|
13
|
+
minHeight: "0",
|
|
14
|
+
minWidth: "0",
|
|
15
|
+
flexGrow: isFilling ? 1 : 0,
|
|
16
|
+
flexShrink: isFilling ? 1 : 0,
|
|
17
|
+
flexBasis: isFilling ? 0 : `${size}px`,
|
|
18
|
+
children: children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function SplitPanel({ sized, fill, ref, orientation: orientationProp = 'horizontal', defaultSize, initialSize = defaultSize, minSize = 0, maxSize, fillMinSize = 0, onResizeEnd }) {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const orientation = 'vertical' === useResponsivePropValue(orientationProp) ? 'vertical' : 'horizontal';
|
|
24
|
+
const hasFill = null != fill;
|
|
25
|
+
const containerRef = useRef(null);
|
|
26
|
+
const dims = useDimensions({
|
|
27
|
+
elementRef: containerRef
|
|
28
|
+
});
|
|
29
|
+
const availableSize = 'horizontal' === orientation ? dims.width : dims.height;
|
|
30
|
+
const min = minSize;
|
|
31
|
+
const explicitMax = maxSize ?? 1 / 0;
|
|
32
|
+
const max = availableSize > 0 ? Math.max(min, Math.min(explicitMax, availableSize - fillMinSize - DRAG_HANDLE_SIZE)) : explicitMax;
|
|
33
|
+
const handleResizeEnd = useCallback((startSize, endSize)=>{
|
|
34
|
+
if (startSize === endSize) return;
|
|
35
|
+
onResizeEnd?.({
|
|
36
|
+
startSize,
|
|
37
|
+
endSize,
|
|
38
|
+
direction: endSize > startSize ? 'increase' : 'decrease'
|
|
39
|
+
});
|
|
40
|
+
}, [
|
|
41
|
+
onResizeEnd
|
|
42
|
+
]);
|
|
43
|
+
const [isHeld, setIsHeld] = useState(false);
|
|
44
|
+
const dragStateRef = useRef(null);
|
|
45
|
+
const { setSize, size: containerSize } = useResizableDrawer({
|
|
46
|
+
direction: 'horizontal' === orientation ? 'left' : 'down',
|
|
47
|
+
initialSize,
|
|
48
|
+
min,
|
|
49
|
+
max
|
|
50
|
+
});
|
|
51
|
+
useImperativeHandle(ref, ()=>({
|
|
52
|
+
setSize
|
|
53
|
+
}), [
|
|
54
|
+
setSize
|
|
55
|
+
]);
|
|
56
|
+
const visibleSize = Math.max(min, Math.min(containerSize, max));
|
|
57
|
+
const handleDoubleClick = ()=>{
|
|
58
|
+
const target = Math.max(min, Math.min(defaultSize, max));
|
|
59
|
+
setSize(target, true);
|
|
60
|
+
handleResizeEnd(visibleSize, target);
|
|
61
|
+
};
|
|
62
|
+
const handleMoveStart = ()=>{
|
|
63
|
+
dragStateRef.current = {
|
|
64
|
+
size: visibleSize,
|
|
65
|
+
startSize: visibleSize
|
|
66
|
+
};
|
|
67
|
+
setIsHeld(true);
|
|
68
|
+
};
|
|
69
|
+
const handleMove = (delta)=>{
|
|
70
|
+
const state = dragStateRef.current;
|
|
71
|
+
if (!state) return;
|
|
72
|
+
state.size = Math.max(min, Math.min(max, state.size + delta));
|
|
73
|
+
setSize(Math.round(state.size), true);
|
|
74
|
+
};
|
|
75
|
+
const handleMoveEnd = ()=>{
|
|
76
|
+
const state = dragStateRef.current;
|
|
77
|
+
dragStateRef.current = null;
|
|
78
|
+
setIsHeld(false);
|
|
79
|
+
if (state) handleResizeEnd(state.startSize, Math.round(state.size));
|
|
80
|
+
};
|
|
81
|
+
const handleKeyDown = (event)=>{
|
|
82
|
+
let newSize = null;
|
|
83
|
+
if ('Home' === event.key) newSize = min;
|
|
84
|
+
else if ('End' === event.key) newSize = max;
|
|
85
|
+
if (null !== newSize && Number.isFinite(newSize)) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
setSize(newSize, true);
|
|
88
|
+
handleResizeEnd(visibleSize, newSize);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const panes = [
|
|
92
|
+
/*#__PURE__*/ jsx(Pane, {
|
|
93
|
+
size: hasFill ? visibleSize : null,
|
|
94
|
+
children: sized
|
|
95
|
+
}, "sized")
|
|
96
|
+
];
|
|
97
|
+
if (hasFill) panes.push(/*#__PURE__*/ jsx(DragHandle, {
|
|
98
|
+
"aria-label": t('Resize panels'),
|
|
99
|
+
isSizedFirst: true,
|
|
100
|
+
max: max,
|
|
101
|
+
min: min,
|
|
102
|
+
orientation: orientation,
|
|
103
|
+
value: visibleSize,
|
|
104
|
+
onDoubleClick: handleDoubleClick,
|
|
105
|
+
onKeyDown: handleKeyDown,
|
|
106
|
+
onMove: handleMove,
|
|
107
|
+
onMoveEnd: handleMoveEnd,
|
|
108
|
+
onMoveStart: handleMoveStart
|
|
109
|
+
}, "divider"), /*#__PURE__*/ jsx(Pane, {
|
|
110
|
+
size: null,
|
|
111
|
+
children: fill
|
|
112
|
+
}, "fill"));
|
|
113
|
+
return /*#__PURE__*/ jsx(Flex, {
|
|
114
|
+
direction: 'horizontal' === orientation ? 'row' : 'column',
|
|
115
|
+
position: "relative",
|
|
116
|
+
width: "100%",
|
|
117
|
+
height: "100%",
|
|
118
|
+
minHeight: "0",
|
|
119
|
+
minWidth: "0",
|
|
120
|
+
flex: "1",
|
|
121
|
+
children: (props)=>/*#__PURE__*/ jsx(RootElement, {
|
|
122
|
+
...props,
|
|
123
|
+
ref: containerRef,
|
|
124
|
+
"data-is-held": isHeld,
|
|
125
|
+
style: hasFill && 0 === availableSize ? {
|
|
126
|
+
visibility: 'hidden'
|
|
127
|
+
} : void 0,
|
|
128
|
+
children: panes
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const RootElement = styled('div')`
|
|
133
|
+
/*
|
|
134
|
+
* Disable iframe pointer events while dragging so the divider doesn't lose the
|
|
135
|
+
* cursor when crossing an embedded iframe (e.g. the Replay player). The
|
|
136
|
+
* triple-& raises specificity so this beats the player's own
|
|
137
|
+
* [data-inspectable] .replayer-wrapper > iframe !important rule, which would
|
|
138
|
+
* otherwise tie and make the drag intermittently stick over the video.
|
|
139
|
+
*/
|
|
140
|
+
&&&[data-is-held='true'] iframe {
|
|
141
|
+
pointer-events: none !important;
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
export { SplitPanel };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { COL_WIDTH_MINIMUM, COL_WIDTH_UNDEFINED, Table, type TableColumnConfig, type TableProps, useTableElement, } from './table.js';
|
|
2
|
+
export { COLUMN_ALIGN_JUSTIFY, getAriaSort, HeaderCellContent, SortableHeaderCell, type ColumnAlign, type SortDirection, } from './sortableHeaderCell.js';
|
|
3
|
+
export { emptyCellStyle, fullWidthCellStyle, statusCellStyle, TableStatusCell, } from './styles.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { COL_WIDTH_MINIMUM, COL_WIDTH_UNDEFINED, Table, useTableElement } from "./table.js";
|
|
2
|
+
export { COLUMN_ALIGN_JUSTIFY, HeaderCellContent, SortableHeaderCell, getAriaSort } from "./sortableHeaderCell.js";
|
|
3
|
+
export { TableStatusCell, emptyCellStyle, fullWidthCellStyle, statusCellStyle } from "./styles.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { HTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { type LinkProps } from '../link/index.js';
|
|
3
|
+
export type SortDirection = 'asc' | 'desc';
|
|
4
|
+
export declare function getAriaSort(direction: SortDirection | undefined): 'ascending' | 'descending' | undefined;
|
|
5
|
+
export type ColumnAlign = 'left' | 'center' | 'right';
|
|
6
|
+
export declare const COLUMN_ALIGN_JUSTIFY: {
|
|
7
|
+
readonly center: "center";
|
|
8
|
+
readonly left: "start";
|
|
9
|
+
readonly right: "end";
|
|
10
|
+
};
|
|
11
|
+
interface SortableHeaderCellProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
align?: ColumnAlign;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
direction?: SortDirection;
|
|
15
|
+
onSort?: (event: MouseEvent) => void;
|
|
16
|
+
overlays?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Whether `to` should replace the history entry rather than pushing a new one.
|
|
19
|
+
*/
|
|
20
|
+
replace?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Sort destination to navigate to on sort.
|
|
23
|
+
*/
|
|
24
|
+
to?: LinkProps['to'];
|
|
25
|
+
}
|
|
26
|
+
export declare function SortableHeaderCell({ align, children, direction, onSort, overlays, replace, to, ...props }: SortableHeaderCellProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const HeaderCellContent: import("@emotion/styled").StyledComponent<{
|
|
28
|
+
theme?: import("@emotion/react").Theme;
|
|
29
|
+
as?: React.ElementType;
|
|
30
|
+
} & {
|
|
31
|
+
align?: ColumnAlign;
|
|
32
|
+
replace?: boolean;
|
|
33
|
+
to?: LinkProps["to"];
|
|
34
|
+
type?: "button";
|
|
35
|
+
}, import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
36
|
+
export {};
|