@bitrise/bitkit-v2 0.3.466 → 0.3.468-beta.2968

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.
Files changed (56) hide show
  1. package/dist/components/BitkitCombobox/BitkitCombobox.d.ts +3 -3
  2. package/dist/components/BitkitCombobox/BitkitCombobox.js +6 -2
  3. package/dist/components/BitkitCombobox/BitkitCombobox.js.map +1 -1
  4. package/dist/components/BitkitMultiselect/BitkitMultiselect.d.ts +3 -3
  5. package/dist/components/BitkitMultiselect/BitkitMultiselect.js +4 -1
  6. package/dist/components/BitkitMultiselect/BitkitMultiselect.js.map +1 -1
  7. package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.d.ts +3 -3
  8. package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.js.map +1 -1
  9. package/dist/components/BitkitSelect/BitkitSelect.d.ts +3 -3
  10. package/dist/components/BitkitSelect/BitkitSelect.js +4 -1
  11. package/dist/components/BitkitSelect/BitkitSelect.js.map +1 -1
  12. package/dist/components/BitkitSelectMenu/BitkitSelectMenu.d.ts +7 -2
  13. package/dist/components/BitkitSelectMenu/BitkitSelectMenu.js.map +1 -1
  14. package/dist/components/BitkitSelectMenu/SelectMenuShell.d.ts +3 -3
  15. package/dist/components/BitkitSelectMenu/SelectMenuShell.js +59 -29
  16. package/dist/components/BitkitSelectMenu/SelectMenuShell.js.map +1 -1
  17. package/dist/components/BitkitUISideNav/BitkitUISideNav.d.ts +38 -0
  18. package/dist/components/BitkitUISideNav/BitkitUISideNav.js +167 -0
  19. package/dist/components/BitkitUISideNav/BitkitUISideNav.js.map +1 -0
  20. package/dist/components/BitkitUISideNav/UISideNavBody.d.ts +7 -0
  21. package/dist/components/BitkitUISideNav/UISideNavBody.js +20 -0
  22. package/dist/components/BitkitUISideNav/UISideNavBody.js.map +1 -0
  23. package/dist/components/BitkitUISideNav/UISideNavContext.d.ts +32 -0
  24. package/dist/components/BitkitUISideNav/UISideNavContext.js +28 -0
  25. package/dist/components/BitkitUISideNav/UISideNavContext.js.map +1 -0
  26. package/dist/components/BitkitUISideNav/UISideNavFooter.d.ts +16 -0
  27. package/dist/components/BitkitUISideNav/UISideNavFooter.js +28 -0
  28. package/dist/components/BitkitUISideNav/UISideNavFooter.js.map +1 -0
  29. package/dist/components/BitkitUISideNav/UISideNavFooterHeading.d.ts +12 -0
  30. package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js +26 -0
  31. package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js.map +1 -0
  32. package/dist/components/BitkitUISideNav/UISideNavItem.d.ts +26 -0
  33. package/dist/components/BitkitUISideNav/UISideNavItem.js +33 -0
  34. package/dist/components/BitkitUISideNav/UISideNavItem.js.map +1 -0
  35. package/dist/components/BitkitUISideNav/UISideNavLink.d.ts +30 -0
  36. package/dist/components/BitkitUISideNav/UISideNavLink.js +58 -0
  37. package/dist/components/BitkitUISideNav/UISideNavLink.js.map +1 -0
  38. package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.d.ts +55 -0
  39. package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js +127 -0
  40. package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js.map +1 -0
  41. package/dist/components/index.d.ts +2 -0
  42. package/dist/main.js +4 -1
  43. package/dist/theme/slot-recipes/DatePickerSelect.recipe.d.ts +14 -2
  44. package/dist/theme/slot-recipes/Drawer.recipe.d.ts +44 -3
  45. package/dist/theme/slot-recipes/Drawer.recipe.js +103 -39
  46. package/dist/theme/slot-recipes/Drawer.recipe.js.map +1 -1
  47. package/dist/theme/slot-recipes/Select.recipe.d.ts +23 -5
  48. package/dist/theme/slot-recipes/Select.recipe.js +37 -3
  49. package/dist/theme/slot-recipes/Select.recipe.js.map +1 -1
  50. package/dist/theme/slot-recipes/UISideNav.recipe.d.ts +119 -0
  51. package/dist/theme/slot-recipes/UISideNav.recipe.js +416 -0
  52. package/dist/theme/slot-recipes/UISideNav.recipe.js.map +1 -0
  53. package/dist/theme/slot-recipes/index.d.ts +194 -10
  54. package/dist/theme/slot-recipes/index.js +3 -1
  55. package/dist/theme/slot-recipes/index.js.map +1 -1
  56. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  import IconCross from "../../icons/IconCross.js";
2
+ import IconCrossCircle from "../../icons/IconCrossCircle.js";
2
3
  import IconMagnifier from "../../icons/IconMagnifier.js";
3
4
  import BitkitGroupHeading from "../BitkitGroupHeading/BitkitGroupHeading.js";
4
5
  import { SelectMenuShellContextProvider } from "./BitkitSelectMenuAction.js";
5
6
  import { Box } from "@chakra-ui/react/box";
6
7
  import { chakra } from "@chakra-ui/react/styled-system";
7
- import { isValidElement, useRef } from "react";
8
+ import { isValidElement, useEffect, useRef } from "react";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  import { Text } from "@chakra-ui/react/text";
10
11
  import { Spinner } from "@chakra-ui/react/spinner";
@@ -21,9 +22,10 @@ var selectSizeMap = {
21
22
  spinnerSize: "md"
22
23
  }
23
24
  };
24
- var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emptyHelperText, emptyLabel = "No matching options", iconSize, isLoading = false, onScrolledToBottom, onSearchChange, renderItem, searchValue, spinnerSize, styles }) => {
25
+ var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emptyHelperText, emptyLabel = "No matching options", errorHelperText, errorLabel, iconSize, isLoading = false, onScrolledToBottom, onSearchChange, renderItem, searchPlaceholder, searchValue, spinnerSize, styles }) => {
25
26
  const { css: contentCss, ...restContentProps } = contentProps ?? {};
26
27
  const isEmpty = collection.size === 0;
28
+ const hasError = !isLoading && !!errorLabel;
27
29
  const hasAction = isValidElement(children);
28
30
  const wasAtBottom = useRef(false);
29
31
  const handleItemListScroll = (event) => {
@@ -49,11 +51,27 @@ var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emp
49
51
  }),
50
52
  onSearchChange && /* @__PURE__ */ jsx(SelectMenuSearch, {
51
53
  iconSize,
54
+ placeholder: searchPlaceholder,
52
55
  styles,
53
56
  value: searchValue ?? "",
54
57
  onSearchChange
55
58
  }),
56
- /* @__PURE__ */ jsxs(Box, {
59
+ hasError ? /* @__PURE__ */ jsxs(Box, {
60
+ css: styles.errorState,
61
+ children: [/* @__PURE__ */ jsx(IconCrossCircle, {
62
+ css: styles.errorIcon,
63
+ size: iconSize
64
+ }), /* @__PURE__ */ jsxs(Box, {
65
+ css: styles.errorTextBlock,
66
+ children: [/* @__PURE__ */ jsx(Text, {
67
+ css: styles.errorLabel,
68
+ children: errorLabel
69
+ }), errorHelperText && /* @__PURE__ */ jsx(Text, {
70
+ css: styles.itemHelperText,
71
+ children: errorHelperText
72
+ })]
73
+ })]
74
+ }) : /* @__PURE__ */ jsxs(Box, {
57
75
  css: styles.itemList,
58
76
  onScroll: handleItemListScroll,
59
77
  children: [
@@ -93,32 +111,44 @@ var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emp
93
111
  })
94
112
  });
95
113
  };
