@kushagradhawan/kookie-ui 0.1.53 → 0.1.54

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 (51) hide show
  1. package/dist/cjs/components/_internal/shell-bottom.js.map +2 -2
  2. package/dist/cjs/components/_internal/shell-handles.js +1 -1
  3. package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
  4. package/dist/cjs/components/_internal/shell-inspector.js.map +2 -2
  5. package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
  6. package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
  7. package/dist/cjs/components/_internal/shell-sidebar.js.map +2 -2
  8. package/dist/cjs/components/chatbar.d.ts.map +1 -1
  9. package/dist/cjs/components/chatbar.js +1 -1
  10. package/dist/cjs/components/chatbar.js.map +3 -3
  11. package/dist/cjs/components/shell.hooks.js +1 -1
  12. package/dist/cjs/components/shell.hooks.js.map +2 -2
  13. package/dist/cjs/components/shell.js +1 -1
  14. package/dist/cjs/components/shell.js.map +3 -3
  15. package/dist/cjs/components/shell.types.d.ts +2 -2
  16. package/dist/cjs/components/shell.types.d.ts.map +1 -1
  17. package/dist/cjs/components/shell.types.js +1 -1
  18. package/dist/cjs/components/shell.types.js.map +3 -3
  19. package/dist/esm/components/_internal/shell-bottom.js.map +2 -2
  20. package/dist/esm/components/_internal/shell-handles.js +1 -1
  21. package/dist/esm/components/_internal/shell-handles.js.map +3 -3
  22. package/dist/esm/components/_internal/shell-inspector.js.map +2 -2
  23. package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
  24. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  25. package/dist/esm/components/_internal/shell-sidebar.js.map +2 -2
  26. package/dist/esm/components/chatbar.d.ts.map +1 -1
  27. package/dist/esm/components/chatbar.js +1 -1
  28. package/dist/esm/components/chatbar.js.map +3 -3
  29. package/dist/esm/components/shell.hooks.js +1 -1
  30. package/dist/esm/components/shell.hooks.js.map +3 -3
  31. package/dist/esm/components/shell.js +1 -1
  32. package/dist/esm/components/shell.js.map +3 -3
  33. package/dist/esm/components/shell.types.d.ts +2 -2
  34. package/dist/esm/components/shell.types.d.ts.map +1 -1
  35. package/dist/esm/components/shell.types.js +1 -1
  36. package/dist/esm/components/shell.types.js.map +3 -3
  37. package/package.json +1 -1
  38. package/schemas/base-button.json +1 -1
  39. package/schemas/button.json +1 -1
  40. package/schemas/icon-button.json +1 -1
  41. package/schemas/index.json +6 -6
  42. package/schemas/toggle-button.json +1 -1
  43. package/schemas/toggle-icon-button.json +1 -1
  44. package/src/components/_internal/shell-bottom.tsx +1 -1
  45. package/src/components/_internal/shell-handles.tsx +1 -1
  46. package/src/components/_internal/shell-inspector.tsx +1 -1
  47. package/src/components/_internal/shell-sidebar.tsx +2 -2
  48. package/src/components/chatbar.tsx +7 -5
  49. package/src/components/shell.hooks.ts +3 -3
  50. package/src/components/shell.tsx +14 -14
  51. package/src/components/shell.types.ts +2 -2
@@ -6,8 +6,8 @@ import { useShell } from '../shell.context.js';
6
6
  import { useResponsivePresentation, useResponsiveValue } from '../shell.hooks.js';
7
7
  import { PaneResizeContext } from './shell-resize.js';
8
8
  import { SidebarHandle, PaneHandle } from './shell-handles.js';
9
- import type { Breakpoint, PaneMode, PaneSizePersistence, PresentationValue, ResponsivePresentation, ResponsiveSidebarMode, SidebarMode, Responsive } from '../shell.types.js';
10
- import { BREAKPOINTS } from '../shell.types.js';
9
+ import type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation, SidebarMode, Responsive } from '../shell.types.js';
10
+ import { _BREAKPOINTS } from '../shell.types.js';
11
11
 
12
12
  interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
13
13
  presentation?: ResponsivePresentation;
@@ -8,9 +8,7 @@ import { Flex } from './flex.js';
8
8
  import { ScrollArea } from './scroll-area.js';
9
9
  import { Slot } from './slot.js';
10
10
  import { Box } from './box.js';
11
- import { Card } from './card.js';
12
11
  import { Text } from './text.js';
13
- import { Inset } from './inset.js';
14
12
  import { useDropzone } from 'react-dropzone';
15
13
  import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
16
14
 
