@bitrise/bitkit-v2 0.3.462-beta.2927 → 0.3.463
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/AGENTS.md +1 -1
- package/dist/components/BitkitCombobox/BitkitCombobox.d.ts +3 -3
- package/dist/components/BitkitCombobox/BitkitCombobox.js +2 -6
- package/dist/components/BitkitCombobox/BitkitCombobox.js.map +1 -1
- package/dist/components/BitkitDefinitionTooltip/BitkitDefinitionTooltip.d.ts +12 -12
- package/dist/components/BitkitDefinitionTooltip/BitkitDefinitionTooltip.js +20 -22
- package/dist/components/BitkitDefinitionTooltip/BitkitDefinitionTooltip.js.map +1 -1
- package/dist/components/BitkitLabeledData/BitkitLabeledData.d.ts +3 -3
- package/dist/components/BitkitLabeledData/BitkitLabeledData.js +11 -2
- package/dist/components/BitkitLabeledData/BitkitLabeledData.js.map +1 -1
- package/dist/components/BitkitMultiselect/BitkitMultiselect.d.ts +3 -3
- package/dist/components/BitkitMultiselect/BitkitMultiselect.js +1 -4
- package/dist/components/BitkitMultiselect/BitkitMultiselect.js.map +1 -1
- package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.d.ts +3 -3
- package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.js.map +1 -1
- package/dist/components/BitkitSelect/BitkitSelect.d.ts +3 -3
- package/dist/components/BitkitSelect/BitkitSelect.js +1 -4
- package/dist/components/BitkitSelect/BitkitSelect.js.map +1 -1
- package/dist/components/BitkitSelectMenu/BitkitSelectMenu.d.ts +2 -7
- package/dist/components/BitkitSelectMenu/BitkitSelectMenu.js.map +1 -1
- package/dist/components/BitkitSelectMenu/SelectMenuShell.d.ts +3 -3
- package/dist/components/BitkitSelectMenu/SelectMenuShell.js +4 -22
- package/dist/components/BitkitSelectMenu/SelectMenuShell.js.map +1 -1
- package/dist/components/BitkitTable/BitkitDefinitionColumnHeader.d.ts +1 -1
- package/dist/components/BitkitTable/BitkitDefinitionColumnHeader.js +16 -19
- package/dist/components/BitkitTable/BitkitDefinitionColumnHeader.js.map +1 -1
- package/dist/components/BitkitToggletip/BitkitToggletip.d.ts +59 -0
- package/dist/components/BitkitToggletip/BitkitToggletip.js +107 -0
- package/dist/components/BitkitToggletip/BitkitToggletip.js.map +1 -0
- package/dist/components/BitkitTooltip/BitkitTooltip.d.ts +7 -23
- package/dist/components/BitkitTooltip/BitkitTooltip.js +14 -45
- package/dist/components/BitkitTooltip/BitkitTooltip.js.map +1 -1
- package/dist/components/BitkitTreeView/BitkitTreeView.js +4 -1
- package/dist/components/BitkitTreeView/BitkitTreeView.js.map +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/main.js +2 -4
- package/dist/theme/common/TooltipAndToggletip.common.d.ts +90 -0
- package/dist/theme/common/TooltipAndToggletip.common.js +72 -0
- package/dist/theme/common/TooltipAndToggletip.common.js.map +1 -0
- package/dist/theme/slot-recipes/DatePickerSelect.recipe.d.ts +2 -14
- package/dist/theme/slot-recipes/Select.recipe.d.ts +5 -23
- package/dist/theme/slot-recipes/Select.recipe.js +3 -37
- package/dist/theme/slot-recipes/Select.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/Toggletip.recipe.d.ts +60 -0
- package/dist/theme/slot-recipes/Toggletip.recipe.js +31 -0
- package/dist/theme/slot-recipes/Toggletip.recipe.js.map +1 -0
- package/dist/theme/slot-recipes/Tooltip.recipe.d.ts +34 -34
- package/dist/theme/slot-recipes/Tooltip.recipe.js +4 -61
- package/dist/theme/slot-recipes/Tooltip.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/TreeView.recipe.js +9 -6
- package/dist/theme/slot-recipes/TreeView.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/index.d.ts +96 -184
- package/dist/theme/slot-recipes/index.js +3 -3
- package/dist/theme/slot-recipes/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/BitkitUISideNav/BitkitUISideNav.d.ts +0 -37
- package/dist/components/BitkitUISideNav/BitkitUISideNav.js +0 -167
- package/dist/components/BitkitUISideNav/BitkitUISideNav.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavBody.d.ts +0 -7
- package/dist/components/BitkitUISideNav/UISideNavBody.js +0 -20
- package/dist/components/BitkitUISideNav/UISideNavBody.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavContext.d.ts +0 -32
- package/dist/components/BitkitUISideNav/UISideNavContext.js +0 -28
- package/dist/components/BitkitUISideNav/UISideNavContext.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavFooter.d.ts +0 -16
- package/dist/components/BitkitUISideNav/UISideNavFooter.js +0 -28
- package/dist/components/BitkitUISideNav/UISideNavFooter.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.d.ts +0 -12
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js +0 -26
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavItem.d.ts +0 -26
- package/dist/components/BitkitUISideNav/UISideNavItem.js +0 -33
- package/dist/components/BitkitUISideNav/UISideNavItem.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavLink.d.ts +0 -30
- package/dist/components/BitkitUISideNav/UISideNavLink.js +0 -58
- package/dist/components/BitkitUISideNav/UISideNavLink.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.d.ts +0 -45
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js +0 -119
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js.map +0 -1
- package/dist/theme/slot-recipes/UISideNav.recipe.d.ts +0 -119
- package/dist/theme/slot-recipes/UISideNav.recipe.js +0 -416
- package/dist/theme/slot-recipes/UISideNav.recipe.js.map +0 -1
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { TooltipRootProps } from '@chakra-ui/react/tooltip';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { BitkitIconComponent } from '../../icons';
|
|
4
|
-
import { BitkitColorButtonProps } from '../BitkitColorButton/BitkitColorButton';
|
|
5
4
|
export type BitkitTooltipProps = {
|
|
6
|
-
/**
|
|
7
|
-
* Action button rendered at the end of the tooltip. Setting it makes the tooltip interactive, so
|
|
8
|
-
* the pointer can move into the tooltip without dismissing it. Defaults to the `white` colour
|
|
9
|
-
* variant, the one that reads on the tooltip's dark background.
|
|
10
|
-
*/
|
|
11
|
-
button?: BitkitColorButtonProps;
|
|
12
5
|
/**
|
|
13
6
|
* The trigger the tooltip is anchored to. Rendered via `asChild`, so it must accept a ref —
|
|
14
7
|
* unless `wrapTrigger` puts a wrapper in between.
|
|
@@ -28,13 +21,6 @@ export type BitkitTooltipProps = {
|
|
|
28
21
|
* `IconArrowNortheast` when the trigger opens something in a new tab, for instance.
|
|
29
22
|
*/
|
|
30
23
|
icon?: BitkitIconComponent;
|
|
31
|
-
/** Target for the "Learn more" link. `_blank` also sets `rel="noopener noreferrer"`. */
|
|
32
|
-
learnMoreTarget?: HTMLAnchorElement['target'];
|
|
33
|
-
/**
|
|
34
|
-
* Adds a "Learn more" link pointing here. Setting it makes the tooltip interactive, so the
|
|
35
|
-
* pointer can move into the tooltip to reach the link.
|
|
36
|
-
*/
|
|
37
|
-
learnMoreUrl?: string;
|
|
38
24
|
/** Called when the tooltip opens or closes, including from hover and focus. */
|
|
39
25
|
onOpenChange?: TooltipRootProps['onOpenChange'];
|
|
40
26
|
/** Controlled open state. Leave unset to let hover and focus drive it. */
|
|
@@ -43,7 +29,7 @@ export type BitkitTooltipProps = {
|
|
|
43
29
|
openDelay?: TooltipRootProps['openDelay'];
|
|
44
30
|
/** Where the tooltip sits relative to the trigger (default `top`). It flips if space is short. */
|
|
45
31
|
placement?: NonNullable<TooltipRootProps['positioning']>['placement'];
|
|
46
|
-
/** The tooltip's text. Plain string only — use `icon
|
|
32
|
+
/** The tooltip's text. Plain string only — use `icon` for a glyph after it. */
|
|
47
33
|
text: string;
|
|
48
34
|
/**
|
|
49
35
|
* Render the trigger inside a focusable wrapper instead of on the trigger itself. Only for triggers
|
|
@@ -66,19 +52,17 @@ export type BitkitTooltipProps = {
|
|
|
66
52
|
wrapTrigger?: boolean;
|
|
67
53
|
};
|
|
68
54
|
/**
|
|
69
|
-
* A hover/focus tooltip anchored to its child
|
|
70
|
-
* after it
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* open while the pointer travels into it, so the link and the button can actually be reached.
|
|
55
|
+
* A hover/focus tooltip anchored to its child: `text` carries the message and `icon` appends a
|
|
56
|
+
* glyph after it. Text only — a tooltip closes when focus leaves its trigger and ignores touch, so a
|
|
57
|
+
* link or a button inside one couldn't be reached. For those use `BitkitToggletip`, which looks the
|
|
58
|
+
* same and opens on click.
|
|
74
59
|
*
|
|
75
60
|
* The content renders in a portal, so it escapes any ancestor that traps stacking (`isolation`,
|
|
76
61
|
* `transform`, a `z-index`ed positioned box) or clips overflow. Dialogs turn that off through
|
|
77
|
-
* `BitkitPortalContext`
|
|
78
|
-
* the manual override.
|
|
62
|
+
* `BitkitPortalContext`; `disablePortal` is the manual override.
|
|
79
63
|
*/
|
|
80
64
|
declare const BitkitTooltip: {
|
|
81
|
-
({
|
|
65
|
+
({ children, closeOnClick, disablePortal, disabled, icon: Icon, onOpenChange, open, openDelay, placement, text, wrapTrigger, }: BitkitTooltipProps): import('react').JSX.Element;
|
|
82
66
|
displayName: string;
|
|
83
67
|
};
|
|
84
68
|
export default BitkitTooltip;
|
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
import BitkitPortalContext from "../../utilities/BitkitPortalContext.js";
|
|
2
|
-
import { rem } from "../../theme/themeUtils.js";
|
|
3
|
-
import BitkitColorButton from "../BitkitColorButton/BitkitColorButton.js";
|
|
4
2
|
import { Box } from "@chakra-ui/react/box";
|
|
5
3
|
import { isValidElement, useContext, useRef } from "react";
|
|
6
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
5
|
import { Portal } from "@chakra-ui/react/portal";
|
|
8
6
|
import { Tooltip } from "@chakra-ui/react/tooltip";
|
|
9
|
-
import { Link } from "@chakra-ui/react/link";
|
|
10
7
|
//#region lib/components/BitkitTooltip/BitkitTooltip.tsx
|
|
11
8
|
/**
|
|
12
|
-
* A hover/focus tooltip anchored to its child
|
|
13
|
-
* after it
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* open while the pointer travels into it, so the link and the button can actually be reached.
|
|
9
|
+
* A hover/focus tooltip anchored to its child: `text` carries the message and `icon` appends a
|
|
10
|
+
* glyph after it. Text only — a tooltip closes when focus leaves its trigger and ignores touch, so a
|
|
11
|
+
* link or a button inside one couldn't be reached. For those use `BitkitToggletip`, which looks the
|
|
12
|
+
* same and opens on click.
|
|
17
13
|
*
|
|
18
14
|
* The content renders in a portal, so it escapes any ancestor that traps stacking (`isolation`,
|
|
19
15
|
* `transform`, a `z-index`ed positioned box) or clips overflow. Dialogs turn that off through
|
|
20
|
-
* `BitkitPortalContext`
|
|
21
|
-
* the manual override.
|
|
16
|
+
* `BitkitPortalContext`; `disablePortal` is the manual override.
|
|
22
17
|
*/
|
|
23
|
-
var BitkitTooltip = ({
|
|
18
|
+
var BitkitTooltip = ({ children, closeOnClick, disablePortal, disabled, icon: Icon, onOpenChange, open, openDelay, placement = "top", text, wrapTrigger }) => {
|
|
24
19
|
const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);
|
|
25
|
-
const isInteractive = !!learnMoreUrl || !!button;
|
|
26
20
|
const triggerRef = useRef(null);
|
|
27
21
|
return /* @__PURE__ */ jsxs(Tooltip.Root, {
|
|
28
22
|
closeOnClick,
|
|
29
23
|
disabled,
|
|
30
|
-
interactive: isInteractive || void 0,
|
|
31
24
|
onOpenChange,
|
|
32
25
|
open,
|
|
33
26
|
openDelay,
|
|
34
|
-
paddingSize: isInteractive ? "lg" : void 0,
|
|
35
27
|
positioning: {
|
|
36
28
|
getAnchorElement: () => triggerRef.current,
|
|
37
29
|
placement,
|
|
@@ -60,37 +52,14 @@ var BitkitTooltip = ({ button, children, closeOnClick, disablePortal, disabled,
|
|
|
60
52
|
}) : children
|
|
61
53
|
}), /* @__PURE__ */ jsx(Portal, {
|
|
62
54
|
disabled: disablePortal || disablePortalFromContext,
|
|
63
|
-
children: /* @__PURE__ */ jsx(Tooltip.Positioner, { children: /* @__PURE__ */ jsxs(Tooltip.Content, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
flexShrink: "0",
|
|
72
|
-
size: "16"
|
|
73
|
-
})]
|
|
74
|
-
}),
|
|
75
|
-
isInteractive && /* @__PURE__ */ jsxs(Box, {
|
|
76
|
-
alignItems: "center",
|
|
77
|
-
display: "flex",
|
|
78
|
-
gap: "16",
|
|
79
|
-
marginBlockStart: "16",
|
|
80
|
-
children: [learnMoreUrl && /* @__PURE__ */ jsx(Link, {
|
|
81
|
-
color: "color/purple/highlight",
|
|
82
|
-
href: learnMoreUrl,
|
|
83
|
-
rel: learnMoreTarget === "_blank" ? "noopener noreferrer" : void 0,
|
|
84
|
-
target: learnMoreTarget,
|
|
85
|
-
children: "Learn more"
|
|
86
|
-
}), button && /* @__PURE__ */ jsx(BitkitColorButton, {
|
|
87
|
-
colorVariant: "white",
|
|
88
|
-
marginInlineStart: "auto",
|
|
89
|
-
...button
|
|
90
|
-
})]
|
|
91
|
-
})
|
|
92
|
-
]
|
|
93
|
-
}) })
|
|
55
|
+
children: /* @__PURE__ */ jsx(Tooltip.Positioner, { children: /* @__PURE__ */ jsxs(Tooltip.Content, { children: [/* @__PURE__ */ jsx(Tooltip.Arrow, { children: /* @__PURE__ */ jsx(Tooltip.ArrowTip, {}) }), /* @__PURE__ */ jsxs(Box, {
|
|
56
|
+
display: "flex",
|
|
57
|
+
gap: "8",
|
|
58
|
+
children: [text, Icon && /* @__PURE__ */ jsx(Icon, {
|
|
59
|
+
flexShrink: "0",
|
|
60
|
+
size: "16"
|
|
61
|
+
})]
|
|
62
|
+
})] }) })
|
|
94
63
|
})]
|
|
95
64
|
});
|
|
96
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitTooltip.js","names":[],"sources":["../../../lib/components/BitkitTooltip/BitkitTooltip.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Link } from '@chakra-ui/react/link';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Tooltip, type TooltipRootProps } from '@chakra-ui/react/tooltip';\nimport { isValidElement, type ReactNode, type Ref, useContext, useRef } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport { rem } from '../../theme/themeUtils';\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport BitkitColorButton, { type BitkitColorButtonProps } from '../BitkitColorButton/BitkitColorButton';\n\nexport type BitkitTooltipProps = {\n /**\n * Action button rendered at the end of the tooltip. Setting it makes the tooltip interactive, so\n * the pointer can move into the tooltip without dismissing it. Defaults to the `white` colour\n * variant, the one that reads on the tooltip's dark background.\n */\n button?: BitkitColorButtonProps;\n /**\n * The trigger the tooltip is anchored to. Rendered via `asChild`, so it must accept a ref —\n * unless `wrapTrigger` puts a wrapper in between.\n */\n children: ReactNode;\n /** Dismiss the tooltip when the trigger is clicked. */\n closeOnClick?: TooltipRootProps['closeOnClick'];\n /**\n * Render the tooltip inline instead of in a portal. Only needed when it must stay inside its\n * parent's DOM subtree — a dialog already sets this for you.\n */\n disablePortal?: boolean;\n /** Render the trigger without a tooltip — for hints that only apply in some states. */\n disabled?: TooltipRootProps['disabled'];\n /**\n * Icon rendered after `text`, at size 16. Use it for the affordance the tooltip describes — an\n * `IconArrowNortheast` when the trigger opens something in a new tab, for instance.\n */\n icon?: BitkitIconComponent;\n /** Target for the \"Learn more\" link. `_blank` also sets `rel=\"noopener noreferrer\"`. */\n learnMoreTarget?: HTMLAnchorElement['target'];\n /**\n * Adds a \"Learn more\" link pointing here. Setting it makes the tooltip interactive, so the\n * pointer can move into the tooltip to reach the link.\n */\n learnMoreUrl?: string;\n /** Called when the tooltip opens or closes, including from hover and focus. */\n onOpenChange?: TooltipRootProps['onOpenChange'];\n /** Controlled open state. Leave unset to let hover and focus drive it. */\n open?: TooltipRootProps['open'];\n /** Delay in ms before an uncontrolled tooltip opens on hover. */\n openDelay?: TooltipRootProps['openDelay'];\n /** Where the tooltip sits relative to the trigger (default `top`). It flips if space is short. */\n placement?: NonNullable<TooltipRootProps['positioning']>['placement'];\n /** The tooltip's text. Plain string only — use `icon`, `learnMoreUrl` and `button` for the rest. */\n text: string;\n /**\n * Render the trigger inside a focusable wrapper instead of on the trigger itself. Only for triggers\n * that cannot take focus — on a focusable one this adds a second, redundant tab stop for the same\n * control. A disabled `<button>` dispatches no pointer events and is out of the tab order, so\n * without a wrapper the tooltip never opens — in the one state whose explanation the user actually\n * needs.\n *\n * Chakra v2's `Tooltip` had this built in as `shouldWrapChildren`, rendering a\n * `<span display=\"inline-block\" tabIndex={0}>` that carried the trigger props. Ark's tooltip has no\n * equivalent, and Chakra's own v2->v3 codemod replaces it with a bare `<span>` — which restores\n * hover but silently drops the tab stop, so the tooltip stays unreachable by keyboard. This prop is\n * that escape hatch, `tabIndex` included.\n *\n * The wrapper is a plain focusable span, so focusing it announces the trigger's label and the\n * tooltip text, not the trigger's own state — a disabled button inside is not re-announced as\n * disabled. Conveying that would mean keeping the trigger focusable with `aria-disabled` instead\n * of the native attribute, which is a change to what `disabled` means, not a tooltip concern.\n */\n wrapTrigger?: boolean;\n};\n\n/**\n * A hover/focus tooltip anchored to its child. `text` carries the message, `icon` appends a glyph\n * after it, and `learnMoreUrl`/`button` add a link and an action.\n *\n * Setting either of those two makes the tooltip *interactive*: it gains roomier padding and stays\n * open while the pointer travels into it, so the link and the button can actually be reached.\n *\n * The content renders in a portal, so it escapes any ancestor that traps stacking (`isolation`,\n * `transform`, a `z-index`ed positioned box) or clips overflow. Dialogs turn that off through\n * `BitkitPortalContext` so an interactive tooltip stays inside the focus trap; `disablePortal` is\n * the manual override.\n */\nconst BitkitTooltip = ({\n button,\n children,\n closeOnClick,\n disablePortal,\n disabled,\n icon: Icon,\n learnMoreTarget,\n learnMoreUrl,\n onOpenChange,\n open,\n openDelay,\n placement = 'top',\n text,\n wrapTrigger,\n}: BitkitTooltipProps) => {\n const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);\n const isInteractive = !!learnMoreUrl || !!button;\n\n // Anchor positioning to the trigger node by ref rather than relying on Zag's\n // id/data-scope lookup. When the trigger is also wrapped by another `asChild`\n // trigger (e.g. Menu.Trigger), the outer trigger's id and data-scope/data-part\n // overwrite ours on the shared node, so `getTriggerEl()` can't find it and the\n // tooltip loses its anchor. `getAnchorElement` takes precedence over the id\n // lookup, so this is safe in the standalone case too.\n const triggerRef = useRef<HTMLElement>(null);\n\n return (\n <Tooltip.Root\n closeOnClick={closeOnClick}\n disabled={disabled}\n interactive={isInteractive || undefined}\n onOpenChange={onOpenChange}\n open={open}\n openDelay={openDelay}\n paddingSize={isInteractive ? 'lg' : undefined}\n positioning={{ getAnchorElement: () => triggerRef.current, placement, offset: { mainAxis: 4, crossAxis: 0 } }}\n >\n <Tooltip.Trigger ref={triggerRef as Ref<HTMLButtonElement>} asChild>\n {wrapTrigger || !isValidElement(children) ? (\n // inline-flex so the wrapper shrink-wraps the trigger: a plain inline span adds descender\n // space below it and shifts the alignment of whatever sits next to it.\n <Box\n as=\"span\"\n display=\"inline-flex\"\n tabIndex={0}\n css={{\n // The wrapper owns the tab stop, but the focus ring belongs on the trigger: an outline\n // follows the border-radius of the element it is drawn on, and the wrapper has none —\n // so leaving it here squares off a pill or a round trigger.\n _focusVisible: {\n outline: 'none',\n '& > *': {\n outlineColor: 'var(--focus-ring-color)',\n outlineOffset: 'var(--focus-ring-offset, 2px)',\n outlineStyle: 'var(--focus-ring-style, solid)',\n outlineWidth: 'var(--focus-ring-width, 2px)',\n },\n },\n }}\n >\n {children}\n </Box>\n ) : (\n children\n )}\n </Tooltip.Trigger>\n <Portal disabled={disablePortal || disablePortalFromContext}>\n <Tooltip.Positioner>\n <Tooltip.Content css={isInteractive && { minWidth: rem(240) }}>\n <Tooltip.Arrow>\n <Tooltip.ArrowTip />\n </Tooltip.Arrow>\n <Box display=\"flex\" gap=\"8\">\n {text}\n {Icon && <Icon flexShrink=\"0\" size=\"16\" />}\n </Box>\n {isInteractive && (\n <Box alignItems=\"center\" display=\"flex\" gap=\"16\" marginBlockStart=\"16\">\n {learnMoreUrl && (\n <Link\n color=\"color/purple/highlight\"\n href={learnMoreUrl}\n rel={learnMoreTarget === '_blank' ? 'noopener noreferrer' : undefined}\n target={learnMoreTarget}\n >\n Learn more\n </Link>\n )}\n {button && <BitkitColorButton colorVariant=\"white\" marginInlineStart=\"auto\" {...button} />}\n </Box>\n )}\n </Tooltip.Content>\n </Tooltip.Positioner>\n </Portal>\n </Tooltip.Root>\n );\n};\n\nBitkitTooltip.displayName = 'BitkitTooltip';\n\nexport default BitkitTooltip;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuFA,IAAM,iBAAiB,EACrB,QACA,UACA,cACA,eACA,UACA,MAAM,MACN,iBACA,cACA,cACA,MACA,WACA,YAAY,OACZ,MACA,kBACwB;CACxB,MAAM,EAAE,eAAe,6BAA6B,WAAW,mBAAmB;CAClF,MAAM,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAQ1C,MAAM,aAAa,OAAoB,IAAI;CAE3C,OACE,qBAAC,QAAQ,MAAT;EACgB;EACJ;EACV,aAAa,iBAAiB,KAAA;EAChB;EACR;EACK;EACX,aAAa,gBAAgB,OAAO,KAAA;EACpC,aAAa;GAAE,wBAAwB,WAAW;GAAS;GAAW,QAAQ;IAAE,UAAU;IAAG,WAAW;GAAE;EAAE;EAR9G,UAAA,CAUE,oBAAC,QAAQ,SAAT;GAAiB,KAAK;GAAsC,SAAA;GACzD,UAAA,eAAe,CAAC,eAAe,QAAQ,IAGtC,oBAAC,KAAD;IACE,IAAG;IACH,SAAQ;IACR,UAAU;IACV,KAAK,EAIH,eAAe;KACb,SAAS;KACT,SAAS;MACP,cAAc;MACd,eAAe;MACf,cAAc;MACd,cAAc;KAChB;IACF,EACF;IAEC;GACE,CAAA,IAEL;EAEa,CAAA,GACjB,oBAAC,QAAD;GAAQ,UAAU,iBAAiB;GACjC,UAAA,oBAAC,QAAQ,YAAT,EAAA,UACE,qBAAC,QAAQ,SAAT;IAAiB,KAAK,iBAAiB,EAAE,UAAU,IAAI,GAAG,EAAE;IAA5D,UAAA;KACE,oBAAC,QAAQ,OAAT,EAAA,UACE,oBAAC,QAAQ,UAAT,CAAmB,CAAA,EACN,CAAA;KACf,qBAAC,KAAD;MAAK,SAAQ;MAAO,KAAI;MAAxB,UAAA,CACG,MACA,QAAQ,oBAAC,MAAD;OAAM,YAAW;OAAI,MAAK;MAAM,CAAA,CACtC;;KACJ,iBACC,qBAAC,KAAD;MAAK,YAAW;MAAS,SAAQ;MAAO,KAAI;MAAK,kBAAiB;MAAlE,UAAA,CACG,gBACC,oBAAC,MAAD;OACE,OAAM;OACN,MAAM;OACN,KAAK,oBAAoB,WAAW,wBAAwB,KAAA;OAC5D,QAAQ;OACT,UAAA;MAEK,CAAA,GAEP,UAAU,oBAAC,mBAAD;OAAmB,cAAa;OAAQ,mBAAkB;OAAO,GAAI;MAAS,CAAA,CACtF;;IAEQ;GACC,CAAA,EAAA,CAAA;EACd,CAAA,CACI;;AAElB;AAEA,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"file":"BitkitTooltip.js","names":[],"sources":["../../../lib/components/BitkitTooltip/BitkitTooltip.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Tooltip, type TooltipRootProps } from '@chakra-ui/react/tooltip';\nimport { isValidElement, type ReactNode, type Ref, useContext, useRef } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\n\nexport type BitkitTooltipProps = {\n /**\n * The trigger the tooltip is anchored to. Rendered via `asChild`, so it must accept a ref —\n * unless `wrapTrigger` puts a wrapper in between.\n */\n children: ReactNode;\n /** Dismiss the tooltip when the trigger is clicked. */\n closeOnClick?: TooltipRootProps['closeOnClick'];\n /**\n * Render the tooltip inline instead of in a portal. Only needed when it must stay inside its\n * parent's DOM subtree — a dialog already sets this for you.\n */\n disablePortal?: boolean;\n /** Render the trigger without a tooltip — for hints that only apply in some states. */\n disabled?: TooltipRootProps['disabled'];\n /**\n * Icon rendered after `text`, at size 16. Use it for the affordance the tooltip describes — an\n * `IconArrowNortheast` when the trigger opens something in a new tab, for instance.\n */\n icon?: BitkitIconComponent;\n /** Called when the tooltip opens or closes, including from hover and focus. */\n onOpenChange?: TooltipRootProps['onOpenChange'];\n /** Controlled open state. Leave unset to let hover and focus drive it. */\n open?: TooltipRootProps['open'];\n /** Delay in ms before an uncontrolled tooltip opens on hover. */\n openDelay?: TooltipRootProps['openDelay'];\n /** Where the tooltip sits relative to the trigger (default `top`). It flips if space is short. */\n placement?: NonNullable<TooltipRootProps['positioning']>['placement'];\n /** The tooltip's text. Plain string only — use `icon` for a glyph after it. */\n text: string;\n /**\n * Render the trigger inside a focusable wrapper instead of on the trigger itself. Only for triggers\n * that cannot take focus — on a focusable one this adds a second, redundant tab stop for the same\n * control. A disabled `<button>` dispatches no pointer events and is out of the tab order, so\n * without a wrapper the tooltip never opens — in the one state whose explanation the user actually\n * needs.\n *\n * Chakra v2's `Tooltip` had this built in as `shouldWrapChildren`, rendering a\n * `<span display=\"inline-block\" tabIndex={0}>` that carried the trigger props. Ark's tooltip has no\n * equivalent, and Chakra's own v2->v3 codemod replaces it with a bare `<span>` — which restores\n * hover but silently drops the tab stop, so the tooltip stays unreachable by keyboard. This prop is\n * that escape hatch, `tabIndex` included.\n *\n * The wrapper is a plain focusable span, so focusing it announces the trigger's label and the\n * tooltip text, not the trigger's own state — a disabled button inside is not re-announced as\n * disabled. Conveying that would mean keeping the trigger focusable with `aria-disabled` instead\n * of the native attribute, which is a change to what `disabled` means, not a tooltip concern.\n */\n wrapTrigger?: boolean;\n};\n\n/**\n * A hover/focus tooltip anchored to its child: `text` carries the message and `icon` appends a\n * glyph after it. Text only — a tooltip closes when focus leaves its trigger and ignores touch, so a\n * link or a button inside one couldn't be reached. For those use `BitkitToggletip`, which looks the\n * same and opens on click.\n *\n * The content renders in a portal, so it escapes any ancestor that traps stacking (`isolation`,\n * `transform`, a `z-index`ed positioned box) or clips overflow. Dialogs turn that off through\n * `BitkitPortalContext`; `disablePortal` is the manual override.\n */\nconst BitkitTooltip = ({\n children,\n closeOnClick,\n disablePortal,\n disabled,\n icon: Icon,\n onOpenChange,\n open,\n openDelay,\n placement = 'top',\n text,\n wrapTrigger,\n}: BitkitTooltipProps) => {\n const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);\n\n // Anchor positioning to the trigger node by ref rather than relying on Zag's\n // id/data-scope lookup. When the trigger is also wrapped by another `asChild`\n // trigger (e.g. Menu.Trigger), the outer trigger's id and data-scope/data-part\n // overwrite ours on the shared node, so `getTriggerEl()` can't find it and the\n // tooltip loses its anchor. `getAnchorElement` takes precedence over the id\n // lookup, so this is safe in the standalone case too.\n const triggerRef = useRef<HTMLElement>(null);\n\n return (\n <Tooltip.Root\n closeOnClick={closeOnClick}\n disabled={disabled}\n onOpenChange={onOpenChange}\n open={open}\n openDelay={openDelay}\n positioning={{ getAnchorElement: () => triggerRef.current, placement, offset: { mainAxis: 4, crossAxis: 0 } }}\n >\n <Tooltip.Trigger ref={triggerRef as Ref<HTMLButtonElement>} asChild>\n {wrapTrigger || !isValidElement(children) ? (\n // inline-flex so the wrapper shrink-wraps the trigger: a plain inline span adds descender\n // space below it and shifts the alignment of whatever sits next to it.\n <Box\n as=\"span\"\n display=\"inline-flex\"\n tabIndex={0}\n css={{\n // The wrapper owns the tab stop, but the focus ring belongs on the trigger: an outline\n // follows the border-radius of the element it is drawn on, and the wrapper has none —\n // so leaving it here squares off a pill or a round trigger.\n _focusVisible: {\n outline: 'none',\n '& > *': {\n outlineColor: 'var(--focus-ring-color)',\n outlineOffset: 'var(--focus-ring-offset, 2px)',\n outlineStyle: 'var(--focus-ring-style, solid)',\n outlineWidth: 'var(--focus-ring-width, 2px)',\n },\n },\n }}\n >\n {children}\n </Box>\n ) : (\n children\n )}\n </Tooltip.Trigger>\n <Portal disabled={disablePortal || disablePortalFromContext}>\n <Tooltip.Positioner>\n <Tooltip.Content>\n <Tooltip.Arrow>\n <Tooltip.ArrowTip />\n </Tooltip.Arrow>\n <Box display=\"flex\" gap=\"8\">\n {text}\n {Icon && <Icon flexShrink=\"0\" size=\"16\" />}\n </Box>\n </Tooltip.Content>\n </Tooltip.Positioner>\n </Portal>\n </Tooltip.Root>\n );\n};\n\nBitkitTooltip.displayName = 'BitkitTooltip';\n\nexport default BitkitTooltip;\n"],"mappings":";;;;;;;;;;;;;;;;;AAqEA,IAAM,iBAAiB,EACrB,UACA,cACA,eACA,UACA,MAAM,MACN,cACA,MACA,WACA,YAAY,OACZ,MACA,kBACwB;CACxB,MAAM,EAAE,eAAe,6BAA6B,WAAW,mBAAmB;CAQlF,MAAM,aAAa,OAAoB,IAAI;CAE3C,OACE,qBAAC,QAAQ,MAAT;EACgB;EACJ;EACI;EACR;EACK;EACX,aAAa;GAAE,wBAAwB,WAAW;GAAS;GAAW,QAAQ;IAAE,UAAU;IAAG,WAAW;GAAE;EAAE;EAN9G,UAAA,CAQE,oBAAC,QAAQ,SAAT;GAAiB,KAAK;GAAsC,SAAA;GACzD,UAAA,eAAe,CAAC,eAAe,QAAQ,IAGtC,oBAAC,KAAD;IACE,IAAG;IACH,SAAQ;IACR,UAAU;IACV,KAAK,EAIH,eAAe;KACb,SAAS;KACT,SAAS;MACP,cAAc;MACd,eAAe;MACf,cAAc;MACd,cAAc;KAChB;IACF,EACF;IAEC;GACE,CAAA,IAEL;EAEa,CAAA,GACjB,oBAAC,QAAD;GAAQ,UAAU,iBAAiB;GACjC,UAAA,oBAAC,QAAQ,YAAT,EAAA,UACE,qBAAC,QAAQ,SAAT,EAAA,UAAA,CACE,oBAAC,QAAQ,OAAT,EAAA,UACE,oBAAC,QAAQ,UAAT,CAAmB,CAAA,EACN,CAAA,GACf,qBAAC,KAAD;IAAK,SAAQ;IAAO,KAAI;IAAxB,UAAA,CACG,MACA,QAAQ,oBAAC,MAAD;KAAM,YAAW;KAAI,MAAK;IAAM,CAAA,CACtC;GACU,CAAA,CAAA,EAAA,CAAA,EACC,CAAA;EACd,CAAA,CACI;;AAElB;AAEA,cAAc,cAAc"}
|
|
@@ -90,7 +90,10 @@ var Nodes = ({ indentGuide, render, renderBranchFooter, variant }) => {
|
|
|
90
90
|
* - Enter on a node selects it and does not fire a DOM click, so open things from
|
|
91
91
|
* `onSelectionChange`. Activating the selected leaf again changes nothing, so a leaf that should
|
|
92
92
|
* reopen needs its own `onClick` and `onKeyDown` for that case.
|
|
93
|
-
* - A node with `children: []` renders as a leaf, not as an empty branch.
|
|
93
|
+
* - A node with `children: []` renders as a leaf, not as an empty branch. For an empty folder, give the
|
|
94
|
+
* collection a `nodeToChildrenCount` that returns `0` for it, and put `disabled: true` on the node itself:
|
|
95
|
+
* Zag reads `node.disabled` and ignores the collection's `isNodeDisabled`. The folder then renders in the
|
|
96
|
+
* disabled colours, cannot be opened, and keeps its actions.
|
|
94
97
|
* - The `navigation` design has no badges, no actions and no subtext on leaves; those slots are drawn
|
|
95
98
|
* for `files`.
|
|
96
99
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitTreeView.js","names":[],"sources":["../../../lib/components/BitkitTreeView/BitkitTreeView.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\nimport { Box } from '@chakra-ui/react/box';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport {\n TreeView,\n type TreeViewBranchControlProps,\n type TreeViewItemProps,\n type TreeViewNodeRenderProps,\n type TreeViewRootProps,\n useTreeViewContext,\n} from '@chakra-ui/react/tree-view';\nimport { VisuallyHidden } from '@chakra-ui/react/visually-hidden';\nimport { cloneElement, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent, IconChevronRight, IconFolder, IconWarningYellow } from '../../icons';\nimport { type BitkitColorToken } from '../../theme/themeUtils';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\n// Re-export for consumer convenience\nexport { createTreeCollection } from '@chakra-ui/react/collection';\n\n// Re-export useful types\nexport type {\n TreeViewExpandedChangeDetails as BitkitTreeViewExpandedChangeDetails,\n TreeViewNodeRenderProps as BitkitTreeViewNodeRenderProps,\n TreeViewSelectionChangeDetails as BitkitTreeViewSelectionChangeDetails,\n} from '@chakra-ui/react/tree-view';\n\n// --- Variant context ---\n\nexport type BitkitTreeViewVariant = 'files' | 'navigation';\n\nconst [VariantProvider, useVariant] = createContext<{ variant: BitkitTreeViewVariant }>({\n name: 'BitkitTreeViewVariantContext',\n defaultValue: { variant: 'files' },\n});\n\nconst useCustomSlotStyles = (variant: BitkitTreeViewVariant) => {\n const recipe = useSlotRecipe({ key: 'treeView' });\n return recipe({ variant });\n};\n\n// --- Root ---\n\nexport interface BitkitTreeViewRootProps extends Omit<TreeViewRootProps, 'children'> {\n children?: ReactNode;\n render: (props: TreeViewNodeRenderProps) => ReactNode;\n /**\n * Content after a branch's children, indented like them: a `BitkitPaginationLoadMore` with\n * `size=\"xs\"` for a directory that loads its files in pages. Called for branch nodes only;\n * return `null` for a branch that needs nothing. Designed for the `files` variant.\n */\n renderBranchFooter?: (props: TreeViewNodeRenderProps) => ReactNode;\n variant?: BitkitTreeViewVariant;\n}\n\ninterface NodesProps extends Pick<BitkitTreeViewRootProps, 'render' | 'renderBranchFooter'> {\n indentGuide?: ReactElement;\n variant: BitkitTreeViewVariant;\n}\n\n// Chakra's TreeView.Node, which has no slot after a branch's children.\nconst Nodes = ({ indentGuide, render, renderBranchFooter, variant }: NodesProps) => {\n const tree = useTreeViewContext();\n const styles = useCustomSlotStyles(variant);\n\n const renderNode = (node: unknown, indexPath: number[]): ReactNode => (\n <TreeView.NodeProvider key={indexPath.join('.')} indexPath={indexPath} node={node}>\n <TreeView.NodeContext>\n {(nodeState) => {\n if (!nodeState.isBranch) {\n return render({ indexPath, node, nodeState });\n }\n\n const footer = renderBranchFooter?.({ indexPath, node, nodeState });\n\n return (\n <TreeView.Branch>\n {render({ indexPath, node, nodeState })}\n <TreeView.BranchContent>\n {indentGuide}\n {tree.collection.getNodeChildren(node).map((child, index) => renderNode(child, [...indexPath, index]))}\n {footer && <Box css={[styles.footer, { '--depth': indexPath.length + 1 }]}>{footer}</Box>}\n </TreeView.BranchContent>\n </TreeView.Branch>\n );\n }}\n </TreeView.NodeContext>\n </TreeView.NodeProvider>\n );\n\n return tree.collection.getNodeChildren(tree.collection.rootNode).map((node, index) => renderNode(node, [index]));\n};\n\n/**\n * A tree of collapsible branches and leaves, in a `files` or a `navigation` look. The tree is data,\n * not JSX: build `collection` with `createTreeCollection` (re-exported from here), and `render`\n * returns `BitkitTreeView.Branch` when `nodeState.isBranch` and `BitkitTreeView.Leaf` otherwise.\n *\n * Root also takes Chakra's `TreeView.Root` props: `defaultExpandedValue` / `expandedValue` /\n * `onExpandedChange`, `selectionMode`, `defaultSelectedValue` / `selectedValue` /\n * `onSelectionChange`, `lazyMount` (keeps unopened branches out of the DOM), and\n * `translations={{ treeLabel }}` for the tree's accessible name. `children` renders after the whole\n * tree, indented like the top-level nodes, and `renderBranchFooter` after one branch's children,\n * indented like them: both take a `BitkitPaginationLoadMore size=\"xs\"` for trees that load in pages.\n *\n * `BitkitTreeView.Branch` (a `TreeView.BranchControl`) and `BitkitTreeView.Leaf` (a `TreeView.Item`,\n * so it takes `onClick` and `onKeyDown`) share these props:\n *\n * | Prop | Type | Notes |\n * | --- | --- | --- |\n * | `label` | `string` | Required. |\n * | `subtext` | `ReactNode` | A second line under the label. |\n * | `suffixText` | `string` | Trailing text, e.g. a count or a duration. |\n * | `suffixIcon` | `BitkitIconComponent` | Trailing icon, before `suffixText`. |\n * | `hasWarning` | `boolean` | A warning icon at the start of the suffix. |\n * | `actions` | `ReactElement[]` | Buttons shown in place of the suffix on hover, forced to `size=\"xs\"`. Their clicks do not reach the row. |\n *\n * Leaf only:\n *\n * | Prop | Type | Notes |\n * | --- | --- | --- |\n * | `icon` | `BitkitIconComponent` | Before the label. Branches draw their own folder or chevron. |\n * | `iconColor` | `icon/*` token | For an icon that carries a status. Wins over hover and selection. |\n * | `badge` | `ReactElement` | Before the label, forced to `size=\"xs\"`. |\n * | `badgeTooltip` | `string` | Shown when the badge is hovered, and read out after the label. Pass it here rather than wrapping `badge` in a tooltip, which would take the `size` instead of the badge. |\n *\n * Behaviour worth knowing:\n * - Enter on a node selects it and does not fire a DOM click, so open things from\n * `onSelectionChange`. Activating the selected leaf again changes nothing, so a leaf that should\n * reopen needs its own `onClick` and `onKeyDown` for that case.\n * - A node with `children: []` renders as a leaf, not as an empty branch.\n * - The `navigation` design has no badges, no actions and no subtext on leaves; those slots are drawn\n * for `files`.\n */\nconst Root = forwardRef<HTMLDivElement, BitkitTreeViewRootProps>(\n ({ children, render, renderBranchFooter, variant = 'files', ...props }, ref) => {\n const indentGuide = variant === 'files' ? <TreeView.BranchIndentGuide /> : undefined;\n const styles = useCustomSlotStyles(variant);\n\n return (\n <VariantProvider value={{ variant }}>\n <TreeView.Root ref={ref} variant={variant} {...props}>\n <TreeView.Tree>\n <Nodes\n indentGuide={indentGuide}\n render={render}\n renderBranchFooter={renderBranchFooter}\n variant={variant}\n />\n {children && <Box css={[styles.footer, { '--depth': 1 }]}>{children}</Box>}\n </TreeView.Tree>\n </TreeView.Root>\n </VariantProvider>\n );\n },\n);\nRoot.displayName = 'BitkitTreeView';\n\n// --- Actions ---\n\n// The buttons sit inside the row, so a click that bubbled up would also toggle the branch or select the leaf.\nconst Actions = ({ actions, variant }: { actions: ReactElement[]; variant: BitkitTreeViewVariant }) => {\n const styles = useCustomSlotStyles(variant);\n\n return (\n <Box css={styles.actionGroup} onClick={(event) => event.stopPropagation()}>\n {actions.map((action) => cloneElement(action, { size: 'xs' }))}\n </Box>\n );\n};\n\n// --- Branch ---\n\nexport interface BitkitTreeViewBranchProps extends Omit<TreeViewBranchControlProps, 'children'> {\n actions?: ReactElement[];\n hasWarning?: boolean;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Branch = forwardRef<HTMLDivElement, BitkitTreeViewBranchProps>((props, ref) => {\n const { actions, hasWarning, label, subtext, suffixIcon: SuffixIcon, suffixText, ...rest } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n\n const BranchIcon = variant === 'navigation' ? IconChevronRight : IconFolder;\n\n return (\n <TreeView.BranchControl ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n <TreeView.BranchIndicator>\n <BranchIcon size=\"16\" />\n </TreeView.BranchIndicator>\n <TreeView.BranchText>\n {label}\n {subtext && <Text css={styles.secondaryText}>{subtext}</Text>}\n </TreeView.BranchText>\n {hasSuffix && (\n <Box css={styles.suffixGroup}>\n {hasWarning && <IconWarningYellow size=\"16\" />}\n {SuffixIcon && <SuffixIcon size=\"16\" />}\n {suffixText && <span>{suffixText}</span>}\n </Box>\n )}\n {hasActions && <Actions actions={actions} variant={variant} />}\n </TreeView.BranchControl>\n );\n});\nBranch.displayName = 'BitkitTreeView.Branch';\n\n// --- Leaf ---\n\nexport interface BitkitTreeViewLeafProps extends Omit<TreeViewItemProps, 'children'> {\n actions?: ReactElement[];\n badge?: ReactElement;\n /** Explains the badge on hover, e.g. what its letter stands for. */\n badgeTooltip?: string;\n hasWarning?: boolean;\n icon?: BitkitIconComponent;\n /** An `icon/*` token for the icon when it carries meaning of its own, such as a test result's status. */\n iconColor?: BitkitColorToken<'icon'>;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Leaf = forwardRef<HTMLDivElement, BitkitTreeViewLeafProps>((props, ref) => {\n const {\n actions,\n badge,\n badgeTooltip,\n hasWarning,\n icon: Icon,\n iconColor,\n label,\n subtext,\n suffixIcon: SuffixIcon,\n suffixText,\n ...rest\n } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n const sizedBadge = badge && cloneElement(badge, { size: 'xs' });\n const badgeDescription = sizedBadge ? badgeTooltip : undefined;\n\n return (\n <TreeView.Item ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n {Icon && <Icon color={iconColor} size=\"16\" />}\n {badgeDescription ? <BitkitTooltip text={badgeDescription}>{sizedBadge}</BitkitTooltip> : sizedBadge}\n <TreeView.ItemText>\n {label}\n {/* A tree has a single Tab stop, so the badge takes no focus: its tooltip is read out with the label instead. */}\n {badgeDescription && <VisuallyHidden>{`, ${badgeDescription}`}</VisuallyHidden>}\n {subtext && <Text css={styles.secondaryText}>{subtext}</Text>}\n </TreeView.ItemText>\n {hasSuffix && (\n <Box css={styles.suffixGroup}>\n {hasWarning && <IconWarningYellow size=\"16\" />}\n {SuffixIcon && <SuffixIcon size=\"16\" />}\n {suffixText && <span>{suffixText}</span>}\n </Box>\n )}\n {hasActions && <Actions actions={actions} variant={variant} />}\n </TreeView.Item>\n );\n});\nLeaf.displayName = 'BitkitTreeView.Leaf';\n\n// --- Main export ---\n\nconst BitkitTreeView = withSubComponents(Root, {\n Branch,\n Leaf,\n});\n\nexport default BitkitTreeView;\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,IAAM,CAAC,iBAAiB,cAAc,gBAAkD;CACtF,MAAM;CACN,cAAc,EAAE,SAAS,QAAQ;AACnC,CAAC;AAED,IAAM,uBAAuB,YAAm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KACrC,cAAc,oBAAC,QAAD,EAAA,UAAO,WAAiB,CAAA;IACpC;;GAEN,cAAc,oBAAC,SAAD;IAAkB;IAAkB;GAAU,CAAA;EAChD;;AAEnB,CAAC;AACD,KAAK,cAAc;AAInB,IAAM,iBAAiB,kBAAkB,MAAM;CAC7C;CACA;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"BitkitTreeView.js","names":[],"sources":["../../../lib/components/BitkitTreeView/BitkitTreeView.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\nimport { Box } from '@chakra-ui/react/box';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport {\n TreeView,\n type TreeViewBranchControlProps,\n type TreeViewItemProps,\n type TreeViewNodeRenderProps,\n type TreeViewRootProps,\n useTreeViewContext,\n} from '@chakra-ui/react/tree-view';\nimport { VisuallyHidden } from '@chakra-ui/react/visually-hidden';\nimport { cloneElement, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent, IconChevronRight, IconFolder, IconWarningYellow } from '../../icons';\nimport { type BitkitColorToken } from '../../theme/themeUtils';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\n// Re-export for consumer convenience\nexport { createTreeCollection } from '@chakra-ui/react/collection';\n\n// Re-export useful types\nexport type {\n TreeViewExpandedChangeDetails as BitkitTreeViewExpandedChangeDetails,\n TreeViewNodeRenderProps as BitkitTreeViewNodeRenderProps,\n TreeViewSelectionChangeDetails as BitkitTreeViewSelectionChangeDetails,\n} from '@chakra-ui/react/tree-view';\n\n// --- Variant context ---\n\nexport type BitkitTreeViewVariant = 'files' | 'navigation';\n\nconst [VariantProvider, useVariant] = createContext<{ variant: BitkitTreeViewVariant }>({\n name: 'BitkitTreeViewVariantContext',\n defaultValue: { variant: 'files' },\n});\n\nconst useCustomSlotStyles = (variant: BitkitTreeViewVariant) => {\n const recipe = useSlotRecipe({ key: 'treeView' });\n return recipe({ variant });\n};\n\n// --- Root ---\n\nexport interface BitkitTreeViewRootProps extends Omit<TreeViewRootProps, 'children'> {\n children?: ReactNode;\n render: (props: TreeViewNodeRenderProps) => ReactNode;\n /**\n * Content after a branch's children, indented like them: a `BitkitPaginationLoadMore` with\n * `size=\"xs\"` for a directory that loads its files in pages. Called for branch nodes only;\n * return `null` for a branch that needs nothing. Designed for the `files` variant.\n */\n renderBranchFooter?: (props: TreeViewNodeRenderProps) => ReactNode;\n variant?: BitkitTreeViewVariant;\n}\n\ninterface NodesProps extends Pick<BitkitTreeViewRootProps, 'render' | 'renderBranchFooter'> {\n indentGuide?: ReactElement;\n variant: BitkitTreeViewVariant;\n}\n\n// Chakra's TreeView.Node, which has no slot after a branch's children.\nconst Nodes = ({ indentGuide, render, renderBranchFooter, variant }: NodesProps) => {\n const tree = useTreeViewContext();\n const styles = useCustomSlotStyles(variant);\n\n const renderNode = (node: unknown, indexPath: number[]): ReactNode => (\n <TreeView.NodeProvider key={indexPath.join('.')} indexPath={indexPath} node={node}>\n <TreeView.NodeContext>\n {(nodeState) => {\n if (!nodeState.isBranch) {\n return render({ indexPath, node, nodeState });\n }\n\n const footer = renderBranchFooter?.({ indexPath, node, nodeState });\n\n return (\n <TreeView.Branch>\n {render({ indexPath, node, nodeState })}\n <TreeView.BranchContent>\n {indentGuide}\n {tree.collection.getNodeChildren(node).map((child, index) => renderNode(child, [...indexPath, index]))}\n {footer && <Box css={[styles.footer, { '--depth': indexPath.length + 1 }]}>{footer}</Box>}\n </TreeView.BranchContent>\n </TreeView.Branch>\n );\n }}\n </TreeView.NodeContext>\n </TreeView.NodeProvider>\n );\n\n return tree.collection.getNodeChildren(tree.collection.rootNode).map((node, index) => renderNode(node, [index]));\n};\n\n/**\n * A tree of collapsible branches and leaves, in a `files` or a `navigation` look. The tree is data,\n * not JSX: build `collection` with `createTreeCollection` (re-exported from here), and `render`\n * returns `BitkitTreeView.Branch` when `nodeState.isBranch` and `BitkitTreeView.Leaf` otherwise.\n *\n * Root also takes Chakra's `TreeView.Root` props: `defaultExpandedValue` / `expandedValue` /\n * `onExpandedChange`, `selectionMode`, `defaultSelectedValue` / `selectedValue` /\n * `onSelectionChange`, `lazyMount` (keeps unopened branches out of the DOM), and\n * `translations={{ treeLabel }}` for the tree's accessible name. `children` renders after the whole\n * tree, indented like the top-level nodes, and `renderBranchFooter` after one branch's children,\n * indented like them: both take a `BitkitPaginationLoadMore size=\"xs\"` for trees that load in pages.\n *\n * `BitkitTreeView.Branch` (a `TreeView.BranchControl`) and `BitkitTreeView.Leaf` (a `TreeView.Item`,\n * so it takes `onClick` and `onKeyDown`) share these props:\n *\n * | Prop | Type | Notes |\n * | --- | --- | --- |\n * | `label` | `string` | Required. |\n * | `subtext` | `ReactNode` | A second line under the label. |\n * | `suffixText` | `string` | Trailing text, e.g. a count or a duration. |\n * | `suffixIcon` | `BitkitIconComponent` | Trailing icon, before `suffixText`. |\n * | `hasWarning` | `boolean` | A warning icon at the start of the suffix. |\n * | `actions` | `ReactElement[]` | Buttons shown in place of the suffix on hover, forced to `size=\"xs\"`. Their clicks do not reach the row. |\n *\n * Leaf only:\n *\n * | Prop | Type | Notes |\n * | --- | --- | --- |\n * | `icon` | `BitkitIconComponent` | Before the label. Branches draw their own folder or chevron. |\n * | `iconColor` | `icon/*` token | For an icon that carries a status. Wins over hover and selection. |\n * | `badge` | `ReactElement` | Before the label, forced to `size=\"xs\"`. |\n * | `badgeTooltip` | `string` | Shown when the badge is hovered, and read out after the label. Pass it here rather than wrapping `badge` in a tooltip, which would take the `size` instead of the badge. |\n *\n * Behaviour worth knowing:\n * - Enter on a node selects it and does not fire a DOM click, so open things from\n * `onSelectionChange`. Activating the selected leaf again changes nothing, so a leaf that should\n * reopen needs its own `onClick` and `onKeyDown` for that case.\n * - A node with `children: []` renders as a leaf, not as an empty branch. For an empty folder, give the\n * collection a `nodeToChildrenCount` that returns `0` for it, and put `disabled: true` on the node itself:\n * Zag reads `node.disabled` and ignores the collection's `isNodeDisabled`. The folder then renders in the\n * disabled colours, cannot be opened, and keeps its actions.\n * - The `navigation` design has no badges, no actions and no subtext on leaves; those slots are drawn\n * for `files`.\n */\nconst Root = forwardRef<HTMLDivElement, BitkitTreeViewRootProps>(\n ({ children, render, renderBranchFooter, variant = 'files', ...props }, ref) => {\n const indentGuide = variant === 'files' ? <TreeView.BranchIndentGuide /> : undefined;\n const styles = useCustomSlotStyles(variant);\n\n return (\n <VariantProvider value={{ variant }}>\n <TreeView.Root ref={ref} variant={variant} {...props}>\n <TreeView.Tree>\n <Nodes\n indentGuide={indentGuide}\n render={render}\n renderBranchFooter={renderBranchFooter}\n variant={variant}\n />\n {children && <Box css={[styles.footer, { '--depth': 1 }]}>{children}</Box>}\n </TreeView.Tree>\n </TreeView.Root>\n </VariantProvider>\n );\n },\n);\nRoot.displayName = 'BitkitTreeView';\n\n// --- Actions ---\n\n// The buttons sit inside the row, so a click that bubbled up would also toggle the branch or select the leaf.\nconst Actions = ({ actions, variant }: { actions: ReactElement[]; variant: BitkitTreeViewVariant }) => {\n const styles = useCustomSlotStyles(variant);\n\n return (\n <Box css={styles.actionGroup} onClick={(event) => event.stopPropagation()}>\n {actions.map((action) => cloneElement(action, { size: 'xs' }))}\n </Box>\n );\n};\n\n// --- Branch ---\n\nexport interface BitkitTreeViewBranchProps extends Omit<TreeViewBranchControlProps, 'children'> {\n actions?: ReactElement[];\n hasWarning?: boolean;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Branch = forwardRef<HTMLDivElement, BitkitTreeViewBranchProps>((props, ref) => {\n const { actions, hasWarning, label, subtext, suffixIcon: SuffixIcon, suffixText, ...rest } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n\n const BranchIcon = variant === 'navigation' ? IconChevronRight : IconFolder;\n\n return (\n <TreeView.BranchControl ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n <TreeView.BranchIndicator>\n <BranchIcon size=\"16\" />\n </TreeView.BranchIndicator>\n <TreeView.BranchText>\n {label}\n {subtext && <Text css={styles.secondaryText}>{subtext}</Text>}\n </TreeView.BranchText>\n {hasSuffix && (\n <Box css={styles.suffixGroup}>\n {hasWarning && <IconWarningYellow size=\"16\" />}\n {SuffixIcon && <SuffixIcon size=\"16\" />}\n {suffixText && <span>{suffixText}</span>}\n </Box>\n )}\n {hasActions && <Actions actions={actions} variant={variant} />}\n </TreeView.BranchControl>\n );\n});\nBranch.displayName = 'BitkitTreeView.Branch';\n\n// --- Leaf ---\n\nexport interface BitkitTreeViewLeafProps extends Omit<TreeViewItemProps, 'children'> {\n actions?: ReactElement[];\n badge?: ReactElement;\n /** Explains the badge on hover, e.g. what its letter stands for. */\n badgeTooltip?: string;\n hasWarning?: boolean;\n icon?: BitkitIconComponent;\n /** An `icon/*` token for the icon when it carries meaning of its own, such as a test result's status. */\n iconColor?: BitkitColorToken<'icon'>;\n label: string;\n subtext?: ReactNode;\n suffixIcon?: BitkitIconComponent;\n suffixText?: string;\n}\n\nconst Leaf = forwardRef<HTMLDivElement, BitkitTreeViewLeafProps>((props, ref) => {\n const {\n actions,\n badge,\n badgeTooltip,\n hasWarning,\n icon: Icon,\n iconColor,\n label,\n subtext,\n suffixIcon: SuffixIcon,\n suffixText,\n ...rest\n } = props;\n const { variant } = useVariant();\n const styles = useCustomSlotStyles(variant);\n const hasSuffix = hasWarning || SuffixIcon || suffixText;\n const hasActions = actions && actions.length > 0;\n const sizedBadge = badge && cloneElement(badge, { size: 'xs' });\n const badgeDescription = sizedBadge ? badgeTooltip : undefined;\n\n return (\n <TreeView.Item ref={ref} className={hasActions ? 'group' : undefined} {...rest}>\n {Icon && <Icon color={iconColor} size=\"16\" />}\n {badgeDescription ? <BitkitTooltip text={badgeDescription}>{sizedBadge}</BitkitTooltip> : sizedBadge}\n <TreeView.ItemText>\n {label}\n {/* A tree has a single Tab stop, so the badge takes no focus: its tooltip is read out with the label instead. */}\n {badgeDescription && <VisuallyHidden>{`, ${badgeDescription}`}</VisuallyHidden>}\n {subtext && <Text css={styles.secondaryText}>{subtext}</Text>}\n </TreeView.ItemText>\n {hasSuffix && (\n <Box css={styles.suffixGroup}>\n {hasWarning && <IconWarningYellow size=\"16\" />}\n {SuffixIcon && <SuffixIcon size=\"16\" />}\n {suffixText && <span>{suffixText}</span>}\n </Box>\n )}\n {hasActions && <Actions actions={actions} variant={variant} />}\n </TreeView.Item>\n );\n});\nLeaf.displayName = 'BitkitTreeView.Leaf';\n\n// --- Main export ---\n\nconst BitkitTreeView = withSubComponents(Root, {\n Branch,\n Leaf,\n});\n\nexport default BitkitTreeView;\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,IAAM,CAAC,iBAAiB,cAAc,gBAAkD;CACtF,MAAM;CACN,cAAc,EAAE,SAAS,QAAQ;AACnC,CAAC;AAED,IAAM,uBAAuB,YAAmC;CAE9D,OADe,cAAc,EAAE,KAAK,WAAW,CACxC,CAAA,CAAO,EAAE,QAAQ,CAAC;AAC3B;AAsBA,IAAM,SAAS,EAAE,aAAa,QAAQ,oBAAoB,cAA0B;CAClF,MAAM,OAAO,mBAAmB;CAChC,MAAM,SAAS,oBAAoB,OAAO;CAE1C,MAAM,cAAc,MAAe,cACjC,oBAAC,SAAS,cAAV;EAA4D;EAAiB;EAC3E,UAAA,oBAAC,SAAS,aAAV,EAAA,WACI,cAAc;GACd,IAAI,CAAC,UAAU,UACb,OAAO,OAAO;IAAE;IAAW;IAAM;GAAU,CAAC;GAG9C,MAAM,SAAS,qBAAqB;IAAE;IAAW;IAAM;GAAU,CAAC;GAElE,OACE,qBAAC,SAAS,QAAV,EAAA,UAAA,CACG,OAAO;IAAE;IAAW;IAAM;GAAU,CAAC,GACtC,qBAAC,SAAS,eAAV,EAAA,UAAA;IACG;IACA,KAAK,WAAW,gBAAgB,IA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O,EAAE,MAAM,KAAK,CAAC;CAC9D,MAAM,mBAAmB,aAAa,eAAe,KAAA;CAErD,OACE,qBAAC,SAAS,MAAV;EAAoB;EAAK,WAAW,aAAa,UAAU,KAAA;EAAW,GAAI;EAA1E,UAAA;GACG,QAAQ,oBAAC,MAAD;IAAM,OAAO;IAAW,MAAK;GAAM,CAAA;GAC3C,mBAAmB,oBAAC,eAAD;IAAe,MAAM;IAAmB,UAAA;GAA0B,CAAA,IAAI;GAC1F,qBAAC,SAAS,UAAV,EAAA,UAAA;IACG;IAEA,oBAAoB,oBAAC,gBAAD,EAAA,UAAiB,KAAK,mBAAmC,CAAA;IAC7E,WAAW,oBAAC,MAAD;KAAM,KAAK,OAAO;KAAgB,UAAA;IAAc,CAAA;GAC3C,EAAA,CAAA;GAClB,aACC,qBAAC,KAAD;IAAK,KAAK,OAAO;IAAjB,UAAA;KACG,cAAc,oBAAC,mBAAD,EAAmB,MAAK,KAAM,CAAA;KAC5C,cAAc,oBAAC,YAAD,EAAY,MAAK,KAAM,CAAA;KACrC,cAAc,oBAAC,QAAD,EAAA,UAAO,WAAiB,CAAA;IACpC;;GAEN,cAAc,oBAAC,SAAD;IAAkB;IAAkB;GAAU,CAAA;EAChD;;AAEnB,CAAC;AACD,KAAK,cAAc;AAInB,IAAM,iBAAiB,kBAAkB,MAAM;CAC7C;CACA;AACF,CAAC"}
|
|
@@ -90,8 +90,7 @@ export { default as BitkitTextArea, type BitkitTextAreaProps } from './BitkitTex
|
|
|
90
90
|
export { default as BitkitTextInput, type BitkitTextInputProps } from './BitkitTextInput/BitkitTextInput';
|
|
91
91
|
export { type BitkitToastProps, default as createBitkitToast, dismissBitkitToast } from './BitkitToast/BitkitToast';
|
|
92
92
|
export { default as BitkitToggleButton, type BitkitToggleButtonProps } from './BitkitToggleButton/BitkitToggleButton';
|
|
93
|
+
export { default as BitkitToggletip, type BitkitToggletipProps } from './BitkitToggletip/BitkitToggletip';
|
|
93
94
|
export { default as BitkitTooltip, type BitkitTooltipProps } from './BitkitTooltip/BitkitTooltip';
|
|
94
95
|
export { default as BitkitTour, type BitkitTourInstance, type BitkitTourOptions, type BitkitTourProps, type BitkitTourSecondaryAction, type BitkitTourStep, useBitkitTour, } from './BitkitTour/BitkitTour';
|
|
95
96
|
export { default as BitkitTreeView, type BitkitTreeViewBranchProps, type BitkitTreeViewExpandedChangeDetails, type BitkitTreeViewLeafProps, type BitkitTreeViewNodeRenderProps, type BitkitTreeViewRootProps, type BitkitTreeViewSelectionChangeDetails, createTreeCollection, } from './BitkitTreeView/BitkitTreeView';
|
|
96
|
-
export { default as BitkitUISideNav, type BitkitUISideNavBodyProps, type BitkitUISideNavFooterHeadingProps, type BitkitUISideNavFooterProps, type BitkitUISideNavItemProps, type BitkitUISideNavLinkAsAnchorProps, type BitkitUISideNavLinkAsButtonProps, type BitkitUISideNavLinkProps, type BitkitUISideNavProps, type BitkitUISideNavWorkspaceProps, type BitkitUISideNavWorkspaceSelectorProps, uiSideNavRailWidth, } from './BitkitUISideNav/BitkitUISideNav';
|
|
97
|
-
export { useUISideNav } from './BitkitUISideNav/UISideNavContext';
|
package/dist/main.js
CHANGED
|
@@ -320,6 +320,7 @@ import BitkitField from "./components/BitkitField/BitkitField.js";
|
|
|
320
320
|
import BitkitCombobox_default from "./components/BitkitCombobox/BitkitCombobox.js";
|
|
321
321
|
import BitkitDataWidget from "./components/BitkitDataWidget/BitkitDataWidget.js";
|
|
322
322
|
import BitkitDatePicker from "./components/BitkitDatePicker/BitkitDatePicker.js";
|
|
323
|
+
import BitkitToggletip from "./components/BitkitToggletip/BitkitToggletip.js";
|
|
323
324
|
import BitkitDefinitionTooltip from "./components/BitkitDefinitionTooltip/BitkitDefinitionTooltip.js";
|
|
324
325
|
import BitkitDialog_default from "./components/BitkitDialog/BitkitDialog.js";
|
|
325
326
|
import BitkitFormDialog_default from "./components/BitkitDialog/BitkitFormDialog.js";
|
|
@@ -383,9 +384,6 @@ import BitkitToggleButton from "./components/BitkitToggleButton/BitkitToggleButt
|
|
|
383
384
|
import BitkitTour, { useBitkitTour } from "./components/BitkitTour/BitkitTour.js";
|
|
384
385
|
import BitkitTreeView, { createTreeCollection } from "./components/BitkitTreeView/BitkitTreeView.js";
|
|
385
386
|
import useResponsive, { ResponsiveProvider } from "./hooks/useResponsive.js";
|
|
386
|
-
import { useUISideNav } from "./components/BitkitUISideNav/UISideNavContext.js";
|
|
387
|
-
import { uiSideNavRailWidth } from "./theme/slot-recipes/UISideNav.recipe.js";
|
|
388
|
-
import BitkitUISideNav_default from "./components/BitkitUISideNav/BitkitUISideNav.js";
|
|
389
387
|
import bitkitTheme from "./theme/index.js";
|
|
390
388
|
import Provider from "./providers/BitkitProvider.js";
|
|
391
|
-
export { BitkitAccordion_default as BitkitAccordion, BitkitActionBar, BitkitActionMenu_default as BitkitActionMenu, BitkitAlert, BitkitAvatar, BitkitBadge, BitkitBreadcrumb, BitkitButton, BitkitCalendar, BitkitCheckbox, BitkitCheckboxGroup, BitkitCloseButton, BitkitCodeSnippet, BitkitCollapsible, BitkitColorButton, BitkitCombobox_default as BitkitCombobox, BitkitControlButton, BitkitDataWidget, BitkitDatePicker, BitkitDefinitionTooltip, BitkitDialog_default as BitkitDialog, BitkitDraggableCard, BitkitDrawer, BitkitEmptyState, BitkitExpandableCard, BitkitField, BitkitFileInput, BitkitFormDialog_default as BitkitFormDialog, BitkitGroupHeading, BitkitHeading, BitkitIconButton, BitkitInlineLoading, BitkitLabel, BitkitLabelTooltip, BitkitLabeledData, BitkitLightbox, BitkitLink, BitkitLinkButton, BitkitList_default as BitkitList, BitkitMarkdown, BitkitMarkdownCard, BitkitMultiselect_default as BitkitMultiselect, BitkitMultiselectMenu, BitkitNativeSelect, BitkitNoteCard, BitkitNumberInput, BitkitOverflowContent, BitkitOverflowTooltip, BitkitPageFooter_default as BitkitPageFooter, BitkitPageHeader, BitkitPageSidebar_default as BitkitPageSidebar, BitkitPagination, BitkitPaginationLoadMore, BitkitPopover, BitkitProgressBar, BitkitPromoBanner, Provider as BitkitProvider, BitkitRadio, BitkitRadioGroup, BitkitRibbon, BitkitSearchInput, BitkitSectionHeading, BitkitSegmentedControl_default as BitkitSegmentedControl, BitkitSelect_default as BitkitSelect, BitkitSelectMenu, BitkitSelectMenuAction, BitkitSelectableTag_default as BitkitSelectableTag, BitkitSettingsCard_default as BitkitSettingsCard, BitkitSkeletonGroup, BitkitSpinner, BitkitSplitButton_default as BitkitSplitButton, BitkitStat, BitkitSteps_default as BitkitSteps, BitkitStepsCard_default as BitkitStepsCard, BitkitStepsDialog_default as BitkitStepsDialog, BitkitSwitch, BitkitTable, BitkitTableCard, BitkitTabs, BitkitTag, BitkitTagsInput, BitkitTextArea, BitkitTextInput, BitkitToggleButton, BitkitTooltip, BitkitTour, BitkitTreeView,
|
|
389
|
+
export { BitkitAccordion_default as BitkitAccordion, BitkitActionBar, BitkitActionMenu_default as BitkitActionMenu, BitkitAlert, BitkitAvatar, BitkitBadge, BitkitBreadcrumb, BitkitButton, BitkitCalendar, BitkitCheckbox, BitkitCheckboxGroup, BitkitCloseButton, BitkitCodeSnippet, BitkitCollapsible, BitkitColorButton, BitkitCombobox_default as BitkitCombobox, BitkitControlButton, BitkitDataWidget, BitkitDatePicker, BitkitDefinitionTooltip, BitkitDialog_default as BitkitDialog, BitkitDraggableCard, BitkitDrawer, BitkitEmptyState, BitkitExpandableCard, BitkitField, BitkitFileInput, BitkitFormDialog_default as BitkitFormDialog, BitkitGroupHeading, BitkitHeading, BitkitIconButton, BitkitInlineLoading, BitkitLabel, BitkitLabelTooltip, BitkitLabeledData, BitkitLightbox, BitkitLink, BitkitLinkButton, BitkitList_default as BitkitList, BitkitMarkdown, BitkitMarkdownCard, BitkitMultiselect_default as BitkitMultiselect, BitkitMultiselectMenu, BitkitNativeSelect, BitkitNoteCard, BitkitNumberInput, BitkitOverflowContent, BitkitOverflowTooltip, BitkitPageFooter_default as BitkitPageFooter, BitkitPageHeader, BitkitPageSidebar_default as BitkitPageSidebar, BitkitPagination, BitkitPaginationLoadMore, BitkitPopover, BitkitProgressBar, BitkitPromoBanner, Provider as BitkitProvider, BitkitRadio, BitkitRadioGroup, BitkitRibbon, BitkitSearchInput, BitkitSectionHeading, BitkitSegmentedControl_default as BitkitSegmentedControl, BitkitSelect_default as BitkitSelect, BitkitSelectMenu, BitkitSelectMenuAction, BitkitSelectableTag_default as BitkitSelectableTag, BitkitSettingsCard_default as BitkitSettingsCard, BitkitSkeletonGroup, BitkitSpinner, BitkitSplitButton_default as BitkitSplitButton, BitkitStat, BitkitSteps_default as BitkitSteps, BitkitStepsCard_default as BitkitStepsCard, BitkitStepsDialog_default as BitkitStepsDialog, BitkitSwitch, BitkitTable, BitkitTableCard, BitkitTabs, BitkitTag, BitkitTagsInput, BitkitTextArea, BitkitTextInput, BitkitToggleButton, BitkitToggletip, BitkitTooltip, BitkitTour, BitkitTreeView, IconAbortCircle, IconAbortCircleFilled, IconAddons, IconAgent, IconAnchor, IconAndroid, IconApp, IconAppSettings, IconAppStore, IconAppStoreColor, IconApple, IconArchive, IconArchiveDelete, IconArchiveRestore, IconArrowBackAndDown, IconArrowBackAndUp, IconArrowDown, IconArrowForwardAndDown, IconArrowForwardAndUp, IconArrowLeft, IconArrowNortheast, IconArrowNorthwest, IconArrowRight, IconArrowUp, IconArrowsHorizontal, IconArrowsVertical, IconAutomation, IconAws, IconAwsColor, IconBadge3RdParty, IconBadgeBitrise, IconBadgeUpgrade, IconBadgeVersionOk, IconBazel, IconBell, IconBitbot, IconBitbotError, IconBitbucket, IconBitbucketColor, IconBitbucketNeutral, IconBitbucketWhite, IconBlockCircle, IconBook, IconBoxArrowDown, IconBoxDot, IconBoxLinesOverflow, IconBoxLinesWrap, IconBranch, IconBrowserstackColor, IconBug, IconBuild, IconBuildCache, IconBuildCacheFilled, IconBuildEnvSetup, IconBuildHub, IconBuildHubFilled, IconCalendar, IconChangePlan, IconChat, IconCheck, IconCheckCircle, IconCheckCircleFilled, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconCi, IconCiFilled, IconCircle, IconCircleDashed, IconCircleHalfFilled, IconClaude, IconClaudeColor, IconClock, IconCode, IconCodePush, IconCodeSigning, IconCoffee, IconCommit, IconConfigure, IconConnectedAccounts, IconContainer, IconCopilot, IconCopy, IconCordova, IconCpu, IconCreditcard, IconCredits, IconCross, IconCrossCircle, IconCrossCircleFilled, IconCrown, IconCursor, IconCycle, IconDashboard, IconDashboardFilled, IconDeployment, IconDetails, IconDoc, IconDollar, IconDot, IconDotnet, IconDotnetColor, IconDotnetText, IconDotnetTextColor, IconDoubleCircle, IconDownload, IconDragHandle, IconEc2Ami, IconEnterprise, IconErrorCircle, IconErrorCircleFilled, IconExpand, IconExtraBuildCapacity, IconEye, IconEyeSlash, IconFastlane, IconFile, IconFileDoc, IconFilePdf, IconFilePlist, IconFileYml, IconFileZip, IconFilter, IconFlag, IconFlutter, IconFolder, IconFullscreen, IconFullscreenExit, IconGauge, IconGit, IconGithub, IconGitlab, IconGitlabColor, IconGitlabWhite, IconGlobe, IconGo, IconGoogleColor, IconGooglePlay, IconGooglePlayColor, IconGradle, IconGroup, IconHashtag, IconHeadset, IconHeart, IconHistory, IconHourglass, IconImage, IconInfoCircle, IconInfoCircleFilled, IconInsights, IconInsightsFilled, IconInstall, IconInteraction, IconInvoice, IconIonic, IconJapanese, IconJava, IconJavaColor, IconJavaDuke, IconJavaDukeColor, IconKey, IconKiroColor, IconKotlin, IconKotlinColor, IconKotlinWhite, IconLaptop, IconLaunchdarkly, IconLegacyApp, IconLightbulb, IconLink, IconLinux, IconLock, IconLockOpen, IconLogin, IconLogout, IconMacos, IconMagicWand, IconMagnifier, IconMail, IconMcp, IconMedal, IconMemory, IconMenuGrid, IconMenuHamburger, IconMessage, IconMessageAlert, IconMessageQuestion, IconMicrophone, IconMinus, IconMinusCircle, IconMinusCircleFilled, IconMobile, IconMobileLandscape, IconMonitorChart, IconMoreHorizontal, IconMoreVertical, IconNews, IconNextjs, IconNodejs, IconOpenInNew, IconOther, IconOutsideContributor, IconOverview, IconPause, IconPencil, IconPeople, IconPercent, IconPerson, IconPersonWithDesk, IconPin, IconPlay, IconPlus, IconPlusCircle, IconPlusCircleFilled, IconPower, IconProject, IconProjectSettings, IconPull, IconPush, IconPuzzle, IconPython, IconPythonColor, IconQuestionCircle, IconQuestionCircleFilled, IconReact, IconRefresh, IconRegex, IconRelease, IconReleaseFilled, IconRemoteAccess, IconReplace, IconResponsiveness, IconReviewerApproved, IconReviewerAssigned, IconReviewerRejected, IconRuby, IconRubyColor, IconSave, IconSecurityShield, IconSettings, IconSettingsFilled, IconShuffle, IconSiren, IconSkip, IconSkipCircle, IconSkipCircleFilled, IconSlack, IconSlackColor, IconSparkle, IconSparkleFilled, IconSpinnerOnDisabled, IconSpinnerPurple, IconSpinnerPurpleDouble, IconSpinnerWhite, IconStability, IconStack, IconStar, IconStep, IconStop, IconStopwatch, IconTabPlus, IconTag, IconTasks, IconTeams, IconTeamsColor, IconTemplateCode, IconTerminal, IconTerminalFilled, IconTestQuarantine, IconThemeDarkToggle, IconThumbDown, IconThumbUp, IconTools, IconTrash, IconTrigger, IconUbuntu, IconUbuntuColor, IconUnity3D, IconUnpin, IconUpload, IconValidateShield, IconVideo, IconVsCode, IconWarning, IconWarningYellow, IconWebUi, IconWebhooks, IconWindsurf, IconWorkflow, IconWorkflowFlow, IconXTwitter, IconXamarin, IconXcode, ResponsiveProvider, bitkitIcon, bitkitTheme as bitriseTheme, createBitkitToast, createTreeCollection, dismissBitkitToast, rem, useBitkitTour, useResponsive, useStepsDialog };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dark bubble BitkitTooltip and BitkitToggletip share, so a hint looks the same whether it opens
|
|
3
|
+
* on hover (a tooltip, text only) or on click (a toggletip, which can hold a link or a button).
|
|
4
|
+
*/
|
|
5
|
+
export declare const base: {
|
|
6
|
+
readonly positioner: {
|
|
7
|
+
readonly fontFamily: "body";
|
|
8
|
+
};
|
|
9
|
+
readonly content: {
|
|
10
|
+
readonly '--tooltip-bg': "colors.background/contrast";
|
|
11
|
+
readonly backgroundColor: "var(--tooltip-bg)";
|
|
12
|
+
readonly maxWidth: `${number}rem`;
|
|
13
|
+
readonly color: "text/on-contrast";
|
|
14
|
+
readonly boxShadow: "elevation/tooltip";
|
|
15
|
+
readonly zIndex: "tooltip";
|
|
16
|
+
readonly transformOrigin: "var(--transform-origin)";
|
|
17
|
+
readonly _open: {
|
|
18
|
+
readonly animationStyle: "scale-fade-in";
|
|
19
|
+
readonly animationDuration: "fast";
|
|
20
|
+
};
|
|
21
|
+
readonly _closed: {
|
|
22
|
+
readonly animationStyle: "scale-fade-out";
|
|
23
|
+
readonly animationDuration: "fast";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly arrow: {
|
|
27
|
+
readonly '--arrow-size': `${number}rem`;
|
|
28
|
+
readonly '--arrow-background': "var(--tooltip-bg)";
|
|
29
|
+
};
|
|
30
|
+
readonly arrowTip: {
|
|
31
|
+
readonly borderTopWidth: "1";
|
|
32
|
+
readonly borderInlineStartWidth: "1";
|
|
33
|
+
readonly borderColor: "var(--tooltip-bg)";
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare const variants: {
|
|
37
|
+
readonly variant: {
|
|
38
|
+
readonly dark: {
|
|
39
|
+
readonly content: {
|
|
40
|
+
readonly '--tooltip-bg': "colors.background/contrast";
|
|
41
|
+
readonly color: "text/on-contrast";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly light: {
|
|
45
|
+
readonly content: {
|
|
46
|
+
readonly '--tooltip-bg': "colors.background/tertiary";
|
|
47
|
+
readonly color: "text/primary";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly paddingSize: {
|
|
52
|
+
readonly sm: {
|
|
53
|
+
readonly content: {
|
|
54
|
+
readonly paddingInline: "8";
|
|
55
|
+
readonly paddingBlock: "4";
|
|
56
|
+
readonly borderRadius: "4";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly md: {
|
|
60
|
+
readonly content: {
|
|
61
|
+
readonly paddingInline: "12";
|
|
62
|
+
readonly paddingBlock: "8";
|
|
63
|
+
readonly borderRadius: "8";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly lg: {
|
|
67
|
+
readonly content: {
|
|
68
|
+
readonly padding: "16";
|
|
69
|
+
readonly borderRadius: "8";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly textStyle: {
|
|
74
|
+
readonly 'sm/regular': {
|
|
75
|
+
readonly content: {
|
|
76
|
+
readonly textStyle: "body/sm/regular";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly 'sm/semibold': {
|
|
80
|
+
readonly content: {
|
|
81
|
+
readonly textStyle: "body/sm/semibold";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
readonly 'md/regular': {
|
|
85
|
+
readonly content: {
|
|
86
|
+
readonly textStyle: "body/md/regular";
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { rem } from "../themeUtils.js";
|
|
2
|
+
//#region lib/theme/common/TooltipAndToggletip.common.ts
|
|
3
|
+
/**
|
|
4
|
+
* The dark bubble BitkitTooltip and BitkitToggletip share, so a hint looks the same whether it opens
|
|
5
|
+
* on hover (a tooltip, text only) or on click (a toggletip, which can hold a link or a button).
|
|
6
|
+
*/
|
|
7
|
+
var base = {
|
|
8
|
+
positioner: { fontFamily: "body" },
|
|
9
|
+
content: {
|
|
10
|
+
"--tooltip-bg": "colors.background/contrast",
|
|
11
|
+
backgroundColor: "var(--tooltip-bg)",
|
|
12
|
+
maxWidth: rem(320),
|
|
13
|
+
color: "text/on-contrast",
|
|
14
|
+
boxShadow: "elevation/tooltip",
|
|
15
|
+
zIndex: "tooltip",
|
|
16
|
+
transformOrigin: "var(--transform-origin)",
|
|
17
|
+
_open: {
|
|
18
|
+
animationStyle: "scale-fade-in",
|
|
19
|
+
animationDuration: "fast"
|
|
20
|
+
},
|
|
21
|
+
_closed: {
|
|
22
|
+
animationStyle: "scale-fade-out",
|
|
23
|
+
animationDuration: "fast"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
arrow: {
|
|
27
|
+
"--arrow-size": rem(8),
|
|
28
|
+
"--arrow-background": "var(--tooltip-bg)"
|
|
29
|
+
},
|
|
30
|
+
arrowTip: {
|
|
31
|
+
borderTopWidth: "1",
|
|
32
|
+
borderInlineStartWidth: "1",
|
|
33
|
+
borderColor: "var(--tooltip-bg)"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var variants = {
|
|
37
|
+
variant: {
|
|
38
|
+
dark: { content: {
|
|
39
|
+
"--tooltip-bg": "colors.background/contrast",
|
|
40
|
+
color: "text/on-contrast"
|
|
41
|
+
} },
|
|
42
|
+
light: { content: {
|
|
43
|
+
"--tooltip-bg": "colors.background/tertiary",
|
|
44
|
+
color: "text/primary"
|
|
45
|
+
} }
|
|
46
|
+
},
|
|
47
|
+
paddingSize: {
|
|
48
|
+
sm: { content: {
|
|
49
|
+
paddingInline: "8",
|
|
50
|
+
paddingBlock: "4",
|
|
51
|
+
borderRadius: "4"
|
|
52
|
+
} },
|
|
53
|
+
md: { content: {
|
|
54
|
+
paddingInline: "12",
|
|
55
|
+
paddingBlock: "8",
|
|
56
|
+
borderRadius: "8"
|
|
57
|
+
} },
|
|
58
|
+
lg: { content: {
|
|
59
|
+
padding: "16",
|
|
60
|
+
borderRadius: "8"
|
|
61
|
+
} }
|
|
62
|
+
},
|
|
63
|
+
textStyle: {
|
|
64
|
+
"sm/regular": { content: { textStyle: "body/sm/regular" } },
|
|
65
|
+
"sm/semibold": { content: { textStyle: "body/sm/semibold" } },
|
|
66
|
+
"md/regular": { content: { textStyle: "body/md/regular" } }
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { base, variants };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=TooltipAndToggletip.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipAndToggletip.common.js","names":[],"sources":["../../../lib/theme/common/TooltipAndToggletip.common.ts"],"sourcesContent":["import { rem } from '../themeUtils';\n\n/**\n * The dark bubble BitkitTooltip and BitkitToggletip share, so a hint looks the same whether it opens\n * on hover (a tooltip, text only) or on click (a toggletip, which can hold a link or a button).\n */\nexport const base = {\n positioner: {\n fontFamily: 'body',\n },\n content: {\n '--tooltip-bg': 'colors.background/contrast',\n backgroundColor: 'var(--tooltip-bg)',\n // Without a cap a tooltip grows to the width of its text, so a long one runs to the edge of\n // the viewport. Every component that renders a tooltip therefore has to set this, and the one\n // that forgot -- BitkitLabelTooltip -- had no cap at all. It belongs to the tooltip, not to\n // each caller. BitkitOverflowTooltip overrides it: it exists to show text that was truncated,\n // so it is allowed to be wider.\n maxWidth: rem(320),\n color: 'text/on-contrast',\n boxShadow: 'elevation/tooltip',\n zIndex: 'tooltip',\n transformOrigin: 'var(--transform-origin)',\n _open: {\n animationStyle: 'scale-fade-in',\n animationDuration: 'fast',\n },\n _closed: {\n animationStyle: 'scale-fade-out',\n animationDuration: 'fast',\n },\n },\n arrow: {\n '--arrow-size': rem(8),\n '--arrow-background': 'var(--tooltip-bg)',\n },\n arrowTip: {\n borderTopWidth: '1',\n borderInlineStartWidth: '1',\n borderColor: 'var(--tooltip-bg)',\n },\n} as const;\n\nexport const variants = {\n variant: {\n dark: {\n content: {\n '--tooltip-bg': 'colors.background/contrast',\n color: 'text/on-contrast',\n },\n },\n light: {\n content: {\n '--tooltip-bg': 'colors.background/tertiary',\n color: 'text/primary',\n },\n },\n },\n paddingSize: {\n sm: {\n content: {\n paddingInline: '8',\n paddingBlock: '4',\n borderRadius: '4',\n },\n },\n md: {\n content: {\n paddingInline: '12',\n paddingBlock: '8',\n borderRadius: '8',\n },\n },\n lg: {\n content: {\n padding: '16',\n borderRadius: '8',\n },\n },\n },\n textStyle: {\n 'sm/regular': {\n content: {\n textStyle: 'body/sm/regular',\n },\n },\n 'sm/semibold': {\n content: {\n textStyle: 'body/sm/semibold',\n },\n },\n 'md/regular': {\n content: {\n textStyle: 'body/md/regular',\n },\n },\n },\n} as const;\n"],"mappings":";;;;;;AAMA,IAAa,OAAO;CAClB,YAAY,EACV,YAAY,OACd;CACA,SAAS;EACP,gBAAgB;EAChB,iBAAiB;EAMjB,UAAU,IAAI,GAAG;EACjB,OAAO;EACP,WAAW;EACX,QAAQ;EACR,iBAAiB;EACjB,OAAO;GACL,gBAAgB;GAChB,mBAAmB;EACrB;EACA,SAAS;GACP,gBAAgB;GAChB,mBAAmB;EACrB;CACF;CACA,OAAO;EACL,gBAAgB,IAAI,CAAC;EACrB,sBAAsB;CACxB;CACA,UAAU;EACR,gBAAgB;EAChB,wBAAwB;EACxB,aAAa;CACf;AACF;AAEA,IAAa,WAAW;CACtB,SAAS;EACP,MAAM,EACJ,SAAS;GACP,gBAAgB;GAChB,OAAO;EACT,EACF;EACA,OAAO,EACL,SAAS;GACP,gBAAgB;GAChB,OAAO;EACT,EACF;CACF;CACA,aAAa;EACX,IAAI,EACF,SAAS;GACP,eAAe;GACf,cAAc;GACd,cAAc;EAChB,EACF;EACA,IAAI,EACF,SAAS;GACP,eAAe;GACf,cAAc;GACd,cAAc;EAChB,EACF;EACA,IAAI,EACF,SAAS;GACP,SAAS;GACT,cAAc;EAChB,EACF;CACF;CACA,WAAW;EACT,cAAc,EACZ,SAAS,EACP,WAAW,kBACb,EACF;EACA,eAAe,EACb,SAAS,EACP,WAAW,mBACb,EACF;EACA,cAAc,EACZ,SAAS,EACP,WAAW,kBACb,EACF;CACF;AACF"}
|
|
@@ -39,8 +39,8 @@ declare const datePickerSelectSlotRecipe: import('@chakra-ui/react').SlotRecipeD
|
|
|
39
39
|
textStyle: "body/md/semibold";
|
|
40
40
|
};
|
|
41
41
|
} | undefined;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
itemList?: {
|
|
43
|
+
maxHeight: `${number}rem`;
|
|
44
44
|
} | undefined;
|
|
45
45
|
itemLabel?: {
|
|
46
46
|
textStyle: "body/md/regular";
|
|
@@ -52,18 +52,6 @@ declare const datePickerSelectSlotRecipe: import('@chakra-ui/react').SlotRecipeD
|
|
|
52
52
|
emptyState?: {
|
|
53
53
|
paddingBlock: "8";
|
|
54
54
|
} | undefined;
|
|
55
|
-
errorState?: {
|
|
56
|
-
paddingBlock: "4";
|
|
57
|
-
} | undefined;
|
|
58
|
-
errorLabel?: {
|
|
59
|
-
textStyle: "body/md/regular";
|
|
60
|
-
} | undefined;
|
|
61
|
-
errorIcon?: {
|
|
62
|
-
marginBlockStart: "4";
|
|
63
|
-
} | undefined;
|
|
64
|
-
errorTextBlock?: {
|
|
65
|
-
paddingBlock: "2";
|
|
66
|
-
} | undefined;
|
|
67
55
|
action?: {
|
|
68
56
|
minHeight: "40";
|
|
69
57
|
paddingBlock: "8";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const selectSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"content" | "label" | "checkbox" | "list" | "avatar" | "emptyState" | "root" | "item" | "itemContent" | "itemIndicator" | "trigger" | "positioner" | "indicator" | "itemGroup" | "itemGroupLabel" | "itemText" | "valueText" | "action" | "clearTrigger" | "control" | "actionContainer" | "
|
|
1
|
+
export declare const selectSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"content" | "label" | "checkbox" | "list" | "avatar" | "emptyState" | "root" | "item" | "itemContent" | "itemIndicator" | "trigger" | "positioner" | "indicator" | "itemGroup" | "itemGroupLabel" | "itemText" | "valueText" | "action" | "clearTrigger" | "control" | "actionContainer" | "searchInputGroup" | "searchInput" | "searchClear" | "itemList" | "itemLoading" | "itemLoadingLabel" | "itemLabel" | "itemHelperText" | "indicatorGroup" | "checkmark" | "itemBadge" | "itemIcon" | "valueIcon", {
|
|
2
2
|
hasStatusIcon: {
|
|
3
3
|
true: {
|
|
4
4
|
trigger: {
|
|
@@ -39,8 +39,8 @@ export declare const selectSlotRecipe: import('@chakra-ui/react').SlotRecipeDefi
|
|
|
39
39
|
textStyle: "body/lg/semibold";
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
itemList: {
|
|
43
|
+
maxHeight: `${number}rem`;
|
|
44
44
|
};
|
|
45
45
|
itemLabel: {
|
|
46
46
|
textStyle: "body/lg/regular";
|
|
@@ -52,12 +52,6 @@ export declare const selectSlotRecipe: import('@chakra-ui/react').SlotRecipeDefi
|
|
|
52
52
|
emptyState: {
|
|
53
53
|
paddingBlock: "12";
|
|
54
54
|
};
|
|
55
|
-
errorState: {
|
|
56
|
-
paddingBlock: "8";
|
|
57
|
-
};
|
|
58
|
-
errorLabel: {
|
|
59
|
-
textStyle: "body/lg/regular";
|
|
60
|
-
};
|
|
61
55
|
action: {
|
|
62
56
|
minHeight: "48";
|
|
63
57
|
paddingBlock: "12";
|
|
@@ -104,8 +98,8 @@ export declare const selectSlotRecipe: import('@chakra-ui/react').SlotRecipeDefi
|
|
|
104
98
|
textStyle: "body/md/semibold";
|
|
105
99
|
};
|
|
106
100
|
};
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
itemList: {
|
|
102
|
+
maxHeight: `${number}rem`;
|
|
109
103
|
};
|
|
110
104
|
itemLabel: {
|
|
111
105
|
textStyle: "body/md/regular";
|
|
@@ -117,18 +111,6 @@ export declare const selectSlotRecipe: import('@chakra-ui/react').SlotRecipeDefi
|
|
|
117
111
|
emptyState: {
|
|
118
112
|
paddingBlock: "8";
|
|
119
113
|
};
|
|
120
|
-
errorState: {
|
|
121
|
-
paddingBlock: "4";
|
|
122
|
-
};
|
|
123
|
-
errorLabel: {
|
|
124
|
-
textStyle: "body/md/regular";
|
|
125
|
-
};
|
|
126
|
-
errorIcon: {
|
|
127
|
-
marginBlockStart: "4";
|
|
128
|
-
};
|
|
129
|
-
errorTextBlock: {
|
|
130
|
-
paddingBlock: "2";
|
|
131
|
-
};
|
|
132
114
|
action: {
|
|
133
115
|
minHeight: "40";
|
|
134
116
|
paddingBlock: "8";
|