@oxy.so/bloom 22.1.5 → 22.1.7
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/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +1 -1
- package/lib/commonjs/list/ListItemBase.js +5 -3
- package/lib/commonjs/list/ListItemBase.js.map +1 -1
- package/lib/commonjs/sidebar/Sidebar.js +2 -2
- package/lib/commonjs/sidebar/Sidebar.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarFolder.js +2 -0
- package/lib/commonjs/sidebar/SidebarFolder.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarItem.js +6 -6
- package/lib/commonjs/sidebar/SidebarItem.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarTreeSection.js +2 -0
- package/lib/commonjs/sidebar/SidebarTreeSection.js.map +1 -1
- package/lib/commonjs/sidebar/metrics.js +5 -2
- package/lib/commonjs/sidebar/metrics.js.map +1 -1
- package/lib/module/list/ListItemBase.js +5 -3
- package/lib/module/list/ListItemBase.js.map +1 -1
- package/lib/module/sidebar/Sidebar.js +2 -2
- package/lib/module/sidebar/Sidebar.js.map +1 -1
- package/lib/module/sidebar/SidebarFolder.js +2 -0
- package/lib/module/sidebar/SidebarFolder.js.map +1 -1
- package/lib/module/sidebar/SidebarItem.js +6 -6
- package/lib/module/sidebar/SidebarItem.js.map +1 -1
- package/lib/module/sidebar/SidebarTreeSection.js +2 -0
- package/lib/module/sidebar/SidebarTreeSection.js.map +1 -1
- package/lib/module/sidebar/metrics.js +5 -2
- package/lib/module/sidebar/metrics.js.map +1 -1
- package/lib/typescript/commonjs/app-shell/use-sidebar-metrics.d.ts +2 -0
- package/lib/typescript/commonjs/app-shell/use-sidebar-metrics.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/ListItemBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/list/types.d.ts +4 -0
- package/lib/typescript/commonjs/list/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarFolder.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/metrics.d.ts +5 -1
- package/lib/typescript/commonjs/sidebar/metrics.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/use-sidebar-metrics.d.ts +2 -0
- package/lib/typescript/module/app-shell/use-sidebar-metrics.d.ts.map +1 -1
- package/lib/typescript/module/list/ListItemBase.d.ts.map +1 -1
- package/lib/typescript/module/list/types.d.ts +4 -0
- package/lib/typescript/module/list/types.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarFolder.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/metrics.d.ts +5 -1
- package/lib/typescript/module/sidebar/metrics.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/list/ListItemBase.tsx +5 -3
- package/src/list/types.ts +4 -0
- package/src/sidebar/Sidebar.tsx +2 -2
- package/src/sidebar/SidebarFolder.tsx +2 -0
- package/src/sidebar/SidebarItem.tsx +6 -6
- package/src/sidebar/SidebarTreeSection.tsx +2 -0
- package/src/sidebar/metrics.ts +31 -10
|
@@ -44,6 +44,8 @@ export function createListItem({
|
|
|
44
44
|
DropdownMenuItem,
|
|
45
45
|
}: Bindings) {
|
|
46
46
|
const Shell = memo(function ListItemShell({
|
|
47
|
+
density = 'comfortable',
|
|
48
|
+
compactPadding = 4,
|
|
47
49
|
label: labelProp,
|
|
48
50
|
contextMenu,
|
|
49
51
|
role,
|
|
@@ -230,7 +232,7 @@ export function createListItem({
|
|
|
230
232
|
style={[
|
|
231
233
|
{
|
|
232
234
|
opacity: disabled ? DISABLED_OPACITY : 1,
|
|
233
|
-
minHeight: LIST_ROW_MIN_HEIGHT,
|
|
235
|
+
minHeight: density === 'compact' ? 0 : LIST_ROW_MIN_HEIGHT,
|
|
234
236
|
borderRadius: 28,
|
|
235
237
|
'--bloom-list-selected': selectedFill,
|
|
236
238
|
'--bloom-list-ring': theme.colors.primary,
|
|
@@ -256,12 +258,12 @@ export function createListItem({
|
|
|
256
258
|
<View
|
|
257
259
|
pointerEvents="box-none"
|
|
258
260
|
style={{
|
|
259
|
-
minHeight: LIST_ROW_MIN_HEIGHT,
|
|
261
|
+
minHeight: density === 'compact' ? 0 : LIST_ROW_MIN_HEIGHT,
|
|
260
262
|
flexDirection: 'row',
|
|
261
263
|
alignItems: 'center',
|
|
262
264
|
gap: 10,
|
|
263
265
|
paddingHorizontal: LIST_ROW_INSET,
|
|
264
|
-
paddingVertical: 8,
|
|
266
|
+
paddingVertical: density === 'compact' ? compactPadding : 8,
|
|
265
267
|
}}
|
|
266
268
|
>
|
|
267
269
|
{selection ? (
|
package/src/list/types.ts
CHANGED
|
@@ -141,6 +141,10 @@ export type ListAction = import('../swipe-row/types').SwipeRowAction;
|
|
|
141
141
|
|
|
142
142
|
/** The shared compact row anatomy for conversations, mail, members and content. */
|
|
143
143
|
export interface ListCommonProps {
|
|
144
|
+
/** Row density. Comfortable preserves the standard 56px list row; compact lets content and insets set its height. */
|
|
145
|
+
density?: 'comfortable' | 'compact';
|
|
146
|
+
/** Vertical inset for a compact row. Defaults to 4px. */
|
|
147
|
+
compactPadding?: number;
|
|
144
148
|
/** Structured menu content for commands with groups, submenus or custom controls. */
|
|
145
149
|
contextMenu?: import('react').ReactNode;
|
|
146
150
|
/** Semantic choice role when a parent owns radio/listbox navigation. */
|
package/src/sidebar/Sidebar.tsx
CHANGED
|
@@ -756,8 +756,8 @@ const SidebarPanel: React.FC<SidebarProps> = ({
|
|
|
756
756
|
flexDirection: 'row',
|
|
757
757
|
alignItems: 'center',
|
|
758
758
|
height: metrics.row.square,
|
|
759
|
-
paddingTop: metrics.row.
|
|
760
|
-
paddingBottom: metrics.row.
|
|
759
|
+
paddingTop: metrics.row.paddingVertical,
|
|
760
|
+
paddingBottom: metrics.row.paddingVertical,
|
|
761
761
|
overflow: 'hidden',
|
|
762
762
|
borderRadius: borderRadius.full,
|
|
763
763
|
backgroundColor: searchHover.state ? palette.searchHover : palette.tertiary,
|
|
@@ -105,6 +105,8 @@ export function SidebarTreeRow({
|
|
|
105
105
|
testID={`sidebar-tree-row-${item.key}`}
|
|
106
106
|
>
|
|
107
107
|
<ListItem
|
|
108
|
+
density="compact"
|
|
109
|
+
compactPadding={tree.padding}
|
|
108
110
|
style={{ flex: 1, minWidth: 0 }}
|
|
109
111
|
active={item.selected ?? selected}
|
|
110
112
|
label={[item.label, item.description, item.meta].filter(Boolean).join(', ')}
|
|
@@ -100,15 +100,15 @@ const SidebarItemComponent: React.FC<SidebarItemProps> = ({
|
|
|
100
100
|
// Not clipped: the collapsed badge hangs off the square's top-end corner.
|
|
101
101
|
// The content clips itself instead, so the label can't spill mid-morph.
|
|
102
102
|
overflow: 'visible',
|
|
103
|
-
// Collapsed it is a square. Expanded it
|
|
104
|
-
//
|
|
105
|
-
//
|
|
103
|
+
// Collapsed it is a square. Expanded it uses its own content floor: the
|
|
104
|
+
// small sidebar's label fits without inheriting the larger collapsed square.
|
|
105
|
+
// This stays a minimum so larger system fonts can grow without clipping.
|
|
106
106
|
height: collapsed ? metrics.row.square : undefined,
|
|
107
|
-
minHeight: metrics.row.square,
|
|
107
|
+
minHeight: collapsed ? metrics.row.square : metrics.row.minHeight,
|
|
108
108
|
paddingLeft: metrics.row.padding,
|
|
109
109
|
paddingRight: metrics.row.padding,
|
|
110
|
-
paddingTop: metrics.row.
|
|
111
|
-
paddingBottom: metrics.row.
|
|
110
|
+
paddingTop: metrics.row.paddingVertical,
|
|
111
|
+
paddingBottom: metrics.row.paddingVertical,
|
|
112
112
|
borderRadius: borderRadius.full,
|
|
113
113
|
// In a sidebar the row stretches with the panel, which morphs between the
|
|
114
114
|
// size's two widths, so the row's width animates with it; standalone,
|
|
@@ -594,6 +594,8 @@ const TreeRow = memo(function TreeRow({
|
|
|
594
594
|
)
|
|
595
595
|
) : null}
|
|
596
596
|
<ListItem
|
|
597
|
+
density="compact"
|
|
598
|
+
compactPadding={tree.padding}
|
|
597
599
|
testID={`sidebar-tree-item-${item.key}`}
|
|
598
600
|
active={selected}
|
|
599
601
|
label={[item.label, item.description, item.meta].filter(Boolean).join(', ')}
|
package/src/sidebar/metrics.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { useBloomAppearance } from '../appearance';
|
|
|
2
2
|
import { createContext, useContext } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { TypeScaleVariant } from '../typography/scale';
|
|
5
|
+
import { typeScale } from '../typography/scale';
|
|
5
6
|
import type { SidebarSize } from './types';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -23,8 +24,12 @@ export interface SidebarMetrics {
|
|
|
23
24
|
/** The panel's horizontal inset while collapsed. */
|
|
24
25
|
collapsedPaddingX: number;
|
|
25
26
|
row: {
|
|
26
|
-
/** The row's
|
|
27
|
+
/** The row's horizontal inset; also determines its collapsed square. */
|
|
27
28
|
padding: number;
|
|
29
|
+
/** The expanded row's vertical inset. */
|
|
30
|
+
paddingVertical: number;
|
|
31
|
+
/** The expanded row's minimum content height, independent of its collapsed square. */
|
|
32
|
+
minHeight: number;
|
|
28
33
|
/** Between the glyph and the label. */
|
|
29
34
|
gap: number;
|
|
30
35
|
/** The glyph's box. */
|
|
@@ -64,6 +69,7 @@ function size(
|
|
|
64
69
|
icon: number,
|
|
65
70
|
label: TypeScaleVariant,
|
|
66
71
|
tree: SidebarMetrics['tree'],
|
|
72
|
+
paddingVertical = padding,
|
|
67
73
|
): SidebarMetrics {
|
|
68
74
|
const square = icon + padding * 2;
|
|
69
75
|
return {
|
|
@@ -71,7 +77,15 @@ function size(
|
|
|
71
77
|
collapsed: square + COLLAPSED_PADDING_X * 2 + 2,
|
|
72
78
|
padding: 12,
|
|
73
79
|
collapsedPaddingX: COLLAPSED_PADDING_X,
|
|
74
|
-
row: {
|
|
80
|
+
row: {
|
|
81
|
+
padding,
|
|
82
|
+
paddingVertical,
|
|
83
|
+
minHeight: Math.max(icon, typeScale(label).lineHeight) + paddingVertical * 2,
|
|
84
|
+
gap: 8,
|
|
85
|
+
icon,
|
|
86
|
+
square,
|
|
87
|
+
label,
|
|
88
|
+
},
|
|
75
89
|
tree,
|
|
76
90
|
};
|
|
77
91
|
}
|
|
@@ -81,14 +95,21 @@ function size(
|
|
|
81
95
|
* `headline-medium` label.
|
|
82
96
|
*/
|
|
83
97
|
export const SIDEBAR_METRICS: Record<SidebarSize, SidebarMetrics> = {
|
|
84
|
-
sm: size(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
sm: size(
|
|
99
|
+
232,
|
|
100
|
+
6,
|
|
101
|
+
18,
|
|
102
|
+
'body-2-medium',
|
|
103
|
+
{
|
|
104
|
+
padding: 4,
|
|
105
|
+
icon: 16,
|
|
106
|
+
avatar: 32,
|
|
107
|
+
label: 'body-2-medium',
|
|
108
|
+
meta: 'caption-2-medium',
|
|
109
|
+
status: 'body-2-regular',
|
|
110
|
+
},
|
|
111
|
+
4,
|
|
112
|
+
),
|
|
92
113
|
md: size(260, 9, 22, 'headline-medium', {
|
|
93
114
|
padding: 5,
|
|
94
115
|
icon: 20,
|