@@ -287,7 +285,10 @@ const Root = React.forwardRef<RootElement, RootProps>((props, forwardedRef) => {
287
285
  // `attachments={undefined}` to clear attachments. In that case we normalize to an empty array.
288
286
  const isAttachmentsControlled = 'attachments' in props;
289
287
  const [attachmentsUncontrolled, setAttachmentsUncontrolled] = React.useState<ChatbarAttachment[]>(defaultAttachments);
290
- const attachments = isAttachmentsControlled ? ((attachmentsProp ?? []) as ChatbarAttachment[]) : attachmentsUncontrolled;
288
+ const attachments = React.useMemo(
289
+ () => (isAttachmentsControlled ? ((attachmentsProp ?? []) as ChatbarAttachment[]) : attachmentsUncontrolled),
290
+ [isAttachmentsControlled, attachmentsProp, attachmentsUncontrolled],
291
+ );
291
292
 
292
293
  // Track generated object URLs for cleanup
293
294
  const generatedUrlSetRef = React.useRef<Set<string>>(new Set());
@@ -416,11 +417,12 @@ const Root = React.forwardRef<RootElement, RootProps>((props, forwardedRef) => {
416
417
 
417
418
  // Revoke any remaining generated URLs on unmount
418
419
  React.useEffect(() => {
420
+ const urlSet = generatedUrlSetRef.current;
419
421
  return () => {
420
- for (const url of Array.from(generatedUrlSetRef.current)) {
422
+ for (const url of Array.from(urlSet)) {
421
423
  URL.revokeObjectURL(url);
422
424
  }
423
- generatedUrlSetRef.current.clear();
425
+ urlSet.clear();
424
426
  };
425
427
  }, []);
426
428
 
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { Breakpoint, PresentationValue, ResponsivePresentation } from './shell.types.js';
3
- import { BREAKPOINTS } from './shell.types.js';
3
+ import { _BREAKPOINTS } from './shell.types.js';
4
4
  import { useShell } from './shell.context.js';
5
5
 
6
6
  export function useResponsivePresentation(presentation: ResponsivePresentation): PresentationValue {
@@ -15,7 +15,7 @@ export function useResponsivePresentation(presentation: ResponsivePresentation):
15
15
  return presentation[currentBreakpoint]!;
16
16
  }
17
17
 
18
- const bpKeys = Object.keys(BREAKPOINTS) as Array<keyof typeof BREAKPOINTS>;
18
+ const bpKeys = Object.keys(_BREAKPOINTS) as Array<keyof typeof _BREAKPOINTS>;
19
19
  const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);
20
20
  const startIdx = order.indexOf(currentBreakpoint as Breakpoint);
21
21
 
@@ -50,7 +50,7 @@ export function useResponsiveValue<T>(value: T | Partial<Record<Breakpoint, T>>
50
50
  return map[currentBreakpoint as Breakpoint] as T;
51
51
  }
52
52
 
53
- const bpKeys = Object.keys(BREAKPOINTS) as Array<keyof typeof BREAKPOINTS>;
53
+ const bpKeys = Object.keys(_BREAKPOINTS) as Array<keyof typeof _BREAKPOINTS>;
54
54
  const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);
55
55
  const startIdx = order.indexOf(currentBreakpoint as Breakpoint);
56
56
 
@@ -31,12 +31,12 @@ import * as Sheet from './sheet.js';
31
31
  import { VisuallyHidden } from './visually-hidden.js';
32
32
  import { useResponsivePresentation, useResponsiveValue } from './shell.hooks.js';
33
33
  import { PaneResizeContext } from './_internal/shell-resize.js';
34
- import { PaneHandle, PanelHandle, SidebarHandle, InspectorHandle, BottomHandle } from './_internal/shell-handles.js';
34
+ import { PaneHandle, PanelHandle } from './_internal/shell-handles.js';
35
35
  import { Sidebar } from './_internal/shell-sidebar.js';
36
36
  import { Bottom } from './_internal/shell-bottom.js';
37
37
  import { Inspector } from './_internal/shell-inspector.js';
38
38
  import type { PresentationValue, ResponsivePresentation, PaneMode, SidebarMode, PaneSizePersistence, Breakpoint, PaneTarget, Responsive } from './shell.types.js';
39
- import { BREAKPOINTS } from './shell.types.js';
39
+ import { _BREAKPOINTS } from './shell.types.js';
40
40
  import {
41
41
  ShellProvider,
42
42
  useShell,
@@ -75,7 +75,7 @@ function useBreakpoint(): { bp: Breakpoint; ready: boolean } {
75
75
  React.useEffect(() => {
76
76
  if (typeof window === 'undefined') return;
77
77
 
78
- const queries: [key: keyof typeof BREAKPOINTS, query: string][] = Object.entries(BREAKPOINTS) as any;
78
+ const queries: [key: keyof typeof _BREAKPOINTS, query: string][] = Object.entries(_BREAKPOINTS) as any;
79
79
  const mqls = queries.map(([k, q]) => [k, window.matchMedia(q)] as const);
80
80
 
81
81
  const compute = () => {
@@ -556,7 +556,7 @@ type RailProps = React.ComponentPropsWithoutRef<'div'> & {
556
556
 
557
557
  // Left container - behaves like Inspector but contains Rail+Panel
558
558
  const Left = React.forwardRef<HTMLDivElement, LeftProps>(
559
- ({ className, presentation = { initial: 'fixed', sm: 'fixed' }, collapsible = true, onExpand, onCollapse, children, style, ...props }, ref) => {
559
+ ({ className, presentation = { initial: 'fixed', sm: 'fixed' }, collapsible: _collapsible = true, onExpand, onCollapse, children, style, ...props }, ref) => {
560
560
  const shell = useShell();
561
561
  const resolvedPresentation = useResponsivePresentation(presentation);
562
562
  const isOverlay = resolvedPresentation === 'overlay';
@@ -581,7 +581,7 @@ const Left = React.forwardRef<HTMLDivElement, LeftProps>(
581
581
  return () => shell.setHasLeft(false);
582
582
  }, [shell]);
583
583
 
584
- const lastBpRef = React.useRef<Breakpoint | null>(null);
584
+ const _lastBpRef = React.useRef<Breakpoint | null>(null);
585
585
  const lastLeftModeRef = React.useRef<PaneMode | null>(null);
586
586
  const initNotifiedRef = React.useRef(false);
587
587
  const resolvedDefaultOpen = useResponsiveValue((props as any).defaultOpen as any);
@@ -633,7 +633,7 @@ const Left = React.forwardRef<HTMLDivElement, LeftProps>(
633
633
  }
634
634
  }, [shell.leftMode, onExpand, onCollapse]);
635
635
 
636
- const isExpanded = shell.leftMode === 'expanded';
636
+ const _isExpanded = shell.leftMode === 'expanded';
637
637
 
638
638
  // Left is not resizable; width derives from Rail/Panel.
639
639
 
@@ -674,11 +674,11 @@ const Left = React.forwardRef<HTMLDivElement, LeftProps>(
674
674
  const isType = (el: React.ReactElement, comp: any) => React.isValidElement(el) && el.type === comp;
675
675
  const railEl = childArray.find((el) => isType(el, Rail));
676
676
  const panelEl = childArray.find((el) => isType(el, Panel));
677
- const railSize = typeof (railEl as any)?.props?.expandedSize === 'number' ? (railEl as any).props.expandedSize : 64;
678
- const panelSize = typeof (panelEl as any)?.props?.expandedSize === 'number' ? (panelEl as any).props.expandedSize : 288;
679
- const hasRail = Boolean(railEl);
680
- const hasPanel = Boolean(panelEl);
681
- const includePanel = hasPanel && (shell.panelMode === 'expanded' || shell.peekTarget === 'panel');
677
+ const _railSize = typeof (railEl as any)?.props?.expandedSize === 'number' ? (railEl as any).props.expandedSize : 64;
678
+ const _panelSize = typeof (panelEl as any)?.props?.expandedSize === 'number' ? (panelEl as any).props.expandedSize : 288;
679
+ const _hasRail = Boolean(railEl);
680
+ const _hasPanel = Boolean(panelEl);
681
+ const _includePanel = _hasPanel && (shell.panelMode === 'expanded' || shell.peekTarget === 'panel');
682
682
 
683
683
  // Strip control props from DOM spread
684
684
  const { open: _openIgnored, defaultOpen: _defaultOpenIgnored, onOpenChange: _onOpenChangeIgnored, ...stackDomProps } = props as any;
@@ -810,7 +810,7 @@ type PanelComponent = React.ForwardRefExoticComponent<PanelPublicProps & React.R
810
810
  Handle: HandleComponent;
811
811
  };
812
812
 
813
- type SidebarComponent = React.ForwardRefExoticComponent<
813
+ type _SidebarComponent = React.ForwardRefExoticComponent<
814
814
  (Omit<PaneProps, 'mode' | 'defaultMode' | 'onModeChange'> & {
815
815
  state?: Responsive<SidebarMode>;
816
816
  defaultState?: SidebarMode;
@@ -821,9 +821,9 @@ type SidebarComponent = React.ForwardRefExoticComponent<
821
821
  React.RefAttributes<HTMLDivElement>
822
822
  > & { Handle: HandleComponent };
823
823
 
824
- type InspectorComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: HandleComponent };
824
+ type _InspectorComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: HandleComponent };
825
825
 
826
- type BottomComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: HandleComponent };
826
+ type _BottomComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: HandleComponent };
827
827
 
828
828
  const Panel = React.forwardRef<HTMLDivElement, PanelPublicProps>(
829
829
  (
@@ -16,7 +16,7 @@ export type PaneSizePersistence = {
16
16
  save?: (size: number) => void | Promise<void>;
17
17
  };
18
18
 
19
- export const BREAKPOINTS = {
19
+ export const _BREAKPOINTS = {
20
20
  xs: '(min-width: 520px)',
21
21
  sm: '(min-width: 768px)',
22
22
  md: '(min-width: 1024px)',
@@ -24,6 +24,6 @@ export const BREAKPOINTS = {
24
24
  xl: '(min-width: 1640px)',
25
25
  } as const;
26
26
 
27
- export type Breakpoint = 'initial' | keyof typeof BREAKPOINTS;
27
+ export type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;
28
28
 
29
29
  export type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';