@kushagradhawan/kookie-ui 0.1.49 → 0.1.51

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 (103) hide show
  1. package/components.css +880 -243
  2. package/dist/cjs/components/_internal/shell-bottom.d.ts +31 -5
  3. package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
  4. package/dist/cjs/components/_internal/shell-bottom.js +1 -1
  5. package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
  6. package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -1
  7. package/dist/cjs/components/_internal/shell-handles.js +1 -1
  8. package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
  9. package/dist/cjs/components/_internal/shell-inspector.d.ts +23 -5
  10. package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
  11. package/dist/cjs/components/_internal/shell-inspector.js +1 -1
  12. package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
  13. package/dist/cjs/components/_internal/shell-sidebar.d.ts +24 -6
  14. package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
  15. package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
  16. package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
  17. package/dist/cjs/components/chatbar.d.ts +9 -2
  18. package/dist/cjs/components/chatbar.d.ts.map +1 -1
  19. package/dist/cjs/components/chatbar.js +1 -1
  20. package/dist/cjs/components/chatbar.js.map +3 -3
  21. package/dist/cjs/components/shell.context.d.ts +88 -0
  22. package/dist/cjs/components/shell.context.d.ts.map +1 -1
  23. package/dist/cjs/components/shell.context.js +1 -1
  24. package/dist/cjs/components/shell.context.js.map +3 -3
  25. package/dist/cjs/components/shell.d.ts +51 -13
  26. package/dist/cjs/components/shell.d.ts.map +1 -1
  27. package/dist/cjs/components/shell.hooks.d.ts +7 -1
  28. package/dist/cjs/components/shell.hooks.d.ts.map +1 -1
  29. package/dist/cjs/components/shell.hooks.js +1 -1
  30. package/dist/cjs/components/shell.hooks.js.map +3 -3
  31. package/dist/cjs/components/shell.js +1 -1
  32. package/dist/cjs/components/shell.js.map +3 -3
  33. package/dist/cjs/components/shell.types.d.ts +1 -0
  34. package/dist/cjs/components/shell.types.d.ts.map +1 -1
  35. package/dist/cjs/components/shell.types.js +1 -1
  36. package/dist/cjs/components/shell.types.js.map +2 -2
  37. package/dist/cjs/components/sidebar.d.ts +7 -1
  38. package/dist/cjs/components/sidebar.d.ts.map +1 -1
  39. package/dist/cjs/components/sidebar.js +1 -1
  40. package/dist/cjs/components/sidebar.js.map +3 -3
  41. package/dist/esm/components/_internal/shell-bottom.d.ts +31 -5
  42. package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
  43. package/dist/esm/components/_internal/shell-bottom.js +1 -1
  44. package/dist/esm/components/_internal/shell-bottom.js.map +3 -3
  45. package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -1
  46. package/dist/esm/components/_internal/shell-handles.js +1 -1
  47. package/dist/esm/components/_internal/shell-handles.js.map +3 -3
  48. package/dist/esm/components/_internal/shell-inspector.d.ts +23 -5
  49. package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
  50. package/dist/esm/components/_internal/shell-inspector.js +1 -1
  51. package/dist/esm/components/_internal/shell-inspector.js.map +3 -3
  52. package/dist/esm/components/_internal/shell-sidebar.d.ts +24 -6
  53. package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
  54. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  55. package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
  56. package/dist/esm/components/chatbar.d.ts +9 -2
  57. package/dist/esm/components/chatbar.d.ts.map +1 -1
  58. package/dist/esm/components/chatbar.js +1 -1
  59. package/dist/esm/components/chatbar.js.map +3 -3
  60. package/dist/esm/components/shell.context.d.ts +88 -0
  61. package/dist/esm/components/shell.context.d.ts.map +1 -1
  62. package/dist/esm/components/shell.context.js +1 -1
  63. package/dist/esm/components/shell.context.js.map +3 -3
  64. package/dist/esm/components/shell.d.ts +51 -13
  65. package/dist/esm/components/shell.d.ts.map +1 -1
  66. package/dist/esm/components/shell.hooks.d.ts +7 -1
  67. package/dist/esm/components/shell.hooks.d.ts.map +1 -1
  68. package/dist/esm/components/shell.hooks.js +1 -1
  69. package/dist/esm/components/shell.hooks.js.map +3 -3
  70. package/dist/esm/components/shell.js +1 -1
  71. package/dist/esm/components/shell.js.map +3 -3
  72. package/dist/esm/components/shell.types.d.ts +1 -0
  73. package/dist/esm/components/shell.types.d.ts.map +1 -1
  74. package/dist/esm/components/shell.types.js.map +2 -2
  75. package/dist/esm/components/sidebar.d.ts +7 -1
  76. package/dist/esm/components/sidebar.d.ts.map +1 -1
  77. package/dist/esm/components/sidebar.js +1 -1
  78. package/dist/esm/components/sidebar.js.map +3 -3
  79. package/package.json +14 -3
  80. package/schemas/base-button.json +1 -1
  81. package/schemas/button.json +1 -1
  82. package/schemas/icon-button.json +1 -1
  83. package/schemas/index.json +6 -6
  84. package/schemas/toggle-button.json +1 -1
  85. package/schemas/toggle-icon-button.json +1 -1
  86. package/src/components/_internal/base-menu.css +17 -18
  87. package/src/components/_internal/base-sidebar-menu.css +23 -21
  88. package/src/components/_internal/base-sidebar.css +20 -0
  89. package/src/components/_internal/shell-bottom.tsx +176 -49
  90. package/src/components/_internal/shell-handles.tsx +29 -4
  91. package/src/components/_internal/shell-inspector.tsx +175 -43
  92. package/src/components/_internal/shell-sidebar.tsx +176 -69
  93. package/src/components/chatbar.css +240 -21
  94. package/src/components/chatbar.tsx +246 -290
  95. package/src/components/sheet.css +8 -16
  96. package/src/components/shell.context.tsx +79 -0
  97. package/src/components/shell.css +28 -2
  98. package/src/components/shell.hooks.ts +35 -0
  99. package/src/components/shell.tsx +574 -214
  100. package/src/components/shell.types.ts +2 -0
  101. package/src/components/sidebar.css +233 -33
  102. package/src/components/sidebar.tsx +247 -213
  103. package/styles.css +841 -204
