@sybilion/uilib 1.4.9 → 1.4.11

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 (96) hide show
  1. package/dist/agent-glossary/content-prompt.generated.ts +27 -0
  2. package/dist/agent-glossary/content.generated.ts +27 -0
  3. package/dist/agent-glossary/content.index.md +4 -0
  4. package/dist/agent-glossary/content.md +27 -0
  5. package/dist/agent-glossary/content.prompt.md +27 -0
  6. package/dist/agent-glossary/workspace.generated.ts +2 -2
  7. package/dist/agent-glossary/workspace.index.md +2 -2
  8. package/dist/agent-glossary/workspace.md +2 -2
  9. package/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.js +2 -2
  10. package/dist/esm/components/ui/Button/Button.styl.js +1 -1
  11. package/dist/esm/components/ui/ButtonGroup/ButtonGroup.js +9 -0
  12. package/dist/esm/components/ui/ButtonGroup/ButtonGroup.styl.js +7 -0
  13. package/dist/esm/components/ui/Chart/Chart.js +3 -3
  14. package/dist/esm/components/ui/Chat/ChatPrompt/ChatPrompt.styl.js +1 -1
  15. package/dist/esm/components/ui/Chat/ChatPrompt/ChatPromptComposer.js +1 -1
  16. package/dist/esm/components/ui/Chat/ChatSheet/ChatSheet.js +13 -0
  17. package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +10 -7
  18. package/dist/esm/components/ui/Chip/Chip.js +3 -4
  19. package/dist/esm/components/ui/Chip/Chip.styl.js +2 -2
  20. package/dist/esm/components/ui/FileChip/FileChip.js +1 -1
  21. package/dist/esm/components/ui/Page/pageScrollRestoration.js +22 -0
  22. package/dist/esm/components/ui/Page/usePageScrollRestoration.js +73 -0
  23. package/dist/esm/components/ui/Renamer/Renamer.js +2 -2
  24. package/dist/esm/components/ui/Renamer/Renamer.styl.js +2 -2
  25. package/dist/esm/components/ui/Sidebar/Sidebar.js +91 -73
  26. package/dist/esm/components/widgets/DriverCard/DriverCard.js +7 -7
  27. package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.js +3 -3
  28. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.js +2 -2
  29. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.styl.js +1 -1
  30. package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.js +1 -0
  31. package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +1 -0
  32. package/dist/esm/components/widgets/SybilionAppHeader/SybilionAppHeader.styl.js +1 -1
  33. package/dist/esm/index.js +4 -2
  34. package/dist/esm/types/src/components/ui/ButtonGroup/ButtonGroup.d.ts +3 -0
  35. package/dist/esm/types/src/components/ui/ButtonGroup/ButtonGroup.types.d.ts +3 -0
  36. package/dist/esm/types/src/components/ui/ButtonGroup/index.d.ts +2 -0
  37. package/dist/esm/types/src/components/ui/Chip/Chip.d.ts +1 -1
  38. package/dist/esm/types/src/components/ui/Chip/Chip.types.d.ts +4 -2
  39. package/dist/esm/types/src/components/ui/Page/index.d.ts +2 -0
  40. package/dist/esm/types/src/components/ui/Page/pageScrollRestoration.d.ts +2 -0
  41. package/dist/esm/types/src/components/ui/Page/usePageScrollRestoration.d.ts +2 -0
  42. package/dist/esm/types/src/components/ui/Sidebar/Sidebar.d.ts +13 -6
  43. package/dist/esm/types/src/docs/pages/ButtonGroupPage.d.ts +1 -0
  44. package/dist/esm/types/src/index.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/src/components/ui/AnalysesSelector/AnalysesSelector.tsx +3 -3
  47. package/src/components/ui/AnalysisLineIcon/AGENT.md +1 -1
  48. package/src/components/ui/Avatar/AGENT.md +1 -1
  49. package/src/components/ui/Button/Button.styl +11 -5
  50. package/src/components/ui/ButtonGroup/AGENT.md +29 -0
  51. package/src/components/ui/ButtonGroup/ButtonGroup.styl +21 -0
  52. package/src/components/ui/{Badge/Badge.styl.d.ts → ButtonGroup/ButtonGroup.styl.d.ts} +0 -6
  53. package/src/components/ui/ButtonGroup/ButtonGroup.tsx +17 -0
  54. package/src/components/ui/ButtonGroup/ButtonGroup.types.ts +3 -0
  55. package/src/components/ui/ButtonGroup/index.ts +2 -0
  56. package/src/components/ui/Chat/ChatPrompt/ChatPrompt.styl +2 -0
  57. package/src/components/ui/Chat/ChatPrompt/ChatPromptComposer.tsx +1 -0
  58. package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +15 -0
  59. package/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.tsx +21 -9
  60. package/src/components/ui/Chip/AGENT.md +4 -3
  61. package/src/components/ui/Chip/Chip.styl +17 -0
  62. package/src/components/ui/Chip/Chip.styl.d.ts +2 -0
  63. package/src/components/ui/Chip/Chip.tsx +10 -6
  64. package/src/components/ui/Chip/Chip.types.ts +5 -2
  65. package/src/components/ui/FileChip/FileChip.tsx +1 -1
  66. package/src/components/ui/Page/index.ts +2 -0
  67. package/src/components/ui/Page/pageScrollRestoration.ts +22 -0
  68. package/src/components/ui/Page/usePageScrollRestoration.ts +90 -0
  69. package/src/components/ui/Renamer/Renamer.styl +24 -4
  70. package/src/components/ui/Renamer/Renamer.styl.d.ts +2 -0
  71. package/src/components/ui/Renamer/Renamer.tsx +2 -1
  72. package/src/components/ui/Sidebar/Sidebar.tsx +158 -99
  73. package/src/components/widgets/DriverCard/DriverCard.tsx +12 -10
  74. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.styl +1 -0
  75. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.tsx +3 -3
  76. package/src/components/widgets/SybilionAppHeader/SybilionAppHeader.styl +2 -2
  77. package/src/docs/pages/ButtonGroupPage.tsx +45 -0
  78. package/src/docs/pages/ChipPage.tsx +37 -0
  79. package/src/docs/pages/RenamerPage.tsx +97 -6
  80. package/src/docs/pages/VimeoEmbedPage.tsx +4 -5
  81. package/src/docs/registry.ts +6 -12
  82. package/src/index.ts +1 -1
  83. package/dist/esm/components/ui/Badge/Badge.js +0 -11
  84. package/dist/esm/components/ui/Badge/Badge.styl.js +0 -7
  85. package/dist/esm/types/src/components/ui/Badge/Badge.d.ts +0 -3
  86. package/dist/esm/types/src/components/ui/Badge/Badge.types.d.ts +0 -6
  87. package/dist/esm/types/src/components/ui/Badge/index.d.ts +0 -2
  88. package/dist/esm/types/src/docs/pages/BadgePage.d.ts +0 -1
  89. package/dist/esm/types/src/docs/pages/TogglePage.d.ts +0 -1
  90. package/src/components/ui/Badge/AGENT.md +0 -16
  91. package/src/components/ui/Badge/Badge.styl +0 -95
  92. package/src/components/ui/Badge/Badge.tsx +0 -31
  93. package/src/components/ui/Badge/Badge.types.ts +0 -7
  94. package/src/components/ui/Badge/index.ts +0 -2
  95. package/src/docs/pages/BadgePage.tsx +0 -30
  96. package/src/docs/pages/TogglePage.tsx +0 -27