96
- var SelectMenuSearch = ({ iconSize, onSearchChange, styles, value }) => /* @__PURE__ */ jsxs(Box, {
97
- css: styles.searchInputGroup,
98
- children: [
99
- /* @__PURE__ */ jsx(IconMagnifier, {
100
- size: iconSize,
101
- color: "icon/tertiary"
102
- }),
103
- /* @__PURE__ */ jsx(chakra.input, {
104
- "aria-label": "Search",
105
- css: styles.searchInput,
106
- placeholder: "Search...",
107
- value,
108
- onChange: (event) => onSearchChange(event.target.value),
109
- onKeyDown: (event) => {
110
- if (event.key === " ") event.stopPropagation();
111
- }
112
- }),
113
- value && /* @__PURE__ */ jsx(chakra.button, {
114
- type: "button",
115
- css: styles.searchClear,
116
- "aria-label": "Clear search",
117
- onClick: () => onSearchChange(""),
118
- children: /* @__PURE__ */ jsx(IconCross, { size: iconSize })
119
- })
120
- ]
121
- });
114
+ var SelectMenuSearch = ({ iconSize, onSearchChange, placeholder = "Search...", styles, value }) => {
115
+ const inputRef = useRef(null);
116
+ useEffect(() => {
117
+ const input = inputRef.current;
118
+ const content = input?.closest("[data-part=\"content\"]");
119
+ if (!input || content?.getAttribute("data-state") !== "open") return;
120
+ const focused = document.activeElement;
121
+ if (focused && focused !== content && content.contains(focused)) return;
122
+ input.focus();
123
+ }, []);
124
+ return /* @__PURE__ */ jsxs(Box, {
125
+ css: styles.searchInputGroup,
126
+ children: [
127
+ /* @__PURE__ */ jsx(IconMagnifier, {
128
+ size: iconSize,
129
+ color: "icon/tertiary"
130
+ }),
131
+ /* @__PURE__ */ jsx(chakra.input, {
132
+ "aria-label": "Search",
133
+ css: styles.searchInput,
134
+ placeholder,
135
+ ref: inputRef,
136
+ value,
137
+ onChange: (event) => onSearchChange(event.target.value),
138
+ onKeyDown: (event) => {
139
+ if (event.key === " ") event.stopPropagation();
140
+ }
141
+ }),
142
+ value && /* @__PURE__ */ jsx(chakra.button, {
143
+ type: "button",
144
+ css: styles.searchClear,
145
+ "aria-label": "Clear search",
146
+ onClick: () => onSearchChange(""),
147
+ children: /* @__PURE__ */ jsx(IconCross, { size: iconSize })
148
+ })
149
+ ]
150
+ });
151
+ };
122
152
  //#endregion
123
153
  export { SelectMenuShell, selectSizeMap };
