@oxy.so/bloom 22.1.6 → 22.1.8

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 (33) hide show
  1. package/docs/task-catalog.json +1 -1
  2. package/docs/task-catalog.mdx +1 -1
  3. package/lib/commonjs/list/ListItemBase.js +4 -1
  4. package/lib/commonjs/list/ListItemBase.js.map +1 -1
  5. package/lib/commonjs/sidebar/Sidebar.js +2 -2
  6. package/lib/commonjs/sidebar/Sidebar.js.map +1 -1
  7. package/lib/commonjs/sidebar/SidebarItem.js +6 -6
  8. package/lib/commonjs/sidebar/SidebarItem.js.map +1 -1
  9. package/lib/commonjs/sidebar/metrics.js +5 -2
  10. package/lib/commonjs/sidebar/metrics.js.map +1 -1
  11. package/lib/module/list/ListItemBase.js +4 -1
  12. package/lib/module/list/ListItemBase.js.map +1 -1
  13. package/lib/module/sidebar/Sidebar.js +2 -2
  14. package/lib/module/sidebar/Sidebar.js.map +1 -1
  15. package/lib/module/sidebar/SidebarItem.js +6 -6
  16. package/lib/module/sidebar/SidebarItem.js.map +1 -1
  17. package/lib/module/sidebar/metrics.js +5 -2
  18. package/lib/module/sidebar/metrics.js.map +1 -1
  19. package/lib/typescript/commonjs/app-shell/use-sidebar-metrics.d.ts +2 -0
  20. package/lib/typescript/commonjs/app-shell/use-sidebar-metrics.d.ts.map +1 -1
  21. package/lib/typescript/commonjs/list/ListItemBase.d.ts.map +1 -1
  22. package/lib/typescript/commonjs/sidebar/metrics.d.ts +5 -1
  23. package/lib/typescript/commonjs/sidebar/metrics.d.ts.map +1 -1
  24. package/lib/typescript/module/app-shell/use-sidebar-metrics.d.ts +2 -0
  25. package/lib/typescript/module/app-shell/use-sidebar-metrics.d.ts.map +1 -1
  26. package/lib/typescript/module/list/ListItemBase.d.ts.map +1 -1
  27. package/lib/typescript/module/sidebar/metrics.d.ts +5 -1
  28. package/lib/typescript/module/sidebar/metrics.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/list/ListItemBase.tsx +4 -1
  31. package/src/sidebar/Sidebar.tsx +2 -2
  32. package/src/sidebar/SidebarItem.tsx +6 -6
  33. package/src/sidebar/metrics.ts +31 -10
@@ -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 is at LEAST the square: at the
104
- // default type scale the label's line fits exactly, and at the largest
105
- // system font a fixed height clipped it top and bottom (Android 16).
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.padding,
111
- paddingBottom: metrics.row.padding,
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,
@@ -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 own inset — its height is this twice, plus the taller of icon and label. */
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: { padding, gap: 8, icon, square, label },
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(232, 6, 18, 'body-2-medium', {
85
- padding: 4,
86
- icon: 16,
87
- avatar: 32,
88
- label: 'body-2-medium',
89
- meta: 'caption-2-medium',
90
- status: 'body-2-regular',
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,