@@ -12,7 +12,6 @@ export * from './components/ui/AnalysesSelector';
12
12
  export * from './components/ui/AnalysisLineIcon';
13
13
  export * from './components/ui/AppHeader';
14
14
  export * from './components/ui/Avatar';
15
- export * from './components/ui/Badge';
16
15
  export * from './components/ui/Banner';
17
16
  export * from './components/ui/Chip';
18
17
  export * from './components/ui/Kicker';
@@ -20,6 +19,7 @@ export * from './components/ui/PullQuote';
20
19
  export * from './components/ui/SignalCard';
21
20
  export * from './components/ui/Breadcrumb';
22
21
  export * from './components/ui/Button';
22
+ export * from './components/ui/ButtonGroup';
23
23
  export * from './components/ui/Card';
24
24
  export * from './components/ui/Chart';
25
25
  export * from './components/ui/ChartAreaInteractive';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybilion/uilib",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Sybilion Design System — React UI components (Webpack + Stylus)",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -8,8 +8,8 @@ import {
8
8
  } from 'react';
9
9
 
10
10
  import { AnalysisLineIcon } from '#uilib/components/ui/AnalysisLineIcon';
11
- import { Badge } from '#uilib/components/ui/Badge';
12
11
  import { Button } from '#uilib/components/ui/Button';