@@ -12,28 +12,22 @@
12
12
 
13
13
  /* Logical side anchoring (RTL-aware via logical inset) */
14
14
  :where(.rt-SheetContent[data-side='start']) {
15
- top: 0 !important;
16
- bottom: 0 !important;
17
- left: 0 !important;
18
- right: auto !important;
15
+ inset-block: 0 !important;
16
+ inset-inline-start: 0 !important;
19
17
  margin: 0 !important;
20
18
  border-start-start-radius: 0;
21
19
  border-end-start-radius: 0;
22
20
  }
23
21
  :where(.rt-SheetContent[data-side='end']) {
24
- top: 0 !important;
25
- bottom: 0 !important;
26
- right: 0 !important;
27
- left: auto !important;
22
+ inset-block: 0 !important;
23
+ inset-inline-end: 0 !important;
28
24
  margin: 0 !important;
29
25
  border-start-end-radius: 0;
30
26
  border-end-end-radius: 0;
31
27
  }
32
28
  :where(.rt-SheetContent[data-side='top']) {
33
- top: 0 !important;
34
- left: 0 !important;
35
- right: 0 !important;
36
- bottom: auto !important;
29
+ inset-block-start: 0 !important;
30
+ inset-inline: 0 !important;
37
31
  width: auto;
38
32
  max-width: none;
39
33
  height: var(--height, 75vh);
@@ -42,10 +36,8 @@
42
36
  border-start-end-radius: 0;
43
37
  }
