@kushagradhawan/kookie-ui 0.1.123 → 0.1.125
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/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +2 -2
- package/dist/cjs/components/_internal/shell-handles.js +1 -1
- package/dist/cjs/components/_internal/shell-handles.js.map +2 -2
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +2 -2
- package/dist/cjs/components/_internal/shell-prop-helpers.js.map +2 -2
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +2 -2
- package/dist/cjs/components/combobox.d.ts.map +1 -1
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +3 -3
- package/dist/cjs/components/shell.context.d.ts +2 -0
- package/dist/cjs/components/shell.context.d.ts.map +1 -1
- package/dist/cjs/components/shell.context.js +1 -1
- package/dist/cjs/components/shell.context.js.map +2 -2
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/shell.types.d.ts +11 -0
- package/dist/cjs/components/shell.types.d.ts.map +1 -1
- package/dist/cjs/components/shell.types.js +1 -1
- package/dist/cjs/components/shell.types.js.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js.map +2 -2
- package/dist/esm/components/_internal/shell-handles.js +1 -1
- package/dist/esm/components/_internal/shell-handles.js.map +2 -2
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.js.map +2 -2
- package/dist/esm/components/_internal/shell-prop-helpers.js.map +2 -2
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js.map +2 -2
- package/dist/esm/components/combobox.d.ts.map +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/combobox.js.map +3 -3
- package/dist/esm/components/shell.context.d.ts +2 -0
- package/dist/esm/components/shell.context.d.ts.map +1 -1
- package/dist/esm/components/shell.context.js.map +2 -2
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.js.map +3 -3
- package/dist/esm/components/shell.types.d.ts +11 -0
- package/dist/esm/components/shell.types.d.ts.map +1 -1
- package/dist/esm/components/shell.types.js.map +1 -1
- package/package.json +1 -1
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +6 -6
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/shell-bottom.tsx +5 -5
- package/src/components/_internal/shell-handles.tsx +26 -26
- package/src/components/_internal/shell-inspector.tsx +5 -5
- package/src/components/_internal/shell-prop-helpers.ts +1 -1
- package/src/components/_internal/shell-sidebar.tsx +10 -10
- package/src/components/combobox.tsx +176 -80
- package/src/components/shell.context.tsx +12 -10
- package/src/components/shell.tsx +21 -20
- package/src/components/shell.types.ts +13 -0
package/src/components/shell.tsx
CHANGED
|
@@ -36,7 +36,7 @@ import { omitPaneProps, extractPaneDomProps, mapResponsiveBooleanToPaneMode } fr
|
|
|
36
36
|
import { Sidebar } from './_internal/shell-sidebar.js';
|
|
37
37
|
import { Bottom } from './_internal/shell-bottom.js';
|
|
38
38
|
import { Inspector } from './_internal/shell-inspector.js';
|
|
39
|
-
import type { PresentationValue, ResponsivePresentation, PaneMode, SidebarMode, PaneSizePersistence, Breakpoint, PaneTarget, Responsive, PaneBaseProps } from './shell.types.js';
|
|
39
|
+
import type { PresentationValue, ResponsivePresentation, PaneMode, SidebarMode, PaneSizePersistence, Breakpoint, PaneTarget, Responsive, PaneBaseProps, CSSPropertiesWithVars } from './shell.types.js';
|
|
40
40
|
import { _BREAKPOINTS } from './shell.types.js';
|
|
41
41
|
import { normalizeToPx } from '../helpers/normalize-to-px.js';
|
|
42
42
|
import {
|
|
@@ -80,10 +80,11 @@ function useBreakpoint(): { bp: Breakpoint; ready: boolean } {
|
|
|
80
80
|
React.useEffect(() => {
|
|
81
81
|
if (typeof window === 'undefined') return;
|
|
82
82
|
|
|
83
|
-
const queries
|
|
83
|
+
const queries = Object.entries(_BREAKPOINTS) as [keyof typeof _BREAKPOINTS, string][];
|
|
84
84
|
const mqls = queries.map(([k, q]) => [k, window.matchMedia(q)] as const);
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
// Accept optional event param to satisfy MediaQueryList listener signature
|
|
87
|
+
const compute = (_e?: MediaQueryListEvent) => {
|
|
87
88
|
// Highest matched wins
|
|
88
89
|
const matched = mqls.filter(([, m]) => m.matches).map(([k]) => k);
|
|
89
90
|
const next = (matched[matched.length - 1] as Breakpoint | undefined) ?? 'initial';
|
|
@@ -101,11 +102,11 @@ function useBreakpoint(): { bp: Breakpoint; ready: boolean } {
|
|
|
101
102
|
removeListener?: (listener: (e: MediaQueryListEvent) => void) => void;
|
|
102
103
|
};
|
|
103
104
|
if (typeof mm.addEventListener === 'function' && typeof mm.removeEventListener === 'function') {
|
|
104
|
-
mm.addEventListener('change', compute
|
|
105
|
-
cleanups.push(() => mm.removeEventListener?.('change', compute
|
|
105
|
+
mm.addEventListener('change', compute);
|
|
106
|
+
cleanups.push(() => mm.removeEventListener?.('change', compute));
|
|
106
107
|
} else if (typeof mm.addListener === 'function' && typeof mm.removeListener === 'function') {
|
|
107
|
-
mm.addListener(compute
|
|
108
|
-
cleanups.push(() => mm.removeListener?.(compute
|
|
108
|
+
mm.addListener(compute);
|
|
109
|
+
cleanups.push(() => mm.removeListener?.(compute));
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
|
|
@@ -568,8 +569,8 @@ const Root = React.forwardRef<HTMLDivElement, ShellRootProps>(({ className, chil
|
|
|
568
569
|
style={
|
|
569
570
|
peekTarget === 'rail' || peekTarget === 'panel'
|
|
570
571
|
? ({
|
|
571
|
-
|
|
572
|
-
} as
|
|
572
|
+
'--peek-rail-width': `${railDefaultSizeRef.current}px`,
|
|
573
|
+
} as CSSPropertiesWithVars)
|
|
573
574
|
: undefined
|
|
574
575
|
}
|
|
575
576
|
>
|
|
@@ -631,8 +632,8 @@ const Header = React.forwardRef<HTMLElement, ShellHeaderProps>(({ className, hei
|
|
|
631
632
|
className={classNames('rt-ShellHeader', className)}
|
|
632
633
|
style={{
|
|
633
634
|
...style,
|
|
634
|
-
|
|
635
|
-
}}
|
|
635
|
+
'--shell-header-height': `${height}px`,
|
|
636
|
+
} as CSSPropertiesWithVars}
|
|
636
637
|
/>
|
|
637
638
|
));
|
|
638
639
|
Header.displayName = 'Shell.Header';
|
|
@@ -698,7 +699,7 @@ const Left = React.forwardRef<HTMLDivElement, LeftProps>((initialProps, ref) =>
|
|
|
698
699
|
const localRef = React.useRef<HTMLDivElement | null>(null);
|
|
699
700
|
// Publish resolved presentation so Root can gate peeking in overlay
|
|
700
701
|
React.useEffect(() => {
|
|
701
|
-
|
|
702
|
+
shell.onLeftPres?.(resolvedPresentation);
|
|
702
703
|
}, [shell, resolvedPresentation]);
|
|
703
704
|
const setRef = React.useCallback(
|
|
704
705
|
(node: HTMLDivElement | null) => {
|
|
@@ -864,7 +865,7 @@ const Rail = React.forwardRef<HTMLDivElement, RailProps>((initialProps, ref) =>
|
|
|
864
865
|
|
|
865
866
|
// Register expanded size with Left container
|
|
866
867
|
React.useEffect(() => {
|
|
867
|
-
|
|
868
|
+
shell.onRailDefaults?.(expandedSize);
|
|
868
869
|
}, [shell, expandedSize]);
|
|
869
870
|
|
|
870
871
|
const isExpanded = shell.leftMode === 'expanded';
|
|
@@ -879,8 +880,8 @@ const Rail = React.forwardRef<HTMLDivElement, RailProps>((initialProps, ref) =>
|
|
|
879
880
|
data-peek={(shell.currentBreakpointReady && shell.leftResolvedPresentation !== 'overlay' && shell.peekTarget === 'rail') || undefined}
|
|
880
881
|
style={{
|
|
881
882
|
...style,
|
|
882
|
-
|
|
883
|
-
}}
|
|
883
|
+
'--rail-size': `${expandedSize}px`,
|
|
884
|
+
} as CSSPropertiesWithVars}
|
|
884
885
|
>
|
|
885
886
|
<div className="rt-ShellRailContent" data-visible={(shell.currentBreakpointReady && (isExpanded || (shell.leftResolvedPresentation !== 'overlay' && shell.peekTarget === 'rail'))) || undefined}>
|
|
886
887
|
{children}
|
|
@@ -1068,7 +1069,7 @@ const Panel = assignShellSlot(
|
|
|
1068
1069
|
}, [open]);
|
|
1069
1070
|
|
|
1070
1071
|
React.useEffect(() => {
|
|
1071
|
-
|
|
1072
|
+
shell.onPanelDefaults?.(expandedSize);
|
|
1072
1073
|
}, [shell, expandedSize]);
|
|
1073
1074
|
const localRef = React.useRef<HTMLDivElement | null>(null);
|
|
1074
1075
|
const setRef = React.useCallback(
|
|
@@ -1245,8 +1246,8 @@ const Panel = assignShellSlot(
|
|
|
1245
1246
|
data-peek={(shell.currentBreakpointReady && shell.leftResolvedPresentation !== 'overlay' && shell.peekTarget === 'panel') || undefined}
|
|
1246
1247
|
style={{
|
|
1247
1248
|
...style,
|
|
1248
|
-
|
|
1249
|
-
}}
|
|
1249
|
+
'--panel-size': `${expandedSize}px`,
|
|
1250
|
+
} as CSSPropertiesWithVars}
|
|
1250
1251
|
>
|
|
1251
1252
|
<div className="rt-ShellPanelContent" data-visible={isExpanded || undefined}>
|
|
1252
1253
|
{contentChildren}
|
|
@@ -1312,7 +1313,7 @@ const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(({ target, act
|
|
|
1312
1313
|
onClick?.(event);
|
|
1313
1314
|
|
|
1314
1315
|
// Clear any active peek on this target before toggling to avoid sticky peek state
|
|
1315
|
-
if (
|
|
1316
|
+
if (shell.peekTarget === target) {
|
|
1316
1317
|
shell.clearPeek();
|
|
1317
1318
|
}
|
|
1318
1319
|
|
|
@@ -1361,7 +1362,7 @@ const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(({ target, act
|
|
|
1361
1362
|
(event: React.MouseEvent<HTMLButtonElement>) => {
|
|
1362
1363
|
onMouseLeave?.(event);
|
|
1363
1364
|
if (!peekOnHover) return;
|
|
1364
|
-
if (
|
|
1365
|
+
if (shell.peekTarget === target) {
|
|
1365
1366
|
shell.clearPeek();
|
|
1366
1367
|
}
|
|
1367
1368
|
},
|
|
@@ -50,3 +50,16 @@ export const _BREAKPOINTS = {
|
|
|
50
50
|
export type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;
|
|
51
51
|
|
|
52
52
|
export type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* CSS custom property key type for type-safe style objects.
|
|
56
|
+
* Allows any string prefixed with '--'.
|
|
57
|
+
*/
|
|
58
|
+
export type CSSCustomProperty = `--${string}`;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Style object that supports CSS custom properties.
|
|
62
|
+
*/
|
|
63
|
+
export type CSSPropertiesWithVars = React.CSSProperties & {
|
|
64
|
+
[key: CSSCustomProperty]: string | number | undefined;
|
|
65
|
+
};
|