12
+ import { Chip } from '#uilib/components/ui/Chip';
13
13
  import { LabelWithId } from '#uilib/components/ui/LabelWithId';
14
14
  import {
15
15
  Select,
@@ -55,9 +55,9 @@ function renderItemContent(item: AnalysesSelectorItem) {
55
55
 
56
56
  if (failed) {
57
57
  return (
58
- <Badge variant="red" className={S.itemBadge}>
58
+ <Chip variant="negative" squared className={S.itemBadge}>
59
59
  failed
60
- </Badge>
60
+ </Chip>
61
61
  );
62
62
  }
63
63
 
@@ -8,4 +8,4 @@ AnalysisLineIcon renders a small solid or dashed line marker in a given colour.
8
8
  ## When not to use
9
9
 
10
10
  - As a generic decorative icon; it only conveys meaning next to a chart.
11
- - To indicate status or severity; use Badge instead.
11
+ - To indicate status or severity; use Chip instead.
@@ -8,7 +8,7 @@ Avatar displays a user or entity image with an automatic fallback to initials wh
8
8
  ## When not to use
9
9
 
10
10
  - For arbitrary illustrative imagery; use a plain image instead.
11
- - To convey status on its own; pair it with a Badge or status indicator.
11
+ - To convey status on its own; pair it with a Chip or status indicator.
12
12
 
13
13
  ## Do
14
14
 
@@ -16,6 +16,9 @@
16
16
  transition all var(--dur-base) var(--ease-standard)
17
17
  border 0
18
18
 
19
+ &:active
20
+ opacity 0.8
21
+
19
22
  &:disabled
20
23
  pointer-events none
21
24
  opacity 0.5
@@ -43,6 +46,9 @@
43
46
  &:hover
44
47
  background-color var(--sb-gray-800)
45
48
 
49
+ :global(.dark) &
50
+ background-color var(--sb-gray-600)
51
+
46
52
  .destructive
47
53
  background-color var(--destructive-900)
48
54
  color white
@@ -51,7 +57,7 @@
51
57
  background-color var(--destructive-600)
52
58
 
53
59
  &:focus-visible
54
- ring 3px var(--destructive-200)
60
+ ring 3px var(--destructive-200)
55
61
 
56
62
  :global(.dark) &
57
63
  ring 3px var(--destructive-400)
@@ -80,11 +86,11 @@
80
86
 
81
87
  .ghost
82
88
  &:hover
83
- background-color var(--accent)
84
- color var(--accent-foreground)
89
+ background-color var(--sb-gray-100)
90
+ color var(--foreground)
85
91
 
86
- :global(.dark) &:hover
87
- background-color var(--accent-500)
92
+ :global(.dark) &
93
+ background-color var(--sb-gray-900)
88
94
 
89
95
  .link
90
96
  color var(--primary)
@@ -0,0 +1,29 @@
1
+ ---
2
+ profiles: [workspace, content]
3
+ summary: Layout wrapper that molds adjacent Button children into one segmented control.
4
+ ---
5
+
6
+ ButtonGroup is a layout wrapper for two or more adjacent buttons. It removes gaps and inner corner radii so outline and secondary actions read as a single segmented control while each button keeps its own click handler.
7
+
8
+ ## When to use
9
+
10
+ - To present a small set of related actions side by side, such as pagination or view toggles implemented with Button.
11
+ - To group outline buttons that share a border, such as filter presets or export format choices.
12
+ - When each segment needs its own label and handler but should look like one control.
13
+
14
+ ## When not to use
15
+
16
+ - For mutually exclusive selection state; use ToggleGroup or Tabs instead.
17
+ - For a single action; use Button alone.
18
+ - When buttons are not direct children of the wrapper.
19
+
20
+ ## Do
21
+
22
+ - Place Button elements as direct children of ButtonGroup.
23
+ - Use the outline variant when adjacent borders should read as one shared edge.
24
+ - Keep segment labels short so the group stays compact.
25
+
26
+ ## Don't
27
+
28
+ - Nest ButtonGroup inside Button or wrap non-button elements expecting grouped styling.
29
+ - Use ButtonGroup for navigation between pages; use links or Tabs instead.
@@ -0,0 +1,21 @@
1
+ .root
2
+ display inline-flex
3
+ align-items stretch
4
+ width fit-content
5
+
6
+ > button
7
+ &:not(:first-child)
8
+ margin-left -1px
9
+ border-top-left-radius 0
10
+ border-bottom-left-radius 0
11
+
12
+ &:not(:last-child)
13
+ border-top-right-radius 0
14
+ border-bottom-right-radius 0
15
+
16
+ &:hover,
17
+ &:focus-visible
18
+ z-index 1
19
+
20
+ &:disabled
21
+ z-index 0
@@ -2,12 +2,6 @@
2
2
  // Please do not change this file!
3
3
  interface CssExports {
4
4
  'root': string;
5
- 'squared': string;
6
- 'variant-default': string;
7
- 'variant-green': string;
8
- 'variant-outline': string;
9
- 'variant-red': string;
10
- 'variant-yellow': string;
11
5
  }
12
6
  export const cssExports: CssExports;
13
7
  export default cssExports;
@@ -0,0 +1,17 @@
1
+ import cn from 'classnames';
2
+
3
+ import S from './ButtonGroup.styl';
4
+ import type { ButtonGroupProps } from './ButtonGroup.types';
5
+
6
+ function ButtonGroup({ className, ...props }: ButtonGroupProps) {
7
+ return (
8
+ <div
9
+ data-slot="button-group"
10
+ className={cn(S.root, className)}
11
+ role="group"
12
+ {...props}
13
+ />
14
+ );
15
+ }
16
+
17
+ export { ButtonGroup };
@@ -0,0 +1,3 @@
1
+ import type { HTMLAttributes } from 'react';
2
+
3
+ export interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {}
@@ -0,0 +1,2 @@
1
+ export { ButtonGroup } from './ButtonGroup';
2
+ export type { ButtonGroupProps } from './ButtonGroup.types';
@@ -104,6 +104,8 @@ INPUT_MAX_HEIGHT = 200px
104
104
  flex-shrink 0
105
105
  align-items center
106
106
  justify-content flex-end
107
+ height 100%
108
+ padding-bottom 2px
107
109
 
108
110
  & > button:focus
109
111
  box-shadow 0 0 0 2px var(--brand-color-500) !important
@@ -105,6 +105,7 @@ export const ChatPromptComposer = forwardRef<
105
105
  <Button
106
106
  type="submit"
107
107
  size="sm"
108
+ icon
108
109
  disabled={disabled || !canSubmit}
109
110
  onMouseDown={e => e.preventDefault()}
110
111
  >
@@ -1,3 +1,4 @@
1
+ import { useEffect, useState } from 'react';
1
2
  import { createPortal } from 'react-dom';
2
3
 
3
4
  import { Button } from '../../Button';
@@ -85,6 +86,19 @@ export function ChatSheet({
85
86
  };
86
87
  }
87
88
 
89
+ const [chromePortalReady, setChromePortalReady] = useState(false);
90
+
91
+ useEffect(() => {
92
+ if (!model.isOpen) {
93
+ setChromePortalReady(false);
94
+ return;
95
+ }
96
+ const frameId = requestAnimationFrame(() => {
97
+ setChromePortalReady(true);
98
+ });
99
+ return () => cancelAnimationFrame(frameId);
100
+ }, [model.isOpen]);
101
+
88
102
  if (inline) {
89
103
  return <ChatChrome {...model.chromeProps} />;
90
104
  }
@@ -101,6 +115,7 @@ export function ChatSheet({
101
115
  </Button>
102
116
  )}
103
117
  {model.isOpen &&
118
+ chromePortalReady &&
104
119
  model.chatPanelContainer &&
105
120
  createPortal(
106
121
  <ChatChrome {...model.chromeProps} />,
@@ -1,4 +1,11 @@
1
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
1
+ import {
2
+ startTransition,
3
+ useCallback,
4
+ useEffect,
5
+ useMemo,
6
+ useRef,
7
+ useState,
8
+ } from 'react';
2
9
 
3
10
  import {
4
11
  ChatPreset,
@@ -47,7 +54,8 @@ import { ScrollRef } from '@homecode/ui';
47
54
 
48
55
  import {
49
56
  DISMISS_CHAT_FOR_LAYOUT_EVENT,
50
- useSidebar,
57
+ useSidebarActions,
58
+ useSidebarState,
51
59
  } from '../../Sidebar/Sidebar';
52
60
  import { Chat } from '../Chat';
53
61
  import type { ChatChromeProps } from '../ChatChrome';
@@ -177,14 +185,16 @@ export function useChatPanelChromeModel({
177
185
  const {
178
186
  chatPanelContainer,
179
187
  isOpen: sidebarNavOpen,
180
- setOpen: setSidebarNavOpen,
181
188
  sidebarWidthPx,
182
189
  chatWidthPx,
190
+ chatPanelOpen: shellChatPanelOpen,
191
+ } = useSidebarState();
192
+ const {
193
+ setOpen: setSidebarNavOpen,
183
194
  setChatWidthPx,
184
195
  getShellWidth,
185
- chatPanelOpen: shellChatPanelOpen,
186
196
  setChatPanelOpen,
187
- } = useSidebar();
197
+ } = useSidebarActions();
188
198
  const [localUiBusy, setLocalUiBusy] = useState(false);
189
199
  const [outboundLoadingLabel, setOutboundLoadingLabel] = useState<
190
200
  string | undefined
@@ -344,10 +354,12 @@ export function useChatPanelChromeModel({
344
354
  layoutDismissedRef.current = false;
345
355
  openedShellChatRef.current = true;
346
356
  setChatPanelOpen(true);
347
- setIsOpen(true);
348
- if (!searchParams.has(CHAT_QUERY_PARAM)) {
349
- addSearchParams({ [CHAT_QUERY_PARAM]: CHAT_OPEN_VALUE });
350
- }
357
+ startTransition(() => {
358
+ setIsOpen(true);
359
+ if (!searchParams.has(CHAT_QUERY_PARAM)) {
360
+ addSearchParams({ [CHAT_QUERY_PARAM]: CHAT_OPEN_VALUE });
361
+ }
362
+ });
351
363
  return;
352
364
  }
353
365
 
@@ -1,18 +1,19 @@
1
- Chips are compact pill-shaped capsules for filters, status pills, version tags, and quantitative delta indicators. Unlike Badge, which stays general purpose, Chip carries status and delta semantics: the positive and negative variants sit outside the primary palette and are reserved for quantitative impact signals.
1
+ Chips are compact capsules for filters, status labels, version tags, and quantitative delta indicators. Use the default pill shape for filters and live status; pass `squared` for compact label badges in lists, tables, and cards.
2
2
 
3
3
  ## When to use
4
4
 
5
5
  - To present a row of filter options, with the active variant marking the current selection.
6
6
  - To flag live status, version tags, or deadlines with the neutral, accent, and filled variants.
7
+ - To label or categorise content in lists, tables, and cards with `squared` and neutral, line, yellow, positive, or negative variants.
7
8
  - To show a quantitative delta or impact direction with the positive or negative variant, optionally with a trend arrow.
8
9
 
9
10
  ## When not to use
10
11
 
11
- - For general-purpose labels without status or delta semantics; use Badge instead.
12
12
  - For file attachments; use FileChip.
13
- - As decoration; the status variants are reserved for quantitative signals only.
13
+ - As decoration; the positive and negative variants are reserved for quantitative signals and status meaning.
14
14
 
15
15
  ## Do
16
16
 
17
17
  - Keep chip labels short and in sentence case.
18
18
  - Pair the positive and negative variants with a trend arrow or delta value so the direction reads at a glance.
19
+ - Use colour variants consistently so a given colour always carries the same meaning across the product.
@@ -14,6 +14,14 @@
14
14
  letter-spacing var(--tracking-body)
15
15
  transition background-color var(--dur-base) var(--ease-standard), color var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard)
16
16
 
17
+ &.squared
18
+ border-radius var(--p-1)
19
+
20
+ & > svg
21
+ width 0.75rem
22
+ height 0.75rem
23
+ pointer-events none
24
+
17
25
  .dot
18
26
  width 6px
19
27
  height 6px
@@ -76,3 +84,12 @@
76
84
  &.variant-negative
77
85
  background var(--status-negative-bg)
78
86
  color var(--status-negative)
87
+
88
+ // Yellow variant — caution / pending status
89
+ &.variant-yellow
90
+ background-color var(--sb-yellow-50)
91
+ color var(--sb-yellow-600)
92
+
93
+ :global(.dark) &
94
+ background-color var(--sb-yellow-900)
95
+ color var(--sb-yellow-400)
@@ -4,6 +4,7 @@ interface CssExports {
4
4
  'arrow': string;
5
5
  'dot': string;
6
6
  'root': string;
7
+ 'squared': string;
7
8
  'variant-accent': string;
8
9
  'variant-active': string;
9
10
  'variant-filled': string;
@@ -11,6 +12,7 @@ interface CssExports {
11
12
  'variant-negative': string;
12
13
  'variant-neutral': string;
13
14
  'variant-positive': string;
15
+ 'variant-yellow': string;
14
16
  }
15
17
  export const cssExports: CssExports;
16
18
  export default cssExports;
@@ -1,29 +1,33 @@
1
- import cn from 'classnames';
2
-
3
1
  import { TrendingDown, TrendingUp } from 'lucide-react';
4
2
 
5
- import S from './Chip.styl';
6
3
  import { ChipProps } from './Chip.types';
4
+ import S from './Chip.styl';
5
+ import cn from 'classnames';
7
6
 
8
7
  function Chip({
9
8
  className,
10
9
  variant = 'neutral',
11
10
  dot,
12
11
  trend,
12
+ squared = false,
13
13
  children,
14
14
  ...props
15
15
  }: ChipProps) {
16
- const showDot = dot ?? variant === 'neutral';
17
16
  const TrendIcon =
18
17
  trend === 'up' ? TrendingUp : trend === 'down' ? TrendingDown : null;
19
18
 
20
19
  return (
21
20
  <span
22
21
  data-slot="chip"
23
- className={cn(S.root, S[`variant-${variant}`], className)}
22
+ className={cn(
23
+ S.root,
24
+ S[`variant-${variant}`],
25
+ squared && S.squared,
26
+ className,
27
+ )}
24
28
  {...props}
25
29
  >
26
- {showDot && <span className={S.dot} aria-hidden="true" />}
30
+ {dot && <span className={S.dot} aria-hidden="true" />}
27
31
  {TrendIcon && (
28
32
  <TrendIcon className={S.arrow} strokeWidth={1.5} aria-hidden="true" />
29
33
  )}
@@ -7,7 +7,8 @@ export type ChipVariant =
7
7
  | 'filled'
8
8
  | 'accent'
9
9
  | 'positive'
10
- | 'negative';
10
+ | 'negative'
11
+ | 'yellow';
11
12
 
12
13
  export type ChipTrend = 'up' | 'down';
13
14
 
@@ -15,9 +16,11 @@ export interface ChipProps extends ComponentProps<'span'> {
15
16
  variant?: ChipVariant;
16
17
  /**
17
18
  * Show the 6px status dot. Defaults to true for the neutral variant
18
- * and false for all others.
19
+ * (when not squared) and false for all others.
19
20
  */
20
21
  dot?: boolean;
21
22
  /** Render a Lucide trend arrow before the label. */
22
23
  trend?: ChipTrend;
24
+ /** Use compact squared corners instead of the default pill shape. */
25
+ squared?: boolean;
23
26
  }
@@ -41,7 +41,7 @@ function FileChipHeader({
41
41
  description={hint}
42
42
  titleClassName={S.title}
43
43
  descriptionClassName={S.hint}
44
- tooltipProps={{ maxWidth: 400 }}
44
+ tooltipProps={{ maxWidth: 400, overTrigger: true }}
45
45
  >
46
46
  {onRemove ? (
47
47
  <CardAction>
@@ -10,6 +10,8 @@ export { PageHeader } from './PageHeader/PageHeader';
10
10
  export { PageEmptyCanvas } from './PageEmptyCanvas/PageEmptyCanvas';
11
11
  export { PageContent, PageContentSection } from './PageContent/PageContent';
12
12
  export { PageScroll } from './PageScroll/PageScroll';
13
+ export { usePageScrollRestoration } from './usePageScrollRestoration';
14
+ export { readSavedScrollTop } from './pageScrollRestoration';
13
15
  export { PageXScroll } from './PageXScroll/PageXScroll';
14
16
  export { Breadcrumbs } from './Breadcrumbs/Breadcrumbs';
15
17
  export { PageFooter } from './PageFooter/PageFooter';
@@ -0,0 +1,22 @@
1
+ import { isBrowser } from '#uilib/tools/env';
2
+
3
+ export function readSavedScrollTop(key: string): number | null {
4
+ if (!isBrowser) return null;
5
+
6
+ const raw = sessionStorage.getItem(key);
7
+ if (raw == null) return null;
8
+
9
+ const top = Number(raw);
10
+ return Number.isFinite(top) && top > 0 ? top : null;
11
+ }
12
+
13
+ export function saveScrollTop(key: string, top: number): void {
14
+ if (!isBrowser) return;
15
+
16
+ if (top <= 0) {
17
+ sessionStorage.removeItem(key);
18
+ return;
19
+ }
20
+
21
+ sessionStorage.setItem(key, String(top));
22
+ }
@@ -0,0 +1,90 @@
1
+ import { useCallback, useContext, useEffect, useRef } from 'react';
2
+
3
+ import debounce from '#uilib/tools/debounce';
4
+
5
+ import { PageContext } from './pageContext';
6
+ import { readSavedScrollTop, saveScrollTop } from './pageScrollRestoration';
7
+
8
+ const SCROLL_SAVE_MS = 150;
9
+
10
+ /** Session scroll restoration for a PageScroll ancestor (via PageContext). */
11
+ export function usePageScrollRestoration(scrollRestorationKey: string) {
12
+ const { getPageScrollElement } = useContext(PageContext);
13
+ const debouncedSaveRef = useRef<ReturnType<typeof debounce> | null>(null);
14
+ const latestScrollTopRef = useRef(0);
15
+ const pendingRestoreTopRef = useRef<number | null>(null);
16
+
17
+ const tryRestoreScroll = useCallback(() => {
18
+ const el = getPageScrollElement();
19
+ const top = pendingRestoreTopRef.current;
20
+ if (!el || top == null) return false;
21
+
22
+ const maxTop = Math.max(0, el.scrollHeight - el.clientHeight);
23
+ const targetTop = Math.min(top, maxTop);
24
+ el.scrollTo({ top: targetTop, behavior: 'auto' });
25
+
26
+ const applied = el.scrollTop >= targetTop - 1 || maxTop <= 0;
27
+ if (applied && maxTop > 0) {
28
+ pendingRestoreTopRef.current = null;
29
+ }
30
+
31
+ return applied;
32
+ }, [getPageScrollElement]);
33
+
34
+ useEffect(() => {
35
+ debouncedSaveRef.current?.cancel();
36
+ debouncedSaveRef.current = debounce(
37
+ (key: string, top: number) => {
38
+ saveScrollTop(key, top);
39
+ },
40
+ SCROLL_SAVE_MS,
41
+ { leading: false },
42
+ );
43
+
44
+ return () => {
45
+ debouncedSaveRef.current?.cancel();
46
+ };
47
+ }, []);
48
+
49
+ useEffect(() => {
50
+ const el = getPageScrollElement();
51
+ if (!el) return;
52
+
53
+ const ro = new ResizeObserver(() => {
54
+ if (pendingRestoreTopRef.current != null) {
55
+ tryRestoreScroll();
56
+ }
57
+ });
58
+ ro.observe(el);
59
+
60
+ return () => ro.disconnect();
61
+ }, [getPageScrollElement, tryRestoreScroll]);
62
+
63
+ useEffect(() => {
64
+ const el = getPageScrollElement();
65
+ if (!el) return;
66
+
67
+ latestScrollTopRef.current = el.scrollTop;
68
+
69
+ const savedTop = readSavedScrollTop(scrollRestorationKey);
70
+ if (savedTop != null) {
71
+ pendingRestoreTopRef.current = savedTop;
72
+ tryRestoreScroll();
73
+ }
74
+
75
+ const handleScroll = () => {
76
+ latestScrollTopRef.current = el.scrollTop;
77
+ debouncedSaveRef.current?.(scrollRestorationKey, el.scrollTop);
78
+ };
79
+
80
+ el.addEventListener('scroll', handleScroll, { passive: true });
81
+
82
+ return () => {
83
+ el.removeEventListener('scroll', handleScroll);
84
+ debouncedSaveRef.current?.cancel();
85
+ const storedTop = readSavedScrollTop(scrollRestorationKey) ?? 0;
86
+ const top = Math.max(latestScrollTopRef.current, storedTop);
87
+ saveScrollTop(scrollRestorationKey, top);
88
+ };
89
+ }, [getPageScrollElement, scrollRestorationKey, tryRestoreScroll]);
90
+ }
@@ -1,9 +1,14 @@
1
1
  .root
2
- display flex
3
- align-items center
2
+ display inline-block
3
+ max-width 100%
4
+ vertical-align top
5
+
6
+ &:has(.input)
7
+ display block
8
+ width 100%
4
9
 
5
10
  .value
6
- padding-right var(--p-2)
11
+ display inline
7
12
 
8
13
  // Matches PageHeader .title h1 typography (page title context).
9
14
  .size-lg.root
@@ -30,9 +35,24 @@
30
35
  background-color var(--accent) / 0.1
31
36
 
32
37
  .button
33
- padding-left 0
38
+ display inline-flex
39
+ vertical-align middle
40
+ margin-left var(--p-2)
34
41
  opacity 0.5
35
42
  transition opacity 0.2s ease-out
36
43
 
37
44
  .root:hover &
38
45
  opacity 1
46
+
47
+ // Pencil icon tracks Button `size` via --icon-size-* tokens (sm 14 / md 16 / lg 20px).
48
+ .size-sm.root .button svg
49
+ width var(--icon-size-sm)
50
+ height var(--icon-size-sm)
51
+
52
+ .size-md.root .button svg
53
+ width var(--icon-size-md)
54
+ height var(--icon-size-md)
55
+
56
+ .size-lg.root .button svg
57
+ width var(--icon-size-lg)
58
+ height var(--icon-size-lg)
@@ -6,6 +6,8 @@ interface CssExports {
6
6
  'input': string;
7
7
  'root': string;
8
8
  'size-lg': string;
9
+ 'size-md': string;
10
+ 'size-sm': string;
9
11
  'value': string;
10
12
  }
11
13
  export const cssExports: CssExports;
@@ -110,6 +110,7 @@ export function Renamer({
110
110
  <Tooltip>
111
111
  <TooltipTrigger asChild>
112
112
  <Button
113
+ icon
113
114
  className={S.button}
114
115
  variant="ghost"
115
116
  onPointerDown={e => {
@@ -123,7 +124,7 @@ export function Renamer({
123
124
  size={buttonSizeMap[size]}
124
125
  type="button"
125
126
  >
126
- <PencilSimpleIcon size={16} />
127
+ <PencilSimpleIcon aria-hidden />
127
128
  </Button>
128
129
  </TooltipTrigger>
129
130
  <TooltipContent side="bottom">Rename</TooltipContent>