44
38
  :where(.rt-SheetContent[data-side='bottom']) {
45
- bottom: 0 !important;
46
- left: 0 !important;
47
- right: 0 !important;
48
- top: auto !important;
39
+ inset-block-end: 0 !important;
40
+ inset-inline: 0 !important;
49
41
  width: auto;
50
42
  max-width: none;
51
43
  height: var(--height, 75vh);
@@ -54,3 +54,82 @@ export function useShell() {
54
54
  export function ShellProvider({ value, children }: { value: ShellContextValue; children: React.ReactNode }) {
55
55
  return <ShellContext.Provider value={value}>{children}</ShellContext.Provider>;
56
56
  }
57
+
58
+ // Phase 7: Split contexts for render isolation
59
+
60
+ // Pane mode slice contexts
61
+ type ModeSetter<T> = (mode: T) => void;
62
+
63
+ export const LeftModeContext = React.createContext<{ leftMode: PaneMode; setLeftMode: ModeSetter<PaneMode> } | null>(null as any);
64
+ export function useLeftMode() {
65
+ const ctx = React.useContext(LeftModeContext);
66
+ if (!ctx) throw new Error('useLeftMode must be used within Shell.Root');
67
+ return ctx;
68
+ }
69
+
70
+ export const PanelModeContext = React.createContext<{ panelMode: PaneMode; setPanelMode: ModeSetter<PaneMode> } | null>(null as any);
71
+ export function usePanelMode() {
72
+ const ctx = React.useContext(PanelModeContext);
73
+ if (!ctx) throw new Error('usePanelMode must be used within Shell.Root');
74
+ return ctx;
75
+ }
76
+
77
+ export const SidebarModeContext = React.createContext<{ sidebarMode: SidebarMode; setSidebarMode: ModeSetter<SidebarMode> } | null>(null as any);
78
+ export function useSidebarMode() {
79
+ const ctx = React.useContext(SidebarModeContext);
80
+ if (!ctx) throw new Error('useSidebarMode must be used within Shell.Root');
81
+ return ctx;
82
+ }
83
+
84
+ export const InspectorModeContext = React.createContext<{ inspectorMode: PaneMode; setInspectorMode: ModeSetter<PaneMode> } | null>(null as any);
85
+ export function useInspectorMode() {
86
+ const ctx = React.useContext(InspectorModeContext);
87
+ if (!ctx) throw new Error('useInspectorMode must be used within Shell.Root');
88
+ return ctx;
89
+ }
90
+
91
+ export const BottomModeContext = React.createContext<{ bottomMode: PaneMode; setBottomMode: ModeSetter<PaneMode> } | null>(null as any);
92
+ export function useBottomMode() {
93
+ const ctx = React.useContext(BottomModeContext);
94
+ if (!ctx) throw new Error('useBottomMode must be used within Shell.Root');
95
+ return ctx;
96
+ }
97
+
98
+ // Presentation slice
99
+ export const PresentationContext = React.createContext<{ currentBreakpoint: Breakpoint; currentBreakpointReady: boolean; leftResolvedPresentation?: PresentationValue } | null>(null as any);
100
+ export function usePresentation() {
101
+ const ctx = React.useContext(PresentationContext);
102
+ if (!ctx) throw new Error('usePresentation must be used within Shell.Root');
103
+ return ctx;
104
+ }
105
+
106
+ // Peek slice
107
+ export const PeekContext = React.createContext<{ peekTarget: PaneTarget | null; setPeekTarget: (t: PaneTarget | null) => void; peekPane: (t: PaneTarget) => void; clearPeek: () => void } | null>(
108
+ null as any,
109
+ );
110
+ export function usePeek() {
111
+ const ctx = React.useContext(PeekContext);
112
+ if (!ctx) throw new Error('usePeek must be used within Shell.Root');
113
+ return ctx;
114
+ }
115
+
116
+ // Actions slice (stable callbacks)
117
+ export const ActionsContext = React.createContext<{
118
+ togglePane: (t: PaneTarget) => void;
119
+ expandPane: (t: PaneTarget) => void;
120
+ collapsePane: (t: PaneTarget) => void;
121
+ setSidebarToggleComputer?: (fn: (current: SidebarMode) => SidebarMode) => void;
122
+ } | null>(null as any);
123
+ export function useShellActions() {
124
+ const ctx = React.useContext(ActionsContext);
125
+ if (!ctx) throw new Error('useShellActions must be used within Shell.Root');
126
+ return ctx;
127
+ }
128
+
129
+ // Composition slice
130
+ export const CompositionContext = React.createContext<{ hasLeft: boolean; setHasLeft: (v: boolean) => void; hasSidebar: boolean; setHasSidebar: (v: boolean) => void } | null>(null as any);
131
+ export function useComposition() {
132
+ const ctx = React.useContext(CompositionContext);
133
+ if (!ctx) throw new Error('useComposition must be used within Shell.Root');
134
+ return ctx;
135
+ }
@@ -74,6 +74,8 @@
74
74
 
75
75
  .rt-ShellRail[data-mode='collapsed'] {
76
76
  width: 0px;
77
+ /* Delay container collapse until content fade completes */
78
+ transition-delay: var(--motion-duration-small);
77
79
  }
78
80
 
79
81
  /* Keep collapsed panes out of flow to avoid layout blips when exiting peek */
@@ -90,7 +92,6 @@
90
92
  flex-direction: column;
91
93
  width: var(--rail-size, 64px);
92
94
  height: 100%;
93
- padding: var(--space-2);
94
95
  gap: var(--space-2);
95
96
 
96
97
  /* Content animation: fade out first, then fade in after width settles */
@@ -128,6 +129,8 @@
128
129
 
129
130
  .rt-ShellPanel:not([data-visible]) {
130
131
  width: 0px;
132
+ /* Delay container collapse until content fade completes */
133
+ transition-delay: var(--motion-duration-small);
131
134
  }
132
135
 
133
136
  /* Keep collapsed panel out of flow to avoid layout blips when exiting peek */
@@ -188,6 +191,8 @@
188
191
 
189
192
  .rt-ShellSidebar[data-mode='collapsed'] {
190
193
  width: 0px;
194
+ /* Delay container collapse until content fade completes */
195
+ transition-delay: var(--motion-duration-small);
191
196
  }
192
197
 
193
198
  /* Keep collapsed sidebar out of flow to avoid layout blips when exiting peek */
@@ -218,6 +223,22 @@
218
223
  opacity: 1;
219
224
  }
220
225
 
226
+ /* Sidebar presentation switch sequencing (thin ↔ expanded) */
227
+ .rt-ShellSidebarContent[data-phase='hiding'] {
228
+ /* Immediately fade out */
229
+ opacity: 0;
230
+ transition: opacity var(--motion-duration-small) var(--motion-ease-standard);
231
+ }
232
+ .rt-ShellSidebarContent[data-phase='resizing'] {
233
+ /* Keep hidden during width transition */
234
+ opacity: 0;
235
+ }
236
+ .rt-ShellSidebarContent[data-phase='showing'] {
237
+ /* Fade back in after width settles */
238
+ opacity: 1;
239
+ transition: opacity var(--motion-duration-small) var(--motion-ease-standard);
240
+ }
241
+
221
242
  .rt-ShellSidebar[data-mode='collapsed'] .rt-ShellSidebarContent {
222
243
  /* Exit animation: fade out content first */
223
244
  opacity: 0;
@@ -274,6 +295,8 @@
274
295
 
275
296
  .rt-ShellInspector[data-mode='collapsed'] {
276
297
  width: 0px;
298
+ /* Delay container collapse until content fade completes */
299
+ transition-delay: var(--motion-duration-small);
277
300
  }
278
301
 
279
302
  .rt-ShellInspector[data-mode='collapsed'] {
@@ -327,6 +350,8 @@
327
350
  position: absolute;
328
351
  inset-inline: 0;
329
352
  inset-block-end: 0;
353
+ /* Delay container collapse until content fade completes */
354
+ transition-delay: var(--motion-duration-small);
330
355
  }
331
356
 
332
357
  .rt-ShellBottomContent {
@@ -537,13 +562,14 @@
537
562
  box-shadow: 0 -4px 8px -4px rgba(0, 0, 0, 0.15);
538
563
  }
539
564
 
540
- /* Force content visible during peek */
565
+ /* Peek: expand container first, then fade content in */
541
566
  .rt-ShellRail[data-peek] .rt-ShellRailContent,
542
567
  .rt-ShellPanel[data-peek] .rt-ShellPanelContent,
543
568
  .rt-ShellSidebar[data-peek] .rt-ShellSidebarContent,
544
569
  .rt-ShellInspector[data-peek] .rt-ShellInspectorContent,
545
570
  .rt-ShellBottom[data-peek] .rt-ShellBottomContent {
546
571
  opacity: 1;
572
+ transition-delay: var(--motion-duration-small);
547
573
  }
548
574
 
549
575
  /* Rail peek: left edge */
@@ -29,3 +29,38 @@ export function useResponsivePresentation(presentation: ResponsivePresentation):
29
29
  return 'fixed';
30
30
  }, [presentation, currentBreakpoint]);
