@bitrise/bitkit-v2 0.3.461-beta.2914 → 0.3.461
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BitkitCombobox/BitkitCombobox.d.ts +3 -3
- package/dist/components/BitkitCombobox/BitkitCombobox.js +2 -6
- package/dist/components/BitkitCombobox/BitkitCombobox.js.map +1 -1
- package/dist/components/BitkitMultiselect/BitkitMultiselect.d.ts +3 -3
- package/dist/components/BitkitMultiselect/BitkitMultiselect.js +1 -4
- package/dist/components/BitkitMultiselect/BitkitMultiselect.js.map +1 -1
- package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.d.ts +3 -3
- package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.js.map +1 -1
- package/dist/components/BitkitSelect/BitkitSelect.d.ts +3 -3
- package/dist/components/BitkitSelect/BitkitSelect.js +1 -4
- package/dist/components/BitkitSelect/BitkitSelect.js.map +1 -1
- package/dist/components/BitkitSelectMenu/BitkitSelectMenu.d.ts +2 -7
- package/dist/components/BitkitSelectMenu/BitkitSelectMenu.js.map +1 -1
- package/dist/components/BitkitSelectMenu/SelectMenuShell.d.ts +3 -3
- package/dist/components/BitkitSelectMenu/SelectMenuShell.js +4 -22
- package/dist/components/BitkitSelectMenu/SelectMenuShell.js.map +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/docs/shared.d.ts +3 -0
- package/dist/main.js +1 -4
- package/dist/theme/global-css.js +1 -0
- package/dist/theme/global-css.js.map +1 -1
- package/dist/theme/semantic-tokens/index.d.ts +93 -3
- package/dist/theme/semantic-tokens/semanticColors.d.ts +93 -3
- package/dist/theme/semantic-tokens/semanticColors.js +349 -93
- package/dist/theme/semantic-tokens/semanticColors.js.map +1 -1
- package/dist/theme/slot-recipes/DatePickerSelect.recipe.d.ts +2 -14
- package/dist/theme/slot-recipes/Select.recipe.d.ts +5 -23
- package/dist/theme/slot-recipes/Select.recipe.js +3 -37
- package/dist/theme/slot-recipes/Select.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/index.d.ts +7 -145
- package/dist/theme/slot-recipes/index.js +1 -3
- package/dist/theme/slot-recipes/index.js.map +1 -1
- package/dist/theme/text-styles.d.ts +36 -0
- package/dist/theme/text-styles.js +17 -0
- package/dist/theme/text-styles.js.map +1 -1
- package/dist/theme/tokens/borderWidths.d.ts +6 -0
- package/dist/theme/tokens/borderWidths.js +3 -1
- package/dist/theme/tokens/borderWidths.js.map +1 -1
- package/dist/theme/tokens/colors.d.ts +38 -0
- package/dist/theme/tokens/colors.js +14 -0
- package/dist/theme/tokens/colors.js.map +1 -1
- package/dist/theme/tokens/index.d.ts +56 -0
- package/dist/theme/tokens/sizes.d.ts +12 -0
- package/dist/theme/tokens/sizes.js +7 -1
- package/dist/theme/tokens/sizes.js.map +1 -1
- package/docs/design-tokens.md +13 -16
- package/package.json +2 -1
- package/dist/components/BitkitUISideNav/BitkitUISideNav.d.ts +0 -37
- package/dist/components/BitkitUISideNav/BitkitUISideNav.js +0 -146
- package/dist/components/BitkitUISideNav/BitkitUISideNav.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavBody.d.ts +0 -7
- package/dist/components/BitkitUISideNav/UISideNavBody.js +0 -20
- package/dist/components/BitkitUISideNav/UISideNavBody.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavContext.d.ts +0 -32
- package/dist/components/BitkitUISideNav/UISideNavContext.js +0 -28
- package/dist/components/BitkitUISideNav/UISideNavContext.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavFooter.d.ts +0 -16
- package/dist/components/BitkitUISideNav/UISideNavFooter.js +0 -28
- package/dist/components/BitkitUISideNav/UISideNavFooter.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.d.ts +0 -12
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js +0 -26
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavItem.d.ts +0 -26
- package/dist/components/BitkitUISideNav/UISideNavItem.js +0 -33
- package/dist/components/BitkitUISideNav/UISideNavItem.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavLink.d.ts +0 -30
- package/dist/components/BitkitUISideNav/UISideNavLink.js +0 -58
- package/dist/components/BitkitUISideNav/UISideNavLink.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.d.ts +0 -45
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js +0 -119
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js.map +0 -1
- package/dist/theme/slot-recipes/UISideNav.recipe.d.ts +0 -114
- package/dist/theme/slot-recipes/UISideNav.recipe.js +0 -411
- package/dist/theme/slot-recipes/UISideNav.recipe.js.map +0 -1
|
@@ -20,6 +20,12 @@ declare const tokens: {
|
|
|
20
20
|
'2': {
|
|
21
21
|
value: string;
|
|
22
22
|
};
|
|
23
|
+
'3': {
|
|
24
|
+
value: string;
|
|
25
|
+
};
|
|
26
|
+
'4': {
|
|
27
|
+
value: string;
|
|
28
|
+
};
|
|
23
29
|
};
|
|
24
30
|
colors: {
|
|
25
31
|
white: {
|
|
@@ -98,6 +104,44 @@ declare const tokens: {
|
|
|
98
104
|
value: string;
|
|
99
105
|
};
|
|
100
106
|
};
|
|
107
|
+
dark: {
|
|
108
|
+
'10': {
|
|
109
|
+
value: string;
|
|
110
|
+
};
|
|
111
|
+
'20': {
|
|
112
|
+
value: string;
|
|
113
|
+
};
|
|
114
|
+
'30': {
|
|
115
|
+
value: string;
|
|
116
|
+
};
|
|
117
|
+
'40': {
|
|
118
|
+
value: string;
|
|
119
|
+
};
|
|
120
|
+
'50': {
|
|
121
|
+
value: string;
|
|
122
|
+
};
|
|
123
|
+
'60': {
|
|
124
|
+
value: string;
|
|
125
|
+
};
|
|
126
|
+
'70': {
|
|
127
|
+
value: string;
|
|
128
|
+
};
|
|
129
|
+
'80': {
|
|
130
|
+
value: string;
|
|
131
|
+
};
|
|
132
|
+
'90': {
|
|
133
|
+
value: string;
|
|
134
|
+
};
|
|
135
|
+
'93': {
|
|
136
|
+
value: string;
|
|
137
|
+
};
|
|
138
|
+
'95': {
|
|
139
|
+
value: string;
|
|
140
|
+
};
|
|
141
|
+
'100': {
|
|
142
|
+
value: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
101
145
|
purple: {
|
|
102
146
|
'10': {
|
|
103
147
|
value: string;
|
|
@@ -497,6 +541,18 @@ declare const tokens: {
|
|
|
497
541
|
};
|
|
498
542
|
};
|
|
499
543
|
sizes: {
|
|
544
|
+
'layout/maxWidth/800': {
|
|
545
|
+
value: string;
|
|
546
|
+
};
|
|
547
|
+
'layout/maxWidth/960': {
|
|
548
|
+
value: string;
|
|
549
|
+
};
|
|
550
|
+
'layout/maxWidth/1280': {
|
|
551
|
+
value: string;
|
|
552
|
+
};
|
|
553
|
+
'layout/maxWidth/1616': {
|
|
554
|
+
value: string;
|
|
555
|
+
};
|
|
500
556
|
"1": {
|
|
501
557
|
value: string;
|
|
502
558
|
};
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
declare const sizes: {
|
|
2
|
+
'layout/maxWidth/800': {
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
'layout/maxWidth/960': {
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
'layout/maxWidth/1280': {
|
|
9
|
+
value: string;
|
|
10
|
+
};
|
|
11
|
+
'layout/maxWidth/1616': {
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
2
14
|
"1": {
|
|
3
15
|
value: string;
|
|
4
16
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import sizesAndSpacing_default from "./sizesAndSpacing.js";
|
|
2
2
|
import { defineTokens } from "@chakra-ui/react/styled-system";
|
|
3
3
|
//#region lib/theme/tokens/sizes.ts
|
|
4
|
-
var sizes = defineTokens.sizes(
|
|
4
|
+
var sizes = defineTokens.sizes({
|
|
5
|
+
...sizesAndSpacing_default,
|
|
6
|
+
"layout/maxWidth/800": { value: "50rem" },
|
|
7
|
+
"layout/maxWidth/960": { value: "60rem" },
|
|
8
|
+
"layout/maxWidth/1280": { value: "80rem" },
|
|
9
|
+
"layout/maxWidth/1616": { value: "101rem" }
|
|
10
|
+
});
|
|
5
11
|
//#endregion
|
|
6
12
|
export { sizes as default };
|
|
7
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizes.js","names":[],"sources":["../../../lib/theme/tokens/sizes.ts"],"sourcesContent":["import { defineTokens } from '@chakra-ui/react/styled-system';\n\nimport object from './sizesAndSpacing.json';\n\nconst sizes = defineTokens.sizes(object);\n\nexport default sizes;\n"],"mappings":";;;AAIA,IAAM,QAAQ,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"sizes.js","names":[],"sources":["../../../lib/theme/tokens/sizes.ts"],"sourcesContent":["import { defineTokens } from '@chakra-ui/react/styled-system';\n\nimport object from './sizesAndSpacing.json';\n\nconst sizes = defineTokens.sizes({\n ...object,\n 'layout/maxWidth/800': { value: '50rem' },\n 'layout/maxWidth/960': { value: '60rem' },\n 'layout/maxWidth/1280': { value: '80rem' },\n 'layout/maxWidth/1616': { value: '101rem' },\n});\n\nexport default sizes;\n"],"mappings":";;;AAIA,IAAM,QAAQ,aAAa,MAAM;CAC/B,GAAG;CACH,uBAAuB,EAAE,OAAO,QAAQ;CACxC,uBAAuB,EAAE,OAAO,QAAQ;CACxC,wBAAwB,EAAE,OAAO,QAAQ;CACzC,wBAAwB,EAAE,OAAO,SAAS;AAC5C,CAAC"}
|
package/docs/design-tokens.md
CHANGED
|
@@ -13,7 +13,8 @@ bitkit-v2 holds **hand-maintained** token files that mirror that source:
|
|
|
13
13
|
| source (`tokens.json`) | bitkit-v2 file |
|
|
14
14
|
| -------------------------------------------------------- | ------------------------------------------- |
|
|
15
15
|
| `core/color-primitives.core` (`purple.50`, `red.40`, …) | `lib/theme/tokens/colors.ts` (primitives) |
|
|
16
|
-
| `semantic/theme-light.{color,sys,…}` | `lib/theme/semantic-tokens/semanticColors.ts` |
|
|
16
|
+
| `semantic/theme-light.{color,sys,…}` | `lib/theme/semantic-tokens/semanticColors.ts` (`_light`) |
|
|
17
|
+
| `semantic/theme-dark.{color,sys,…}` | `lib/theme/semantic-tokens/semanticColors.ts` (`_dark`) |
|
|
17
18
|
| `components/colors.{background,text,icon,button,status,gradient,…}` | `lib/theme/semantic-tokens/semanticColors.ts` |
|
|
18
19
|
|
|
19
20
|
When the source changes (it does, in small increments), re-sync bitkit's files
|
|
@@ -38,6 +39,8 @@ semantic+component layers:
|
|
|
38
39
|
- tokens **bitkit has but the source doesn't** (renamed / stale / intentional extra),
|
|
39
40
|
- **light value/reference mismatches** on the common tokens.
|
|
40
41
|
|
|
42
|
+
`_dark` values aren't compared — check them against `semantic/theme-dark` by hand.
|
|
43
|
+
|
|
41
44
|
Values are compared canonically, so equivalent spellings (`#fff` ≡ `#ffffff`,
|
|
42
45
|
`core.purple.50` ≡ `colors.purple.50`) are **not** flagged.
|
|
43
46
|
|
|
@@ -60,27 +63,21 @@ After any change, run `npm run theme:generate-types` then `npm run type-check`.
|
|
|
60
63
|
## Runtime constraint: why some values can't match the source verbatim
|
|
61
64
|
|
|
62
65
|
bitkit resolves token references to **CSS custom properties** at runtime
|
|
63
|
-
(`var(--colors-purple-50)`).
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
2. **Alpha via `rgba({ref}, a)`**. `rgba(var(--x), 0.5)` is invalid CSS, so
|
|
73
|
-
bitkit uses `color-mix(in srgb, {colors.x} 50%, transparent)` (and a literal
|
|
74
|
-
`rgba(255, 255, 255, 0)` for fully-transparent tokens).
|
|
66
|
+
(`var(--colors-purple-50)`). The source's **alpha via `rgba({ref}, a)`** is
|
|
67
|
+
therefore impossible to reproduce: `rgba(var(--x), 0.5)` is invalid CSS. bitkit
|
|
68
|
+
expresses it differently — **same rendered color**:
|
|
69
|
+
|
|
70
|
+
- `rgba({ref}, 1)` inside a gradient → the plain reference:
|
|
71
|
+
- source: `linear-gradient(90deg, rgba({color.purple.minimal}, 1) 0%, …)`
|
|
72
|
+
- bitkit: `linear-gradient(90deg, {colors.color/purple/minimal} 0%, …)`
|
|
73
|
+
- any other alpha → `color-mix(in srgb, {colors.x} 50%, transparent)` (and a
|
|
74
|
+
literal `rgba(255, 255, 255, 0)` for fully-transparent tokens).
|
|
75
75
|
|
|
76
76
|
A drift report that only flags these representation differences means bitkit is
|
|
77
77
|
**fully in sync**.
|
|
78
78
|
|
|
79
79
|
## Out of scope (intentional)
|
|
80
80
|
|
|
81
|
-
- **Dark theme** — the source ships a full `semantic/theme-dark` layer and a
|
|
82
|
-
`dark` primitive scale. bitkit does **not** implement dark mode yet, so these
|
|
83
|
-
are intentionally absent. _(Later task — revisit when dark mode is on the roadmap.)_
|
|
84
81
|
- **brand** — the source's `brand/*` primitives (and `brand/primary`) are "not
|
|
85
82
|
in design" for bitkit and were intentionally dropped.
|
|
86
83
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit-v2",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.461
|
|
4
|
+
"version": "0.3.461",
|
|
5
5
|
"description": "Bitrise Design System Components built with Chakra UI V3",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"@google-cloud/storage": "^8.2.0",
|
|
79
79
|
"@storybook/addon-docs": "10.6.0",
|
|
80
80
|
"@storybook/addon-mcp": "10.6.0",
|
|
81
|
+
"@storybook/addon-themes": "10.6.0",
|
|
81
82
|
"@storybook/react-vite": "10.6.0",
|
|
82
83
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
83
84
|
"@types/node": "^26.6.2",
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
onValueChange?: (value: string) => void;
|
|
33
|
-
value?: string;
|
|
34
|
-
workspaces: Array<import('./UISideNavWorkspaceSelector').BitkitUISideNavWorkspaceProps>;
|
|
35
|
-
} & Omit<import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuSearchProps, "searchPlaceholder"> & import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuScrollProps & import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuEmptyStateProps & import('../BitkitSelectMenu/BitkitSelectMenu').BitkitSelectMenuErrorStateProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
36
|
-
};
|
|
37
|
-
export default _default;
|
|
@@ -1,146 +0,0 @@
|
|
|
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, useMemo, useRef, useState } from "react";
|
|
15
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
import { Portal } from "@chakra-ui/react/portal";
|
|
17
|
-
import { Drawer } from "@chakra-ui/react/drawer";
|
|
18
|
-
//#region lib/components/BitkitUISideNav/BitkitUISideNav.tsx
|
|
19
|
-
/**
|
|
20
|
-
* The platform's primary navigation. It expects a workspace selector, a body of navigation
|
|
21
|
-
* items, and an optional footer:
|
|
22
|
-
*
|
|
23
|
-
* ```tsx
|
|
24
|
-
* <BitkitUISideNav open={open} onOpenChange={setOpen}>
|
|
25
|
-
* <BitkitUISideNav.WorkspaceSelector
|
|
26
|
-
* workspaces={workspaces}
|
|
27
|
-
* value={workspace}
|
|
28
|
-
* onValueChange={setWorkspace}
|
|
29
|
-
* />
|
|
30
|
-
* <BitkitUISideNav.Body>
|
|
31
|
-
* <BitkitUISideNav.Item href="/dashboard" icon={IconDashboard} selectedIcon={IconDashboardFilled} selected>
|
|
32
|
-
* Dashboard
|
|
33
|
-
* </BitkitUISideNav.Item>
|
|
34
|
-
* </BitkitUISideNav.Body>
|
|
35
|
-
* <BitkitUISideNav.Footer>…</BitkitUISideNav.Footer>
|
|
36
|
-
* </BitkitUISideNav>
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* On desktop it is a 72px rail that widens to 256px under the pointer and while anything inside
|
|
40
|
-
* it holds keyboard focus. The rows are always laid out at the full width and clipped, so the
|
|
41
|
-
* labels appear without any text reflowing. It will not collapse while the workspace menu is
|
|
42
|
-
* open. There is no pin: the rail is the resting state.
|
|
43
|
-
*
|
|
44
|
-
* Below the `tablet` breakpoint it becomes an overlay drawer instead, opened by the header rather
|
|
45
|
-
* than by hovering. Pass `open` and `onOpenChange`; they are ignored on desktop.
|
|
46
|
-
*
|
|
47
|
-
* It does not position itself. The consumer decides where it sits and how tall it is, which is
|
|
48
|
-
* what lets a page slot it under a header of any height. The expanded rail overlays the page
|
|
49
|
-
* rather than pushing it, so give it a `position` of your own and reserve 72px beside it.
|
|
50
|
-
*
|
|
51
|
-
* Descendants can read the current state with `useUISideNav()`.
|
|
52
|
-
*/
|
|
53
|
-
var BitkitUISideNav = forwardRef((props, ref) => {
|
|
54
|
-
const { children, css, expanded: expandedProp, onBlur, onFocus, onOpenChange, onPointerEnter, onPointerLeave, open = false, ...rest } = props;
|
|
55
|
-
const { isMobile } = useResponsive();
|
|
56
|
-
const [pointerInside, setPointerInside] = useState(false);
|
|
57
|
-
const [focusInside, setFocusInside] = useState(false);
|
|
58
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
59
|
-
const menuContainerRef = useRef(null);
|
|
60
|
-
const styles = useSlotRecipe({ key: "uiSideNav" })({ layout: isMobile ? "drawer" : "rail" });
|
|
61
|
-
const expanded = isMobile || (expandedProp ?? (pointerInside || focusInside || menuOpen));
|
|
62
|
-
const tracksPointer = !isMobile && expandedProp === void 0;
|
|
63
|
-
const handleFocus = (event) => {
|
|
64
|
-
onFocus?.(event);
|
|
65
|
-
if (!tracksPointer || !event.target.matches(":focus-visible")) return;
|
|
66
|
-
setFocusInside(true);
|
|
67
|
-
};
|
|
68
|
-
const handleBlur = (event) => {
|
|
69
|
-
onBlur?.(event);
|
|
70
|
-
if (!tracksPointer || event.currentTarget.contains(event.relatedTarget)) return;
|
|
71
|
-
setFocusInside(false);
|
|
72
|
-
};
|
|
73
|
-
const handlePointerEnter = (event) => {
|
|
74
|
-
onPointerEnter?.(event);
|
|
75
|
-
if (tracksPointer) setPointerInside(true);
|
|
76
|
-
};
|
|
77
|
-
const handlePointerLeave = (event) => {
|
|
78
|
-
onPointerLeave?.(event);
|
|
79
|
-
if (tracksPointer) setPointerInside(false);
|
|
80
|
-
};
|
|
81
|
-
const nav = /* @__PURE__ */ jsx(Box, {
|
|
82
|
-
ref,
|
|
83
|
-
"aria-label": "Platform navigation",
|
|
84
|
-
asChild: true,
|
|
85
|
-
"data-expanded": expanded ? "" : void 0,
|
|
86
|
-
...rest,
|
|
87
|
-
css: [styles.root, css],
|
|
88
|
-
onBlur: handleBlur,
|
|
89
|
-
onFocus: handleFocus,
|
|
90
|
-
onPointerEnter: handlePointerEnter,
|
|
91
|
-
onPointerLeave: handlePointerLeave,
|
|
92
|
-
children: /* @__PURE__ */ jsx("nav", { children })
|
|
93
|
-
});
|
|
94
|
-
const context = useMemo(() => ({
|
|
95
|
-
expanded,
|
|
96
|
-
isMobile,
|
|
97
|
-
menuContainerRef,
|
|
98
|
-
setMenuOpen,
|
|
99
|
-
styles
|
|
100
|
-
}), [
|
|
101
|
-
expanded,
|
|
102
|
-
isMobile,
|
|
103
|
-
styles
|
|
104
|
-
]);
|
|
105
|
-
if (!isMobile) return /* @__PURE__ */ jsx(UISideNavContextProvider, {
|
|
106
|
-
value: context,
|
|
107
|
-
children: nav
|
|
108
|
-
});
|
|
109
|
-
return /* @__PURE__ */ jsx(UISideNavContextProvider, {
|
|
110
|
-
value: context,
|
|
111
|
-
children: /* @__PURE__ */ jsx(Drawer.Root, {
|
|
112
|
-
onOpenChange: (details) => onOpenChange?.(details.open),
|
|
113
|
-
open,
|
|
114
|
-
children: /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(Drawer.Backdrop, { css: styles.backdrop }), /* @__PURE__ */ jsx(Drawer.Positioner, {
|
|
115
|
-
css: styles.positioner,
|
|
116
|
-
children: /* @__PURE__ */ jsxs(Drawer.Content, {
|
|
117
|
-
ref: menuContainerRef,
|
|
118
|
-
"aria-label": "Navigation",
|
|
119
|
-
css: styles.content,
|
|
120
|
-
children: [nav, /* @__PURE__ */ jsx(Box, {
|
|
121
|
-
css: styles.closeButton,
|
|
122
|
-
children: /* @__PURE__ */ jsx(BitkitCloseButton, {
|
|
123
|
-
"aria-label": "Close navigation",
|
|
124
|
-
colorVariant: "white",
|
|
125
|
-
onClick: () => onOpenChange?.(false),
|
|
126
|
-
size: "md"
|
|
127
|
-
})
|
|
128
|
-
})]
|
|
129
|
-
})
|
|
130
|
-
})] })
|
|
131
|
-
})
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
BitkitUISideNav.displayName = "BitkitUISideNav";
|
|
135
|
-
var BitkitUISideNav_default = withSubComponents(BitkitUISideNav, {
|
|
136
|
-
Body: UISideNavBody,
|
|
137
|
-
Footer: UISideNavFooter,
|
|
138
|
-
FooterHeading: UISideNavFooterHeading,
|
|
139
|
-
Item: UISideNavItem,
|
|
140
|
-
Link: UISideNavLink,
|
|
141
|
-
WorkspaceSelector: UISideNavWorkspaceSelector
|
|
142
|
-
});
|
|
143
|
-
//#endregion
|
|
144
|
-
export { BitkitUISideNav_default as default, uiSideNavRailWidth };
|
|
145
|
-
|
|
146
|
-
//# sourceMappingURL=BitkitUISideNav.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitUISideNav.js","names":[],"sources":["../../../lib/components/BitkitUISideNav/BitkitUISideNav.tsx"],"sourcesContent":["import { 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, 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\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 // 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 || !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) setPointerInside(true);\n };\n\n const handlePointerLeave: NonNullable<BitkitUISideNavProps['onPointerLeave']> = (event) => {\n onPointerLeave?.(event);\n if (tracksPointer) setPointerInside(false);\n };\n\n const nav = (\n <Box\n ref={ref}\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,IAAM,kBAAkB,YAA+C,OAAO,QAAQ;CACpF,MAAM,EACJ,UACA,KACA,UAAU,cACV,QACA,SACA,cACA,gBACA,gBACA,OAAO,OACP,GAAG,SACD;CAEJ,MAAM,EAAE,aAAa,cAAc;CAEnC,MAAM,CAAC,eAAe,oBAAoB,SAAS,KAAK;CACxD,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CACpD,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,mBAAmB,OAAuB,IAAI;CAGpD,MAAM,SADS,cAAc,EAAE,KAAK,YAAY,CACjC,CAAA,CAAO,EAAE,QAAQ,WAAW,WAAW,OAAO,CAAC;CAE9D,MAAM,WAAW,aAAa,iBAAiB,iBAAiB,eAAe;CAC/E,MAAM,gBAAgB,CAAC,YAAY,iBAAiB,KAAA;CAIpD,MAAM,eAA6D,UAAU;EAC3E,UAAU,KAAK;EACf,IAAI,CAAC,iBAAiB,CAAC,MAAM,OAAO,QAAQ,gBAAgB,GAAG;EAC/D,eAAe,IAAI;CACrB;CAEA,MAAM,cAA2D,UAAU;EACzE,SAAS,KAAK;EAEd,IAAI,CAAC,iBAAiB,MAAM,cAAc,SAAS,MAAM,aAAa,GAAG;EACzE,eAAe,KAAK;CACtB;CAEA,MAAM,sBAA2E,UAAU;EACzF,iBAAiB,KAAK;EACtB,IAAI,eAAe,iBAAiB,IAAI;CAC1C;CAEA,MAAM,sBAA2E,UAAU;EACzF,iBAAiB,KAAK;EACtB,IAAI,eAAe,iBAAiB,KAAK;CAC3C;CAEA,MAAM,MACJ,oBAAC,KAAD;EACO;EACL,cAAW;EACX,SAAA;EACA,iBAAe,WAAW,KAAK,KAAA;EAC/B,GAAI;EACJ,KAAK,CAAC,OAAO,MAAM,GAAG;EACtB,QAAQ;EACR,SAAS;EACT,gBAAgB;EAChB,gBAAgB;EAEhB,UAAA,oBAAC,OAAD,EAAM,SAAc,CAAA;CACjB,CAAA;CAGP,MAAM,UAAU,eACP;EAAE;EAAU;EAAU;EAAkB;EAAa;CAAO,IACnE;EAAC;EAAU;EAAU;CAAM,CAC7B;CAEA,IAAI,CAAC,UACH,OAAO,oBAAC,0BAAD;EAA0B,OAAO;EAAU,UAAA;CAA8B,CAAA;CAGlF,OACE,oBAAC,0BAAD;EAA0B,OAAO;EAC/B,UAAA,oBAAC,OAAO,MAAR;GAAa,eAAe,YAAY,eAAe,QAAQ,IAAI;GAAS;GAC1E,UAAA,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAO,UAAR,EAAiB,KAAK,OAAO,SAAW,CAAA,GACxC,oBAAC,OAAO,YAAR;IAAmB,KAAK,OAAO;IAC7B,UAAA,qBAAC,OAAO,SAAR;KAAgB,KAAK;KAAkB,cAAW;KAAa,KAAK,OAAO;KAA3E,UAAA,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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,32 +0,0 @@
|
|
|
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">;
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { HTMLChakraProps } from '@chakra-ui/react/styled-system';
|
|
2
|
-
import { BitkitIconComponent } from '../../icons';
|
|
3
|
-
export interface BitkitUISideNavItemProps extends Omit<HTMLChakraProps<'a'>, 'children'> {
|
|
4
|
-
/**
|
|
5
|
-
* The destination. Always an anchor: the platform navigation moves between server-rendered
|
|
6
|
-
* product areas, so every row is a real link rather than a button with a handler.
|
|
7
|
-
*/
|
|
8
|
-
href: string;
|
|
9
|
-
/**
|
|
10
|
-
* The row's label. A string rather than `ReactNode` because the collapsed rail clips it and
|
|
11
|
-
* the expanded rail truncates it, neither of which survives arbitrary markup.
|
|
12
|
-
*/
|
|
13
|
-
children: string;
|
|
14
|
-
/** Shown at rest. In the collapsed rail this is the only thing visible. */
|
|
15
|
-
icon: BitkitIconComponent;
|
|
16
|
-
/** Marks the row as the current product area. The consumer decides what counts as current. */
|
|
17
|
-
selected?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Swapped in for `icon` while selected. The design pairs an outline icon with its filled
|
|
20
|
-
* counterpart, e.g. `IconDashboard` with `IconDashboardFilled`. Without it the outline icon
|
|
21
|
-
* stays and only the row's colour and marker change.
|
|
22
|
-
*/
|
|
23
|
-
selectedIcon?: BitkitIconComponent;
|
|
24
|
-
}
|
|
25
|
-
declare const UISideNavItem: import('react').ForwardRefExoticComponent<BitkitUISideNavItemProps & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
26
|
-
export default UISideNavItem;
|