@bitrise/bitkit-v2 0.3.546 → 0.3.548
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 +2 -1
- package/dist/components/BitkitActionBar/BitkitActionBar.js +2 -1
- package/dist/components/BitkitActionBar/BitkitActionBar.js.map +1 -1
- package/dist/components/BitkitButton/BitkitButton.js +7 -2
- package/dist/components/BitkitButton/BitkitButton.js.map +1 -1
- package/dist/components/BitkitCalendar/BitkitCalendar.js +3 -2
- package/dist/components/BitkitCalendar/BitkitCalendar.js.map +1 -1
- package/dist/components/BitkitContentWrapper/BitkitContentWrapperStickyBar.d.ts +1 -1
- package/dist/components/BitkitContentWrapper/BitkitContentWrapperStickyBar.js.map +1 -1
- package/dist/components/BitkitDialog/DialogShell.js +2 -1
- package/dist/components/BitkitDialog/DialogShell.js.map +1 -1
- package/dist/components/BitkitDrawer/BitkitDrawer.js +5 -1
- package/dist/components/BitkitDrawer/BitkitDrawer.js.map +1 -1
- package/dist/components/BitkitIconButton/BitkitIconButton.js +7 -2
- package/dist/components/BitkitIconButton/BitkitIconButton.js.map +1 -1
- package/dist/components/BitkitLightbox/BitkitLightbox.js +2 -1
- package/dist/components/BitkitLightbox/BitkitLightbox.js.map +1 -1
- package/dist/components/BitkitPageHeader/BitkitPageHeader.d.ts +27 -23
- package/dist/components/BitkitPageHeader/BitkitPageHeader.js +42 -9
- package/dist/components/BitkitPageHeader/BitkitPageHeader.js.map +1 -1
- package/dist/components/BitkitPageHeader/pageHeaderBottom.d.ts +18 -0
- package/dist/components/BitkitPageHeader/pageHeaderBottom.js +21 -0
- package/dist/components/BitkitPageHeader/pageHeaderBottom.js.map +1 -0
- package/dist/components/BitkitPageHeader/usePageHeaderBottom.d.ts +7 -0
- package/dist/components/BitkitPageHeader/usePageHeaderBottom.js +38 -0
- package/dist/components/BitkitPageHeader/usePageHeaderBottom.js.map +1 -0
- package/dist/components/BitkitPageHeader/useSelfSticky.d.ts +16 -0
- package/dist/components/BitkitPageHeader/useSelfSticky.js +76 -0
- package/dist/components/BitkitPageHeader/useSelfSticky.js.map +1 -0
- package/dist/components/BitkitPageSidebar/BitkitPageSidebar.d.ts +6 -0
- package/dist/components/BitkitPageSidebar/BitkitPageSidebar.js +5 -2
- package/dist/components/BitkitPageSidebar/BitkitPageSidebar.js.map +1 -1
- package/dist/components/BitkitPopover/BitkitPopover.js +3 -2
- package/dist/components/BitkitPopover/BitkitPopover.js.map +1 -1
- package/dist/components/BitkitSplitButton/BitkitSplitButton.js +4 -1
- package/dist/components/BitkitSplitButton/BitkitSplitButton.js.map +1 -1
- package/dist/components/BitkitToggleButton/BitkitToggleButton.js +4 -1
- package/dist/components/BitkitToggleButton/BitkitToggleButton.js.map +1 -1
- package/dist/components/BitkitUIHeader/BitkitUIHeader.d.ts +1 -0
- package/dist/components/BitkitUIHeader/BitkitUIHeader.js +2 -1
- package/dist/components/BitkitUIHeader/BitkitUIHeader.js.map +1 -1
- package/dist/components/BitkitUIHeader/usePublishedBottom.d.ts +1 -0
- package/dist/components/BitkitUIHeader/usePublishedBottom.js +1 -1
- package/dist/components/BitkitUIHeader/usePublishedBottom.js.map +1 -1
- package/dist/components/BitkitUIHeader/useUiHeaderBottom.d.ts +6 -0
- package/dist/components/BitkitUIHeader/useUiHeaderBottom.js +29 -0
- package/dist/components/BitkitUIHeader/useUiHeaderBottom.js.map +1 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/main.js +5 -2
- package/dist/theme/global-css.js +6 -0
- package/dist/theme/global-css.js.map +1 -1
- package/dist/theme/slot-recipes/Breadcrumb.recipe.js +5 -1
- package/dist/theme/slot-recipes/Breadcrumb.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/PageHeader.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/PageSidebar.recipe.d.ts +32 -0
- package/dist/theme/slot-recipes/PageSidebar.recipe.js +30 -0
- package/dist/theme/slot-recipes/PageSidebar.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/index.d.ts +25 -0
- package/dist/theme/tokens/index.d.ts +3 -0
- package/dist/theme/tokens/keyframes.js +5 -0
- package/dist/theme/tokens/keyframes.js.map +1 -1
- package/dist/theme/tokens/zIndex.d.ts +3 -0
- package/dist/theme/tokens/zIndex.js +1 -0
- package/dist/theme/tokens/zIndex.js.map +1 -1
- package/dist/utilities/ControlSizeContext.d.ts +15 -0
- package/dist/utilities/ControlSizeContext.js +20 -0
- package/dist/utilities/ControlSizeContext.js.map +1 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -82,7 +82,8 @@ import { BitkitProvider, BitkitButton } from '@bitrise/bitkit-v2';
|
|
|
82
82
|
|
|
83
83
|
- **Don't rebuild what Bitkit has.** Before hand-building a dialog, select, search input, list, table, tabs or empty state from Chakra primitives or HTML, look for the Bitkit component in the MCP. Raw Chakra is for layout and text (`Box`, `Stack`, `Text`) only — never Chakra's own `Button`, `Input`, `Dialog` and the like: the Bitkit theme styles them, so they look right, but they lack Bitkit's API and behaviour.
|
|
84
84
|
- **A whole page starts from the page-level components** — `BitkitPageHeader`, `BitkitPageSubheader`, `BitkitContentWrapper`, `BitkitUISideNav`, `BitkitPageFooter` — not from a hand-built frame. Before building or changing a page layout, read the `Docs/Page Layout` page: content widths, alignment, spacing and heading levels.
|
|
85
|
-
- **Clear a pinned `BitkitUIHeader` with `uiHeaderBottom`** — anything that has to start below it (a sticky row's `insetBlockStart`, a `scrollMarginTop`) uses `uiHeaderBottom`, which the header measures itself, banner and anything pushing it down included. Don't add up the header's and banners' heights by hand.
|
|
85
|
+
- **Clear a pinned `BitkitUIHeader` with `uiHeaderBottom`** — anything that has to start below it on a page without a sticky page header (a sticky row's `insetBlockStart`, a `scrollMarginTop`) uses `uiHeaderBottom`, which the header measures itself, banner and anything pushing it down included. Don't add up the header's and banners' heights by hand.
|
|
86
|
+
- **The page header sticks** — pass `sticky` to `BitkitPageHeader`, and to a `BitkitPageSidebar` below it; rows that stick under it use `pageHeaderBottom`. End the breadcrumb with a `BitkitBreadcrumb.CurrentItem` carrying the title, and use `CurrentItem` for nothing else. Don't wire your own scroll detection, and don't size the header's actions by hand: they follow the header. In JS, `usePageHeaderBottom()` and `useUiHeaderBottom()` give `pageHeaderBottom` and `uiHeaderBottom` as numbers.
|
|
86
87
|
- **Handle every state of a data view.** Anything that shows data needs a loading state (see *Skeleton loading*), an empty state (`BitkitEmptyState`) and an error state (`BitkitAlert`, or `createBitkitToast` for a failed action).
|
|
87
88
|
- **Don't override a Bitkit component's styling** — no `border`, `borderRadius`, `background`, `boxShadow` or `color` fighting its design — and don't pass an empty or placeholder value just to satisfy a required prop. Layout props (`width`, `flex`, `margin*`, …) are fine.
|
|
88
89
|
- **When Bitkit doesn't fit, it's a design-system gap, not a styling task.** Stop and tell the user; the gap gets fixed in Bitkit, once. At Bitrise, report it in #engineering-domain-frontend.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResetControlSize } from "../../utilities/ControlSizeContext.js";
|
|
1
2
|
import BitkitCloseButton from "../BitkitCloseButton/BitkitCloseButton.js";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { ActionBar } from "@chakra-ui/react/action-bar";
|
|
@@ -15,7 +16,7 @@ var BitkitActionBar = (props) => {
|
|
|
15
16
|
children: [countValue, " selected"]
|
|
16
17
|
}),
|
|
17
18
|
/* @__PURE__ */ jsx(ActionBar.Separator, {}),
|
|
18
|
-
children,
|
|
19
|
+
/* @__PURE__ */ jsx(ResetControlSize, { children }),
|
|
19
20
|
!!onClose && /* @__PURE__ */ jsx(BitkitCloseButton, {
|
|
20
21
|
colorVariant: "neutral",
|
|
21
22
|
onClick: onClose,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitActionBar.js","names":[],"sources":["../../../lib/components/BitkitActionBar/BitkitActionBar.tsx"],"sourcesContent":["import { ActionBar, type ActionBarRootProps } from '@chakra-ui/react/action-bar';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ReactNode } from 'react';\n\nimport BitkitCloseButton from '../BitkitCloseButton/BitkitCloseButton';\n\nexport interface BitkitActionBarProps extends ActionBarRootProps {\n children: ReactNode;\n countValue: number;\n onClose?: () => void;\n}\n\nconst BitkitActionBar = (props: BitkitActionBarProps) => {\n const { children, countValue, onClose, size, ...rest } = props;\n return (\n <ActionBar.Root size={size} {...rest}>\n <Portal>\n <ActionBar.Positioner>\n <ActionBar.Content>\n <ActionBar.SelectionTrigger tabIndex={-1} textStyle={size === 'xs' ? 'body/sm/regular' : 'body/md/regular'}>\n {countValue} selected\n </ActionBar.SelectionTrigger>\n <ActionBar.Separator />\n {children}
|
|
1
|
+
{"version":3,"file":"BitkitActionBar.js","names":[],"sources":["../../../lib/components/BitkitActionBar/BitkitActionBar.tsx"],"sourcesContent":["import { ActionBar, type ActionBarRootProps } from '@chakra-ui/react/action-bar';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ReactNode } from 'react';\n\nimport { ResetControlSize } from '../../utilities/ControlSizeContext';\nimport BitkitCloseButton from '../BitkitCloseButton/BitkitCloseButton';\n\nexport interface BitkitActionBarProps extends ActionBarRootProps {\n children: ReactNode;\n countValue: number;\n onClose?: () => void;\n}\n\nconst BitkitActionBar = (props: BitkitActionBarProps) => {\n const { children, countValue, onClose, size, ...rest } = props;\n return (\n <ActionBar.Root size={size} {...rest}>\n <Portal>\n <ActionBar.Positioner>\n <ActionBar.Content>\n <ActionBar.SelectionTrigger tabIndex={-1} textStyle={size === 'xs' ? 'body/sm/regular' : 'body/md/regular'}>\n {countValue} selected\n </ActionBar.SelectionTrigger>\n <ActionBar.Separator />\n <ResetControlSize>{children}</ResetControlSize>\n {!!onClose && <BitkitCloseButton colorVariant=\"neutral\" onClick={onClose} size={size} />}\n </ActionBar.Content>\n </ActionBar.Positioner>\n </Portal>\n </ActionBar.Root>\n );\n};\n\nexport default BitkitActionBar;\n"],"mappings":";;;;;;AAaA,IAAM,mBAAmB,UAAgC;CACvD,MAAM,EAAE,UAAU,YAAY,SAAS,MAAM,GAAG,SAAS;CACzD,OACE,oBAAC,UAAU,MAAX;EAAsB;EAAM,GAAI;EAC9B,UAAA,oBAAC,QAAD,EAAA,UACE,oBAAC,UAAU,YAAX,EAAA,UACE,qBAAC,UAAU,SAAX,EAAA,UAAA;GACE,qBAAC,UAAU,kBAAX;IAA4B,UAAU;IAAI,WAAW,SAAS,OAAO,oBAAoB;IAAzF,UAAA,CACG,YAAW,WACc;;GAC5B,oBAAC,UAAU,WAAX,CAAsB,CAAA;GACtB,oBAAC,kBAAD,EAAmB,SAA2B,CAAA;GAC7C,CAAC,CAAC,WAAW,oBAAC,mBAAD;IAAmB,cAAa;IAAU,SAAS;IAAe;GAAO,CAAA;EACtE,EAAA,CAAA,EACC,CAAA,EAChB,CAAA;CACM,CAAA;AAEpB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useControlSizeFromContext } from "../../utilities/ControlSizeContext.js";
|
|
1
2
|
import focusableDisabledProps from "../../utilities/focusableDisabledProps.js";
|
|
2
3
|
import BitkitTooltip from "../BitkitTooltip/BitkitTooltip.js";
|
|
3
4
|
import { chakra, useRecipe } from "@chakra-ui/react/styled-system";
|
|
@@ -10,7 +11,9 @@ var BitkitButton = forwardRef((props, ref) => {
|
|
|
10
11
|
const buttonRecipe = useRecipe({ key: "button" });
|
|
11
12
|
const Icon = props.icon;
|
|
12
13
|
const SuffixIcon = props.suffixIcon;
|
|
13
|
-
const
|
|
14
|
+
const contextSize = useControlSizeFromContext();
|
|
15
|
+
const size = props.size ?? contextSize;
|
|
16
|
+
const iconSize = (size ?? "lg") === "lg" ? "24" : "16";
|
|
14
17
|
const isDisabled = props.state === "disabled";
|
|
15
18
|
const isSkeleton = props.state === "skeleton";
|
|
16
19
|
if (props.asChild) {
|
|
@@ -22,6 +25,7 @@ var BitkitButton = forwardRef((props, ref) => {
|
|
|
22
25
|
loading: state === "loading",
|
|
23
26
|
ref,
|
|
24
27
|
...buttonRest,
|
|
28
|
+
size,
|
|
25
29
|
children: cloneElement(onlyChild, void 0, /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
26
30
|
Icon && /* @__PURE__ */ jsx(Icon, {
|
|
27
31
|
marginInlineStart: "-4",
|
|
@@ -41,7 +45,7 @@ var BitkitButton = forwardRef((props, ref) => {
|
|
|
41
45
|
}) : buttonElement;
|
|
42
46
|
}
|
|
43
47
|
if (props.href !== void 0) {
|
|
44
|
-
const { children, css, href, icon: _icon, isExternal, onClick, onKeyDown, rel, size, state: _state, suffixIcon: _suffixIcon, target, variant, ...anchorRest } = props;
|
|
48
|
+
const { children, css, href, icon: _icon, isExternal, onClick, onKeyDown, rel, size: _size, state: _state, suffixIcon: _suffixIcon, target, variant, ...anchorRest } = props;
|
|
45
49
|
const effectiveTarget = isExternal ? "_blank" : target;
|
|
46
50
|
const effectiveRel = isExternal ? rel ? `${rel} noreferrer noopener` : "noreferrer noopener" : rel;
|
|
47
51
|
const handleClick = isDisabled ? (e) => {
|
|
@@ -96,6 +100,7 @@ var BitkitButton = forwardRef((props, ref) => {
|
|
|
96
100
|
loading: state === "loading",
|
|
97
101
|
ref,
|
|
98
102
|
...buttonRest,
|
|
103
|
+
size,
|
|
99
104
|
...hasReason && focusableDisabledProps,
|
|
100
105
|
children: [
|
|
101
106
|
Icon && /* @__PURE__ */ jsx(Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitButton.js","names":["_Fragment"],"sources":["../../../lib/components/BitkitButton/BitkitButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport focusableDisabledProps from '../../utilities/focusableDisabledProps';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\ntype BitkitButtonOmittedFromButton =\n 'asChild' | 'children' | 'colorPalette' | 'disabled' | 'loading' | 'loadingText' | 'spinner' | 'spinnerPlacement';\n\ninterface BitkitButtonCommonProps {\n icon?: BitkitIconComponent;\n suffixIcon?: BitkitIconComponent;\n}\n\nexport interface BitkitButtonAsButtonProps\n extends BitkitButtonCommonProps, Omit<ButtonProps, BitkitButtonOmittedFromButton> {\n asChild?: false;\n children: string;\n /**\n * Why the button is disabled, shown in a tooltip on it while `state` is `\"disabled\"`. The button\n * then stays focusable (`aria-disabled` instead of the native attribute), so the tooltip opens on\n * hover and focus, and screen readers announce the reason. Use it instead of wrapping a disabled\n * button in `BitkitTooltip`.\n */\n disabledReason?: string;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport interface BitkitButtonAsAnchorProps\n extends BitkitButtonCommonProps, Omit<HTMLChakraProps<'a'>, 'children' | 'colorPalette'>, RecipeProps<'button'> {\n asChild?: false;\n children: string;\n href: string;\n isExternal?: boolean;\n state?: 'disabled' | 'skeleton';\n}\n\ninterface BitkitButtonAsChildProps extends BitkitButtonCommonProps, Omit<ButtonProps, BitkitButtonOmittedFromButton> {\n asChild: true;\n children: ReactElement;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport type BitkitButtonProps = BitkitButtonAsButtonProps | BitkitButtonAsAnchorProps | BitkitButtonAsChildProps;\n\n// The forwarded ref is typed as HTMLElement to cover all three modes (button, anchor, slot/asChild),\n// since asChild can render any element (router Link, custom wrappers, etc.). Inner narrow casts\n// satisfy the wrapped Chakra components without affecting the consumer-visible ref shape.\nconst BitkitButton = forwardRef<HTMLElement, BitkitButtonProps>((props, ref) => {\n const buttonRecipe = useRecipe({ key: 'button' });\n const Icon = props.icon;\n const SuffixIcon = props.suffixIcon;\n // Resolve the size the recipe would apply before branching on it: an unset `size` reaches us as\n // `undefined` because the recipe's default lives in CSS, not on the prop. Keep the fallback equal\n // to `defaultVariants.size` in Button.recipe.ts.\n const
|
|
1
|
+
{"version":3,"file":"BitkitButton.js","names":["_Fragment"],"sources":["../../../lib/components/BitkitButton/BitkitButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport { useControlSizeFromContext } from '../../utilities/ControlSizeContext';\nimport focusableDisabledProps from '../../utilities/focusableDisabledProps';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\ntype BitkitButtonOmittedFromButton =\n 'asChild' | 'children' | 'colorPalette' | 'disabled' | 'loading' | 'loadingText' | 'spinner' | 'spinnerPlacement';\n\ninterface BitkitButtonCommonProps {\n icon?: BitkitIconComponent;\n suffixIcon?: BitkitIconComponent;\n}\n\nexport interface BitkitButtonAsButtonProps\n extends BitkitButtonCommonProps, Omit<ButtonProps, BitkitButtonOmittedFromButton> {\n asChild?: false;\n children: string;\n /**\n * Why the button is disabled, shown in a tooltip on it while `state` is `\"disabled\"`. The button\n * then stays focusable (`aria-disabled` instead of the native attribute), so the tooltip opens on\n * hover and focus, and screen readers announce the reason. Use it instead of wrapping a disabled\n * button in `BitkitTooltip`.\n */\n disabledReason?: string;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport interface BitkitButtonAsAnchorProps\n extends BitkitButtonCommonProps, Omit<HTMLChakraProps<'a'>, 'children' | 'colorPalette'>, RecipeProps<'button'> {\n asChild?: false;\n children: string;\n href: string;\n isExternal?: boolean;\n state?: 'disabled' | 'skeleton';\n}\n\ninterface BitkitButtonAsChildProps extends BitkitButtonCommonProps, Omit<ButtonProps, BitkitButtonOmittedFromButton> {\n asChild: true;\n children: ReactElement;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport type BitkitButtonProps = BitkitButtonAsButtonProps | BitkitButtonAsAnchorProps | BitkitButtonAsChildProps;\n\n// The forwarded ref is typed as HTMLElement to cover all three modes (button, anchor, slot/asChild),\n// since asChild can render any element (router Link, custom wrappers, etc.). Inner narrow casts\n// satisfy the wrapped Chakra components without affecting the consumer-visible ref shape.\nconst BitkitButton = forwardRef<HTMLElement, BitkitButtonProps>((props, ref) => {\n const buttonRecipe = useRecipe({ key: 'button' });\n const Icon = props.icon;\n const SuffixIcon = props.suffixIcon;\n // Resolve the size the recipe would apply before branching on it: an unset `size` reaches us as\n // `undefined` because the recipe's default lives in CSS, not on the prop. Keep the fallback equal\n // to `defaultVariants.size` in Button.recipe.ts.\n const contextSize = useControlSizeFromContext();\n const size = props.size ?? contextSize;\n const iconSize = (size ?? 'lg') === 'lg' ? '24' : '16';\n const isDisabled = props.state === 'disabled';\n const isSkeleton = props.state === 'skeleton';\n\n // --- Slot mode (asChild) ---\n if (props.asChild) {\n const { asChild: _asChild, children, icon: _icon, state, suffixIcon: _suffixIcon, ...buttonRest } = props;\n const onlyChild = Children.only(children) as ReactElement<{ children?: ReactNode }>;\n const buttonElement = (\n <Button\n asChild\n disabled={isDisabled}\n loading={state === 'loading'}\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n size={size}\n >\n {cloneElement(\n onlyChild,\n undefined,\n <>\n {Icon && <Icon marginInlineStart=\"-4\" size={iconSize} />}\n {onlyChild.props.children}\n {SuffixIcon && <SuffixIcon marginInlineEnd=\"-4\" size={iconSize} />}\n </>,\n )}\n </Button>\n );\n return isSkeleton ? (\n <Skeleton asChild loading>\n {buttonElement}\n </Skeleton>\n ) : (\n buttonElement\n );\n }\n\n // --- Anchor mode (href) ---\n if (props.href !== undefined) {\n const {\n children,\n css,\n href,\n icon: _icon,\n isExternal,\n onClick,\n onKeyDown,\n rel,\n size: _size,\n state: _state,\n suffixIcon: _suffixIcon,\n target,\n variant,\n ...anchorRest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n const handleClick = isDisabled\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n const handleKeyDown = isDisabled\n ? (e: KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n : onKeyDown;\n const anchorElement = (\n <chakra.a\n ref={ref as Ref<HTMLAnchorElement>}\n {...anchorRest}\n aria-disabled={isDisabled || undefined}\n // A native <a> can't be `:disabled`, so mark `data-disabled` too: it's the styling/interaction hook the\n // recipe's `_hover`/`_active` conditions exclude (`:not(…, [data-disabled])`), while `aria-disabled` stays\n // for a11y. Without it, hover/active would still match a disabled anchor and override the disabled colors.\n css={[buttonRecipe({ size, variant }), css]}\n data-disabled={isDisabled || undefined}\n href={isDisabled ? undefined : href}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n rel={effectiveRel}\n target={effectiveTarget}\n >\n {Icon && <Icon marginInlineStart=\"-4\" size={iconSize} />}\n {children}\n {SuffixIcon && <SuffixIcon marginInlineEnd=\"-4\" size={iconSize} />}\n </chakra.a>\n );\n return isSkeleton ? (\n <Skeleton asChild loading>\n {anchorElement}\n </Skeleton>\n ) : (\n anchorElement\n );\n }\n\n // --- Button mode (default) ---\n const { children, disabledReason, icon: _icon, state, suffixIcon: _suffixIcon, ...buttonRest } = props;\n const hasReason = isDisabled && !!disabledReason;\n const buttonElement = (\n <Skeleton asChild loading={isSkeleton}>\n <Button\n disabled={isDisabled && !hasReason}\n loading={state === 'loading'}\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n size={size}\n {...(hasReason && focusableDisabledProps)}\n >\n {Icon && <Icon marginInlineStart=\"-4\" size={iconSize} />}\n {children}\n {SuffixIcon && <SuffixIcon marginInlineEnd=\"-4\" size={iconSize} />}\n </Button>\n </Skeleton>\n );\n // Always wrapped, like the icon button's label tooltip: adding the wrapper only with a reason would\n // remount the button whenever the reason or the state changes, and drop its focus.\n return (\n <BitkitTooltip disabled={!hasReason} text={disabledReason ?? ''}>\n {buttonElement}\n </BitkitTooltip>\n );\n});\n\nBitkitButton.displayName = 'BitkitButton';\n\nexport default BitkitButton;\n"],"mappings":";;;;;;;;;AAiEA,IAAM,eAAe,YAA4C,OAAO,QAAQ;CAC9E,MAAM,eAAe,UAAU,EAAE,KAAK,SAAS,CAAC;CAChD,MAAM,OAAO,MAAM;CACnB,MAAM,aAAa,MAAM;CAIzB,MAAM,cAAc,0BAA0B;CAC9C,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,YAAY,QAAQ,UAAU,OAAO,OAAO;CAClD,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,aAAa,MAAM,UAAU;CAGnC,IAAI,MAAM,SAAS;EACjB,MAAM,EAAE,SAAS,UAAU,UAAU,MAAM,OAAO,OAAO,YAAY,aAAa,GAAG,eAAe;EACpG,MAAM,YAAY,SAAS,KAAK,QAAQ;EACxC,MAAM,gBACJ,oBAAC,QAAD;GACE,SAAA;GACA,UAAU;GACV,SAAS,UAAU;GACd;GACL,GAAI;GACE;GAEL,UAAA,aACC,WACA,KAAA,GACA,qBAAAA,YAAA,EAAA,UAAA;IACG,QAAQ,oBAAC,MAAD;KAAM,mBAAkB;KAAK,MAAM;IAAW,CAAA;IACtD,UAAU,MAAM;IAChB,cAAc,oBAAC,YAAD;KAAY,iBAAgB;KAAK,MAAM;IAAW,CAAA;GACjE,EAAA,CAAA,CACJ;EACM,CAAA;EAEV,OAAO,aACL,oBAAC,UAAD;GAAU,SAAA;GAAQ,SAAA;GACf,UAAA;EACO,CAAA,IAEV;CAEJ;CAGA,IAAI,MAAM,SAAS,KAAA,GAAW;EAC5B,MAAM,EACJ,UACA,KACA,MACA,MAAM,OACN,YACA,SACA,WACA,KACA,MAAM,OACN,OAAO,QACP,YAAY,aACZ,QACA,SACA,GAAG,eACD;EACJ,MAAM,kBAAkB,aAAa,WAAW;EAChD,MAAM,eAAe,aAAc,MAAM,GAAG,IAAI,wBAAwB,wBAAyB;EACjG,MAAM,cAAc,cACf,MAAqC;GACpC,EAAE,eAAe;GACjB,EAAE,gBAAgB;EACpB,IACA;EACJ,MAAM,gBAAgB,cACjB,MAAwC;GACvC,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;IACtC,EAAE,eAAe;IACjB,EAAE,gBAAgB;GACpB;EACF,IACA;EACJ,MAAM,gBACJ,qBAAC,OAAO,GAAR;GACO;GACL,GAAI;GACJ,iBAAe,cAAc,KAAA;GAI7B,KAAK,CAAC,aAAa;IAAE;IAAM;GAAQ,CAAC,GAAG,GAAG;GAC1C,iBAAe,cAAc,KAAA;GAC7B,MAAM,aAAa,KAAA,IAAY;GAC/B,SAAS;GACT,WAAW;GACX,KAAK;GACL,QAAQ;GAbV,UAAA;IAeG,QAAQ,oBAAC,MAAD;KAAM,mBAAkB;KAAK,MAAM;IAAW,CAAA;IACtD;IACA,cAAc,oBAAC,YAAD;KAAY,iBAAgB;KAAK,MAAM;IAAW,CAAA;GACzD;;EAEZ,OAAO,aACL,oBAAC,UAAD;GAAU,SAAA;GAAQ,SAAA;GACf,UAAA;EACO,CAAA,IAEV;CAEJ;CAGA,MAAM,EAAE,UAAU,gBAAgB,MAAM,OAAO,OAAO,YAAY,aAAa,GAAG,eAAe;CACjG,MAAM,YAAY,cAAc,CAAC,CAAC;CAClC,MAAM,gBACJ,oBAAC,UAAD;EAAU,SAAA;EAAQ,SAAS;EACzB,UAAA,qBAAC,QAAD;GACE,UAAU,cAAc,CAAC;GACzB,SAAS,UAAU;GACd;GACL,GAAI;GACE;GACN,GAAK,aAAa;GANpB,UAAA;IAQG,QAAQ,oBAAC,MAAD;KAAM,mBAAkB;KAAK,MAAM;IAAW,CAAA;IACtD;IACA,cAAc,oBAAC,YAAD;KAAY,iBAAgB;KAAK,MAAM;IAAW,CAAA;GAC3D;;CACA,CAAA;CAIZ,OACE,oBAAC,eAAD;EAAe,UAAU,CAAC;EAAW,MAAM,kBAAkB;EAC1D,UAAA;CACY,CAAA;AAEnB,CAAC;AAED,aAAa,cAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DatePicker } from "../../atoms/DatePicker/DatePicker.js";
|
|
2
|
+
import { ResetControlSize } from "../../utilities/ControlSizeContext.js";
|
|
2
3
|
import { calendarDateToDate, dateToCalendarDate } from "./Calendar.utils.js";
|
|
3
4
|
import CalendarContent from "./components/CalendarContent.js";
|
|
4
5
|
import CalendarTrigger from "./components/CalendarTrigger.js";
|
|
@@ -12,7 +13,7 @@ var BitkitCalendar = forwardRef((props, ref) => {
|
|
|
12
13
|
const maxCalendarDate = useMemo(() => max ? dateToCalendarDate(max) : void 0, [max]);
|
|
13
14
|
const value = inputValue === void 0 ? void 0 : (inputValue ?? []).map(dateToCalendarDate);
|
|
14
15
|
const inline = !children;
|
|
15
|
-
const content = /* @__PURE__ */ jsx(CalendarContent, {
|
|
16
|
+
const content = /* @__PURE__ */ jsx(ResetControlSize, { children: /* @__PURE__ */ jsx(CalendarContent, {
|
|
16
17
|
dayTooltip,
|
|
17
18
|
device,
|
|
18
19
|
footer,
|
|
@@ -21,7 +22,7 @@ var BitkitCalendar = forwardRef((props, ref) => {
|
|
|
21
22
|
min: minCalendarDate,
|
|
22
23
|
selectionMode,
|
|
23
24
|
showSelectedDate
|
|
24
|
-
});
|
|
25
|
+
}) });
|
|
25
26
|
const showOutsideDays = showOutsideDaysProp ?? layout === "1-month";
|
|
26
27
|
return /* @__PURE__ */ jsxs(DatePicker.Root, {
|
|
27
28
|
closeOnSelect: !footer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitCalendar.js","names":[],"sources":["../../../lib/components/BitkitCalendar/BitkitCalendar.tsx"],"sourcesContent":["import { Portal } from '@chakra-ui/react/portal';\nimport { forwardRef, type ReactNode, useMemo } from 'react';\n\nimport { DatePicker } from '../../atoms/DatePicker/DatePicker';\nimport { calendarDateToDate, dateToCalendarDate } from './Calendar.utils';\nimport CalendarContent from './components/CalendarContent';\nimport CalendarTrigger from './components/CalendarTrigger';\n\nexport interface BitkitCalendarProps {\n children?: ReactNode;\n /** Text for a day's tooltip, e.g. why it can't be picked. Return `undefined` for no tooltip. */\n dayTooltip?: (date: Date) => string | undefined;\n defaultValue?: Date | Date[] | null;\n device?: 'desktop' | 'mobile';\n /**\n * Content under the month grid, inside the calendar card — e.g. Clear/Apply buttons that commit\n * the selection. With a footer, picking a range no longer closes the popover; closing is up to it.\n */\n footer?: ReactNode;\n layout?: '1-month' | '2-month';\n max?: Date;\n min?: Date;\n /** Called when the popover opens or closes. Pair it with `open` to control it. */\n onOpenChange?: (open: boolean) => void;\n onValueChange?: (value: Date[] | null) => void;\n /** Controls whether the popover is open. Only applies with a trigger (`children`). */\n open?: boolean;\n selectionMode?: 'day' | 'range';\n /** Shows the days of the neighbouring months. Defaults to `true` on the `1-month` layout, `false` on `2-month`. */\n showOutsideDays?: boolean;\n showSelectedDate?: boolean;\n value?: Date[] | null;\n}\n\nconst BitkitCalendar = forwardRef<HTMLDivElement, BitkitCalendarProps>((props, ref) => {\n const {\n children,\n dayTooltip,\n defaultValue,\n device = 'desktop',\n footer,\n layout = '1-month',\n selectionMode = 'range',\n min,\n max,\n onOpenChange,\n onValueChange,\n open,\n showOutsideDays: showOutsideDaysProp,\n showSelectedDate = false,\n value: inputValue,\n ...rest\n } = props;\n\n const minCalendarDate = useMemo(() => (min ? dateToCalendarDate(min) : undefined), [min]);\n const maxCalendarDate = useMemo(() => (max ? dateToCalendarDate(max) : undefined), [max]);\n\n // `null` is a cleared selection, still controlled; only `undefined` leaves the picker uncontrolled.\n const value = inputValue === undefined ? undefined : (inputValue ?? []).map(dateToCalendarDate);\n\n const inline = !children;\n\n const content = (\n <CalendarContent\n
|
|
1
|
+
{"version":3,"file":"BitkitCalendar.js","names":[],"sources":["../../../lib/components/BitkitCalendar/BitkitCalendar.tsx"],"sourcesContent":["import { Portal } from '@chakra-ui/react/portal';\nimport { forwardRef, type ReactNode, useMemo } from 'react';\n\nimport { DatePicker } from '../../atoms/DatePicker/DatePicker';\nimport { ResetControlSize } from '../../utilities/ControlSizeContext';\nimport { calendarDateToDate, dateToCalendarDate } from './Calendar.utils';\nimport CalendarContent from './components/CalendarContent';\nimport CalendarTrigger from './components/CalendarTrigger';\n\nexport interface BitkitCalendarProps {\n children?: ReactNode;\n /** Text for a day's tooltip, e.g. why it can't be picked. Return `undefined` for no tooltip. */\n dayTooltip?: (date: Date) => string | undefined;\n defaultValue?: Date | Date[] | null;\n device?: 'desktop' | 'mobile';\n /**\n * Content under the month grid, inside the calendar card — e.g. Clear/Apply buttons that commit\n * the selection. With a footer, picking a range no longer closes the popover; closing is up to it.\n */\n footer?: ReactNode;\n layout?: '1-month' | '2-month';\n max?: Date;\n min?: Date;\n /** Called when the popover opens or closes. Pair it with `open` to control it. */\n onOpenChange?: (open: boolean) => void;\n onValueChange?: (value: Date[] | null) => void;\n /** Controls whether the popover is open. Only applies with a trigger (`children`). */\n open?: boolean;\n selectionMode?: 'day' | 'range';\n /** Shows the days of the neighbouring months. Defaults to `true` on the `1-month` layout, `false` on `2-month`. */\n showOutsideDays?: boolean;\n showSelectedDate?: boolean;\n value?: Date[] | null;\n}\n\nconst BitkitCalendar = forwardRef<HTMLDivElement, BitkitCalendarProps>((props, ref) => {\n const {\n children,\n dayTooltip,\n defaultValue,\n device = 'desktop',\n footer,\n layout = '1-month',\n selectionMode = 'range',\n min,\n max,\n onOpenChange,\n onValueChange,\n open,\n showOutsideDays: showOutsideDaysProp,\n showSelectedDate = false,\n value: inputValue,\n ...rest\n } = props;\n\n const minCalendarDate = useMemo(() => (min ? dateToCalendarDate(min) : undefined), [min]);\n const maxCalendarDate = useMemo(() => (max ? dateToCalendarDate(max) : undefined), [max]);\n\n // `null` is a cleared selection, still controlled; only `undefined` leaves the picker uncontrolled.\n const value = inputValue === undefined ? undefined : (inputValue ?? []).map(dateToCalendarDate);\n\n const inline = !children;\n\n // The popover renders in a portal, so a footer's buttons would otherwise take the size of the\n // container the trigger sits in.\n const content = (\n <ResetControlSize>\n <CalendarContent\n dayTooltip={dayTooltip}\n device={device}\n footer={footer}\n layout={layout}\n max={maxCalendarDate}\n min={minCalendarDate}\n selectionMode={selectionMode}\n showSelectedDate={showSelectedDate}\n />\n </ResetControlSize>\n );\n\n const showOutsideDays = showOutsideDaysProp ?? layout === '1-month';\n\n return (\n <DatePicker.Root\n closeOnSelect={!footer}\n defaultValue={\n defaultValue instanceof Array\n ? defaultValue.map(dateToCalendarDate)\n : defaultValue\n ? [dateToCalendarDate(defaultValue)]\n : undefined\n }\n device={device}\n layout={layout}\n numOfMonths={layout === '2-month' ? 2 : 1}\n onOpenChange={onOpenChange ? (details) => onOpenChange(details.open) : undefined}\n open={open}\n ref={ref}\n inline={inline}\n min={minCalendarDate}\n max={maxCalendarDate}\n onValueChange={\n onValueChange\n ? (details) => {\n const dates = details.value?.map(calendarDateToDate) || null;\n onValueChange(dates);\n }\n : undefined\n }\n selectionMode={selectionMode === 'day' ? 'single' : 'range'}\n showOutsideDays={showOutsideDays}\n startOfWeek={1}\n value={value}\n {...rest}\n >\n {!inline && (\n <DatePicker.Control>\n <CalendarTrigger>{children}</CalendarTrigger>\n </DatePicker.Control>\n )}\n {inline ? (\n content\n ) : (\n <Portal>\n <DatePicker.Positioner>{content}</DatePicker.Positioner>\n </Portal>\n )}\n </DatePicker.Root>\n );\n});\n\nBitkitCalendar.displayName = 'BitkitCalendar';\n\nexport default BitkitCalendar;\n"],"mappings":";;;;;;;;;AAmCA,IAAM,iBAAiB,YAAiD,OAAO,QAAQ;CACrF,MAAM,EACJ,UACA,YACA,cACA,SAAS,WACT,QACA,SAAS,WACT,gBAAgB,SAChB,KACA,KACA,cACA,eACA,MACA,iBAAiB,qBACjB,mBAAmB,OACnB,OAAO,YACP,GAAG,SACD;CAEJ,MAAM,kBAAkB,cAAe,MAAM,mBAAmB,GAAG,IAAI,KAAA,GAAY,CAAC,GAAG,CAAC;CACxF,MAAM,kBAAkB,cAAe,MAAM,mBAAmB,GAAG,IAAI,KAAA,GAAY,CAAC,GAAG,CAAC;CAGxF,MAAM,QAAQ,eAAe,KAAA,IAAY,KAAA,KAAa,cAAc,CAAC,EAAA,CAAG,IAAI,kBAAkB;CAE9F,MAAM,SAAS,CAAC;CAIhB,MAAM,UACJ,oBAAC,kBAAD,EAAA,UACE,oBAAC,iBAAD;EACc;EACJ;EACA;EACA;EACR,KAAK;EACL,KAAK;EACU;EACG;CACnB,CAAA,EACe,CAAA;CAGpB,MAAM,kBAAkB,uBAAuB,WAAW;CAE1D,OACE,qBAAC,WAAW,MAAZ;EACE,eAAe,CAAC;EAChB,cACE,wBAAwB,QACpB,aAAa,IAAI,kBAAkB,IACnC,eACE,CAAC,mBAAmB,YAAY,CAAC,IACjC,KAAA;EAEA;EACA;EACR,aAAa,WAAW,YAAY,IAAI;EACxC,cAAc,gBAAgB,YAAY,aAAa,QAAQ,IAAI,IAAI,KAAA;EACjE;EACD;EACG;EACR,KAAK;EACL,KAAK;EACL,eACE,iBACK,YAAY;GACX,MAAM,QAAQ,QAAQ,OAAO,IAAI,kBAAkB,KAAK;GACxD,cAAc,KAAK;EACrB,IACA,KAAA;EAEN,eAAe,kBAAkB,QAAQ,WAAW;EACnC;EACjB,aAAa;EACN;EACP,GAAI;EA9BN,UAAA,CAgCG,CAAC,UACA,oBAAC,WAAW,SAAZ,EAAA,UACE,oBAAC,iBAAD,EAAkB,SAA0B,CAAA,EAC1B,CAAA,GAErB,SACC,UAEA,oBAAC,QAAD,EAAA,UACE,oBAAC,WAAW,YAAZ,EAAA,UAAwB,QAA+B,CAAA,EACjD,CAAA,CAEK;;AAErB,CAAC;AAED,eAAe,cAAc"}
|
|
@@ -2,7 +2,7 @@ import { BoxProps } from '@chakra-ui/react/box';
|
|
|
2
2
|
export interface BitkitContentWrapperStickyBarProps extends Omit<BoxProps, 'colorVariant'> {
|
|
3
3
|
/** The page background behind the bar, so content scrolling under it stays hidden. Defaults to `gray`. */
|
|
4
4
|
colorVariant?: 'gray' | 'white';
|
|
5
|
-
/** Whether the bar is stuck; adds the shadow. The consumer owns the scroll detection
|
|
5
|
+
/** Whether the bar is stuck; adds the shadow. The consumer owns the scroll detection. */
|
|
6
6
|
isSticky?: boolean;
|
|
7
7
|
/** Where the bar sticks: the bottom of whatever is stuck above it, such as the page header. */
|
|
8
8
|
insetBlockStart: BoxProps['insetBlockStart'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitContentWrapperStickyBar.js","names":[],"sources":["../../../lib/components/BitkitContentWrapper/BitkitContentWrapperStickyBar.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { useRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef } from 'react';\n\nexport interface BitkitContentWrapperStickyBarProps extends Omit<BoxProps, 'colorVariant'> {\n /** The page background behind the bar, so content scrolling under it stays hidden. Defaults to `gray`. */\n colorVariant?: 'gray' | 'white';\n /** Whether the bar is stuck; adds the shadow. The consumer owns the scroll detection
|
|
1
|
+
{"version":3,"file":"BitkitContentWrapperStickyBar.js","names":[],"sources":["../../../lib/components/BitkitContentWrapper/BitkitContentWrapperStickyBar.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { useRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef } from 'react';\n\nexport interface BitkitContentWrapperStickyBarProps extends Omit<BoxProps, 'colorVariant'> {\n /** The page background behind the bar, so content scrolling under it stays hidden. Defaults to `gray`. */\n colorVariant?: 'gray' | 'white';\n /** Whether the bar is stuck; adds the shadow. The consumer owns the scroll detection. */\n isSticky?: boolean;\n /** Where the bar sticks: the bottom of whatever is stuck above it, such as the page header. */\n insetBlockStart: BoxProps['insetBlockStart'];\n}\n\n/** A bar that sticks under the page header once scrolled to, as the first child of `BitkitContentWrapper`. Sticky from `tablet` up. */\nconst BitkitContentWrapperStickyBar = forwardRef<HTMLDivElement, BitkitContentWrapperStickyBarProps>((props, ref) => {\n const { colorVariant, css, isSticky, ...rest } = props;\n\n const recipe = useRecipe({ key: 'contentWrapperStickyBar' });\n\n return <Box css={[recipe({ colorVariant, isSticky }), css]} ref={ref} {...rest} />;\n});\n\nBitkitContentWrapperStickyBar.displayName = 'BitkitContentWrapperStickyBar';\n\nexport default BitkitContentWrapperStickyBar;\n"],"mappings":";;;;;;AAcA,IAAM,gCAAgC,YAAgE,OAAO,QAAQ;CACnH,MAAM,EAAE,cAAc,KAAK,UAAU,GAAG,SAAS;CAEjD,MAAM,SAAS,UAAU,EAAE,KAAK,0BAA0B,CAAC;CAE3D,OAAO,oBAAC,KAAD;EAAK,KAAK,CAAC,OAAO;GAAE;GAAc;EAAS,CAAC,GAAG,GAAG;EAAQ;EAAK,GAAI;CAAO,CAAA;AACnF,CAAC;AAED,8BAA8B,cAAc"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResetControlSize } from "../../utilities/ControlSizeContext.js";
|
|
1
2
|
import { resolveScrollBehavior } from "./DialogBodyContext.js";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { Portal } from "@chakra-ui/react/portal";
|
|
@@ -29,7 +30,7 @@ var DialogShell = ({ children, dismissible = true, initialFocusEl, onExitComplet
|
|
|
29
30
|
children: [trigger && /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
30
31
|
asChild: true,
|
|
31
32
|
children: trigger
|
|
32
|
-
}), /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {}), /* @__PURE__ */ jsx(Dialog.Positioner, { children })] })]
|
|
33
|
+
}), /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {}), /* @__PURE__ */ jsx(Dialog.Positioner, { children: /* @__PURE__ */ jsx(ResetControlSize, { children }) })] })]
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
36
|
export { DialogShell as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogShell.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogShell.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ComponentProps, type ReactNode } from 'react';\n\nimport { resolveScrollBehavior } from './DialogBodyContext';\n\nexport interface DialogShellProps {\n /** The `Dialog.Content` element (rendered inside the positioner). */\n children: ReactNode;\n dismissible?: boolean;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: ComponentProps<typeof Dialog.Root>['initialFocusEl'];\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n size?: 'sm' | 'md' | 'lg' | 'full';\n state?: 'loading';\n trigger?: ReactNode;\n variant?: 'overflowContent';\n}\n\n/**\n * Shared overlay shell for every Bitkit dialog flavour: `Dialog.Root` + optional trigger + portal +\n * backdrop + positioner. `dismissible={false}` removes every route out that skips a decision: the\n * close button is not rendered (see `DialogInner`) and ESC is blocked. `state=\"loading\"` blocks the\n * same routes for as long as it is set, but keeps the close button in place, disabled. Outside clicks never dismiss a\n * Bitkit dialog either way (`closeOnInteractOutside={false}`). Note that `dismissible` does not reach\n * `ActionTrigger` -- a footer button wired to it closes the dialog either way, so a caller that has\n * to block every route out disables that button itself.\n * The caller passes the `Dialog.Content` (or a `Dialog.Content asChild` wrapper) as children.\n **/\n\nconst DialogShell = ({\n children,\n dismissible = true,\n initialFocusEl,\n onExitComplete,\n onOpenChange,\n open,\n preventScroll = true,\n scrollBehavior: scrollBehaviorProp,\n size,\n state,\n trigger,\n variant,\n}: DialogShellProps) => {\n const scrollBehavior = resolveScrollBehavior(variant, scrollBehaviorProp);\n\n return (\n <Dialog.Root\n closeOnEscape={dismissible && state !== 'loading'}\n closeOnInteractOutside={false}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={onOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n variant={variant}\n >\n {trigger && <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>}\n <Portal>\n <Dialog.Backdrop />\n <Dialog.Positioner>{children}</Dialog.Positioner>\n </Portal>\n </Dialog.Root>\n );\n};\n\nexport default DialogShell;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DialogShell.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogShell.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ComponentProps, type ReactNode } from 'react';\n\nimport { ResetControlSize } from '../../utilities/ControlSizeContext';\nimport { resolveScrollBehavior } from './DialogBodyContext';\n\nexport interface DialogShellProps {\n /** The `Dialog.Content` element (rendered inside the positioner). */\n children: ReactNode;\n dismissible?: boolean;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: ComponentProps<typeof Dialog.Root>['initialFocusEl'];\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n size?: 'sm' | 'md' | 'lg' | 'full';\n state?: 'loading';\n trigger?: ReactNode;\n variant?: 'overflowContent';\n}\n\n/**\n * Shared overlay shell for every Bitkit dialog flavour: `Dialog.Root` + optional trigger + portal +\n * backdrop + positioner. `dismissible={false}` removes every route out that skips a decision: the\n * close button is not rendered (see `DialogInner`) and ESC is blocked. `state=\"loading\"` blocks the\n * same routes for as long as it is set, but keeps the close button in place, disabled. Outside clicks never dismiss a\n * Bitkit dialog either way (`closeOnInteractOutside={false}`). Note that `dismissible` does not reach\n * `ActionTrigger` -- a footer button wired to it closes the dialog either way, so a caller that has\n * to block every route out disables that button itself.\n * The caller passes the `Dialog.Content` (or a `Dialog.Content asChild` wrapper) as children.\n **/\n\nconst DialogShell = ({\n children,\n dismissible = true,\n initialFocusEl,\n onExitComplete,\n onOpenChange,\n open,\n preventScroll = true,\n scrollBehavior: scrollBehaviorProp,\n size,\n state,\n trigger,\n variant,\n}: DialogShellProps) => {\n const scrollBehavior = resolveScrollBehavior(variant, scrollBehaviorProp);\n\n return (\n <Dialog.Root\n closeOnEscape={dismissible && state !== 'loading'}\n closeOnInteractOutside={false}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={onOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n variant={variant}\n >\n {trigger && <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>}\n <Portal>\n <Dialog.Backdrop />\n <Dialog.Positioner>\n <ResetControlSize>{children}</ResetControlSize>\n </Dialog.Positioner>\n </Portal>\n </Dialog.Root>\n );\n};\n\nexport default DialogShell;\n"],"mappings":";;;;;;;;;;;;;;;;AAmCA,IAAM,eAAe,EACnB,UACA,cAAc,MACd,gBACA,gBACA,cACA,MACA,gBAAgB,MAChB,gBAAgB,oBAChB,MACA,OACA,SACA,cACsB;CACtB,MAAM,iBAAiB,sBAAsB,SAAS,kBAAkB;CAExE,OACE,qBAAC,OAAO,MAAR;EACE,eAAe,eAAe,UAAU;EACxC,wBAAwB;EACR;EACA;EACF;EACR;EACS;EACC;EACV;EACG;EAVX,UAAA,CAYG,WAAW,oBAAC,OAAO,SAAR;GAAgB,SAAA;GAAS,UAAA;EAAwB,CAAA,GAC7D,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAO,UAAR,CAAkB,CAAA,GAClB,oBAAC,OAAO,YAAR,EAAA,UACE,oBAAC,kBAAD,EAAmB,SAA2B,CAAA,EAC7B,CAAA,CACb,EAAA,CAAA,CACG;;AAEjB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import IconCross from "../../icons/IconCross.js";
|
|
2
|
+
import { ResetControlSize } from "../../utilities/ControlSizeContext.js";
|
|
2
3
|
import BitkitLabelTooltip from "../BitkitLabelTooltip/BitkitLabelTooltip.js";
|
|
3
4
|
import { forwardRef } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -7,7 +8,6 @@ import { Drawer } from "@chakra-ui/react/drawer";
|
|
|
7
8
|
var Root = Drawer.Root;
|
|
8
9
|
var Trigger = Drawer.Trigger;
|
|
9
10
|
var Backdrop = Drawer.Backdrop;
|
|
10
|
-
var Positioner = Drawer.Positioner;
|
|
11
11
|
var Content = Drawer.Content;
|
|
12
12
|
var Header = Drawer.Header;
|
|
13
13
|
var Title = Drawer.Title;
|
|
@@ -15,6 +15,10 @@ var Description = Drawer.Description;
|
|
|
15
15
|
var Body = Drawer.Body;
|
|
16
16
|
var Footer = Drawer.Footer;
|
|
17
17
|
var ActionTrigger = Drawer.ActionTrigger;
|
|
18
|
+
var Positioner = forwardRef((props, ref) => /* @__PURE__ */ jsx(ResetControlSize, { children: /* @__PURE__ */ jsx(Drawer.Positioner, {
|
|
19
|
+
ref,
|
|
20
|
+
...props
|
|
21
|
+
}) }));
|
|
18
22
|
var CloseButton = forwardRef((props, ref) => /* @__PURE__ */ jsx(BitkitLabelTooltip, {
|
|
19
23
|
text: "Close",
|
|
20
24
|
children: /* @__PURE__ */ jsx(Drawer.CloseTrigger, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitDrawer.js","names":[],"sources":["../../../lib/components/BitkitDrawer/BitkitDrawer.tsx"],"sourcesContent":["import {\n Drawer,\n type DrawerActionTriggerProps,\n type DrawerBackdropProps,\n type DrawerBodyProps,\n type DrawerCloseTriggerProps,\n type DrawerContentProps,\n type DrawerDescriptionProps,\n type DrawerFooterProps,\n type DrawerHeaderProps,\n type DrawerPositionerProps,\n type DrawerRootProps,\n type DrawerTitleProps,\n type DrawerTriggerProps,\n} from '@chakra-ui/react/drawer';\nimport { forwardRef } from 'react';\n\nimport { IconCross } from '../../icons';\nimport BitkitLabelTooltip from '../BitkitLabelTooltip/BitkitLabelTooltip';\n\nexport type BitkitDrawerRootProps = DrawerRootProps;\nexport type BitkitDrawerTriggerProps = DrawerTriggerProps;\nexport type BitkitDrawerBackdropProps = DrawerBackdropProps;\nexport type BitkitDrawerPositionerProps = DrawerPositionerProps;\nexport type BitkitDrawerContentProps = DrawerContentProps;\nexport type BitkitDrawerHeaderProps = DrawerHeaderProps;\nexport type BitkitDrawerTitleProps = DrawerTitleProps;\nexport type BitkitDrawerDescriptionProps = DrawerDescriptionProps;\nexport type BitkitDrawerBodyProps = DrawerBodyProps;\nexport type BitkitDrawerFooterProps = DrawerFooterProps;\nexport type BitkitDrawerActionTriggerProps = DrawerActionTriggerProps;\nexport type BitkitDrawerCloseButtonProps = DrawerCloseTriggerProps;\n\nconst Root = Drawer.Root;\nconst Trigger = Drawer.Trigger;\nconst Backdrop = Drawer.Backdrop;\nconst
|
|
1
|
+
{"version":3,"file":"BitkitDrawer.js","names":[],"sources":["../../../lib/components/BitkitDrawer/BitkitDrawer.tsx"],"sourcesContent":["import {\n Drawer,\n type DrawerActionTriggerProps,\n type DrawerBackdropProps,\n type DrawerBodyProps,\n type DrawerCloseTriggerProps,\n type DrawerContentProps,\n type DrawerDescriptionProps,\n type DrawerFooterProps,\n type DrawerHeaderProps,\n type DrawerPositionerProps,\n type DrawerRootProps,\n type DrawerTitleProps,\n type DrawerTriggerProps,\n} from '@chakra-ui/react/drawer';\nimport { forwardRef } from 'react';\n\nimport { IconCross } from '../../icons';\nimport { ResetControlSize } from '../../utilities/ControlSizeContext';\nimport BitkitLabelTooltip from '../BitkitLabelTooltip/BitkitLabelTooltip';\n\nexport type BitkitDrawerRootProps = DrawerRootProps;\nexport type BitkitDrawerTriggerProps = DrawerTriggerProps;\nexport type BitkitDrawerBackdropProps = DrawerBackdropProps;\nexport type BitkitDrawerPositionerProps = DrawerPositionerProps;\nexport type BitkitDrawerContentProps = DrawerContentProps;\nexport type BitkitDrawerHeaderProps = DrawerHeaderProps;\nexport type BitkitDrawerTitleProps = DrawerTitleProps;\nexport type BitkitDrawerDescriptionProps = DrawerDescriptionProps;\nexport type BitkitDrawerBodyProps = DrawerBodyProps;\nexport type BitkitDrawerFooterProps = DrawerFooterProps;\nexport type BitkitDrawerActionTriggerProps = DrawerActionTriggerProps;\nexport type BitkitDrawerCloseButtonProps = DrawerCloseTriggerProps;\n\nconst Root = Drawer.Root;\nconst Trigger = Drawer.Trigger;\nconst Backdrop = Drawer.Backdrop;\nconst Content = Drawer.Content;\nconst Header = Drawer.Header;\nconst Title = Drawer.Title;\nconst Description = Drawer.Description;\nconst Body = Drawer.Body;\nconst Footer = Drawer.Footer;\nconst ActionTrigger = Drawer.ActionTrigger;\n\n// Context passes through the portal the drawer sits in, so its buttons would take the size of the\n// container its trigger lives in, such as a page header's actions.\nconst Positioner = forwardRef<HTMLDivElement, BitkitDrawerPositionerProps>((props, ref) => (\n <ResetControlSize>\n <Drawer.Positioner ref={ref} {...props} />\n </ResetControlSize>\n));\n\nconst CloseButton = forwardRef<HTMLButtonElement, BitkitDrawerCloseButtonProps>((props, ref) => (\n <BitkitLabelTooltip text=\"Close\">\n <Drawer.CloseTrigger ref={ref} aria-label=\"Close\" {...props}>\n <IconCross />\n </Drawer.CloseTrigger>\n </BitkitLabelTooltip>\n));\n\nRoot.displayName = 'BitkitDrawer.Root';\nTrigger.displayName = 'BitkitDrawer.Trigger';\nBackdrop.displayName = 'BitkitDrawer.Backdrop';\nPositioner.displayName = 'BitkitDrawer.Positioner';\nContent.displayName = 'BitkitDrawer.Content';\nHeader.displayName = 'BitkitDrawer.Header';\nTitle.displayName = 'BitkitDrawer.Title';\nDescription.displayName = 'BitkitDrawer.Description';\nBody.displayName = 'BitkitDrawer.Body';\nFooter.displayName = 'BitkitDrawer.Footer';\nActionTrigger.displayName = 'BitkitDrawer.ActionTrigger';\nCloseButton.displayName = 'BitkitDrawer.CloseButton';\n\nconst BitkitDrawer = {\n ActionTrigger,\n Backdrop,\n Body,\n CloseButton,\n Content,\n Description,\n Footer,\n Header,\n Positioner,\n Root,\n Title,\n Trigger,\n};\n\nexport default BitkitDrawer;\n"],"mappings":";;;;;;;AAkCA,IAAM,OAAO,OAAO;AACpB,IAAM,UAAU,OAAO;AACvB,IAAM,WAAW,OAAO;AACxB,IAAM,UAAU,OAAO;AACvB,IAAM,SAAS,OAAO;AACtB,IAAM,QAAQ,OAAO;AACrB,IAAM,cAAc,OAAO;AAC3B,IAAM,OAAO,OAAO;AACpB,IAAM,SAAS,OAAO;AACtB,IAAM,gBAAgB,OAAO;AAI7B,IAAM,aAAa,YAAyD,OAAO,QACjF,oBAAC,kBAAD,EAAA,UACE,oBAAC,OAAO,YAAR;CAAwB;CAAK,GAAI;AAAQ,CAAA,EACzB,CAAA,CACnB;AAED,IAAM,cAAc,YAA6D,OAAO,QACtF,oBAAC,oBAAD;CAAoB,MAAK;CACvB,UAAA,oBAAC,OAAO,cAAR;EAA0B;EAAK,cAAW;EAAQ,GAAI;EACpD,UAAA,oBAAC,WAAD,CAAY,CAAA;CACO,CAAA;AACH,CAAA,CACrB;AAED,KAAK,cAAc;AACnB,QAAQ,cAAc;AACtB,SAAS,cAAc;AACvB,WAAW,cAAc;AACzB,QAAQ,cAAc;AACtB,OAAO,cAAc;AACrB,MAAM,cAAc;AACpB,YAAY,cAAc;AAC1B,KAAK,cAAc;AACnB,OAAO,cAAc;AACrB,cAAc,cAAc;AAC5B,YAAY,cAAc;AAE1B,IAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useControlSizeFromContext } from "../../utilities/ControlSizeContext.js";
|
|
1
2
|
import focusableDisabledProps from "../../utilities/focusableDisabledProps.js";
|
|
2
3
|
import opensPopup from "../../utilities/opensPopup.js";
|
|
3
4
|
import BitkitLabelTooltip from "../BitkitLabelTooltip/BitkitLabelTooltip.js";
|
|
@@ -10,7 +11,9 @@ import { IconButton } from "@chakra-ui/react/button";
|
|
|
10
11
|
var BitkitIconButton = forwardRef((props, ref) => {
|
|
11
12
|
const buttonRecipe = useRecipe({ key: "button" });
|
|
12
13
|
const Icon = props.icon;
|
|
13
|
-
const
|
|
14
|
+
const contextSize = useControlSizeFromContext();
|
|
15
|
+
const size = props.size ?? contextSize;
|
|
16
|
+
const iconSize = (size ?? "lg") === "lg" ? "24" : "16";
|
|
14
17
|
const isDisabled = props.state === "disabled";
|
|
15
18
|
const isSkeleton = props.state === "skeleton";
|
|
16
19
|
const isPopupTrigger = opensPopup(props);
|
|
@@ -24,6 +27,7 @@ var BitkitIconButton = forwardRef((props, ref) => {
|
|
|
24
27
|
loading: state === "loading",
|
|
25
28
|
ref,
|
|
26
29
|
...buttonRest,
|
|
30
|
+
size,
|
|
27
31
|
children: cloneElement(onlyChild, { "aria-label": onlyChild.props["aria-label"] ?? label }, /* @__PURE__ */ jsx(Icon, { size: iconSize }))
|
|
28
32
|
});
|
|
29
33
|
return /* @__PURE__ */ jsx(BitkitLabelTooltip, {
|
|
@@ -38,7 +42,7 @@ var BitkitIconButton = forwardRef((props, ref) => {
|
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
if (props.href !== void 0) {
|
|
41
|
-
const { css, href, icon: _icon, isExternal, label, onClick, onKeyDown, rel, size, state: _state, target, tooltipProps, variant, ...anchorRest } = props;
|
|
45
|
+
const { css, href, icon: _icon, isExternal, label, onClick, onKeyDown, rel, size: _size, state: _state, target, tooltipProps, variant, ...anchorRest } = props;
|
|
42
46
|
const effectiveTarget = isExternal ? "_blank" : target;
|
|
43
47
|
const effectiveRel = isExternal ? rel ? `${rel} noreferrer noopener` : "noreferrer noopener" : rel;
|
|
44
48
|
const handleClick = isDisabled ? (e) => {
|
|
@@ -100,6 +104,7 @@ var BitkitIconButton = forwardRef((props, ref) => {
|
|
|
100
104
|
loading: state === "loading",
|
|
101
105
|
ref,
|
|
102
106
|
...buttonRest,
|
|
107
|
+
size,
|
|
103
108
|
...reason && focusableDisabledProps,
|
|
104
109
|
children: /* @__PURE__ */ jsx(Icon, { size: iconSize })
|
|
105
110
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitIconButton.js","names":[],"sources":["../../../lib/components/BitkitIconButton/BitkitIconButton.tsx"],"sourcesContent":["import { IconButton, type IconButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport focusableDisabledProps from '../../utilities/focusableDisabledProps';\nimport opensPopup from '../../utilities/opensPopup';\nimport BitkitLabelTooltip, { type BitkitLabelTooltipProps } from '../BitkitLabelTooltip/BitkitLabelTooltip';\n\ntype BitkitIconButtonOmittedFromButton =\n | 'aria-label'\n | 'asChild'\n | 'children'\n | 'colorPalette'\n | 'disabled'\n | 'loading'\n | 'loadingText'\n | 'spinner'\n | 'spinnerPlacement';\n\ninterface BitkitIconButtonCommonProps {\n icon: BitkitIconComponent;\n label: string;\n /**\n * Overrides for the label tooltip. It is off by default when this control opens a popup — a menu,\n * select or popover trigger — where the panel is the affordance and a tooltip would hover over it.\n * Pass `{ disabled: false }` to bring it back. The accessible name comes from `label` either way.\n */\n tooltipProps?: Partial<Omit<BitkitLabelTooltipProps, 'children' | 'text'>>;\n}\n\ninterface BitkitIconButtonAsButtonProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild?: false;\n /**\n * Why the button is disabled, shown in its tooltip in place of the label while `state` is\n * `\"disabled\"`. The button then stays focusable (`aria-disabled` instead of the native attribute),\n * so the tooltip opens on hover and focus, and screen readers announce the reason after the\n * label. Use it instead of wrapping a disabled button in `BitkitTooltip`.\n */\n disabledReason?: string;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsAnchorProps\n extends\n BitkitIconButtonCommonProps,\n Omit<HTMLChakraProps<'a'>, 'aria-label' | 'children' | 'colorPalette'>,\n RecipeProps<'button'> {\n asChild?: false;\n href: string;\n isExternal?: boolean;\n state?: 'disabled' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsChildProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild: true;\n children: ReactElement;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport type BitkitIconButtonProps =\n BitkitIconButtonAsButtonProps | BitkitIconButtonAsAnchorProps | BitkitIconButtonAsChildProps;\n\n// The forwarded ref is typed as HTMLElement to cover all three modes (button, anchor, slot/asChild),\n// since asChild can render any element (router Link, custom wrappers, etc.). Inner narrow casts\n// satisfy the wrapped Chakra components without affecting the consumer-visible ref shape.\nconst BitkitIconButton = forwardRef<HTMLElement, BitkitIconButtonProps>((props, ref) => {\n const buttonRecipe = useRecipe({ key: 'button' });\n const Icon = props.icon;\n // An unset `size` reaches us as `undefined` — the `button` recipe's `lg` default lives in CSS,\n // not on the prop — so resolve it here rather than letting it fall to the 16px branch.\n const
|
|
1
|
+
{"version":3,"file":"BitkitIconButton.js","names":[],"sources":["../../../lib/components/BitkitIconButton/BitkitIconButton.tsx"],"sourcesContent":["import { IconButton, type IconButtonProps } from '@chakra-ui/react/button';\nimport { Skeleton } from '@chakra-ui/react/skeleton';\nimport { chakra, type HTMLChakraProps, type RecipeProps, useRecipe } from '@chakra-ui/react/styled-system';\nimport {\n Children,\n cloneElement,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type Ref,\n} from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport { useControlSizeFromContext } from '../../utilities/ControlSizeContext';\nimport focusableDisabledProps from '../../utilities/focusableDisabledProps';\nimport opensPopup from '../../utilities/opensPopup';\nimport BitkitLabelTooltip, { type BitkitLabelTooltipProps } from '../BitkitLabelTooltip/BitkitLabelTooltip';\n\ntype BitkitIconButtonOmittedFromButton =\n | 'aria-label'\n | 'asChild'\n | 'children'\n | 'colorPalette'\n | 'disabled'\n | 'loading'\n | 'loadingText'\n | 'spinner'\n | 'spinnerPlacement';\n\ninterface BitkitIconButtonCommonProps {\n icon: BitkitIconComponent;\n label: string;\n /**\n * Overrides for the label tooltip. It is off by default when this control opens a popup — a menu,\n * select or popover trigger — where the panel is the affordance and a tooltip would hover over it.\n * Pass `{ disabled: false }` to bring it back. The accessible name comes from `label` either way.\n */\n tooltipProps?: Partial<Omit<BitkitLabelTooltipProps, 'children' | 'text'>>;\n}\n\ninterface BitkitIconButtonAsButtonProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild?: false;\n /**\n * Why the button is disabled, shown in its tooltip in place of the label while `state` is\n * `\"disabled\"`. The button then stays focusable (`aria-disabled` instead of the native attribute),\n * so the tooltip opens on hover and focus, and screen readers announce the reason after the\n * label. Use it instead of wrapping a disabled button in `BitkitTooltip`.\n */\n disabledReason?: string;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsAnchorProps\n extends\n BitkitIconButtonCommonProps,\n Omit<HTMLChakraProps<'a'>, 'aria-label' | 'children' | 'colorPalette'>,\n RecipeProps<'button'> {\n asChild?: false;\n href: string;\n isExternal?: boolean;\n state?: 'disabled' | 'skeleton';\n}\n\ninterface BitkitIconButtonAsChildProps\n extends BitkitIconButtonCommonProps, Omit<IconButtonProps, BitkitIconButtonOmittedFromButton> {\n asChild: true;\n children: ReactElement;\n href?: undefined;\n isExternal?: undefined;\n state?: 'disabled' | 'loading' | 'skeleton';\n}\n\nexport type BitkitIconButtonProps =\n BitkitIconButtonAsButtonProps | BitkitIconButtonAsAnchorProps | BitkitIconButtonAsChildProps;\n\n// The forwarded ref is typed as HTMLElement to cover all three modes (button, anchor, slot/asChild),\n// since asChild can render any element (router Link, custom wrappers, etc.). Inner narrow casts\n// satisfy the wrapped Chakra components without affecting the consumer-visible ref shape.\nconst BitkitIconButton = forwardRef<HTMLElement, BitkitIconButtonProps>((props, ref) => {\n const buttonRecipe = useRecipe({ key: 'button' });\n const Icon = props.icon;\n // An unset `size` reaches us as `undefined` — the `button` recipe's `lg` default lives in CSS,\n // not on the prop — so resolve it here rather than letting it fall to the 16px branch.\n const contextSize = useControlSizeFromContext();\n const size = props.size ?? contextSize;\n const iconSize = (size ?? 'lg') === 'lg' ? '24' : '16';\n const isDisabled = props.state === 'disabled';\n const isSkeleton = props.state === 'skeleton';\n const isPopupTrigger = opensPopup(props);\n\n // --- Slot mode (asChild) ---\n if (props.asChild) {\n const { asChild: _asChild, children, icon: _icon, label, state, tooltipProps, ...buttonRest } = props;\n const onlyChild = Children.only(children) as ReactElement<{ 'aria-label'?: string }>;\n const iconButtonElement = (\n <IconButton\n asChild\n aria-label={label}\n disabled={isDisabled}\n loading={state === 'loading'}\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n size={size}\n >\n {cloneElement(onlyChild, { 'aria-label': onlyChild.props['aria-label'] ?? label }, <Icon size={iconSize} />)}\n </IconButton>\n );\n return (\n <BitkitLabelTooltip text={label} disabled={isPopupTrigger} {...tooltipProps}>\n {isSkeleton ? (\n <Skeleton asChild loading>\n {iconButtonElement}\n </Skeleton>\n ) : (\n iconButtonElement\n )}\n </BitkitLabelTooltip>\n );\n }\n\n // --- Anchor mode (href) ---\n if (props.href !== undefined) {\n const {\n css,\n href,\n icon: _icon,\n isExternal,\n label,\n onClick,\n onKeyDown,\n rel,\n size: _size,\n state: _state,\n target,\n tooltipProps,\n variant,\n ...anchorRest\n } = props;\n const effectiveTarget = isExternal ? '_blank' : target;\n const effectiveRel = isExternal ? (rel ? `${rel} noreferrer noopener` : 'noreferrer noopener') : rel;\n const handleClick = isDisabled\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : onClick;\n const handleKeyDown = isDisabled\n ? (e: KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n : onKeyDown;\n const anchorElement = (\n <chakra.a\n ref={ref as Ref<HTMLAnchorElement>}\n {...anchorRest}\n aria-disabled={isDisabled || undefined}\n aria-label={label}\n css={[buttonRecipe({ size, variant }), { paddingBlock: 0, paddingInline: 0 }, css]}\n href={isDisabled ? undefined : href}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n rel={effectiveRel}\n target={effectiveTarget}\n >\n <Icon size={iconSize} />\n </chakra.a>\n );\n return (\n <BitkitLabelTooltip text={label} disabled={isPopupTrigger} {...tooltipProps}>\n {isSkeleton ? (\n <Skeleton asChild loading>\n {anchorElement}\n </Skeleton>\n ) : (\n anchorElement\n )}\n </BitkitLabelTooltip>\n );\n }\n\n // --- Button mode (default) ---\n const { disabledReason, icon: _icon, label, state, tooltipProps, ...buttonRest } = props;\n const reason = isDisabled ? disabledReason : undefined;\n // One tooltip whose text switches, rather than a second tooltip component: swapping components\n // when the state changes would remount the button and drop its focus. The label is still\n // announced as the button's name, and a popup trigger shows the reason since the popup can't open.\n return (\n <BitkitLabelTooltip text={reason ?? label} disabled={!reason && isPopupTrigger} {...tooltipProps}>\n <Skeleton asChild loading={isSkeleton}>\n <IconButton\n aria-label={label}\n disabled={isDisabled && !reason}\n loading={state === 'loading'}\n ref={ref as Ref<HTMLButtonElement>}\n {...buttonRest}\n size={size}\n {...(reason && focusableDisabledProps)}\n >\n <Icon size={iconSize} />\n </IconButton>\n </Skeleton>\n </BitkitLabelTooltip>\n );\n});\n\nBitkitIconButton.displayName = 'BitkitIconButton';\n\nexport default BitkitIconButton;\n"],"mappings":";;;;;;;;;;AAkFA,IAAM,mBAAmB,YAAgD,OAAO,QAAQ;CACtF,MAAM,eAAe,UAAU,EAAE,KAAK,SAAS,CAAC;CAChD,MAAM,OAAO,MAAM;CAGnB,MAAM,cAAc,0BAA0B;CAC9C,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,YAAY,QAAQ,UAAU,OAAO,OAAO;CAClD,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,iBAAiB,WAAW,KAAK;CAGvC,IAAI,MAAM,SAAS;EACjB,MAAM,EAAE,SAAS,UAAU,UAAU,MAAM,OAAO,OAAO,OAAO,cAAc,GAAG,eAAe;EAChG,MAAM,YAAY,SAAS,KAAK,QAAQ;EACxC,MAAM,oBACJ,oBAAC,YAAD;GACE,SAAA;GACA,cAAY;GACZ,UAAU;GACV,SAAS,UAAU;GACd;GACL,GAAI;GACE;GAEL,UAAA,aAAa,WAAW,EAAE,cAAc,UAAU,MAAM,iBAAiB,MAAM,GAAG,oBAAC,MAAD,EAAM,MAAM,SAAW,CAAA,CAAC;EACjG,CAAA;EAEd,OACE,oBAAC,oBAAD;GAAoB,MAAM;GAAO,UAAU;GAAgB,GAAI;GAC5D,UAAA,aACC,oBAAC,UAAD;IAAU,SAAA;IAAQ,SAAA;IACf,UAAA;GACO,CAAA,IAEV;EAEgB,CAAA;CAExB;CAGA,IAAI,MAAM,SAAS,KAAA,GAAW;EAC5B,MAAM,EACJ,KACA,MACA,MAAM,OACN,YACA,OACA,SACA,WACA,KACA,MAAM,OACN,OAAO,QACP,QACA,cACA,SACA,GAAG,eACD;EACJ,MAAM,kBAAkB,aAAa,WAAW;EAChD,MAAM,eAAe,aAAc,MAAM,GAAG,IAAI,wBAAwB,wBAAyB;EACjG,MAAM,cAAc,cACf,MAAqC;GACpC,EAAE,eAAe;GACjB,EAAE,gBAAgB;EACpB,IACA;EACJ,MAAM,gBAAgB,cACjB,MAAwC;GACvC,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;IACtC,EAAE,eAAe;IACjB,EAAE,gBAAgB;GACpB;EACF,IACA;EACJ,MAAM,gBACJ,oBAAC,OAAO,GAAR;GACO;GACL,GAAI;GACJ,iBAAe,cAAc,KAAA;GAC7B,cAAY;GACZ,KAAK;IAAC,aAAa;KAAE;KAAM;IAAQ,CAAC;IAAG;KAAE,cAAc;KAAG,eAAe;IAAE;IAAG;GAAG;GACjF,MAAM,aAAa,KAAA,IAAY;GAC/B,SAAS;GACT,WAAW;GACX,KAAK;GACL,QAAQ;GAER,UAAA,oBAAC,MAAD,EAAM,MAAM,SAAW,CAAA;EACf,CAAA;EAEZ,OACE,oBAAC,oBAAD;GAAoB,MAAM;GAAO,UAAU;GAAgB,GAAI;GAC5D,UAAA,aACC,oBAAC,UAAD;IAAU,SAAA;IAAQ,SAAA;IACf,UAAA;GACO,CAAA,IAEV;EAEgB,CAAA;CAExB;CAGA,MAAM,EAAE,gBAAgB,MAAM,OAAO,OAAO,OAAO,cAAc,GAAG,eAAe;CACnF,MAAM,SAAS,aAAa,iBAAiB,KAAA;CAI7C,OACE,oBAAC,oBAAD;EAAoB,MAAM,UAAU;EAAO,UAAU,CAAC,UAAU;EAAgB,GAAI;EAClF,UAAA,oBAAC,UAAD;GAAU,SAAA;GAAQ,SAAS;GACzB,UAAA,oBAAC,YAAD;IACE,cAAY;IACZ,UAAU,cAAc,CAAC;IACzB,SAAS,UAAU;IACd;IACL,GAAI;IACE;IACN,GAAK,UAAU;IAEf,UAAA,oBAAC,MAAD,EAAM,MAAM,SAAW,CAAA;GACb,CAAA;EACJ,CAAA;CACQ,CAAA;AAExB,CAAC;AAED,iBAAiB,cAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { rem } from "../../theme/themeUtils.js";
|
|
2
|
+
import { ResetControlSize } from "../../utilities/ControlSizeContext.js";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { Portal } from "@chakra-ui/react/portal";
|
|
4
5
|
import { Dialog } from "@chakra-ui/react/dialog";
|
|
@@ -32,7 +33,7 @@ var BitkitLightbox = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelled
|
|
|
32
33
|
boxShadow: "none",
|
|
33
34
|
maxWidth: MAX_WIDTH[size],
|
|
34
35
|
width: "full",
|
|
35
|
-
children
|
|
36
|
+
children: /* @__PURE__ */ jsx(ResetControlSize, { children })
|
|
36
37
|
})
|
|
37
38
|
})] })]
|
|
38
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitLightbox.js","names":[],"sources":["../../../lib/components/BitkitLightbox/BitkitLightbox.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ReactNode } from 'react';\n\nimport { rem } from '../../theme/themeUtils';\n\ntype BitkitLightboxSize = 'sm' | 'md' | 'lg' | 'full';\n\n// The Dialog recipe's `size` sets a fixed `width`; a lightbox instead stays fluid and only caps how\n// wide it can grow, so we map size → maxWidth here and keep `width=\"full\"`. The sm/md/lg caps mirror\n// the Dialog recipe's widths; `full` lifts the cap so the dialog spans the viewport width, minus a\n// side gutter added on the positioner below (like BitkitDialog's full). Height stays content-driven.\nconst MAX_WIDTH: Record<BitkitLightboxSize, string> = {\n sm: rem(480),\n md: rem(640),\n lg: rem(800),\n full: 'full',\n};\n\nexport interface BitkitLightboxProps {\n /** Accessible name for the dialog. Set this (or `aria-labelledby`) so the modal isn't announced unnamed. */\n 'aria-label'?: string;\n /** ID of an element in `children` that names the dialog (alternative to `aria-label`). */\n 'aria-labelledby'?: string;\n /** Content rendered on the overlay. The lightbox adds no chrome — the caller brings its own look. */\n children?: ReactNode;\n onOpenChange?: (details: { open: boolean }) => void;\n open?: boolean;\n /** Caps how wide the dialog can grow; below the cap it's fluid. `full` spans the viewport width (keeping a side gutter). Defaults to `md`. */\n size?: BitkitLightboxSize;\n /** Optional element that opens the lightbox (rendered as the dialog trigger). */\n trigger?: ReactNode;\n}\n\n/**\n * A bare, chrome-less dialog: a dimmed overlay with the caller's children on top, and nothing else —\n * the `Dialog.Content` card (background, radius, shadow) is stripped, so only the children show. No\n * header, footer or close button. Unlike `BitkitDialog`'s fixed widths, the dialog is fluid up to a\n * `size` cap, so the child (e.g. an image/video in an AspectRatio) drives the height. Escape and an\n * overlay (outside) click both dismiss it — Chakra's `Dialog.Root` default, so it isn't overridden.\n */\nconst BitkitLightbox = ({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n children,\n onOpenChange,\n open,\n size = 'md',\n trigger,\n}: BitkitLightboxProps) => (\n <Dialog.Root onOpenChange={onOpenChange} open={open}>\n {trigger && <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>}\n <Portal>\n <Dialog.Backdrop />\n {/* `full` keeps a side gutter (like BitkitDialog's full) instead of running edge to edge. */}\n <Dialog.Positioner paddingInline={size === 'full' ? '32' : undefined}>\n {/* Strip the Dialog card so only the children show; fluid width capped by `size` (no fixed\n width). Kept on Dialog.Content to keep focus trap, role and open/close animation. */}\n <Dialog.Content\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n background=\"transparent\"\n borderRadius=\"0\"\n boxShadow=\"none\"\n maxWidth={MAX_WIDTH[size]}\n width=\"full\"\n >\n {children}
|
|
1
|
+
{"version":3,"file":"BitkitLightbox.js","names":[],"sources":["../../../lib/components/BitkitLightbox/BitkitLightbox.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ReactNode } from 'react';\n\nimport { rem } from '../../theme/themeUtils';\nimport { ResetControlSize } from '../../utilities/ControlSizeContext';\n\ntype BitkitLightboxSize = 'sm' | 'md' | 'lg' | 'full';\n\n// The Dialog recipe's `size` sets a fixed `width`; a lightbox instead stays fluid and only caps how\n// wide it can grow, so we map size → maxWidth here and keep `width=\"full\"`. The sm/md/lg caps mirror\n// the Dialog recipe's widths; `full` lifts the cap so the dialog spans the viewport width, minus a\n// side gutter added on the positioner below (like BitkitDialog's full). Height stays content-driven.\nconst MAX_WIDTH: Record<BitkitLightboxSize, string> = {\n sm: rem(480),\n md: rem(640),\n lg: rem(800),\n full: 'full',\n};\n\nexport interface BitkitLightboxProps {\n /** Accessible name for the dialog. Set this (or `aria-labelledby`) so the modal isn't announced unnamed. */\n 'aria-label'?: string;\n /** ID of an element in `children` that names the dialog (alternative to `aria-label`). */\n 'aria-labelledby'?: string;\n /** Content rendered on the overlay. The lightbox adds no chrome — the caller brings its own look. */\n children?: ReactNode;\n onOpenChange?: (details: { open: boolean }) => void;\n open?: boolean;\n /** Caps how wide the dialog can grow; below the cap it's fluid. `full` spans the viewport width (keeping a side gutter). Defaults to `md`. */\n size?: BitkitLightboxSize;\n /** Optional element that opens the lightbox (rendered as the dialog trigger). */\n trigger?: ReactNode;\n}\n\n/**\n * A bare, chrome-less dialog: a dimmed overlay with the caller's children on top, and nothing else —\n * the `Dialog.Content` card (background, radius, shadow) is stripped, so only the children show. No\n * header, footer or close button. Unlike `BitkitDialog`'s fixed widths, the dialog is fluid up to a\n * `size` cap, so the child (e.g. an image/video in an AspectRatio) drives the height. Escape and an\n * overlay (outside) click both dismiss it — Chakra's `Dialog.Root` default, so it isn't overridden.\n */\nconst BitkitLightbox = ({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n children,\n onOpenChange,\n open,\n size = 'md',\n trigger,\n}: BitkitLightboxProps) => (\n <Dialog.Root onOpenChange={onOpenChange} open={open}>\n {trigger && <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>}\n <Portal>\n <Dialog.Backdrop />\n {/* `full` keeps a side gutter (like BitkitDialog's full) instead of running edge to edge. */}\n <Dialog.Positioner paddingInline={size === 'full' ? '32' : undefined}>\n {/* Strip the Dialog card so only the children show; fluid width capped by `size` (no fixed\n width). Kept on Dialog.Content to keep focus trap, role and open/close animation. */}\n <Dialog.Content\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n background=\"transparent\"\n borderRadius=\"0\"\n boxShadow=\"none\"\n maxWidth={MAX_WIDTH[size]}\n width=\"full\"\n >\n <ResetControlSize>{children}</ResetControlSize>\n </Dialog.Content>\n </Dialog.Positioner>\n </Portal>\n </Dialog.Root>\n);\n\nBitkitLightbox.displayName = 'BitkitLightbox';\n\nexport default BitkitLightbox;\n"],"mappings":";;;;;;AAaA,IAAM,YAAgD;CACpD,IAAI,IAAI,GAAG;CACX,IAAI,IAAI,GAAG;CACX,IAAI,IAAI,GAAG;CACX,MAAM;AACR;;;;;;;;AAwBA,IAAM,kBAAkB,EACtB,cAAc,WACd,mBAAmB,gBACnB,UACA,cACA,MACA,OAAO,MACP,cAEA,qBAAC,OAAO,MAAR;CAA2B;CAAoB;CAA/C,UAAA,CACG,WAAW,oBAAC,OAAO,SAAR;EAAgB,SAAA;EAAS,UAAA;CAAwB,CAAA,GAC7D,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAO,UAAR,CAAkB,CAAA,GAElB,oBAAC,OAAO,YAAR;EAAmB,eAAe,SAAS,SAAS,OAAO,KAAA;EAGzD,UAAA,oBAAC,OAAO,SAAR;GACE,cAAY;GACZ,mBAAiB;GACjB,YAAW;GACX,cAAa;GACb,WAAU;GACV,UAAU,UAAU;GACpB,OAAM;GAEN,UAAA,oBAAC,kBAAD,EAAmB,SAA2B,CAAA;EAChC,CAAA;CACC,CAAA,CACb,EAAA,CAAA,CACG;;AAGf,eAAe,cAAc"}
|
|
@@ -29,14 +29,13 @@ export interface BitkitPageHeaderProps extends Omit<BoxProps, 'title'> {
|
|
|
29
29
|
* Trailing action buttons. Stacked full-width below the title on mobile, primary action on top.
|
|
30
30
|
*
|
|
31
31
|
* The collapsed row is built for `size="sm"` buttons and the expanded header for `size="md"`.
|
|
32
|
-
*
|
|
33
|
-
* whenever `minimal` or `isSticky` is in play.
|
|
32
|
+
* A `sticky` or `minimal` header sizes its actions itself, unless they set a size of their own.
|
|
34
33
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
34
|
+
* `minimal` sizes them `sm` on mobile too, where it doesn't collapse: a little small in the
|
|
35
|
+
* expanded mobile layout, but the design draws no mobile frame for it, so `sm` is the closer of
|
|
36
|
+
* the two. Pass a flat `size` to override, not a responsive one: Bitkit icons render a different
|
|
37
|
+
* SVG asset per size, so `BitkitButton` resolves `size` in JS and a `{ base, tablet }` object
|
|
38
|
+
* matches no key.
|
|
40
39
|
*/
|
|
41
40
|
children?: ReactNode;
|
|
42
41
|
/**
|
|
@@ -58,21 +57,24 @@ export interface BitkitPageHeaderProps extends Omit<BoxProps, 'title'> {
|
|
|
58
57
|
* Their presence spreads the row into three groups instead of the usual trail-and-actions pair,
|
|
59
58
|
* which is the shape the design file calls `PageHeader-WFE`.
|
|
60
59
|
*
|
|
61
|
-
* Belongs to the collapsed row, so it is honoured by `variant="minimal"` *and* by
|
|
62
|
-
* the two produce the same row — and ignored in the expanded layouts, which the
|
|
63
|
-
* controls in.
|
|
60
|
+
* Belongs to the collapsed row, so it is honoured by `variant="minimal"` *and* by a stuck
|
|
61
|
+
* `sticky` header — the two produce the same row — and ignored in the expanded layouts, which the
|
|
62
|
+
* design draws no controls in.
|
|
64
63
|
*/
|
|
65
64
|
controls?: ReactNode;
|
|
66
65
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
66
|
+
* Makes the header stick by itself: from `tablet` it sticks right below a pinned
|
|
67
|
+
* `BitkitUIHeader` (`uiHeaderBottom`), collapses into the compact row once scrolled to it, and
|
|
68
|
+
* its actions shrink to `sm` unless they set a size of their own. No scroll detection on the
|
|
69
|
+
* page's side.
|
|
70
|
+
*
|
|
71
|
+
* End the `breadcrumb` with a `BitkitBreadcrumb.CurrentItem` carrying the title, always, and use
|
|
72
|
+
* `CurrentItem` for nothing else: the expanded header hides it (the title is its heading there),
|
|
73
|
+
* the collapsed row shows it. Render the header as a direct child of the page's column, not inside
|
|
74
|
+
* a wrapper (it would stick to the wrapper) or a `gap` stack (its sentinel and spacer would take
|
|
75
|
+
* gaps).
|
|
74
76
|
*/
|
|
75
|
-
|
|
77
|
+
sticky?: boolean;
|
|
76
78
|
/**
|
|
77
79
|
* Opens the page's sidebar on mobile. Its presence switches the header to the design's
|
|
78
80
|
* `hasSidebar` layout below `tablet`: the title shrinks beside a menu button, and the
|
|
@@ -95,8 +97,8 @@ export interface BitkitPageHeaderProps extends Omit<BoxProps, 'title'> {
|
|
|
95
97
|
* page spaces its content from the header itself.
|
|
96
98
|
*
|
|
97
99
|
* The collapsed row keeps its padding, which centres the row rather than spacing the page, and from
|
|
98
|
-
* `tablet` a
|
|
99
|
-
* `tablet`
|
|
100
|
+
* `tablet` a stuck `sticky` header keeps its line as well, since content scrolls under it. Below
|
|
101
|
+
* `tablet` the header doesn't stick, so there the line goes too.
|
|
100
102
|
*
|
|
101
103
|
* Ignored with `tabs`, whose list sits on that edge. That includes `variant="minimal"`, which hides
|
|
102
104
|
* the tab list from `tablet`: the line stays although no tabs show above it.
|
|
@@ -137,7 +139,7 @@ export interface BitkitPageHeaderProps extends Omit<BoxProps, 'title'> {
|
|
|
137
139
|
* Truncated to a single line with an ellipsis. When it does not fit, hovering or focusing it
|
|
138
140
|
* shows the full string in a tooltip — so a long title never grows the header.
|
|
139
141
|
*
|
|
140
|
-
* In the collapsed layout (`minimal` or `
|
|
142
|
+
* In the collapsed layout (`minimal` or a stuck `sticky` header) *with* a `breadcrumb`, the design shows the
|
|
141
143
|
* title in the trail rather than as a heading, so end the breadcrumb with a
|
|
142
144
|
* `BitkitBreadcrumb.CurrentItem` carrying it — the title is then rendered as a visually hidden
|
|
143
145
|
* `h1`, since `Breadcrumb.CurrentLink` is a link and not a heading. Below `tablet` the header
|
|
@@ -147,10 +149,12 @@ export interface BitkitPageHeaderProps extends Omit<BoxProps, 'title'> {
|
|
|
147
149
|
title: string;
|
|
148
150
|
/**
|
|
149
151
|
* `minimal` collapses the header to the single breadcrumb row used by sub-pages that don't repeat
|
|
150
|
-
* their title as a heading. Like `
|
|
151
|
-
* `
|
|
152
|
+
* their title as a heading. Like `sticky`, it only collapses from `tablet` up. Its actions are
|
|
153
|
+
* `sm` — see `children`.
|
|
152
154
|
*/
|
|
153
155
|
variant?: 'default' | 'minimal';
|
|
154
156
|
}
|
|
155
157
|
declare const BitkitPageHeader: import('react').ForwardRefExoticComponent<BitkitPageHeaderProps & import('react').RefAttributes<HTMLElement>>;
|
|
158
|
+
export { pageHeaderBottom } from './pageHeaderBottom';
|
|
159
|
+
export { default as usePageHeaderBottom } from './usePageHeaderBottom';
|
|
156
160
|
export default BitkitPageHeader;
|