31
31
  }
32
+
33
+ /**
34
+ * Resolve a responsive value (T or responsive map keyed by breakpoints) against the current Shell breakpoint.
35
+ * If no value is defined for the current breakpoint, search smaller breakpoints down to 'initial'.
36
+ * Returns undefined when passed a responsive map with no matching key across the chain.
37
+ */
38
+ export function useResponsiveValue<T>(value: T | Partial<Record<Breakpoint, T>> | undefined): T | undefined {
39
+ const { currentBreakpoint } = useShell();
40
+
41
+ return React.useMemo(() => {
42
+ if (value == null) return undefined;
43
+ // Primitive value
44
+ if (typeof value !== 'object') {
45
+ return value as T;
46
+ }
47
+
48
+ const map = value as Partial<Record<Breakpoint, T>>;
49
+ if (map[currentBreakpoint as Breakpoint] !== undefined) {
50
+ return map[currentBreakpoint as Breakpoint] as T;
51
+ }
52
+
53
+ const bpKeys = Object.keys(BREAKPOINTS) as Array<keyof typeof BREAKPOINTS>;
54
+ const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);
55
+ const startIdx = order.indexOf(currentBreakpoint as Breakpoint);
56
+
57
+ for (let i = startIdx + 1; i < order.length; i++) {
58
+ const bp = order[i];
59
+ if (map[bp] !== undefined) {
60
+ return map[bp] as T;
61
+ }
62
+ }
63
+
64
+ return undefined;
65
+ }, [value, currentBreakpoint]);
66
+ }