124
154
 
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMenuShell.js","names":[],"sources":["../../../lib/components/BitkitSelectMenu/SelectMenuShell.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { type ListCollection } from '@chakra-ui/react/collection';\nimport { type Combobox } from '@chakra-ui/react/combobox';\nimport { type Select, type SelectContentProps } from '@chakra-ui/react/select';\nimport { Spinner } from '@chakra-ui/react/spinner';\nimport { chakra, type SystemStyleObject } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { type ChangeEvent, isValidElement, type ReactNode, type Ref, type UIEvent, useRef } from 'react';\n\nimport { IconCross, IconMagnifier } from '../../icons';\nimport BitkitGroupHeading from '../BitkitGroupHeading/BitkitGroupHeading';\nimport {\n type BitkitSelectMenuEmptyStateProps,\n type BitkitSelectMenuScrollProps,\n type BitkitSelectMenuSearchProps,\n} from './BitkitSelectMenu';\nimport { type BitkitSelectMenuActionChild, SelectMenuShellContextProvider } from './BitkitSelectMenuAction';\n\nexport const selectSizeMap = {\n lg: { avatarSize: '32', iconSize: '24', spinnerSize: 'lg' },\n md: { avatarSize: '24', iconSize: '16', spinnerSize: 'md' },\n} as const;\n\nexport type SelectSizes = (typeof selectSizeMap)[keyof typeof selectSizeMap];\n\n/**\n * Internal shared shell for BitkitSelectMenu and BitkitMultiselectMenu.\n * Handles Content wrapper, search, loading, empty state, groups, and the action slot —\n * the caller only provides per-item rendering via renderItem and any sub-components\n * (e.g. <BitkitSelectMenu.Action />) via children.\n */\nexport type SelectMenuShellProps<T extends { value: string; group?: string }> = {\n NS: typeof Select | typeof Combobox;\n children?: BitkitSelectMenuActionChild;\n collection: ListCollection<T>;\n contentProps?: SelectContentProps;\n contentRef?: Ref<HTMLDivElement>;\n iconSize: SelectSizes['iconSize'];\n isLoading?: boolean;\n renderItem: (item: T) => ReactNode;\n spinnerSize: SelectSizes['spinnerSize'];\n styles: Record<string, SystemStyleObject>;\n} & BitkitSelectMenuSearchProps &\n BitkitSelectMenuScrollProps &\n BitkitSelectMenuEmptyStateProps;\n\nexport const SelectMenuShell = <T extends { value: string; group?: string }>({\n NS,\n children,\n collection,\n contentProps,\n contentRef,\n emptyHelperText,\n emptyLabel = 'No matching options',\n iconSize,\n isLoading = false,\n onScrolledToBottom,\n onSearchChange,\n renderItem,\n searchValue,\n spinnerSize,\n styles,\n}: SelectMenuShellProps<T>) => {\n const { css: contentCss, ...restContentProps } = contentProps ?? {};\n const isEmpty = collection.size === 0;\n const hasAction = isValidElement(children);\n\n const wasAtBottom = useRef(false);\n const handleItemListScroll = (event: UIEvent<HTMLDivElement>) => {\n const list = event.currentTarget;\n const atBottom = list.scrollTop >= list.scrollHeight - list.offsetHeight - 1;\n // Only the transition into \"at the end\", so resting at the bottom doesn't keep asking.\n if (atBottom && !wasAtBottom.current) onScrolledToBottom?.();\n wasAtBottom.current = atBottom;\n };\n\n return (\n <SelectMenuShellContextProvider value={{ iconSize, styles }}>\n <NS.Content css={[styles.content, contentCss]} ref={contentRef} {...restContentProps}>\n {/*\n Without a search input, Zag's getInitialFocus (see @zag-js/dom-query) picks the first\n tabbable descendant as the menu's initial focus target — which would be the action\n slot, visually confusing. A hidden [data-autofocus] span wins over tabbables in\n getInitialFocus's querySelector, so we focus an invisible element instead and Zag's\n aria-activedescendant drives the highlight like a normal Select would.\n */}\n {!onSearchChange && hasAction && <span data-autofocus=\"\" tabIndex={-1} aria-hidden=\"true\" />}\n {onSearchChange && (\n <SelectMenuSearch\n iconSize={iconSize}\n styles={styles}\n value={searchValue ?? ''}\n onSearchChange={onSearchChange}\n />\n )}\n <Box css={styles.itemList} onScroll={handleItemListScroll}>\n {isLoading && (\n <Box css={styles.item}>\n <Spinner variant=\"purple\" size={spinnerSize} css={styles.itemLoading} />\n <Text css={styles.itemLoadingLabel}>Loading...</Text>\n </Box>\n )}\n {!isLoading && isEmpty && (\n <Box css={styles.emptyState}>\n <Text css={styles.itemLabel}>{emptyLabel}</Text>\n {emptyHelperText && <Text css={styles.itemHelperText}>{emptyHelperText}</Text>}\n </Box>\n )}\n {!isLoading &&\n !isEmpty &&\n collection.group().map(([type, group]) => (\n <NS.ItemGroup key={type}>\n {type && (\n <NS.ItemGroupLabel asChild>\n <BitkitGroupHeading label={type} paddingBlock=\"12\" paddingInline=\"16\" />\n </NS.ItemGroupLabel>\n )}\n {group.map(renderItem)}\n </NS.ItemGroup>\n ))}\n </Box>\n {children}\n </NS.Content>\n </SelectMenuShellContextProvider>\n );\n};\n\ntype SelectMenuSearchProps = {\n iconSize: '16' | '24';\n onSearchChange: (searchText: string) => void;\n styles: Record<string, SystemStyleObject>;\n value: string;\n};\n\nconst SelectMenuSearch = ({ iconSize, onSearchChange, styles, value }: SelectMenuSearchProps) => (\n <Box css={styles.searchInputGroup}>\n <IconMagnifier size={iconSize} color=\"icon/tertiary\" />\n <chakra.input\n aria-label=\"Search\"\n css={styles.searchInput}\n placeholder=\"Search...\"\n value={value}\n onChange={(event: ChangeEvent<HTMLInputElement>) => onSearchChange(event.target.value)}\n onKeyDown={(event) => {\n // Zag's Select.Content keyDown listener fires ITEM.CLICK + preventDefault on Space\n // regardless of which descendant is focused. That would eat the space before the\n // input can type it. Enter is left alone so \"type-then-Enter-to-select\" still works.\n if (event.key === ' ') event.stopPropagation();\n }}\n />\n {value && (\n <chakra.button\n type=\"button\"\n css={styles.searchClear}\n aria-label=\"Clear search\"\n onClick={() => onSearchChange('')}\n >\n <IconCross size={iconSize} />\n </chakra.button>\n )}\n </Box>\n);\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,gBAAgB;CAC3B,IAAI;EAAE,YAAY;EAAM,UAAU;EAAM,aAAa;CAAK;CAC1D,IAAI;EAAE,YAAY;EAAM,UAAU;EAAM,aAAa;CAAK;AAC5D;AAyBA,IAAa,mBAAgE,EAC3E,IACA,UACA,YACA,cACA,YACA,iBACA,aAAa,uBACb,UACA,YAAY,OACZ,oBACA,gBACA,YACA,aACA,aACA,aAC6B;CAC7B,MAAM,EAAE,KAAK,YAAY,GAAG,qBAAqB,gBAAgB,CAAC;CAClE,MAAM,UAAU,WAAW,SAAS;CACpC,MAAM,YAAY,eAAe,QAAQ;CAEzC,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,wBAAwB,UAAmC;EAC/D,MAAM,OAAO,MAAM;EACnB,MAAM,WAAW,KAAK,aAAa,KAAK,eAAe,KAAK,eAAe;EAE3E,IAAI,YAAY,CAAC,YAAY,SAAS,qBAAqB;EAC3D,YAAY,UAAU;CACxB;CAEA,OACE,oBAAC,gCAAD;EAAgC,OAAO;GAAE;GAAU;EAAO;EACxD,UAAA,qBAAC,GAAG,SAAJ;GAAY,KAAK,CAAC,OAAO,SAAS,UAAU;GAAG,KAAK;GAAY,GAAI;GAApE,UAAA;IAQG,CAAC,kBAAkB,aAAa,oBAAC,QAAD;K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,KAAK,MAAM,gBAAgB;GAC/C;EACD,CAAA;EACA,SACC,oBAAC,OAAO,QAAR;GACE,MAAK;GACL,KAAK,OAAO;GACZ,cAAW;GACX,eAAe,eAAe,EAAE;GAEhC,UAAA,oBAAC,WAAD,EAAW,MAAM,SAAW,CAAA;EACf,CAAA;CAEd"}
1
+ {"version":3,"file":"SelectMenuShell.js","names":[],"sources":["../../../lib/components/BitkitSelectMenu/SelectMenuShell.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { type ListCollection } from '@chakra-ui/react/collection';\nimport { type Combobox } from '@chakra-ui/react/combobox';\nimport { type Select, type SelectContentProps } from '@chakra-ui/react/select';\nimport { Spinner } from '@chakra-ui/react/spinner';\nimport { chakra, type SystemStyleObject } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { type ChangeEvent, isValidElement, type ReactNode, type Ref, type UIEvent, useEffect, useRef } from 'react';\n\nimport { IconCross, IconCrossCircle, IconMagnifier } from '../../icons';\nimport BitkitGroupHeading from '../BitkitGroupHeading/BitkitGroupHeading';\nimport {\n type BitkitSelectMenuEmptyStateProps,\n type BitkitSelectMenuErrorStateProps,\n type BitkitSelectMenuScrollProps,\n type BitkitSelectMenuSearchProps,\n} from './BitkitSelectMenu';\nimport { type BitkitSelectMenuActionChild, SelectMenuShellContextProvider } from './BitkitSelectMenuAction';\n\nexport const selectSizeMap = {\n lg: { avatarSize: '32', iconSize: '24', spinnerSize: 'lg' },\n md: { avatarSize: '24', iconSize: '16', spinnerSize: 'md' },\n} as const;\n\nexport type SelectSizes = (typeof selectSizeMap)[keyof typeof selectSizeMap];\n\n/**\n * Internal shared shell for BitkitSelectMenu and BitkitMultiselectMenu.\n * Handles Content wrapper, search, loading, empty state, groups, and the action slot —\n * the caller only provides per-item rendering via renderItem and any sub-components\n * (e.g. <BitkitSelectMenu.Action />) via children.\n */\nexport type SelectMenuShellProps<T extends { value: string; group?: string }> = {\n NS: typeof Select | typeof Combobox;\n children?: BitkitSelectMenuActionChild;\n collection: ListCollection<T>;\n contentProps?: SelectContentProps;\n contentRef?: Ref<HTMLDivElement>;\n iconSize: SelectSizes['iconSize'];\n isLoading?: boolean;\n renderItem: (item: T) => ReactNode;\n spinnerSize: SelectSizes['spinnerSize'];\n styles: Record<string, SystemStyleObject>;\n} & BitkitSelectMenuSearchProps &\n BitkitSelectMenuScrollProps &\n BitkitSelectMenuEmptyStateProps &\n BitkitSelectMenuErrorStateProps;\n\nexport const SelectMenuShell = <T extends { value: string; group?: string }>({\n NS,\n children,\n collection,\n contentProps,\n contentRef,\n emptyHelperText,\n emptyLabel = 'No matching options',\n errorHelperText,\n errorLabel,\n iconSize,\n isLoading = false,\n onScrolledToBottom,\n onSearchChange,\n renderItem,\n searchPlaceholder,\n searchValue,\n spinnerSize,\n styles,\n}: SelectMenuShellProps<T>) => {\n const { css: contentCss, ...restContentProps } = contentProps ?? {};\n const isEmpty = collection.size === 0;\n const hasError = !isLoading && !!errorLabel;\n const hasAction = isValidElement(children);\n\n const wasAtBottom = useRef(false);\n const handleItemListScroll = (event: UIEvent<HTMLDivElement>) => {\n const list = event.currentTarget;\n const atBottom = list.scrollTop >= list.scrollHeight - list.offsetHeight - 1;\n // Only the transition into \"at the end\", so resting at the bottom doesn't keep asking.\n if (atBottom && !wasAtBottom.current) onScrolledToBottom?.();\n wasAtBottom.current = atBottom;\n };\n\n return (\n <SelectMenuShellContextProvider value={{ iconSize, styles }}>\n <NS.Content css={[styles.content, contentCss]} ref={contentRef} {...restContentProps}>\n {/*\n Without a search input, Zag's getInitialFocus (see @zag-js/dom-query) picks the first\n tabbable descendant as the menu's initial focus target — which would be the action\n slot, visually confusing. A hidden [data-autofocus] span wins over tabbables in\n getInitialFocus's querySelector, so we focus an invisible element instead and Zag's\n aria-activedescendant drives the highlight like a normal Select would. Zag picks that\n target once, when the menu opens, so a search input that arrives later takes the focus\n over from the span itself — see SelectMenuSearch below.\n */}\n {!onSearchChange && hasAction && <span data-autofocus=\"\" tabIndex={-1} aria-hidden=\"true\" />}\n {onSearchChange && (\n <SelectMenuSearch\n iconSize={iconSize}\n placeholder={searchPlaceholder}\n styles={styles}\n value={searchValue ?? ''}\n onSearchChange={onSearchChange}\n />\n )}\n {hasError ? (\n <Box css={styles.errorState}>\n <IconCrossCircle css={styles.errorIcon} size={iconSize} />\n <Box css={styles.errorTextBlock}>\n <Text css={styles.errorLabel}>{errorLabel}</Text>\n {errorHelperText && <Text css={styles.itemHelperText}>{errorHelperText}</Text>}\n </Box>\n </Box>\n ) : (\n <Box css={styles.itemList} onScroll={handleItemListScroll}>\n {isLoading && (\n <Box css={styles.item}>\n <Spinner variant=\"purple\" size={spinnerSize} css={styles.itemLoading} />\n <Text css={styles.itemLoadingLabel}>Loading...</Text>\n </Box>\n )}\n {!isLoading && isEmpty && (\n <Box css={styles.emptyState}>\n <Text css={styles.itemLabel}>{emptyLabel}</Text>\n {emptyHelperText && <Text css={styles.itemHelperText}>{emptyHelperText}</Text>}\n </Box>\n )}\n {!isLoading &&\n !isEmpty &&\n collection.group().map(([type, group]) => (\n <NS.ItemGroup key={type}>\n {type && (\n <NS.ItemGroupLabel asChild>\n <BitkitGroupHeading label={type} paddingBlock=\"12\" paddingInline=\"16\" />\n </NS.ItemGroupLabel>\n )}\n {group.map(renderItem)}\n </NS.ItemGroup>\n ))}\n </Box>\n )}\n {children}\n </NS.Content>\n </SelectMenuShellContextProvider>\n );\n};\n\ntype SelectMenuSearchProps = {\n iconSize: '16' | '24';\n onSearchChange: (searchText: string) => void;\n placeholder?: string;\n styles: Record<string, SystemStyleObject>;\n value: string;\n};\n\nconst SelectMenuSearch = ({\n iconSize,\n onSearchChange,\n placeholder = 'Search...',\n styles,\n value,\n}: SelectMenuSearchProps) => {\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n const input = inputRef.current;\n const content = input?.closest('[data-part=\"content\"]');\n if (!input || content?.getAttribute('data-state') !== 'open') return;\n const focused = document.activeElement;\n if (focused && focused !== content && content.contains(focused)) return;\n input.focus();\n }, []);\n\n return (\n <Box css={styles.searchInputGroup}>\n <IconMagnifier size={iconSize} color=\"icon/tertiary\" />\n <chakra.input\n aria-label=\"Search\"\n css={styles.searchInput}\n placeholder={placeholder}\n ref={inputRef}\n value={value}\n onChange={(event: ChangeEvent<HTMLInputElement>) => onSearchChange(event.target.value)}\n onKeyDown={(event) => {\n // Zag's Select.Content keyDown listener fires ITEM.CLICK + preventDefault on Space\n // regardless of which descendant is focused. That would eat the space before the\n // input can type it. Enter is left alone so \"type-then-Enter-to-select\" still works.\n if (event.key === ' ') event.stopPropagation();\n }}\n />\n {value && (\n <chakra.button\n type=\"button\"\n css={styles.searchClear}\n aria-label=\"Clear search\"\n onClick={() => onSearchChange('')}\n >\n <IconCross size={iconSize} />\n </chakra.button>\n )}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAa,gBAAgB;CAC3B,IAAI;EAAE,YAAY;EAAM,UAAU;EAAM,aAAa;CAAK;CAC1D,IAAI;EAAE,YAAY;EAAM,UAAU;EAAM,aAAa;CAAK;AAC5D;AA0BA,IAAa,mBAAgE,EAC3E,IACA,UACA,YACA,cACA,YACA,iBACA,aAAa,uBACb,iBACA,YACA,UACA,YAAY,OACZ,oBACA,gBACA,YACA,mBACA,aACA,aACA,aAC6B;CAC7B,MAAM,EAAE,KAAK,YAAY,GAAG,qBAAqB,gBAAgB,CAAC;CAClE,MAAM,UAAU,WAAW,SAAS;CACpC,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;CACjC,MAAM,YAAY,eAAe,QAAQ;CAEzC,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,wBAAwB,UAAmC;EAC/D,MAAM,OAAO,MAAM;EACnB,MAAM,WAAW,KAAK,aAAa,KAAK,eAAe,KAAK,eAAe;EAE3E,IAAI,YAAY,CAAC,YAAY,SAAS,qBAAqB;EAC3D,YAAY,UAAU;CACxB;CAEA,OACE,oBAAC,gCAAD;EAAgC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BAAC,GAAG,gBAAJ;OAAmB,SAAA;OACjB,UAAA,oBAAC,oBAAD;QAAoB,OAAO;QAAM,cAAa;QAAK,eAAc;OAAM,CAAA;MACtD,CAAA,GAEpB,MAAM,IAAI,UAAU,CACT,EAAA,GAPK,IAOL,CACf;KACA;;IAEN;GACS;;CACkB,CAAA;AAEpC;AAUA,IAAM,oBAAoB,EACxB,UACA,gBACA,cAAc,aACd,QACA,YAC2B;CAC3B,MAAM,WAAW,OAAyB,IAAI;CAE9C,gBAAgB;EACd,MAAM,QAAQ,SAAS;EACvB,MAAM,UAAU,OAAO,QAAQ,yBAAuB;EACtD,IAAI,CAAC,SAAS,SAAS,aAAa,YAAY,MAAM,QAAQ;EAC9D,MAAM,UAAU,SAAS;EACzB,IAAI,WAAW,YAAY,WAAW,QAAQ,SAAS,OAAO,GAAG;EACjE,MAAM,MAAM;CACd,GAAG,CAAC,CAAC;CAEL,OACE,qBAAC,KAAD;EAAK,KAAK,OAAO;EAAjB,UAAA;GACE,oBAAC,eAAD;IAAe,MAAM;IAAU,OAAM;GAAiB,CAAA;GACtD,oBAAC,OAAO,OAAR;IACE,cAAW;IACX,KAAK,OAAO;IACC;IACb,KAAK;IACE;IACP,WAAW,UAAyC,eAAe,MAAM,OAAO,KAAK;IACrF,YAAY,UAAU;KAIpB,IAAI,MAAM,QAAQ,KAAK,MAAM,gBAAgB;IAC/C;GACD,CAAA;GACA,SACC,oBAAC,OAAO,QAAR;IACE,MAAK;IACL,KAAK,OAAO;IACZ,cAAW;IACX,eAAe,eAAe,EAAE;IAEhC,UAAA,oBAAC,WAAD,EAAW,MAAM,SAAW,CAAA;GACf,CAAA;EAEd;;AAET"}
@@ -0,0 +1,38 @@
1
+ import { BoxProps } from '@chakra-ui/react/box';
2
+ import { ReactNode } from 'react';
3
+ export interface BitkitUISideNavProps extends Omit<BoxProps, 'children'> {
4
+ children: ReactNode;
5
+ /**
6
+ * Forces the desktop rail open or shut, overriding the pointer and focus behaviour. Leave it
7
+ * unset for the normal rail. Set it to `true` while something the rail does not know about is
8
+ * anchored to it, such as a popover opened from the footer.
9
+ */
10
+ expanded?: boolean;
11
+ /** Mobile drawer visibility. Controlled, because the header's menu button is what opens it. */
12
+ open?: boolean;
13
+ onOpenChange?: (open: boolean) => void;
14
+ }
15
+ export { uiSideNavRailWidth } from '../../theme/slot-recipes/UISideNav.recipe';
16
+ export { type BitkitUISideNavBodyProps } from './UISideNavBody';
17
+ export { type BitkitUISideNavFooterProps } from './UISideNavFooter';
18
+ export { type BitkitUISideNavFooterHeadingProps } from './UISideNavFooterHeading';
19
+ export { type BitkitUISideNavItemProps } from './UISideNavItem';
20
+ export { type BitkitUISideNavLinkAsAnchorProps, type BitkitUISideNavLinkAsButtonProps, type BitkitUISideNavLinkProps, } from './UISideNavLink';
21
+ export { type BitkitUISideNavWorkspaceProps, type BitkitUISideNavWorkspaceSelectorProps, } from './UISideNavWorkspaceSelector';
22
+ declare const _default: import('react').ForwardRefExoticComponent<BitkitUISideNavProps & import('react').RefAttributes<HTMLElement>> & {
23
+ Body: import('react').ForwardRefExoticComponent<import('./UISideNavBody').BitkitUISideNavBodyProps & import('react').RefAttributes<HTMLDivElement>>;
24
+ Footer: import('react').ForwardRefExoticComponent<import('./UISideNavFooter').BitkitUISideNavFooterProps & import('react').RefAttributes<HTMLDivElement>>;
25
+ FooterHeading: import('react').ForwardRefExoticComponent<import('./UISideNavFooterHeading').BitkitUISideNavFooterHeadingProps & import('react').RefAttributes<HTMLParagraphElement>>;
26
+ Item: import('react').ForwardRefExoticComponent<import('./UISideNavItem').BitkitUISideNavItemProps & import('react').RefAttributes<HTMLAnchorElement>>;
27
+ Link: import('react').ForwardRefExoticComponent<import('./UISideNavLink').BitkitUISideNavLinkProps & import('react').RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
28
+ WorkspaceSelector: import('react').ForwardRefExoticComponent<Omit<import('@chakra-ui/react').SelectTriggerProps, "children" | "onChange"> & {
29
+ children?: import('../BitkitSelectMenu/BitkitSelectMenuAction').BitkitSelectMenuActionChild;
30
+ isLoading?: boolean;
31
+ label?: string;
32
+ onOpenChange?: (open: boolean) => void;
33
+ onValueChange?: (value: string) => void;
34
+ value?: string;
35
+ workspaces: Array<import('./UISideNavWorkspaceSelector').BitkitUISideNavWorkspaceProps>;
36
+ } & Omit<import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuSearchProps, "searchPlaceholder"> & import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuScrollProps & import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuEmptyStateProps & import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuErrorStateProps & import('react').RefAttributes<HTMLButtonElement>>;
37
+ };
38
+ export default _default;
@@ -0,0 +1,167 @@
1
+ import { withSubComponents } from "../../utilities/withSubComponents.js";
2
+ import BitkitCloseButton from "../BitkitCloseButton/BitkitCloseButton.js";
3
+ import useResponsive from "../../hooks/useResponsive.js";
4
+ import { UISideNavContextProvider } from "./UISideNavContext.js";
5
+ import UISideNavBody from "./UISideNavBody.js";
6
+ import UISideNavFooter from "./UISideNavFooter.js";
7
+ import UISideNavFooterHeading from "./UISideNavFooterHeading.js";
8
+ import UISideNavItem from "./UISideNavItem.js";
9
+ import UISideNavLink from "./UISideNavLink.js";
10
+ import UISideNavWorkspaceSelector from "./UISideNavWorkspaceSelector.js";
11
+ import { uiSideNavRailWidth } from "../../theme/slot-recipes/UISideNav.recipe.js";
12
+ import { Box } from "@chakra-ui/react/box";
13
+ import { useSlotRecipe } from "@chakra-ui/react/styled-system";
14
+ import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ import { Portal } from "@chakra-ui/react/portal";
17
+ import { mergeRefs } from "@chakra-ui/react";
18
+ import { Drawer } from "@chakra-ui/react/drawer";
19
+ //#region lib/components/BitkitUISideNav/BitkitUISideNav.tsx
20
+ /**
21
+ * The platform's primary navigation. It expects a workspace selector, a body of navigation
22
+ * items, and an optional footer:
23
+ *
24
+ * ```tsx
25
+ * <BitkitUISideNav open={open} onOpenChange={setOpen}>
26
+ * <BitkitUISideNav.WorkspaceSelector
27
+ * workspaces={workspaces}
28
+ * value={workspace}
29
+ * onValueChange={setWorkspace}
30
+ * />
31
+ * <BitkitUISideNav.Body>
32
+ * <BitkitUISideNav.Item href="/dashboard" icon={IconDashboard} selectedIcon={IconDashboardFilled} selected>
33
+ * Dashboard
34
+ * </BitkitUISideNav.Item>
35
+ * </BitkitUISideNav.Body>
36
+ * <BitkitUISideNav.Footer>…</BitkitUISideNav.Footer>
37
+ * </BitkitUISideNav>
38
+ * ```
39
+ *
40
+ * On desktop it is a 72px rail that widens to 256px under the pointer and while anything inside
41
+ * it holds keyboard focus. The rows are always laid out at the full width and clipped, so the
42
+ * labels appear without any text reflowing. It will not collapse while the workspace menu is
43
+ * open. There is no pin: the rail is the resting state.
44
+ *
45
+ * Below the `tablet` breakpoint it becomes an overlay drawer instead, opened by the header rather
46
+ * than by hovering. Pass `open` and `onOpenChange`; they are ignored on desktop.
47
+ *
48
+ * It does not position itself. The consumer decides where it sits and how tall it is, which is
49
+ * what lets a page slot it under a header of any height. The expanded rail overlays the page
50
+ * rather than pushing it, so give it a `position` of your own and reserve 72px beside it.
51
+ *
52
+ * Descendants can read the current state with `useUISideNav()`.
53
+ */
54
+ var BitkitUISideNav = forwardRef((props, ref) => {
55
+ const { children, css, expanded: expandedProp, onBlur, onFocus, onOpenChange, onPointerEnter, onPointerLeave, open = false, ...rest } = props;
56
+ const { isMobile } = useResponsive();
57
+ const [pointerInside, setPointerInside] = useState(false);
58
+ const [focusInside, setFocusInside] = useState(false);
59
+ const [menuOpen, setMenuOpen] = useState(false);
60
+ const menuContainerRef = useRef(null);
61
+ const navRef = useRef(null);
62
+ const setNavRef = useMemo(() => mergeRefs(navRef, ref), [ref]);
63
+ const styles = useSlotRecipe({ key: "uiSideNav" })({ layout: isMobile ? "drawer" : "rail" });
64
+ const expanded = isMobile || (expandedProp ?? (pointerInside || focusInside || menuOpen));
65
+ const tracksPointer = !isMobile && expandedProp === void 0;
66
+ const isInsideNav = (event) => event.target instanceof Node && event.currentTarget.contains(event.target);
67
+ const handleFocus = (event) => {
68
+ onFocus?.(event);
69
+ if (!tracksPointer || !isInsideNav(event)) return;
70
+ if (!event.target.matches(":focus-visible")) return;
71
+ setFocusInside(true);
72
+ };
73
+ const handleBlur = (event) => {
74
+ onBlur?.(event);
75
+ if (!tracksPointer || event.currentTarget.contains(event.relatedTarget)) return;
76
+ setFocusInside(false);
77
+ };
78
+ const handlePointerEnter = (event) => {
79
+ onPointerEnter?.(event);
80
+ if (tracksPointer && isInsideNav(event)) setPointerInside(true);
81
+ };
82
+ const handlePointerLeave = (event) => {
83
+ onPointerLeave?.(event);
84
+ if (tracksPointer && isInsideNav(event)) setPointerInside(false);
85
+ };
86
+ useEffect(() => {
87
+ if (!tracksPointer || !focusInside) return void 0;
88
+ const syncFocusInside = () => {
89
+ if (!navRef.current?.contains(document.activeElement)) setFocusInside(false);
90
+ };
91
+ document.addEventListener("focusin", syncFocusInside);
92
+ return () => document.removeEventListener("focusin", syncFocusInside);
93
+ }, [focusInside, tracksPointer]);
94
+ useEffect(() => {
95
+ if (!tracksPointer || !pointerInside) return void 0;
96
+ const syncPointerInside = () => {
97
+ if (!navRef.current?.matches(":hover")) setPointerInside(false);
98
+ };
99
+ document.addEventListener("pointerover", syncPointerInside);
100
+ return () => document.removeEventListener("pointerover", syncPointerInside);
101
+ }, [pointerInside, tracksPointer]);
102
+ const nav = /* @__PURE__ */ jsx(Box, {
103
+ ref: setNavRef,
104
+ "aria-label": "Platform navigation",
105
+ asChild: true,
106
+ "data-expanded": expanded ? "" : void 0,
107
+ ...rest,
108
+ css: [styles.root, css],
109
+ onBlur: handleBlur,
110
+ onFocus: handleFocus,
111
+ onPointerEnter: handlePointerEnter,
112
+ onPointerLeave: handlePointerLeave,
113
+ children: /* @__PURE__ */ jsx("nav", { children })
114
+ });
115
+ const context = useMemo(() => ({
116
+ expanded,
117
+ isMobile,
118
+ menuContainerRef,
119
+ setMenuOpen,
120
+ styles
121
+ }), [
122
+ expanded,
123
+ isMobile,
124
+ styles
125
+ ]);
126
+ if (!isMobile) return /* @__PURE__ */ jsx(UISideNavContextProvider, {
127
+ value: context,
128
+ children: nav
129
+ });
130
+ return /* @__PURE__ */ jsx(UISideNavContextProvider, {
131
+ value: context,
132
+ children: /* @__PURE__ */ jsx(Drawer.Root, {
133
+ onOpenChange: (details) => onOpenChange?.(details.open),
134
+ open,
135
+ children: /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(Drawer.Backdrop, { css: styles.backdrop }), /* @__PURE__ */ jsx(Drawer.Positioner, {
136
+ css: styles.positioner,
137
+ children: /* @__PURE__ */ jsxs(Drawer.Content, {
138
+ ref: menuContainerRef,
139
+ "aria-label": "Navigation",
140
+ css: styles.content,
141
+ children: [nav, /* @__PURE__ */ jsx(Box, {
142
+ css: styles.closeButton,
143
+ children: /* @__PURE__ */ jsx(BitkitCloseButton, {
144
+ "aria-label": "Close navigation",
145
+ colorVariant: "white",
146
+ onClick: () => onOpenChange?.(false),
147
+ size: "md"
148
+ })
149
+ })]
150
+ })
151
+ })] })
152
+ })
153
+ });
154
+ });
155
+ BitkitUISideNav.displayName = "BitkitUISideNav";
156
+ var BitkitUISideNav_default = withSubComponents(BitkitUISideNav, {
157
+ Body: UISideNavBody,
158
+ Footer: UISideNavFooter,
159
+ FooterHeading: UISideNavFooterHeading,
160
+ Item: UISideNavItem,
161
+ Link: UISideNavLink,
162
+ WorkspaceSelector: UISideNavWorkspaceSelector
163
+ });
164
+ //#endregion
165
+ export { BitkitUISideNav_default as default, uiSideNavRailWidth };
166
+
167
+ //# sourceMappingURL=BitkitUISideNav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitkitUISideNav.js","names":[],"sources":["../../../lib/components/BitkitUISideNav/BitkitUISideNav.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { mergeRefs } from '@chakra-ui/react';\nimport { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { Drawer } from '@chakra-ui/react/drawer';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactNode, useEffect, useMemo, useRef, useState } from 'react';\n\nimport useResponsive from '../../hooks/useResponsive';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitCloseButton from '../BitkitCloseButton/BitkitCloseButton';\nimport UISideNavBody from './UISideNavBody';\nimport { UISideNavContextProvider } from './UISideNavContext';\nimport UISideNavFooter from './UISideNavFooter';\nimport UISideNavFooterHeading from './UISideNavFooterHeading';\nimport UISideNavItem from './UISideNavItem';\nimport UISideNavLink from './UISideNavLink';\nimport UISideNavWorkspaceSelector from './UISideNavWorkspaceSelector';\n\nexport interface BitkitUISideNavProps extends Omit<BoxProps, 'children'> {\n children: ReactNode;\n /**\n * Forces the desktop rail open or shut, overriding the pointer and focus behaviour. Leave it\n * unset for the normal rail. Set it to `true` while something the rail does not know about is\n * anchored to it, such as a popover opened from the footer.\n */\n expanded?: boolean;\n /** Mobile drawer visibility. Controlled, because the header's menu button is what opens it. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * The platform's primary navigation. It expects a workspace selector, a body of navigation\n * items, and an optional footer:\n *\n * ```tsx\n * <BitkitUISideNav open={open} onOpenChange={setOpen}>\n * <BitkitUISideNav.WorkspaceSelector\n * workspaces={workspaces}\n * value={workspace}\n * onValueChange={setWorkspace}\n * />\n * <BitkitUISideNav.Body>\n * <BitkitUISideNav.Item href=\"/dashboard\" icon={IconDashboard} selectedIcon={IconDashboardFilled} selected>\n * Dashboard\n * </BitkitUISideNav.Item>\n * </BitkitUISideNav.Body>\n * <BitkitUISideNav.Footer>…</BitkitUISideNav.Footer>\n * </BitkitUISideNav>\n * ```\n *\n * On desktop it is a 72px rail that widens to 256px under the pointer and while anything inside\n * it holds keyboard focus. The rows are always laid out at the full width and clipped, so the\n * labels appear without any text reflowing. It will not collapse while the workspace menu is\n * open. There is no pin: the rail is the resting state.\n *\n * Below the `tablet` breakpoint it becomes an overlay drawer instead, opened by the header rather\n * than by hovering. Pass `open` and `onOpenChange`; they are ignored on desktop.\n *\n * It does not position itself. The consumer decides where it sits and how tall it is, which is\n * what lets a page slot it under a header of any height. The expanded rail overlays the page\n * rather than pushing it, so give it a `position` of your own and reserve 72px beside it.\n *\n * Descendants can read the current state with `useUISideNav()`.\n */\nconst BitkitUISideNav = forwardRef<HTMLElement, BitkitUISideNavProps>((props, ref) => {\n const {\n children,\n css,\n expanded: expandedProp,\n onBlur,\n onFocus,\n onOpenChange,\n onPointerEnter,\n onPointerLeave,\n open = false,\n ...rest\n } = props;\n\n const { isMobile } = useResponsive();\n\n const [pointerInside, setPointerInside] = useState(false);\n const [focusInside, setFocusInside] = useState(false);\n const [menuOpen, setMenuOpen] = useState(false);\n const menuContainerRef = useRef<HTMLDivElement>(null);\n const navRef = useRef<HTMLElement>(null);\n const setNavRef = useMemo(() => mergeRefs(navRef, ref), [ref]);\n\n const recipe = useSlotRecipe({ key: 'uiSideNav' });\n const styles = recipe({ layout: isMobile ? 'drawer' : 'rail' });\n\n const expanded = isMobile || (expandedProp ?? (pointerInside || focusInside || menuOpen));\n const tracksPointer = !isMobile && expandedProp === undefined;\n\n // React bubbles a portalled descendant's events through the React tree rather than the DOM\n // tree, so a dialog opened from a footer row reaches these handlers while sitting under\n // `body`. Only a target that is really a DOM descendant counts as being inside the rail.\n const isInsideNav = (event: { currentTarget: Node; target: EventTarget | null }) =>\n event.target instanceof Node && event.currentTarget.contains(event.target);\n\n // The consumer's handlers run first and unconditionally: the rail listens on the same events,\n // it does not own them.\n const handleFocus: NonNullable<BitkitUISideNavProps['onFocus']> = (event) => {\n onFocus?.(event);\n if (!tracksPointer || !isInsideNav(event)) return;\n if (!event.target.matches(':focus-visible')) return;\n setFocusInside(true);\n };\n\n const handleBlur: NonNullable<BitkitUISideNavProps['onBlur']> = (event) => {\n onBlur?.(event);\n // `blur` also fires when focus moves between two rows. Only a target outside the nav counts.\n if (!tracksPointer || event.currentTarget.contains(event.relatedTarget)) return;\n setFocusInside(false);\n };\n\n const handlePointerEnter: NonNullable<BitkitUISideNavProps['onPointerEnter']> = (event) => {\n onPointerEnter?.(event);\n if (tracksPointer && isInsideNav(event)) setPointerInside(true);\n };\n\n const handlePointerLeave: NonNullable<BitkitUISideNavProps['onPointerLeave']> = (event) => {\n onPointerLeave?.(event);\n if (tracksPointer && isInsideNav(event)) setPointerInside(false);\n };\n\n // A blur does not always reach the nav. Focus can move into a portal, or the focused row can be\n // unmounted, and then the rail would stay open with nothing to close it. While focus counts as\n // inside, re-check every focus change against the document rather than trusting blur alone.\n useEffect(() => {\n if (!tracksPointer || !focusInside) return undefined;\n\n const syncFocusInside = () => {\n if (!navRef.current?.contains(document.activeElement)) setFocusInside(false);\n };\n\n document.addEventListener('focusin', syncFocusInside);\n return () => document.removeEventListener('focusin', syncFocusInside);\n }, [focusInside, tracksPointer]);\n\n // React derives pointer enter and leave from the React tree too, so moving from a row onto a\n // portalled descendant never counts as leaving and `onPointerLeave` never fires. While the\n // pointer counts as inside, read the nav's own `:hover` on every pointer target change rather\n // than waiting for a leave that may not come.\n useEffect(() => {\n if (!tracksPointer || !pointerInside) return undefined;\n\n const syncPointerInside = () => {\n if (!navRef.current?.matches(':hover')) setPointerInside(false);\n };\n\n document.addEventListener('pointerover', syncPointerInside);\n return () => document.removeEventListener('pointerover', syncPointerInside);\n }, [pointerInside, tracksPointer]);\n\n const nav = (\n <Box\n ref={setNavRef}\n aria-label=\"Platform navigation\"\n asChild\n data-expanded={expanded ? '' : undefined}\n {...rest}\n css={[styles.root, css]}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n >\n <nav>{children}</nav>\n </Box>\n );\n\n const context = useMemo(\n () => ({ expanded, isMobile, menuContainerRef, setMenuOpen, styles }),\n [expanded, isMobile, styles],\n );\n\n if (!isMobile) {\n return <UISideNavContextProvider value={context}>{nav}</UISideNavContextProvider>;\n }\n\n return (\n <UISideNavContextProvider value={context}>\n <Drawer.Root onOpenChange={(details) => onOpenChange?.(details.open)} open={open}>\n <Portal>\n <Drawer.Backdrop css={styles.backdrop} />\n <Drawer.Positioner css={styles.positioner}>\n <Drawer.Content ref={menuContainerRef} aria-label=\"Navigation\" css={styles.content}>\n {nav}\n <Box css={styles.closeButton}>\n <BitkitCloseButton\n aria-label=\"Close navigation\"\n colorVariant=\"white\"\n onClick={() => onOpenChange?.(false)}\n size=\"md\"\n />\n </Box>\n </Drawer.Content>\n </Drawer.Positioner>\n </Portal>\n </Drawer.Root>\n </UISideNavContextProvider>\n );\n});\n\nexport { uiSideNavRailWidth } from '../../theme/slot-recipes/UISideNav.recipe';\nexport { type BitkitUISideNavBodyProps } from './UISideNavBody';\nexport { type BitkitUISideNavFooterProps } from './UISideNavFooter';\nexport { type BitkitUISideNavFooterHeadingProps } from './UISideNavFooterHeading';\nexport { type BitkitUISideNavItemProps } from './UISideNavItem';\nexport {\n type BitkitUISideNavLinkAsAnchorProps,\n type BitkitUISideNavLinkAsButtonProps,\n type BitkitUISideNavLinkProps,\n} from './UISideNavLink';\nexport {\n type BitkitUISideNavWorkspaceProps,\n type BitkitUISideNavWorkspaceSelectorProps,\n} from './UISideNavWorkspaceSelector';\n\nBitkitUISideNav.displayName = 'BitkitUISideNav';\n\nexport default withSubComponents(BitkitUISideNav, {\n Body: UISideNavBody,\n Footer: UISideNavFooter,\n FooterHeading: UISideNavFooterHeading,\n Item: UISideNavItem,\n Link: UISideNavLink,\n WorkspaceSelector: UISideNavWorkspaceSelector,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAM,kBAAkB,YAA+C,OAAO,QAAQ;CACpF,MAAM,EACJ,U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A,CACG,KACD,oBAAC,KAAD;MAAK,KAAK,OAAO;MACf,UAAA,oBAAC,mBAAD;OACE,cAAW;OACX,cAAa;OACb,eAAe,eAAe,KAAK;OACnC,MAAK;MACN,CAAA;KACE,CAAA,CACS;;GACC,CAAA,CACb,EAAA,CAAA;EACG,CAAA;CACW,CAAA;AAE9B,CAAC;AAiBD,gBAAgB,cAAc;AAE9B,IAAA,0BAAe,kBAAkB,iBAAiB;CAChD,MAAM;CACN,QAAQ;CACR,eAAe;CACf,MAAM;CACN,MAAM;CACN,mBAAmB;AACrB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { BoxProps } from '@chakra-ui/react/box';
2
+ import { ReactNode } from 'react';
3
+ export interface BitkitUISideNavBodyProps extends BoxProps {
4
+ children: ReactNode;
5
+ }
6
+ declare const UISideNavBody: import('react').ForwardRefExoticComponent<BitkitUISideNavBodyProps & import('react').RefAttributes<HTMLDivElement>>;
7
+ export default UISideNavBody;
@@ -0,0 +1,20 @@
1
+ import { useUISideNavContext } from "./UISideNavContext.js";
2
+ import { Box } from "@chakra-ui/react/box";
3
+ import { forwardRef } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region lib/components/BitkitUISideNav/UISideNavBody.tsx
6
+ var UISideNavBody = forwardRef((props, ref) => {
7
+ const { children, css, ...rest } = props;
8
+ const { styles } = useUISideNavContext();
9
+ return /* @__PURE__ */ jsx(Box, {
10
+ ref,
11
+ ...rest,
12
+ css: [styles.body, css],
13
+ children
14
+ });
15
+ });
16
+ UISideNavBody.displayName = "BitkitUISideNav.Body";
17
+ //#endregion
18
+ export { UISideNavBody as default };
19
+
20
+ //# sourceMappingURL=UISideNavBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UISideNavBody.js","names":[],"sources":["../../../lib/components/BitkitUISideNav/UISideNavBody.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { useUISideNavContext } from './UISideNavContext';\n\nexport interface BitkitUISideNavBodyProps extends BoxProps {\n children: ReactNode;\n}\n\nconst UISideNavBody = forwardRef<HTMLDivElement, BitkitUISideNavBodyProps>((props, ref) => {\n const { children, css, ...rest } = props;\n\n const { styles } = useUISideNavContext();\n\n return (\n <Box ref={ref} {...rest} css={[styles.body, css]}>\n {children}\n </Box>\n );\n});\n\nUISideNavBody.displayName = 'BitkitUISideNav.Body';\n\nexport default UISideNavBody;\n"],"mappings":";;;;;AASA,IAAM,gBAAgB,YAAsD,OAAO,QAAQ;CACzF,MAAM,EAAE,UAAU,KAAK,GAAG,SAAS;CAEnC,MAAM,EAAE,WAAW,oBAAoB;CAEvC,OACE,oBAAC,KAAD;EAAU;EAAK,GAAI;EAAM,KAAK,CAAC,OAAO,MAAM,GAAG;EAC5C;CACE,CAAA;AAET,CAAC;AAED,cAAc,cAAc"}
@@ -0,0 +1,32 @@
1
+ import { SystemStyleObject } from '@chakra-ui/react/styled-system';
2
+ import { RefObject } from 'react';
3
+ export interface UISideNavContextValue {
4
+ /** True while the rail is showing its labels, and always true in the mobile drawer. */
5
+ expanded: boolean;
6
+ isMobile: boolean;
7
+ /**
8
+ * Where a menu opened inside the drawer has to be portalled: the panel itself. The panel
9
+ * scrolls, so a menu left in the flow would scroll with it and be clipped by it, and anywhere
10
+ * outside the panel is outside the dialog's focus trap.
11
+ */
12
+ menuContainerRef: RefObject<HTMLDivElement | null>;
13
+ /**
14
+ * How a descendant menu holds the rail open. The rail cannot collapse while a menu anchored
15
+ * inside it is open, or the menu would be left hanging beside a 72px strip.
16
+ */
17
+ setMenuOpen: (open: boolean) => void;
18
+ styles: Record<string, SystemStyleObject>;
19
+ }
20
+ declare const UISideNavContextProvider: import('react').Provider<UISideNavContextValue>, useUISideNavContext: () => UISideNavContextValue;
21
+ export { UISideNavContextProvider, useUISideNavContext };
22
+ /**
23
+ * Reads the side navigation's current state from inside it. Anything rendered in the footer that
24
+ * has to lay itself out differently in the collapsed rail should call this rather than have the
25
+ * state passed down to it.
26
+ *
27
+ * ```tsx
28
+ * const { expanded } = useUISideNav();
29
+ * return expanded ? <McpWidget /> : <McpWidgetIcon />;
30
+ * ```
31
+ */
32
+ export declare const useUISideNav: () => Pick<UISideNavContextValue, "expanded" | "isMobile">;
@@ -0,0 +1,28 @@
1
+ import { createContext } from "@chakra-ui/react";
2
+ //#region lib/components/BitkitUISideNav/UISideNavContext.tsx
3
+ var [UISideNavContextProvider, useUISideNavContext] = createContext({
4
+ hookName: "useUISideNavContext",
5
+ name: "UISideNavContext",
6
+ providerName: "<BitkitUISideNav />"
7
+ });
8
+ /**
9
+ * Reads the side navigation's current state from inside it. Anything rendered in the footer that
10
+ * has to lay itself out differently in the collapsed rail should call this rather than have the
11
+ * state passed down to it.
12
+ *
13
+ * ```tsx
14
+ * const { expanded } = useUISideNav();
15
+ * return expanded ? <McpWidget /> : <McpWidgetIcon />;
16
+ * ```
17
+ */
18
+ var useUISideNav = () => {
19
+ const { expanded, isMobile } = useUISideNavContext();
20
+ return {
21
+ expanded,
22
+ isMobile
23
+ };
24
+ };
25
+ //#endregion
26
+ export { UISideNavContextProvider, useUISideNav, useUISideNavContext };
27
+
28
+ //# sourceMappingURL=UISideNavContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UISideNavContext.js","names":[],"sources":["../../../lib/components/BitkitUISideNav/UISideNavContext.tsx"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\nimport { type SystemStyleObject } from '@chakra-ui/react/styled-system';\nimport { type RefObject } from 'react';\n\nexport interface UISideNavContextValue {\n /** True while the rail is showing its labels, and always true in the mobile drawer. */\n expanded: boolean;\n isMobile: boolean;\n /**\n * Where a menu opened inside the drawer has to be portalled: the panel itself. The panel\n * scrolls, so a menu left in the flow would scroll with it and be clipped by it, and anywhere\n * outside the panel is outside the dialog's focus trap.\n */\n menuContainerRef: RefObject<HTMLDivElement | null>;\n /**\n * How a descendant menu holds the rail open. The rail cannot collapse while a menu anchored\n * inside it is open, or the menu would be left hanging beside a 72px strip.\n */\n setMenuOpen: (open: boolean) => void;\n styles: Record<string, SystemStyleObject>;\n}\n\nconst [UISideNavContextProvider, useUISideNavContext] = createContext<UISideNavContextValue>({\n hookName: 'useUISideNavContext',\n name: 'UISideNavContext',\n providerName: '<BitkitUISideNav />',\n});\n\nexport { UISideNavContextProvider, useUISideNavContext };\n\n/**\n * Reads the side navigation's current state from inside it. Anything rendered in the footer that\n * has to lay itself out differently in the collapsed rail should call this rather than have the\n * state passed down to it.\n *\n * ```tsx\n * const { expanded } = useUISideNav();\n * return expanded ? <McpWidget /> : <McpWidgetIcon />;\n * ```\n */\nexport const useUISideNav = (): Pick<UISideNavContextValue, 'expanded' | 'isMobile'> => {\n const { expanded, isMobile } = useUISideNavContext();\n return { expanded, isMobile };\n};\n"],"mappings":";;AAuBA,IAAM,CAAC,0BAA0B,uBAAuB,cAAqC;CAC3F,UAAU;CACV,MAAM;CACN,cAAc;AAChB,CAAC;;;;;;;;;;;AAcD,IAAa,qBAA2E;CACtF,MAAM,EAAE,UAAU,aAAa,oBAAoB;CACnD,OAAO;EAAE;EAAU;CAAS;AAC9B"}
@@ -0,0 +1,16 @@
1
+ import { BoxProps } from '@chakra-ui/react/box';
2
+ import { ReactNode } from 'react';
3
+ export interface BitkitUISideNavFooterProps extends BoxProps {
4
+ /**
5
+ * The rows below the navigation. Drop a `FooterHeading` between them to start a further
6
+ * section, the way the mobile drawer parts its status row from its Help links.
7
+ */
8
+ children: ReactNode;
9
+ /**
10
+ * An uppercase heading for the whole block, e.g. `Help`, drawn under the footer's own rule.
11
+ * The desktop rail has nowhere to show one when collapsed, so it usually has none.
12
+ */
13
+ label?: string;
14
+ }
15
+ declare const UISideNavFooter: import('react').ForwardRefExoticComponent<BitkitUISideNavFooterProps & import('react').RefAttributes<HTMLDivElement>>;
16
+ export default UISideNavFooter;
@@ -0,0 +1,28 @@
1
+ import { useUISideNavContext } from "./UISideNavContext.js";
2
+ import { Box } from "@chakra-ui/react/box";
3
+ import { forwardRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Text } from "@chakra-ui/react/text";
6
+ //#region lib/components/BitkitUISideNav/UISideNavFooter.tsx
7
+ var UISideNavFooter = forwardRef((props, ref) => {
8
+ const { children, css, label, ...rest } = props;
9
+ const { styles } = useUISideNavContext();
10
+ return /* @__PURE__ */ jsxs(Box, {
11
+ ref,
12
+ ...rest,
13
+ css: [styles.footer, css],
14
+ children: [
15
+ /* @__PURE__ */ jsx(Box, { css: styles.footerSeparator }),
16
+ label && /* @__PURE__ */ jsx(Text, {
17
+ css: styles.footerHeading,
18
+ children: label
19
+ }),
20
+ children
21
+ ]
22
+ });
23
+ });
24
+ UISideNavFooter.displayName = "BitkitUISideNav.Footer";
25
+ //#endregion
26
+ export { UISideNavFooter as default };
27
+
28
+ //# sourceMappingURL=UISideNavFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UISideNavFooter.js","names":[],"sources":["../../../lib/components/BitkitUISideNav/UISideNavFooter.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { Text } from '@chakra-ui/react/text';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { useUISideNavContext } from './UISideNavContext';\n\nexport interface BitkitUISideNavFooterProps extends BoxProps {\n /**\n * The rows below the navigation. Drop a `FooterHeading` between them to start a further\n * section, the way the mobile drawer parts its status row from its Help links.\n */\n children: ReactNode;\n /**\n * An uppercase heading for the whole block, e.g. `Help`, drawn under the footer's own rule.\n * The desktop rail has nowhere to show one when collapsed, so it usually has none.\n */\n label?: string;\n}\n\nconst UISideNavFooter = forwardRef<HTMLDivElement, BitkitUISideNavFooterProps>((props, ref) => {\n const { children, css, label, ...rest } = props;\n\n const { styles } = useUISideNavContext();\n\n return (\n <Box ref={ref} {...rest} css={[styles.footer, css]}>\n {/* Always drawn: the design parts the footer from the navigation above it in both layouts. */}\n <Box css={styles.footerSeparator} />\n {label && <Text css={styles.footerHeading}>{label}</Text>}\n {children}\n </Box>\n );\n});\n\nUISideNavFooter.displayName = 'BitkitUISideNav.Footer';\n\nexport default UISideNavFooter;\n"],"mappings":";;;;;;AAmBA,IAAM,kBAAkB,YAAwD,OAAO,QAAQ;CAC7F,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,SAAS;CAE1C,MAAM,EAAE,WAAW,oBAAoB;CAEvC,OACE,qBAAC,KAAD;EAAU;EAAK,GAAI;EAAM,KAAK,CAAC,OAAO,QAAQ,GAAG;EAAjD,UAAA;GAEE,oBAAC,KAAD,EAAK,KAAK,OAAO,gBAAkB,CAAA;GAClC,SAAS,oBAAC,MAAD;IAAM,KAAK,OAAO;IAAgB,UAAA;GAAY,CAAA;GACvD;EACE;;AAET,CAAC;AAED,gBAAgB,cAAc"}
@@ -0,0 +1,12 @@
1
+ import { TextProps } from '@chakra-ui/react/text';
2
+ export interface BitkitUISideNavFooterHeadingProps extends Omit<TextProps, 'children'> {
3
+ /** The heading, e.g. `Help`. Drawn uppercase, so write it in normal case. */
4
+ children: string;
5
+ }
6
+ /**
7
+ * Starts a further section inside a footer that already holds rows, bringing a rule of its own.
8
+ * A footer that is nothing but one titled section says the same thing with `label` — and without
9
+ * the second rule, since the footer already draws one at its top.
10
+ */
11
+ declare const UISideNavFooterHeading: import('react').ForwardRefExoticComponent<BitkitUISideNavFooterHeadingProps & import('react').RefAttributes<HTMLParagraphElement>>;
12
+ export default UISideNavFooterHeading;
@@ -0,0 +1,26 @@
1
+ import { useUISideNavContext } from "./UISideNavContext.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Text } from "@chakra-ui/react/text";
5
+ //#region lib/components/BitkitUISideNav/UISideNavFooterHeading.tsx
6
+ /**
7
+ * Starts a further section inside a footer that already holds rows, bringing a rule of its own.
8
+ * A footer that is nothing but one titled section says the same thing with `label` — and without
9
+ * the second rule, since the footer already draws one at its top.
10
+ */
11
+ var UISideNavFooterHeading = forwardRef((props, ref) => {
12
+ const { children, css, ...rest } = props;
13
+ const { styles } = useUISideNavContext();
14
+ return /* @__PURE__ */ jsx(Text, {
15
+ ref,
16
+ "data-section": "",
17
+ ...rest,
18
+ css: [styles.footerHeading, css],
19
+ children
20
+ });
21
+ });
22
+ UISideNavFooterHeading.displayName = "BitkitUISideNav.FooterHeading";
23
+ //#endregion
24
+ export { UISideNavFooterHeading as default };
25
+
26
+ //# sourceMappingURL=UISideNavFooterHeading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UISideNavFooterHeading.js","names":[],"sources":["../../../lib/components/BitkitUISideNav/UISideNavFooterHeading.tsx"],"sourcesContent":["import { Text, type TextProps } from '@chakra-ui/react/text';\nimport { forwardRef } from 'react';\n\nimport { useUISideNavContext } from './UISideNavContext';\n\nexport interface BitkitUISideNavFooterHeadingProps extends Omit<TextProps, 'children'> {\n /** The heading, e.g. `Help`. Drawn uppercase, so write it in normal case. */\n children: string;\n}\n\n/**\n * Starts a further section inside a footer that already holds rows, bringing a rule of its own.\n * A footer that is nothing but one titled section says the same thing with `label` — and without\n * the second rule, since the footer already draws one at its top.\n */\nconst UISideNavFooterHeading = forwardRef<HTMLParagraphElement, BitkitUISideNavFooterHeadingProps>((props, ref) => {\n const { children, css, ...rest } = props;\n\n const { styles } = useUISideNavContext();\n\n return (\n <Text ref={ref} data-section=\"\" {...rest} css={[styles.footerHeading, css]}>\n {children}\n </Text>\n );\n});\n\nUISideNavFooterHeading.displayName = 'BitkitUISideNav.FooterHeading';\n\nexport default UISideNavFooterHeading;\n"],"mappings":";;;;;;;;;;AAeA,IAAM,yBAAyB,YAAqE,OAAO,QAAQ;CACjH,MAAM,EAAE,UAAU,KAAK,GAAG,SAAS;CAEnC,MAAM,EAAE,WAAW,oBAAoB;CAEvC,OACE,oBAAC,MAAD;EAAW;EAAK,gBAAa;EAAG,GAAI;EAAM,KAAK,CAAC,OAAO,eAAe,GAAG;EACtE;CACG,CAAA;AAEV,CAAC;AAED,uBAAuB,cAAc"}