@epam/ai-dial-ui-kit 0.14.0-dev.2 → 0.14.0-dev.22
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 +7 -1
- package/dist/CHANGELOG.md +56 -1
- package/dist/{JsonEditor-DPtZkKQi.cjs → JsonEditor-CLmDZqJH.cjs} +1 -1
- package/dist/{JsonEditor-CM-CG-FK.js → JsonEditor-DdYGciSl.js} +1 -1
- package/dist/{MarkdownEditor-cdq8UZxL.js → MarkdownEditor-B9Bs3UUs.js} +1 -1
- package/dist/MarkdownEditor-DXdBLiV3.cjs +1 -0
- package/dist/{MarkdownEditor-D4WuEafx.cjs → MarkdownEditor-DlAqXKw_.cjs} +1 -1
- package/dist/MarkdownEditor-YU-phCxT.js +69 -0
- package/dist/components-manifest.json +1795 -202
- package/dist/dial-ui-kit.cjs.js +1 -1
- package/dist/dial-ui-kit.es.js +231 -195
- package/dist/{index-CBk9P1Pa.js → index-CpVGPv8D.js} +15116 -13323
- package/dist/{index-A_KNCHda.cjs → index-DBHH26fT.cjs} +31 -31
- package/dist/index.css +2 -2
- package/dist/migration-guides/0.14.0/button-tooltip-2-0.md +111 -0
- package/dist/migration-guides/0.14.0/control-color-token-rename.md +143 -0
- package/dist/migration-guides/0.14.0/focus-border-token-role-naming.md +87 -0
- package/dist/migration-guides/0.14.0/select-multiselect-option-row.md +99 -0
- package/dist/migration-guides/0.14.0/shadow-token-per-step-rename.md +139 -0
- package/dist/migration-guides/0.14.0/tag-single-size.md +121 -0
- package/dist/migration-guides/README.md +6 -0
- package/dist/src/components/Grid/comparators/base-column-comparator.d.ts +1 -4
- package/dist/src/components/Grid/renderers/utils.d.ts +1 -2
- package/dist/src/components/New/Button/Button.d.ts +4 -3
- package/dist/src/components/New/Calendar/constants.d.ts +5 -5
- package/dist/src/components/New/Checkbox/Checkbox.d.ts +50 -0
- package/dist/src/components/New/Checkbox/CheckboxBox.d.ts +30 -0
- package/dist/src/components/New/Checkbox/constants.d.ts +10 -0
- package/dist/src/components/New/CollapsibleSidebar/CollapsibleSidebar.d.ts +82 -0
- package/dist/src/components/New/Dropdown/constants.d.ts +3 -1
- package/dist/src/components/New/EllipsisTooltip/EllipsisTooltip.d.ts +51 -0
- package/dist/src/components/New/EllipsisTooltip/use-truncation.d.ts +26 -0
- package/dist/src/components/New/Grid/Grid.d.ts +124 -0
- package/dist/src/components/New/Grid/components/SelectionCell.d.ts +21 -0
- package/dist/src/components/New/Grid/components/SelectionHeader.d.ts +14 -0
- package/dist/src/components/New/Grid/constants.d.ts +61 -0
- package/dist/src/components/New/Grid/renderers/DateCellRenderer.d.ts +48 -0
- package/dist/src/components/New/Grid/renderers/constants.d.ts +5 -0
- package/dist/src/components/New/Highlight/Highlight.d.ts +1 -1
- package/dist/src/components/New/IconButton/IconButton.d.ts +4 -4
- package/dist/src/components/New/Input/Button/constants.d.ts +1 -1
- package/dist/src/components/New/Label/Label.d.ts +5 -0
- package/dist/src/components/New/NoDataContent/NoDataContent.d.ts +48 -0
- package/dist/src/components/New/Notification/Notification.d.ts +7 -0
- package/dist/src/components/New/Notification/NotificationWrapper.d.ts +2 -0
- package/dist/src/components/New/Popup/Popup.d.ts +48 -9
- package/dist/src/components/New/Popup/constants.d.ts +7 -0
- package/dist/src/components/New/Radio/Radio.d.ts +48 -0
- package/dist/src/components/New/RadioGroup/RadioGroup.d.ts +78 -0
- package/dist/src/components/New/RadioGroup/constants.d.ts +11 -0
- package/dist/src/components/New/RadioGroupPopupField/RadioGroupPopupField.d.ts +93 -0
- package/dist/src/components/New/RadioGroupPopupField/constants.d.ts +22 -0
- package/dist/src/components/New/ResizableContainer/ConditionalResizableContainer.d.ts +34 -0
- package/dist/src/components/New/ResizableContainer/ResizableContainer.d.ts +77 -0
- package/dist/src/components/New/ResizableContainer/components/ResizeHandle.d.ts +21 -0
- package/dist/src/components/New/SegmentedControl/SegmentedControl.d.ts +54 -0
- package/dist/src/components/New/SegmentedControl/constants.d.ts +16 -0
- package/dist/src/components/New/Select/constants.d.ts +2 -2
- package/dist/src/components/New/Slider/Slider.d.ts +70 -0
- package/dist/src/components/New/Tag/Tag.d.ts +26 -4
- package/dist/src/components/New/Tag/constants.d.ts +23 -0
- package/dist/src/components/New/ThemeScope/ThemeScope.d.ts +46 -0
- package/dist/src/components/New/ToggleIconButton/ToggleIconButton.d.ts +47 -0
- package/dist/src/components/New/Tooltip/Tooltip.d.ts +43 -0
- package/dist/src/components/New/Tooltip/TooltipContainer.d.ts +32 -0
- package/dist/src/components/New/Tooltip/TooltipContent.d.ts +18 -0
- package/dist/src/components/New/Tooltip/TooltipContext.d.ts +115 -0
- package/dist/src/components/New/Tooltip/TooltipTrigger.d.ts +18 -0
- package/dist/src/components/New/Tooltip/constants.d.ts +30 -0
- package/dist/src/components/New/constants/icon.d.ts +22 -0
- package/dist/src/components/New/constants/overlay.d.ts +12 -3
- package/dist/src/index.d.ts +47 -1
- package/dist/src/models/dropdown.d.ts +10 -0
- package/dist/src/types/notification.d.ts +2 -1
- package/dist/src/types/tag.d.ts +4 -0
- package/dist/src/types/tooltip.d.ts +6 -0
- package/dist/src/utils/__tests__/element-size-observer.spec.d.ts +1 -0
- package/dist/src/utils/element-size-observer.d.ts +26 -0
- package/dist/src/utils/grid-comparators.d.ts +4 -0
- package/dist/src/utils/grid-date.d.ts +7 -0
- package/package.json +1 -1
- package/dist/MarkdownEditor-DRQoDnC-.js +0 -75
- package/dist/MarkdownEditor-DyIvPpmt.cjs +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC, HTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TagAppearance } from '../../../types/tag';
|
|
3
3
|
type NativeTagProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'>;
|
|
4
4
|
export interface TagProps extends NativeTagProps {
|
|
5
5
|
label: string;
|
|
6
6
|
icon?: ReactNode;
|
|
7
|
-
|
|
7
|
+
appearance?: TagAppearance;
|
|
8
8
|
selected?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
closable?: boolean;
|
|
@@ -16,6 +16,10 @@ export interface TagProps extends NativeTagProps {
|
|
|
16
16
|
* aliases: Chip|Pill
|
|
17
17
|
* Design system 2.0
|
|
18
18
|
*
|
|
19
|
+
* The tag has one height — the 32px pill of the 2.0 design. There is no `size`
|
|
20
|
+
* prop: a tag sizes itself, and a caller that needs a different height is
|
|
21
|
+
* usually reaching for a button.
|
|
22
|
+
*
|
|
19
23
|
* The label truncates rather than wrapping, and carries a native `title` so the
|
|
20
24
|
* full text stays reachable when it does.
|
|
21
25
|
*
|
|
@@ -24,18 +28,36 @@ export interface TagProps extends NativeTagProps {
|
|
|
24
28
|
* the caller: a clickable tag that is also closable gives a screen reader two
|
|
25
29
|
* actions with no way to tell which one it landed on.
|
|
26
30
|
*
|
|
31
|
+
* No tag draws a rim; the two appearances are told apart by their fill.
|
|
32
|
+
* `TagAppearance.Selectable` is the filter chip of the 2.0 design: no fill
|
|
33
|
+
* at all until it is selected, one hover tint shared by both states, a semibold
|
|
34
|
+
* label once selected, and the state carried on `aria-pressed` rather than by
|
|
35
|
+
* the tint alone. Give it an `onClick` — a selectable tag that cannot be
|
|
36
|
+
* activated is a colour and nothing else.
|
|
37
|
+
*
|
|
38
|
+
* Selecting one therefore changes its width by the difference between the
|
|
39
|
+
* regular and semibold label. In a wrapping filter row that is what the design
|
|
40
|
+
* asks for; if a fixed width matters, give the chip one.
|
|
41
|
+
*
|
|
27
42
|
* @example
|
|
28
43
|
* ```tsx
|
|
29
44
|
* <Tag label="TypeScript" />
|
|
30
45
|
* <Tag label="TypeScript" closable onRemove={() => remove('TypeScript')} />
|
|
31
46
|
* <Tag label="Drafts" selected onClick={() => toggle('Drafts')} />
|
|
47
|
+
* <Tag
|
|
48
|
+
* label="Drafts"
|
|
49
|
+
* appearance={TagAppearance.Selectable}
|
|
50
|
+
* selected={isSelected}
|
|
51
|
+
* onClick={() => toggle('Drafts')}
|
|
52
|
+
* />
|
|
32
53
|
* ```
|
|
33
54
|
*
|
|
34
55
|
* @param label - Text content displayed inside the tag.
|
|
35
56
|
* @param [icon] - Icon rendered before the label.
|
|
36
|
-
* @param [
|
|
57
|
+
* @param [appearance=TagAppearance.Outlined] - `outlined` is the filled chip on the raised
|
|
58
|
+
* layer; `selectable` is the unfilled filter chip that tints and turns semibold when selected.
|
|
37
59
|
* @param [selected=false] - Applies the accent-tinted selected styling.
|
|
38
|
-
* @param [disabled=false] -
|
|
60
|
+
* @param [disabled=false] - Stops the tag responding: no click handling, no remove control. The design defines no disabled tag, so the colours stay put.
|
|
39
61
|
* @param [closable=false] - Renders the remove button. Needs `onRemove` to appear.
|
|
40
62
|
* @param [removeLabel] - Accessible name of the remove button; defaults to `Remove <label>`.
|
|
41
63
|
* @param [onRemove] - Called when the remove button is clicked. The click does not bubble to `onClick`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TagAppearance } from '../../../types/tag';
|
|
2
|
+
/**
|
|
3
|
+
* Geometry and layout shared by every tag. No transition: the design animates
|
|
4
|
+
* the hover and selected steps instantly (0ms), so the fill switches on the
|
|
5
|
+
* same frame as the pointer.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tagBaseClassName = "inline-flex h-[32px] max-w-full items-center gap-1 rounded-full px-3";
|
|
8
|
+
/**
|
|
9
|
+
* Fill and text colour per appearance and selection. No tag draws a rim: the
|
|
10
|
+
* two appearances are told apart by their fill — `outlined` sits on the raised
|
|
11
|
+
* layer, `selectable` on nothing until it is selected, where it also steps its
|
|
12
|
+
* label up from secondary to primary.
|
|
13
|
+
*/
|
|
14
|
+
export declare const tagStateClassNames: Record<TagAppearance, Record<'default' | 'selected', string>>;
|
|
15
|
+
/** Cursor and focus ring of a tag that can be activated. */
|
|
16
|
+
export declare const tagInteractiveClassName = "cursor-pointer outline-offset-0 focus-visible:outline focus-visible:outline-focus";
|
|
17
|
+
/**
|
|
18
|
+
* Hover and active step of a clickable tag — one accent tint for every
|
|
19
|
+
* appearance and both selections, as the 2.0 overlay rows do. A selected tag
|
|
20
|
+
* must not read as hovered at rest, and the label is left alone, so an
|
|
21
|
+
* unselected one never darkens into looking selected.
|
|
22
|
+
*/
|
|
23
|
+
export declare const tagHoverClassName = "hover:bg-control-accent-alpha-hover active:bg-control-accent-alpha-active";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface ThemeScopeProps {
|
|
3
|
+
/**
|
|
4
|
+
* Class name that redefines the design tokens for this subtree — typically a
|
|
5
|
+
* host-owned rule setting `--bg-*` / `--text-*` / `--stroke-*` custom
|
|
6
|
+
* properties. Multiple space-separated classes are allowed.
|
|
7
|
+
*/
|
|
8
|
+
className: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Marks a subtree as living under a host-defined token scope, so overlays this
|
|
13
|
+
* subtree opens in a portal are painted with the same tokens.
|
|
14
|
+
* Design system 2.0
|
|
15
|
+
*
|
|
16
|
+
* Redefining design tokens on a panel root re-themes everything the panel
|
|
17
|
+
* renders — until a `Dropdown`, `Popup`, `Tooltip` or `Calendar` escapes into a
|
|
18
|
+
* `FloatingPortal` at the end of `<body>`, where the scope's custom properties
|
|
19
|
+
* no longer reach it. Wrapping the panel in a `ThemeScope` re-applies the same
|
|
20
|
+
* class to those portalled overlays, so an overlay opened from a dark panel
|
|
21
|
+
* stays dark while the rest of the app keeps its own palette.
|
|
22
|
+
*
|
|
23
|
+
* The wrapper itself is `display: contents`, so it generates no box and leaves
|
|
24
|
+
* the surrounding flex or grid layout untouched — custom properties inherit
|
|
25
|
+
* through it all the same. Scopes nest: an inner scope's overlays carry the
|
|
26
|
+
* outer classes first, matching the cascade they would see in place.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // .side-panel-theme redefines --bg-*, --text-* and --stroke-* tokens.
|
|
31
|
+
* <ThemeScope className="side-panel-theme">
|
|
32
|
+
* <ConversationPanel {...props} />
|
|
33
|
+
* </ThemeScope>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param className - Class name redefining the design tokens for this subtree
|
|
37
|
+
* @param children - The subtree painted with those tokens
|
|
38
|
+
*/
|
|
39
|
+
export declare const ThemeScope: FC<ThemeScopeProps>;
|
|
40
|
+
/**
|
|
41
|
+
* Class names of the enclosing `ThemeScope`s, outermost first, or `''` when the
|
|
42
|
+
* caller sits outside any scope. Components rendering into a `FloatingPortal`
|
|
43
|
+
* merge this onto their floating root so the tokens follow them out of the
|
|
44
|
+
* subtree.
|
|
45
|
+
*/
|
|
46
|
+
export declare const useThemeScope: () => string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { IconButtonProps } from '../IconButton/IconButton';
|
|
3
|
+
import { TooltipProps } from '../Tooltip/Tooltip';
|
|
4
|
+
type ToggleTooltipProps = Omit<TooltipProps, 'children'>;
|
|
5
|
+
export interface ToggleIconButtonProps extends Omit<IconButtonProps, 'variant' | 'appearance' | 'tooltipProps' | 'onToggle'> {
|
|
6
|
+
icon: ReactNode;
|
|
7
|
+
selectedIcon?: ReactNode;
|
|
8
|
+
isSelected?: boolean;
|
|
9
|
+
onToggle?: (isSelected: boolean) => void;
|
|
10
|
+
tooltipProps?: ToggleTooltipProps;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An icon button that stays pressed, for a setting the icon itself represents.
|
|
14
|
+
* aliases: IconToggle|ToggleButton|BookmarkButton
|
|
15
|
+
* Design system 2.0
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ToggleIconButton
|
|
20
|
+
* icon={<IconBookmark />}
|
|
21
|
+
* selectedIcon={<IconBookmarkFilled />}
|
|
22
|
+
* isSelected={isBookmarked}
|
|
23
|
+
* onToggle={setIsBookmarked}
|
|
24
|
+
* tooltipProps={{ tooltip: 'Bookmark' }}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* This is a button, not a checkbox: the state rides on `aria-pressed`, so one
|
|
29
|
+
* unchanging accessible name covers both states and screen readers announce it
|
|
30
|
+
* as "pressed". Do not switch the name between them — a control that renames
|
|
31
|
+
* itself on click reads as a different control.
|
|
32
|
+
*
|
|
33
|
+
* Built on the primary ghost {@link IconButton}, which already supplies the
|
|
34
|
+
* whole unselected column of the design: a secondary-grey icon that turns
|
|
35
|
+
* accent on hover, an accent-alpha tint on hover and active, and a grey icon
|
|
36
|
+
* when disabled. Selected keeps that accent icon at rest and swaps in
|
|
37
|
+
* `selectedIcon` — usually the filled twin of `icon`.
|
|
38
|
+
*
|
|
39
|
+
* @param icon - Icon shown while unselected; rendered at 16px
|
|
40
|
+
* @param [selectedIcon] - Icon shown while selected; falls back to `icon`
|
|
41
|
+
* @param [isSelected=false] - Whether the toggle is on
|
|
42
|
+
* @param [onToggle] - Callback fired with the next value when clicked
|
|
43
|
+
* @param [size=ElementSize.Small] - Defines the size of the button
|
|
44
|
+
* @param [tooltipProps] - Props of the 2.0 {@link Tooltip} wrapping the button
|
|
45
|
+
*/
|
|
46
|
+
export declare const ToggleIconButton: FC<ToggleIconButtonProps>;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { TooltipContainerOptions } from './TooltipContext';
|
|
3
|
+
export interface TooltipProps extends TooltipContainerOptions {
|
|
4
|
+
hideTooltip?: boolean;
|
|
5
|
+
tooltip?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
triggerClassName?: string;
|
|
9
|
+
contentClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shows a short explanation next to an element while it is hovered or focused.
|
|
13
|
+
* aliases: HoverPopover|InfoPopover
|
|
14
|
+
* Design system 2.0
|
|
15
|
+
*
|
|
16
|
+
* The tooltip is placed on one of the four sides of the trigger and follows it
|
|
17
|
+
* on scroll, flipping to the opposite side when it would not fit.
|
|
18
|
+
*
|
|
19
|
+
* Tooltip text does not reach assistive technology unless the trigger itself
|
|
20
|
+
* carries it: pass `asChild` so the `aria-describedby` lands on the control
|
|
21
|
+
* rather than on a wrapper `<span>`, and never let a tooltip be the only
|
|
22
|
+
* accessible name of a control — it renders nothing on mobile screens.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Tooltip tooltip="Tooltip text" placement={TooltipPlacement.Top} asChild>
|
|
27
|
+
* <button>Hover me</button>
|
|
28
|
+
* </Tooltip>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param [tooltip] - The content to display in the tooltip
|
|
32
|
+
* @param children - The element that triggers the tooltip
|
|
33
|
+
* @param [asChild=false] - Use the child as the trigger instead of wrapping it in a `<span>`
|
|
34
|
+
* @param [hideTooltip=false] - Suppress the tooltip while keeping the trigger rendered
|
|
35
|
+
* @param [triggerClassName] - Additional CSS classes for the trigger element
|
|
36
|
+
* @param [contentClassName] - Additional CSS classes for the tooltip bubble
|
|
37
|
+
* @param [initialOpen=false] - Whether the tooltip starts open (uncontrolled only)
|
|
38
|
+
* @param [placement=TooltipPlacement.Bottom] - Side of the trigger the tooltip is placed on
|
|
39
|
+
* @param [isTriggerClickable=false] - Restrict hover handling to mouse input, ignoring touch
|
|
40
|
+
* @param [open] - Controlled open state; disables the hover and focus triggers
|
|
41
|
+
* @param [onOpenChange] - Callback fired when the open state should change
|
|
42
|
+
*/
|
|
43
|
+
export declare const Tooltip: FC<TooltipProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { TooltipContainerOptions } from './TooltipContext';
|
|
3
|
+
interface Props {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Provides tooltip positioning and open state to a trigger and a content pair.
|
|
8
|
+
* aliases: TooltipProvider|TooltipRoot
|
|
9
|
+
* Design system 2.0
|
|
10
|
+
*
|
|
11
|
+
* Use it directly only when the trigger and the content cannot be rendered by
|
|
12
|
+
* `Tooltip` itself — for example when the content needs custom markup.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <TooltipContainer placement={TooltipPlacement.Top}>
|
|
17
|
+
* <TooltipTrigger asChild>
|
|
18
|
+
* <button>Hover me</button>
|
|
19
|
+
* </TooltipTrigger>
|
|
20
|
+
* <TooltipContent>Tooltip text</TooltipContent>
|
|
21
|
+
* </TooltipContainer>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param children - The tooltip trigger and content components
|
|
25
|
+
* @param [initialOpen=false] - Whether the tooltip starts open (uncontrolled only)
|
|
26
|
+
* @param [placement=TooltipPlacement.Bottom] - Side of the trigger the tooltip is placed on
|
|
27
|
+
* @param [isTriggerClickable=false] - Restrict hover handling to mouse input, ignoring touch
|
|
28
|
+
* @param [open] - Controlled open state; disables the hover and focus triggers
|
|
29
|
+
* @param [onOpenChange] - Callback fired when the open state should change
|
|
30
|
+
*/
|
|
31
|
+
export declare const TooltipContainer: FC<Props & TooltipContainerOptions>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties, FC, HTMLProps } from 'react';
|
|
2
|
+
export interface TooltipContentProps extends HTMLProps<HTMLDivElement> {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The floating bubble that carries the tooltip text.
|
|
7
|
+
* Design system 2.0
|
|
8
|
+
*
|
|
9
|
+
* Rendered in a portal, above popups and dropdowns, with an arrow pointing back
|
|
10
|
+
* at the trigger. Renders nothing on a mobile screen, where there is no hover
|
|
11
|
+
* to reveal it — so a control must never depend on a tooltip alone to be
|
|
12
|
+
* understood, or to have an accessible name.
|
|
13
|
+
*
|
|
14
|
+
* @param children - The content to display inside the tooltip
|
|
15
|
+
* @param [className] - Additional CSS classes applied to the tooltip bubble
|
|
16
|
+
* @param [style] - Additional inline styles for the tooltip bubble
|
|
17
|
+
*/
|
|
18
|
+
export declare const TooltipContent: FC<TooltipContentProps>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { TooltipPlacement } from '../../../types/tooltip';
|
|
2
|
+
type ContextType = ReturnType<typeof useTooltip> | null;
|
|
3
|
+
export declare const TooltipContext: import('react').Context<ContextType>;
|
|
4
|
+
export interface TooltipContainerOptions {
|
|
5
|
+
initialOpen?: boolean;
|
|
6
|
+
placement?: TooltipPlacement;
|
|
7
|
+
isTriggerClickable?: boolean;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const useTooltipContext: () => {
|
|
12
|
+
placement: import('@floating-ui/utils').Placement;
|
|
13
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
14
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
isPositioned: boolean;
|
|
18
|
+
update: () => void;
|
|
19
|
+
floatingStyles: React.CSSProperties;
|
|
20
|
+
refs: {
|
|
21
|
+
reference: import('react').MutableRefObject<import('@floating-ui/react-dom').ReferenceType | null>;
|
|
22
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
23
|
+
setReference: (node: import('@floating-ui/react-dom').ReferenceType | null) => void;
|
|
24
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
25
|
+
} & import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
26
|
+
elements: {
|
|
27
|
+
reference: import('@floating-ui/react-dom').ReferenceType | null;
|
|
28
|
+
floating: HTMLElement | null;
|
|
29
|
+
} & import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
30
|
+
context: {
|
|
31
|
+
placement: import('@floating-ui/utils').Placement;
|
|
32
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
36
|
+
isPositioned: boolean;
|
|
37
|
+
update: () => void;
|
|
38
|
+
floatingStyles: React.CSSProperties;
|
|
39
|
+
open: boolean;
|
|
40
|
+
onOpenChange: (open: boolean, event?: Event, reason?: import('@floating-ui/react').OpenChangeReason) => void;
|
|
41
|
+
events: import('@floating-ui/react').FloatingEvents;
|
|
42
|
+
dataRef: React.MutableRefObject<import('@floating-ui/react').ContextData>;
|
|
43
|
+
nodeId: string | undefined;
|
|
44
|
+
floatingId: string | undefined;
|
|
45
|
+
refs: import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
46
|
+
elements: import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
47
|
+
};
|
|
48
|
+
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
49
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
50
|
+
getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
|
|
51
|
+
active?: boolean;
|
|
52
|
+
selected?: boolean;
|
|
53
|
+
}) => Record<string, unknown>;
|
|
54
|
+
open: boolean;
|
|
55
|
+
setOpen: (open: boolean) => void;
|
|
56
|
+
arrowRef: import('react').RefObject<SVGSVGElement | null>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Positioning and interaction state shared by the tooltip trigger and content.
|
|
60
|
+
* Design system 2.0
|
|
61
|
+
*
|
|
62
|
+
* @param [initialOpen=false] - Whether the tooltip starts open (uncontrolled only)
|
|
63
|
+
* @param [placement=TooltipPlacement.Bottom] - Side of the trigger the tooltip is placed on
|
|
64
|
+
* @param [isTriggerClickable=false] - Restrict hover handling to mouse input, ignoring touch
|
|
65
|
+
* @param [open] - Controlled open state; disables the hover and focus triggers
|
|
66
|
+
* @param [onOpenChange] - Callback fired when the open state should change
|
|
67
|
+
*/
|
|
68
|
+
export declare const useTooltip: ({ initialOpen, placement, isTriggerClickable, open: controlledOpen, onOpenChange: setControlledOpen, }?: TooltipContainerOptions) => {
|
|
69
|
+
placement: import('@floating-ui/utils').Placement;
|
|
70
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
71
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
isPositioned: boolean;
|
|
75
|
+
update: () => void;
|
|
76
|
+
floatingStyles: React.CSSProperties;
|
|
77
|
+
refs: {
|
|
78
|
+
reference: import('react').MutableRefObject<import('@floating-ui/react-dom').ReferenceType | null>;
|
|
79
|
+
floating: React.MutableRefObject<HTMLElement | null>;
|
|
80
|
+
setReference: (node: import('@floating-ui/react-dom').ReferenceType | null) => void;
|
|
81
|
+
setFloating: (node: HTMLElement | null) => void;
|
|
82
|
+
} & import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
83
|
+
elements: {
|
|
84
|
+
reference: import('@floating-ui/react-dom').ReferenceType | null;
|
|
85
|
+
floating: HTMLElement | null;
|
|
86
|
+
} & import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
87
|
+
context: {
|
|
88
|
+
placement: import('@floating-ui/utils').Placement;
|
|
89
|
+
strategy: import('@floating-ui/utils').Strategy;
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
middlewareData: import('@floating-ui/core').MiddlewareData;
|
|
93
|
+
isPositioned: boolean;
|
|
94
|
+
update: () => void;
|
|
95
|
+
floatingStyles: React.CSSProperties;
|
|
96
|
+
open: boolean;
|
|
97
|
+
onOpenChange: (open: boolean, event?: Event, reason?: import('@floating-ui/react').OpenChangeReason) => void;
|
|
98
|
+
events: import('@floating-ui/react').FloatingEvents;
|
|
99
|
+
dataRef: React.MutableRefObject<import('@floating-ui/react').ContextData>;
|
|
100
|
+
nodeId: string | undefined;
|
|
101
|
+
floatingId: string | undefined;
|
|
102
|
+
refs: import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
103
|
+
elements: import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
104
|
+
};
|
|
105
|
+
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
|
|
106
|
+
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
|
|
107
|
+
getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
|
|
108
|
+
active?: boolean;
|
|
109
|
+
selected?: boolean;
|
|
110
|
+
}) => Record<string, unknown>;
|
|
111
|
+
open: boolean;
|
|
112
|
+
setOpen: (open: boolean) => void;
|
|
113
|
+
arrowRef: import('react').RefObject<SVGSVGElement | null>;
|
|
114
|
+
};
|
|
115
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, HTMLProps } from 'react';
|
|
2
|
+
interface TooltipTriggerProps extends HTMLProps<HTMLElement> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The element a tooltip is anchored to and opened from.
|
|
7
|
+
* Design system 2.0
|
|
8
|
+
*
|
|
9
|
+
* Prefer `asChild` whenever the trigger is a single element: it puts the
|
|
10
|
+
* `aria-describedby` that names the tooltip on the control itself instead of on
|
|
11
|
+
* a wrapper `<span>`, which is the only way the tooltip text reaches assistive
|
|
12
|
+
* technology.
|
|
13
|
+
*
|
|
14
|
+
* @param children - The element that opens the tooltip
|
|
15
|
+
* @param [asChild=false] - Render the child as the trigger instead of wrapping it in a `<span>`
|
|
16
|
+
*/
|
|
17
|
+
export declare const TooltipTrigger: FC<TooltipTriggerProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip layout and styling constants.
|
|
3
|
+
* Design system 2.0
|
|
4
|
+
*/
|
|
5
|
+
/** Height of the `FloatingArrow` triangle, in px — its default `height`. */
|
|
6
|
+
export declare const ARROW_HEIGHT = 7;
|
|
7
|
+
/** Space left between the arrow tip and the trigger, in px. */
|
|
8
|
+
export declare const ARROW_GAP = 2;
|
|
9
|
+
/**
|
|
10
|
+
* Delay before an on-hover tooltip opens, in ms. Long enough that a pointer
|
|
11
|
+
* crossing the trigger on its way somewhere else does not flash a tooltip.
|
|
12
|
+
*/
|
|
13
|
+
export declare const HOVER_OPEN_DELAY = 500;
|
|
14
|
+
/**
|
|
15
|
+
* The arrow is an SVG outside the tooltip box, so it cannot inherit the box's
|
|
16
|
+
* background — keep this in sync with `bg-control-inverted` in
|
|
17
|
+
* `tooltipClassName`. A CSS fill beats the `fill` presentation attribute
|
|
18
|
+
* `FloatingArrow` puts on the `<svg>`, and the filled `<path>` inherits it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const arrowClassName = "fill-control-inverted";
|
|
21
|
+
/**
|
|
22
|
+
* Tooltips sit above popups, dropdowns and the calendar (all `z-[53]`), since
|
|
23
|
+
* they can be triggered by a control inside one of them.
|
|
24
|
+
*
|
|
25
|
+
* `max-w-[376px]` is the cap the design puts on a tooltip: at `dial-small-text`
|
|
26
|
+
* that is around 60 characters a line, past which a line stops being
|
|
27
|
+
* comfortable to read. Longer text wraps instead of widening the bubble. The
|
|
28
|
+
* width stays a literal because Tailwind only sees static class strings.
|
|
29
|
+
*/
|
|
30
|
+
export declare const tooltipClassName = "z-[55] max-w-[376px] whitespace-pre-wrap break-words rounded-lg bg-control-inverted px-3 py-2 dial-small-text text-control-inverted";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon stroke (1.5px) from the 2.0 stroke scale. Tabler renders every outline
|
|
3
|
+
* icon at `stroke={2}` unless told otherwise, so the token has to be passed
|
|
4
|
+
* explicitly — a 2.0 component that omits it draws a heavier icon than the
|
|
5
|
+
* design system asks for.
|
|
6
|
+
*
|
|
7
|
+
* It is a number rather than a Tailwind utility because an icon's weight is an
|
|
8
|
+
* SVG `stroke-width` attribute on the glyph, not a border on its box. The
|
|
9
|
+
* border half of the same scale stays on plain Tailwind widths — `border`,
|
|
10
|
+
* `border-2`, `border-4`, and `border-[0.5px]` for a table divider.
|
|
11
|
+
*
|
|
12
|
+
* Exported publicly so icons a consumer passes into a 2.0 component — a button
|
|
13
|
+
* icon, a menu item, a segmented-control segment — can match the ones the
|
|
14
|
+
* components draw themselves.
|
|
15
|
+
*
|
|
16
|
+
* Two deliberate departures inside the library: the empty-state illustrations
|
|
17
|
+
* (`NoDataContent`, the grid's no-rows overlay) use a much lighter stroke,
|
|
18
|
+
* since a 1.5px line reads as a drawing at 16px and as a fence at 100px; and
|
|
19
|
+
* the checkbox glyph uses a heavier one, because it is a control mark sized to
|
|
20
|
+
* a 14px box rather than an icon from the set.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DIAL_KIT_ICON_STROKE = 1.5;
|
|
@@ -17,8 +17,17 @@ export declare const overlaySubMenuClassName: string;
|
|
|
17
17
|
* reached by keyboard, and the 1.0 versions suppressed the ring outright.
|
|
18
18
|
*/
|
|
19
19
|
export declare const overlayItemClassName: string;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Tint marking the row that is currently selected, at rest: the faint step of
|
|
22
|
+
* the accent-alpha ramp, so hovering a selected row still has somewhere to go.
|
|
23
|
+
*/
|
|
24
|
+
export declare const overlayItemSelectedClassName = "bg-control-accent-alpha";
|
|
25
|
+
/**
|
|
26
|
+
* A row that cannot be chosen. `overlayItemClassName` tints every row on hover
|
|
27
|
+
* and a selected row carries a tint at rest, so both have to be turned off
|
|
28
|
+
* again here — `mergeClasses` is tailwind-merge, so these later declarations
|
|
29
|
+
* win as long as the disabled classes are merged after the selected ones.
|
|
30
|
+
*/
|
|
31
|
+
export declare const overlayItemDisabledClassName: string;
|
|
23
32
|
/** Distance between the trigger and its panel, and between nested panels. */
|
|
24
33
|
export declare const overlayGap = 4;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export { Notification } from './components/New/Notification/Notification';
|
|
|
150
150
|
export { Highlight } from './components/New/Highlight/Highlight';
|
|
151
151
|
export { CardShell } from './components/New/CardShell/CardShell';
|
|
152
152
|
export type { CardShellProps } from './components/New/CardShell/CardShell';
|
|
153
|
-
export { ErrorMessageNotification, ErrorToastNotification, InfoMessageNotification, InfoToastNotification, LoadingMessageNotification, LoadingToastNotification, SuccessMessageNotification, SuccessToastNotification, WarningMessageNotification, WarningToastNotification, } from './components/New/Notification/NotificationWrapper';
|
|
153
|
+
export { ErrorMessageNotification, ErrorToastNotification, GeneralMessageNotification, GeneralToastNotification, InfoMessageNotification, InfoToastNotification, LoadingMessageNotification, LoadingToastNotification, SuccessMessageNotification, SuccessToastNotification, WarningMessageNotification, WarningToastNotification, } from './components/New/Notification/NotificationWrapper';
|
|
154
154
|
export { CalendarMode } from './types/calendar.ts';
|
|
155
155
|
export { Calendar } from './components/New/Calendar/Calendar';
|
|
156
156
|
export type { CalendarProps, CalendarValue, } from './components/New/Calendar/Calendar';
|
|
@@ -193,6 +193,8 @@ export { ConfirmationPopup } from './components/New/ConfirmationPopup/Confirmati
|
|
|
193
193
|
export type { ConfirmationPopupProps } from './components/New/ConfirmationPopup/ConfirmationPopup';
|
|
194
194
|
export { Dropdown } from './components/New/Dropdown/Dropdown';
|
|
195
195
|
export type { DropdownProps } from './components/New/Dropdown/Dropdown';
|
|
196
|
+
export { ThemeScope, useThemeScope, } from './components/New/ThemeScope/ThemeScope';
|
|
197
|
+
export type { ThemeScopeProps } from './components/New/ThemeScope/ThemeScope';
|
|
196
198
|
export type { TextareaProps } from './components/New/Textarea/Textarea';
|
|
197
199
|
export type { CaptionTextProps } from './components/New/CaptionText/CaptionText';
|
|
198
200
|
export { CaptionText, ErrorText, } from './components/New/CaptionText/CaptionText';
|
|
@@ -200,14 +202,58 @@ export { Accordion } from './components/New/Accordion/Accordion';
|
|
|
200
202
|
export type { AccordionProps } from './components/New/Accordion/Accordion';
|
|
201
203
|
export { Switch } from './components/New/Switch/Switch';
|
|
202
204
|
export type { SwitchProps } from './components/New/Switch/Switch';
|
|
205
|
+
export { Radio } from './components/New/Radio/Radio';
|
|
206
|
+
export type { RadioProps } from './components/New/Radio/Radio';
|
|
207
|
+
export { RadioGroup } from './components/New/RadioGroup/RadioGroup';
|
|
208
|
+
export type { RadioGroupProps, RadioGroupItem, } from './components/New/RadioGroup/RadioGroup';
|
|
209
|
+
export { RadioGroupPopupField } from './components/New/RadioGroupPopupField/RadioGroupPopupField';
|
|
210
|
+
export type { RadioGroupPopupFieldProps } from './components/New/RadioGroupPopupField/RadioGroupPopupField';
|
|
211
|
+
export { Checkbox } from './components/New/Checkbox/Checkbox';
|
|
212
|
+
export type { CheckboxProps } from './components/New/Checkbox/Checkbox';
|
|
213
|
+
export { CheckboxBox } from './components/New/Checkbox/CheckboxBox';
|
|
214
|
+
export type { CheckboxBoxProps } from './components/New/Checkbox/CheckboxBox';
|
|
215
|
+
export { ToggleIconButton } from './components/New/ToggleIconButton/ToggleIconButton';
|
|
216
|
+
export type { ToggleIconButtonProps } from './components/New/ToggleIconButton/ToggleIconButton';
|
|
217
|
+
export { SegmentedControl } from './components/New/SegmentedControl/SegmentedControl';
|
|
218
|
+
export type { SegmentedControlProps, SegmentedControlItem, } from './components/New/SegmentedControl/SegmentedControl';
|
|
203
219
|
export { Tabs } from './components/New/Tabs/Tabs';
|
|
204
220
|
export type { TabsProps, TabItem } from './components/New/Tabs/Tabs';
|
|
205
221
|
export { FileDropzone } from './components/New/FileDropzone/FileDropzone';
|
|
206
222
|
export type { FileDropzoneProps } from './components/New/FileDropzone/FileDropzone';
|
|
207
223
|
export { Tag } from './components/New/Tag/Tag';
|
|
208
224
|
export type { TagProps } from './components/New/Tag/Tag';
|
|
225
|
+
export { TagAppearance } from './types/tag';
|
|
209
226
|
export { TagInput } from './components/New/TagInput/TagInput';
|
|
210
227
|
export type { TagInputProps } from './components/New/TagInput/TagInput';
|
|
211
228
|
export { Search } from './components/New/Search/Search';
|
|
212
229
|
export type { SearchProps } from './components/New/Search/Search';
|
|
213
230
|
export { matchesAccept } from './utils/file-accept';
|
|
231
|
+
export { Slider } from './components/New/Slider/Slider';
|
|
232
|
+
export type { SliderProps } from './components/New/Slider/Slider';
|
|
233
|
+
export { Tooltip } from './components/New/Tooltip/Tooltip';
|
|
234
|
+
export type { TooltipProps } from './components/New/Tooltip/Tooltip';
|
|
235
|
+
export { TooltipContainer } from './components/New/Tooltip/TooltipContainer';
|
|
236
|
+
export { TooltipContent } from './components/New/Tooltip/TooltipContent';
|
|
237
|
+
export type { TooltipContentProps } from './components/New/Tooltip/TooltipContent';
|
|
238
|
+
export { TooltipTrigger } from './components/New/Tooltip/TooltipTrigger';
|
|
239
|
+
export type { TooltipContainerOptions } from './components/New/Tooltip/TooltipContext';
|
|
240
|
+
export { TooltipPlacement } from './types/tooltip.ts';
|
|
241
|
+
export { EllipsisTooltip } from './components/New/EllipsisTooltip/EllipsisTooltip';
|
|
242
|
+
export type { EllipsisTooltipProps } from './components/New/EllipsisTooltip/EllipsisTooltip';
|
|
243
|
+
export { CollapsibleSidebar } from './components/New/CollapsibleSidebar/CollapsibleSidebar';
|
|
244
|
+
export type { CollapsibleSidebarProps } from './components/New/CollapsibleSidebar/CollapsibleSidebar';
|
|
245
|
+
export { ResizableContainer } from './components/New/ResizableContainer/ResizableContainer';
|
|
246
|
+
export type { ResizableContainerProps } from './components/New/ResizableContainer/ResizableContainer';
|
|
247
|
+
export { ConditionalResizableContainer } from './components/New/ResizableContainer/ConditionalResizableContainer';
|
|
248
|
+
export type { ConditionalResizableContainerProps } from './components/New/ResizableContainer/ConditionalResizableContainer';
|
|
249
|
+
export { NoDataContent } from './components/New/NoDataContent/NoDataContent';
|
|
250
|
+
export type { NoDataContentProps } from './components/New/NoDataContent/NoDataContent';
|
|
251
|
+
export { Grid, GRID_SELECTION_COLUMN_ID } from './components/New/Grid/Grid';
|
|
252
|
+
export type { GridProps } from './components/New/Grid/Grid';
|
|
253
|
+
export { DateCellRenderer } from './components/New/Grid/renderers/DateCellRenderer';
|
|
254
|
+
export type { DateCellRendererProps, DateValue, } from './components/New/Grid/renderers/DateCellRenderer';
|
|
255
|
+
export { DEFAULT_DATE_FORMAT_OPTIONS, DEFAULT_LOCALE as DEFAULT_DATE_LOCALE, } from './components/New/Grid/renderers/constants';
|
|
256
|
+
export { GRID_ALIGN_RIGHT_CLASS, GRID_ROOT_CLASS, GRID_THEME_PARAMS, ROW_HEIGHT as GRID_ROW_HEIGHT, } from './components/New/Grid/constants';
|
|
257
|
+
export { DIAL_KIT_ICON_STROKE } from './components/New/constants/icon';
|
|
258
|
+
export { convertToDate } from './utils/grid-date';
|
|
259
|
+
export { baseColumnComparator, checkColDefsChanges, } from './utils/grid-comparators';
|
|
@@ -15,6 +15,16 @@ export interface DropdownItem {
|
|
|
15
15
|
icon?: ReactNode;
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
danger?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Renders the item as a multiselect row: a checkbox box before the label, the
|
|
20
|
+
* accent tint while checked, and a click that leaves the menu open. The row is
|
|
21
|
+
* a `menuitemcheckbox` whose state lives on `aria-checked`; the box itself is
|
|
22
|
+
* decorative. Keep `checked` in your own state and update it from the item's
|
|
23
|
+
* `onClick` (or the dropdown's `onItemClick`).
|
|
24
|
+
*/
|
|
25
|
+
selectable?: boolean;
|
|
26
|
+
/** Whether a `selectable` item is currently checked. */
|
|
27
|
+
checked?: boolean;
|
|
18
28
|
type?: DropdownItemType;
|
|
19
29
|
className?: string;
|
|
20
30
|
onClick?: (info: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type SizeCallback = () => void;
|
|
2
|
+
/**
|
|
3
|
+
* Queues a measurement for the next animation frame, coalescing it with every
|
|
4
|
+
* other measurement queued for that frame.
|
|
5
|
+
*
|
|
6
|
+
* Passing the same callback twice before the frame runs schedules it once.
|
|
7
|
+
*
|
|
8
|
+
* @param callback - Reads layout and stores the result; must be referentially stable
|
|
9
|
+
*/
|
|
10
|
+
export declare const scheduleMeasure: (callback: SizeCallback) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Watches an element's box for size changes and calls back — batched through
|
|
13
|
+
* {@link scheduleMeasure} — whenever it may need re-measuring.
|
|
14
|
+
*
|
|
15
|
+
* A parent can resize without the window doing so, which is what the
|
|
16
|
+
* `ResizeObserver` covers; the `window.resize` listener stays for environments
|
|
17
|
+
* that have no `ResizeObserver`.
|
|
18
|
+
*
|
|
19
|
+
* One callback per element: observing the same element again replaces it.
|
|
20
|
+
*
|
|
21
|
+
* @param element - The element to watch
|
|
22
|
+
* @param callback - Runs when the element may have changed size; must be referentially stable
|
|
23
|
+
* @returns Unsubscribes the element, tearing the shared observer down once nothing is left to watch
|
|
24
|
+
*/
|
|
25
|
+
export declare const observeElementSize: (element: Element, callback: SizeCallback) => () => void;
|
|
26
|
+
export {};
|