@kushagradhawan/kookie-ui 0.1.57 → 0.1.59
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/components.css +33 -33
- 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 +3 -3
- 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 +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js.map +2 -2
- package/dist/cjs/components/icons.d.ts +1 -1
- package/dist/cjs/components/icons.d.ts.map +1 -1
- package/dist/cjs/components/icons.js.map +2 -2
- package/dist/cjs/components/schemas/shell.schema.d.ts +2 -2
- package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/shell.schema.js +1 -1
- package/dist/cjs/components/schemas/shell.schema.js.map +3 -3
- 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/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 +3 -3
- 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 +3 -3
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js.map +2 -2
- package/dist/esm/components/icons.d.ts +1 -1
- package/dist/esm/components/icons.d.ts.map +1 -1
- package/dist/esm/components/icons.js.map +2 -2
- package/dist/esm/components/schemas/shell.schema.d.ts +2 -2
- package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/shell.schema.js.map +3 -3
- 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/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 +14 -13
- package/src/components/_internal/shell-inspector.tsx +13 -11
- package/src/components/_internal/shell-sidebar.tsx +12 -12
- package/src/components/callout.css +5 -5
- package/src/components/chatbar.css +3 -3
- package/src/components/chatbar.tsx +0 -1
- package/src/components/icons.tsx +19 -87
- package/src/components/schemas/shell.schema.ts +10 -33
- package/src/components/shell.tsx +32 -24
- package/styles.css +33 -33
package/schemas/index.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"title": "Kookie UI Button Components",
|
|
4
4
|
"description": "Complete JSON Schema collection for all button components in Kookie UI",
|
|
5
5
|
"version": "1.0.0",
|
|
6
|
-
"generatedAt": "2025-
|
|
6
|
+
"generatedAt": "2025-11-11T07:34:25.392Z",
|
|
7
7
|
"source": "Zod schemas",
|
|
8
8
|
"components": {
|
|
9
9
|
"base-button": {
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
"title": "Base-button Component Props",
|
|
288
288
|
"description": "Props schema for the base-button component in Kookie UI",
|
|
289
289
|
"version": "1.0.0",
|
|
290
|
-
"generatedAt": "2025-
|
|
290
|
+
"generatedAt": "2025-11-11T07:34:25.381Z",
|
|
291
291
|
"source": "Zod schema"
|
|
292
292
|
},
|
|
293
293
|
"button": {
|
|
@@ -822,7 +822,7 @@
|
|
|
822
822
|
"title": "Button Component Props",
|
|
823
823
|
"description": "Props schema for the button component in Kookie UI",
|
|
824
824
|
"version": "1.0.0",
|
|
825
|
-
"generatedAt": "2025-
|
|
825
|
+
"generatedAt": "2025-11-11T07:34:25.387Z",
|
|
826
826
|
"source": "Zod schema"
|
|
827
827
|
},
|
|
828
828
|
"icon-button": {
|
|
@@ -1140,7 +1140,7 @@
|
|
|
1140
1140
|
"title": "Icon-button Component Props",
|
|
1141
1141
|
"description": "Props schema for the icon-button component in Kookie UI",
|
|
1142
1142
|
"version": "1.0.0",
|
|
1143
|
-
"generatedAt": "2025-
|
|
1143
|
+
"generatedAt": "2025-11-11T07:34:25.389Z",
|
|
1144
1144
|
"source": "Zod schema"
|
|
1145
1145
|
},
|
|
1146
1146
|
"toggle-button": {
|
|
@@ -1683,7 +1683,7 @@
|
|
|
1683
1683
|
"title": "Toggle-button Component Props",
|
|
1684
1684
|
"description": "Props schema for the toggle-button component in Kookie UI",
|
|
1685
1685
|
"version": "1.0.0",
|
|
1686
|
-
"generatedAt": "2025-
|
|
1686
|
+
"generatedAt": "2025-11-11T07:34:25.390Z",
|
|
1687
1687
|
"source": "Zod schema"
|
|
1688
1688
|
},
|
|
1689
1689
|
"toggle-icon-button": {
|
|
@@ -2009,7 +2009,7 @@
|
|
|
2009
2009
|
"title": "Toggle-icon-button Component Props",
|
|
2010
2010
|
"description": "Props schema for the toggle-icon-button component in Kookie UI",
|
|
2011
2011
|
"version": "1.0.0",
|
|
2012
|
-
"generatedAt": "2025-
|
|
2012
|
+
"generatedAt": "2025-11-11T07:34:25.391Z",
|
|
2013
2013
|
"source": "Zod schema"
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
@@ -538,6 +538,6 @@
|
|
|
538
538
|
"title": "Toggle-button Component Props",
|
|
539
539
|
"description": "Props schema for the toggle-button component in Kookie UI",
|
|
540
540
|
"version": "1.0.0",
|
|
541
|
-
"generatedAt": "2025-
|
|
541
|
+
"generatedAt": "2025-11-11T07:34:25.390Z",
|
|
542
542
|
"source": "Zod schema"
|
|
543
543
|
}
|
|
@@ -321,6 +321,6 @@
|
|
|
321
321
|
"title": "Toggle-icon-button Component Props",
|
|
322
322
|
"description": "Props schema for the toggle-icon-button component in Kookie UI",
|
|
323
323
|
"version": "1.0.0",
|
|
324
|
-
"generatedAt": "2025-
|
|
324
|
+
"generatedAt": "2025-11-11T07:34:25.391Z",
|
|
325
325
|
"source": "Zod schema"
|
|
326
326
|
}
|
|
@@ -95,10 +95,13 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
95
95
|
const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === BottomHandle));
|
|
96
96
|
|
|
97
97
|
// Throttled/debounced emitter for onSizeChange
|
|
98
|
+
const onSizeChange = (props as any).onSizeChange;
|
|
99
|
+
const sizeUpdate = (props as any).sizeUpdate;
|
|
100
|
+
const sizeUpdateMs = (props as any).sizeUpdateMs;
|
|
98
101
|
const emitSizeChange = React.useMemo(() => {
|
|
99
|
-
const cb =
|
|
100
|
-
const strategy =
|
|
101
|
-
const ms =
|
|
102
|
+
const cb = onSizeChange as undefined | ((s: number, meta: BottomSizeChangeMeta) => void);
|
|
103
|
+
const strategy = sizeUpdate as undefined | 'throttle' | 'debounce';
|
|
104
|
+
const ms = sizeUpdateMs ?? 50;
|
|
102
105
|
if (!cb) return () => {};
|
|
103
106
|
if (strategy === 'debounce') {
|
|
104
107
|
let t: any = null;
|
|
@@ -120,7 +123,7 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
125
|
return (s: number, meta: BottomSizeChangeMeta) => cb(s, meta);
|
|
123
|
-
}, [
|
|
126
|
+
}, [onSizeChange, sizeUpdate, sizeUpdateMs]);
|
|
124
127
|
|
|
125
128
|
const didInitRef = React.useRef(false);
|
|
126
129
|
const didInitFromDefaultOpenRef = React.useRef(false);
|
|
@@ -134,17 +137,15 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
134
137
|
shell.setBottomMode(initial ? 'expanded' : 'collapsed');
|
|
135
138
|
didInitFromDefaultOpenRef.current = true;
|
|
136
139
|
}
|
|
137
|
-
}, [shell
|
|
140
|
+
}, [shell, open, defaultOpen, resolvedDefaultOpen]);
|
|
138
141
|
|
|
139
142
|
// Dev guards
|
|
140
143
|
const wasControlledRef = React.useRef<boolean | null>(null);
|
|
141
144
|
if (process.env.NODE_ENV !== 'production') {
|
|
142
145
|
if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {
|
|
143
|
-
// eslint-disable-next-line no-console
|
|
144
146
|
console.error('Shell.Bottom: Do not pass both `open` and `defaultOpen`. Choose one.');
|
|
145
147
|
}
|
|
146
148
|
if (typeof (props as any).size !== 'undefined' && typeof (props as any).defaultSize !== 'undefined') {
|
|
147
|
-
// eslint-disable-next-line no-console
|
|
148
149
|
console.error('Shell.Bottom: Do not pass both `size` and `defaultSize`. Choose one.');
|
|
149
150
|
}
|
|
150
151
|
}
|
|
@@ -156,7 +157,6 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
156
157
|
return;
|
|
157
158
|
}
|
|
158
159
|
if (wasControlledRef.current !== isControlled) {
|
|
159
|
-
// eslint-disable-next-line no-console
|
|
160
160
|
console.warn('Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported.');
|
|
161
161
|
wasControlledRef.current = isControlled;
|
|
162
162
|
}
|
|
@@ -166,7 +166,7 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
166
166
|
React.useEffect(() => {
|
|
167
167
|
if (typeof open === 'undefined') return;
|
|
168
168
|
shell.setBottomMode(open ? 'expanded' : 'collapsed');
|
|
169
|
-
}, [open]);
|
|
169
|
+
}, [shell, open]);
|
|
170
170
|
|
|
171
171
|
const responsiveNotifiedRef = React.useRef(false);
|
|
172
172
|
|
|
@@ -176,7 +176,7 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
176
176
|
if (typeof resolvedOpen === 'undefined') return;
|
|
177
177
|
const shouldExpand = Boolean(resolvedOpen);
|
|
178
178
|
shell.setBottomMode(shouldExpand ? 'expanded' : 'collapsed');
|
|
179
|
-
}, [resolvedOpen]);
|
|
179
|
+
}, [shell, resolvedOpen]);
|
|
180
180
|
|
|
181
181
|
const initNotifiedRef = React.useRef(false);
|
|
182
182
|
const lastBottomModeRef = React.useRef<PaneMode | null>(null);
|
|
@@ -323,10 +323,11 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
323
323
|
}, []);
|
|
324
324
|
|
|
325
325
|
// Controlled size sync (moved above overlay return)
|
|
326
|
+
const controlledSize = (props as any).size;
|
|
326
327
|
React.useEffect(() => {
|
|
327
328
|
if (!localRef.current) return;
|
|
328
|
-
if (typeof
|
|
329
|
-
const px = normalizeToPx(
|
|
329
|
+
if (typeof controlledSize === 'undefined') return;
|
|
330
|
+
const px = normalizeToPx(controlledSize);
|
|
330
331
|
if (typeof px === 'number' && Number.isFinite(px)) {
|
|
331
332
|
const minPx = typeof minSize === 'number' ? minSize : undefined;
|
|
332
333
|
const maxPx = typeof maxSize === 'number' ? maxSize : undefined;
|
|
@@ -334,7 +335,7 @@ export const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(
|
|
|
334
335
|
localRef.current.style.setProperty('--bottom-size', `${clamped}px`);
|
|
335
336
|
emitSizeChange(clamped, { reason: 'controlled' });
|
|
336
337
|
}
|
|
337
|
-
}, [
|
|
338
|
+
}, [controlledSize, minSize, maxSize, normalizeToPx, emitSizeChange]);
|
|
338
339
|
|
|
339
340
|
if (isOverlay) {
|
|
340
341
|
const open = shell.bottomMode === 'expanded';
|
|
@@ -92,10 +92,13 @@ export const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(
|
|
|
92
92
|
const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === InspectorHandle));
|
|
93
93
|
|
|
94
94
|
// Throttled/debounced emitter for onSizeChange
|
|
95
|
+
const onSizeChange = (props as any).onSizeChange;
|
|
96
|
+
const sizeUpdate = (props as any).sizeUpdate;
|
|
97
|
+
const sizeUpdateMs = (props as any).sizeUpdateMs;
|
|
95
98
|
const emitSizeChange = React.useMemo(() => {
|
|
96
|
-
const cb =
|
|
97
|
-
const strategy =
|
|
98
|
-
const ms =
|
|
99
|
+
const cb = onSizeChange as undefined | ((s: number, meta: InspectorSizeChangeMeta) => void);
|
|
100
|
+
const strategy = sizeUpdate as undefined | 'throttle' | 'debounce';
|
|
101
|
+
const ms = sizeUpdateMs ?? 50;
|
|
99
102
|
if (!cb) return () => {};
|
|
100
103
|
if (strategy === 'debounce') {
|
|
101
104
|
let t: any = null;
|
|
@@ -117,13 +120,12 @@ export const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(
|
|
|
117
120
|
};
|
|
118
121
|
}
|
|
119
122
|
return (s: number, meta: InspectorSizeChangeMeta) => cb(s, meta);
|
|
120
|
-
}, [
|
|
123
|
+
}, [onSizeChange, sizeUpdate, sizeUpdateMs]);
|
|
121
124
|
|
|
122
125
|
// Dev guards
|
|
123
126
|
const wasControlledRef = React.useRef<boolean | null>(null);
|
|
124
127
|
if (process.env.NODE_ENV !== 'production') {
|
|
125
128
|
if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {
|
|
126
|
-
// eslint-disable-next-line no-console
|
|
127
129
|
console.error('Shell.Inspector: Do not pass both `open` and `defaultOpen`. Choose one.');
|
|
128
130
|
}
|
|
129
131
|
}
|
|
@@ -136,7 +138,6 @@ export const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(
|
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
140
|
if (wasControlledRef.current !== isControlled) {
|
|
139
|
-
// eslint-disable-next-line no-console
|
|
140
141
|
console.warn('Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported.');
|
|
141
142
|
wasControlledRef.current = isControlled;
|
|
142
143
|
}
|
|
@@ -154,7 +155,7 @@ export const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(
|
|
|
154
155
|
shell.setInspectorMode(initialOpen ? 'expanded' : 'collapsed');
|
|
155
156
|
if (initialOpen) onOpenChange?.(true, { reason: 'init' });
|
|
156
157
|
didInitFromDefaultOpenRef.current = true;
|
|
157
|
-
}, [shell
|
|
158
|
+
}, [shell, resolvedDefaultOpen, defaultOpen, open, onOpenChange]);
|
|
158
159
|
|
|
159
160
|
// Controlled responsive open
|
|
160
161
|
const resolvedOpen = useResponsiveValue(open);
|
|
@@ -163,7 +164,7 @@ export const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(
|
|
|
163
164
|
const shouldExpand = Boolean(resolvedOpen);
|
|
164
165
|
if (shouldExpand && shell.inspectorMode !== 'expanded') shell.setInspectorMode('expanded');
|
|
165
166
|
if (!shouldExpand && shell.inspectorMode !== 'collapsed') shell.setInspectorMode('collapsed');
|
|
166
|
-
}, [
|
|
167
|
+
}, [shell, resolvedOpen]);
|
|
167
168
|
|
|
168
169
|
// Removed boolean-only mount init; handled in responsive init effect above
|
|
169
170
|
|
|
@@ -305,10 +306,11 @@ export const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(
|
|
|
305
306
|
}, []);
|
|
306
307
|
|
|
307
308
|
// Controlled size sync
|
|
309
|
+
const controlledSize = (props as any).size;
|
|
308
310
|
React.useEffect(() => {
|
|
309
311
|
if (!localRef.current) return;
|
|
310
|
-
if (typeof
|
|
311
|
-
const px = normalizeToPx(
|
|
312
|
+
if (typeof controlledSize === 'undefined') return;
|
|
313
|
+
const px = normalizeToPx(controlledSize);
|
|
312
314
|
if (typeof px === 'number' && Number.isFinite(px)) {
|
|
313
315
|
const minPx = typeof minSize === 'number' ? minSize : undefined;
|
|
314
316
|
const maxPx = typeof maxSize === 'number' ? maxSize : undefined;
|
|
@@ -316,7 +318,7 @@ export const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(
|
|
|
316
318
|
localRef.current.style.setProperty('--inspector-size', `${clamped}px`);
|
|
317
319
|
emitSizeChange(clamped, { reason: 'controlled' });
|
|
318
320
|
}
|
|
319
|
-
}, [
|
|
321
|
+
}, [controlledSize, minSize, maxSize, normalizeToPx, emitSizeChange]);
|
|
320
322
|
|
|
321
323
|
if (isOverlay) {
|
|
322
324
|
const open = shell.inspectorMode === 'expanded';
|
|
@@ -101,10 +101,13 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>(
|
|
|
101
101
|
const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === SidebarHandle));
|
|
102
102
|
|
|
103
103
|
// Throttled/debounced emitter for onSizeChange
|
|
104
|
+
const onSizeChange = (props as any).onSizeChange;
|
|
105
|
+
const sizeUpdate = (props as any).sizeUpdate;
|
|
106
|
+
const sizeUpdateMs = (props as any).sizeUpdateMs;
|
|
104
107
|
const emitSizeChange = React.useMemo(() => {
|
|
105
|
-
const cb =
|
|
106
|
-
const strategy =
|
|
107
|
-
const ms =
|
|
108
|
+
const cb = onSizeChange as undefined | ((s: number, meta: { reason: 'init' | 'resize' | 'controlled' }) => void);
|
|
109
|
+
const strategy = sizeUpdate as undefined | 'throttle' | 'debounce';
|
|
110
|
+
const ms = sizeUpdateMs ?? 50;
|
|
108
111
|
if (!cb) return () => {};
|
|
109
112
|
if (strategy === 'debounce') {
|
|
110
113
|
let t: any = null;
|
|
@@ -126,7 +129,7 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>(
|
|
|
126
129
|
};
|
|
127
130
|
}
|
|
128
131
|
return (s: number, meta: { reason: 'init' | 'resize' | 'controlled' }) => cb(s, meta);
|
|
129
|
-
}, [
|
|
132
|
+
}, [onSizeChange, sizeUpdate, sizeUpdateMs]);
|
|
130
133
|
|
|
131
134
|
// Register with shell
|
|
132
135
|
const sidebarId = React.useId();
|
|
@@ -141,11 +144,9 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>(
|
|
|
141
144
|
const wasControlledRef = React.useRef<boolean | null>(null);
|
|
142
145
|
if (process.env.NODE_ENV !== 'production') {
|
|
143
146
|
if (typeof state !== 'undefined' && typeof defaultState !== 'undefined') {
|
|
144
|
-
// eslint-disable-next-line no-console
|
|
145
147
|
console.error('Shell.Sidebar: Do not pass both `state` and `defaultState`. Choose one.');
|
|
146
148
|
}
|
|
147
149
|
if (typeof (props as any).size !== 'undefined' && typeof (props as any).defaultSize !== 'undefined') {
|
|
148
|
-
// eslint-disable-next-line no-console
|
|
149
150
|
console.error('Shell.Sidebar: Do not pass both `size` and `defaultSize`. Choose one.');
|
|
150
151
|
}
|
|
151
152
|
}
|
|
@@ -158,7 +159,6 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>(
|
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
161
|
if (wasControlledRef.current !== isControlled) {
|
|
161
|
-
// eslint-disable-next-line no-console
|
|
162
162
|
console.warn('Shell.Sidebar: Switching between controlled and uncontrolled `state` is not supported.');
|
|
163
163
|
wasControlledRef.current = isControlled;
|
|
164
164
|
}
|
|
@@ -194,7 +194,7 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>(
|
|
|
194
194
|
React.useEffect(() => {
|
|
195
195
|
if (resolvedState === undefined) return;
|
|
196
196
|
if (shell.sidebarMode !== resolvedState) shell.setSidebarMode(resolvedState);
|
|
197
|
-
}, [
|
|
197
|
+
}, [shell, resolvedState]);
|
|
198
198
|
|
|
199
199
|
// Emit mode changes
|
|
200
200
|
const lastNotifyModeRef = React.useRef<SidebarMode | null>(null);
|
|
@@ -370,11 +370,11 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>(
|
|
|
370
370
|
}, []);
|
|
371
371
|
|
|
372
372
|
// Controlled size sync
|
|
373
|
+
const controlledSize = (props as any).size;
|
|
373
374
|
React.useEffect(() => {
|
|
374
375
|
if (!localRef.current) return;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const px = normalizeToPx(size);
|
|
376
|
+
if (typeof controlledSize === 'undefined') return;
|
|
377
|
+
const px = normalizeToPx(controlledSize);
|
|
378
378
|
if (typeof px === 'number' && Number.isFinite(px)) {
|
|
379
379
|
const minPx = typeof minSize === 'number' ? minSize : undefined;
|
|
380
380
|
const maxPx = typeof maxSize === 'number' ? maxSize : undefined;
|
|
@@ -382,7 +382,7 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>(
|
|
|
382
382
|
localRef.current.style.setProperty('--sidebar-size', `${clamped}px`);
|
|
383
383
|
emitSizeChange(clamped, { reason: 'controlled' });
|
|
384
384
|
}
|
|
385
|
-
}, [
|
|
385
|
+
}, [controlledSize, minSize, maxSize, normalizeToPx, emitSizeChange]);
|
|
386
386
|
|
|
387
387
|
if (isOverlay) {
|
|
388
388
|
const open = shell.sidebarMode !== 'collapsed';
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
row-gap: var(--space-2);
|
|
81
81
|
column-gap: var(--space-2);
|
|
82
82
|
padding: var(--space-3);
|
|
83
|
-
--callout-border-radius:
|
|
83
|
+
--callout-border-radius: max(var(--radius-1), var(--radius-full));
|
|
84
84
|
--callout-icon-height: var(--line-height-1);
|
|
85
85
|
--callout-icon-size: var(--content-icon-size-1);
|
|
86
86
|
}
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
row-gap: var(--space-2);
|
|
89
89
|
column-gap: var(--space-3);
|
|
90
90
|
padding: var(--space-4);
|
|
91
|
-
--callout-border-radius:
|
|
91
|
+
--callout-border-radius: max(var(--radius-2), var(--radius-full));
|
|
92
92
|
--callout-icon-height: var(--line-height-2);
|
|
93
93
|
--callout-icon-size: var(--content-icon-size-2);
|
|
94
94
|
}
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
row-gap: var(--space-3);
|
|
97
97
|
column-gap: var(--space-4);
|
|
98
98
|
padding: var(--space-5);
|
|
99
|
-
--callout-border-radius:
|
|
99
|
+
--callout-border-radius: max(var(--radius-3), var(--radius-full));
|
|
100
100
|
--callout-icon-height: var(--line-height-3);
|
|
101
101
|
--callout-icon-size: var(--content-icon-size-3);
|
|
102
102
|
}
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
row-gap: var(--space-3);
|
|
105
105
|
column-gap: var(--space-5);
|
|
106
106
|
padding: var(--space-6);
|
|
107
|
-
--callout-border-radius:
|
|
107
|
+
--callout-border-radius: max(var(--radius-4), var(--radius-full));
|
|
108
108
|
--callout-icon-height: var(--line-height-4);
|
|
109
109
|
--callout-icon-size: var(--content-icon-size-4);
|
|
110
110
|
}
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
row-gap: var(--space-4);
|
|
113
113
|
column-gap: var(--space-6);
|
|
114
114
|
padding: var(--space-7);
|
|
115
|
-
--callout-border-radius:
|
|
115
|
+
--callout-border-radius: max(var(--radius-5), var(--radius-full));
|
|
116
116
|
--callout-icon-height: var(--line-height-5);
|
|
117
117
|
--callout-icon-size: var(--content-icon-size-5);
|
|
118
118
|
}
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
/* outline */
|
|
220
220
|
.rt-ChatbarBox:where(.rt-variant-outline) {
|
|
221
221
|
--text-area-selection-color: var(--focus-a5);
|
|
222
|
-
--text-area-focus-color: var(--focus-
|
|
222
|
+
--text-area-focus-color: var(--focus-9);
|
|
223
223
|
--text-area-border-width: 1px;
|
|
224
224
|
box-shadow: inset 0 0 0 1px var(--accent-6);
|
|
225
225
|
transition: var(--transition-background-blur);
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
/* classic */
|
|
249
249
|
.rt-ChatbarBox:where(.rt-variant-classic) {
|
|
250
250
|
--text-area-selection-color: var(--focus-a5);
|
|
251
|
-
--text-area-focus-color: var(--focus-
|
|
251
|
+
--text-area-focus-color: var(--focus-9);
|
|
252
252
|
--text-area-border-width: 0px;
|
|
253
253
|
background-color: var(--color-surface-solid);
|
|
254
254
|
box-shadow: var(--shadow-2);
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
.rt-ChatbarBox:where(.rt-variant-classic):where(:focus-within) {
|
|
268
268
|
box-shadow:
|
|
269
269
|
var(--shadow-2),
|
|
270
|
-
0 0 0 2px var(--focus-
|
|
270
|
+
0 0 0 2px var(--focus-9);
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
/* soft */
|
|
@@ -767,7 +767,6 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, fo
|
|
|
767
767
|
if (process.env.NODE_ENV === 'production') return;
|
|
768
768
|
const hasLabel = textareaProps['aria-label'] != null || textareaProps['aria-labelledby'] != null;
|
|
769
769
|
if (!hasLabel) {
|
|
770
|
-
// eslint-disable-next-line no-console
|
|
771
770
|
console.warn('[Chatbar.Textarea] Provide aria-label or aria-labelledby to ensure the control has an accessible name.');
|
|
772
771
|
}
|
|
773
772
|
// warn only on mount
|
package/src/components/icons.tsx
CHANGED
|
@@ -5,41 +5,23 @@ import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-p
|
|
|
5
5
|
type IconElement = React.ElementRef<'svg'>;
|
|
6
6
|
interface IconProps extends ComponentPropsWithout<'svg', RemovedProps | 'children'> {}
|
|
7
7
|
|
|
8
|
-
const ThickDividerHorizontalIcon = React.forwardRef<IconElement, IconProps>(
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
>
|
|
20
|
-
<path
|
|
21
|
-
fillRule="evenodd"
|
|
22
|
-
clipRule="evenodd"
|
|
23
|
-
d="M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"
|
|
24
|
-
/>
|
|
25
|
-
</svg>
|
|
26
|
-
);
|
|
27
|
-
},
|
|
28
|
-
);
|
|
8
|
+
const ThickDividerHorizontalIcon = React.forwardRef<IconElement, IconProps>((props, forwardedRef) => {
|
|
9
|
+
return (
|
|
10
|
+
<svg width="9" height="9" viewBox="0 0 9 9" fill="currentcolor" xmlns="http://www.w3.org/2000/svg" {...props} ref={forwardedRef}>
|
|
11
|
+
<path
|
|
12
|
+
fillRule="evenodd"
|
|
13
|
+
clipRule="evenodd"
|
|
14
|
+
d="M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
29
19
|
|
|
30
20
|
ThickDividerHorizontalIcon.displayName = 'ThickDividerHorizontalIcon';
|
|
31
21
|
|
|
32
22
|
const ThickCheckIcon = React.forwardRef<IconElement, IconProps>((props, forwardedRef) => {
|
|
33
23
|
return (
|
|
34
|
-
<svg
|
|
35
|
-
width="9"
|
|
36
|
-
height="9"
|
|
37
|
-
viewBox="0 0 9 9"
|
|
38
|
-
fill="currentcolor"
|
|
39
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
40
|
-
{...props}
|
|
41
|
-
ref={forwardedRef}
|
|
42
|
-
>
|
|
24
|
+
<svg width="9" height="9" viewBox="0 0 9 9" fill="currentcolor" xmlns="http://www.w3.org/2000/svg" {...props} ref={forwardedRef}>
|
|
43
25
|
<path
|
|
44
26
|
fillRule="evenodd"
|
|
45
27
|
clipRule="evenodd"
|
|
@@ -52,15 +34,7 @@ ThickCheckIcon.displayName = 'ThickCheckIcon';
|
|
|
52
34
|
|
|
53
35
|
const ChevronDownIcon = React.forwardRef<IconElement, IconProps>((props, forwardedRef) => {
|
|
54
36
|
return (
|
|
55
|
-
<svg
|
|
56
|
-
width="9"
|
|
57
|
-
height="9"
|
|
58
|
-
viewBox="0 0 9 9"
|
|
59
|
-
fill="currentcolor"
|
|
60
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
61
|
-
{...props}
|
|
62
|
-
ref={forwardedRef}
|
|
63
|
-
>
|
|
37
|
+
<svg width="9" height="9" viewBox="0 0 9 9" fill="currentcolor" xmlns="http://www.w3.org/2000/svg" {...props} ref={forwardedRef}>
|
|
64
38
|
<path d="M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z" />
|
|
65
39
|
</svg>
|
|
66
40
|
);
|
|
@@ -69,15 +43,7 @@ ChevronDownIcon.displayName = 'ChevronDownIcon';
|
|
|
69
43
|
|
|
70
44
|
const ThickChevronRightIcon = React.forwardRef<IconElement, IconProps>((props, forwardedRef) => {
|
|
71
45
|
return (
|
|
72
|
-
<svg
|
|
73
|
-
width="9"
|
|
74
|
-
height="9"
|
|
75
|
-
viewBox="0 0 9 9"
|
|
76
|
-
fill="currentcolor"
|
|
77
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
78
|
-
{...props}
|
|
79
|
-
ref={forwardedRef}
|
|
80
|
-
>
|
|
46
|
+
<svg width="9" height="9" viewBox="0 0 9 9" fill="currentcolor" xmlns="http://www.w3.org/2000/svg" {...props} ref={forwardedRef}>
|
|
81
47
|
<path
|
|
82
48
|
fillRule="evenodd"
|
|
83
49
|
clipRule="evenodd"
|
|
@@ -90,28 +56,14 @@ ThickChevronRightIcon.displayName = 'ThickChevronRightIcon';
|
|
|
90
56
|
|
|
91
57
|
const ThickDotIcon = React.forwardRef<IconElement, IconProps>((props, forwardedRef) => {
|
|
92
58
|
return (
|
|
93
|
-
<svg
|
|
94
|
-
width="9"
|
|
95
|
-
height="9"
|
|
96
|
-
viewBox="0 0 9 9"
|
|
97
|
-
fill="currentcolor"
|
|
98
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
99
|
-
{...props}
|
|
100
|
-
ref={forwardedRef}
|
|
101
|
-
>
|
|
59
|
+
<svg width="9" height="9" viewBox="0 0 9 9" fill="currentcolor" xmlns="http://www.w3.org/2000/svg" {...props} ref={forwardedRef}>
|
|
102
60
|
<circle cx="4.5" cy="4.5" r="2" />
|
|
103
61
|
</svg>
|
|
104
62
|
);
|
|
105
63
|
});
|
|
106
64
|
ThickDotIcon.displayName = 'ThickDotIcon';
|
|
107
65
|
|
|
108
|
-
export {
|
|
109
|
-
ChevronDownIcon,
|
|
110
|
-
ThickCheckIcon,
|
|
111
|
-
ThickChevronRightIcon,
|
|
112
|
-
ThickDividerHorizontalIcon,
|
|
113
|
-
ThickDotIcon,
|
|
114
|
-
};
|
|
66
|
+
export { ChevronDownIcon, ThickCheckIcon, ThickChevronRightIcon, ThickDividerHorizontalIcon, ThickDotIcon };
|
|
115
67
|
export type { IconProps };
|
|
116
68
|
|
|
117
69
|
// Additional minimal icons
|
|
@@ -158,19 +110,9 @@ const PaperclipIcon = React.forwardRef<IconElement, IconProps>((props, forwarded
|
|
|
158
110
|
});
|
|
159
111
|
PaperclipIcon.displayName = 'PaperclipIcon';
|
|
160
112
|
|
|
161
|
-
const FileIcon = React.forwardRef<IconElement, IconProps>((
|
|
113
|
+
const FileIcon = React.forwardRef<IconElement, IconProps>((_props, _forwardedRef) => {
|
|
162
114
|
return (
|
|
163
|
-
<svg
|
|
164
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
165
|
-
width="24"
|
|
166
|
-
height="24"
|
|
167
|
-
viewBox="0 0 24 24"
|
|
168
|
-
fill="none"
|
|
169
|
-
stroke="currentColor"
|
|
170
|
-
strokeWidth="2"
|
|
171
|
-
strokeLinecap="round"
|
|
172
|
-
strokeLinejoin="round"
|
|
173
|
-
>
|
|
115
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
174
116
|
<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
|
|
175
117
|
<path d="M14 2v4a2 2 0 0 0 2 2h4" />
|
|
176
118
|
</svg>
|
|
@@ -180,17 +122,7 @@ FileIcon.displayName = 'FileIcon';
|
|
|
180
122
|
|
|
181
123
|
const FileTextIcon = React.forwardRef<IconElement, IconProps>((_props, _forwardedRef) => {
|
|
182
124
|
return (
|
|
183
|
-
<svg
|
|
184
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
185
|
-
width="24"
|
|
186
|
-
height="24"
|
|
187
|
-
viewBox="0 0 24 24"
|
|
188
|
-
fill="none"
|
|
189
|
-
stroke="currentColor"
|
|
190
|
-
strokeWidth="2"
|
|
191
|
-
strokeLinecap="round"
|
|
192
|
-
strokeLinejoin="round"
|
|
193
|
-
>
|
|
125
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
194
126
|
<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
|
|
195
127
|
<path d="M14 2v4a2 2 0 0 0 2 2h4" />
|
|
196
128
|
<path d="M10 9H8" />
|
|
@@ -23,15 +23,9 @@ import { z } from 'zod';
|
|
|
23
23
|
// Common types
|
|
24
24
|
const PaneModeSchema = z.enum(['expanded', 'collapsed']).describe('Pane state mode');
|
|
25
25
|
const SidebarModeSchema = z.enum(['collapsed', 'thin', 'expanded']).describe('Sidebar state mode');
|
|
26
|
-
const PresentationValueSchema = z
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const BreakpointSchema = z
|
|
30
|
-
.enum(['initial', 'xs', 'sm', 'md', 'lg', 'xl'])
|
|
31
|
-
.describe('Responsive breakpoint');
|
|
32
|
-
const PaneTargetSchema = z
|
|
33
|
-
.enum(['left', 'rail', 'panel', 'sidebar', 'inspector', 'bottom'])
|
|
34
|
-
.describe('Pane target');
|
|
26
|
+
const PresentationValueSchema = z.enum(['fixed', 'overlay', 'stacked']).describe('Presentation mode');
|
|
27
|
+
const _BreakpointSchema = z.enum(['initial', 'xs', 'sm', 'md', 'lg', 'xl']).describe('Responsive breakpoint');
|
|
28
|
+
const PaneTargetSchema = z.enum(['left', 'rail', 'panel', 'sidebar', 'inspector', 'bottom']).describe('Pane target');
|
|
35
29
|
const TriggerActionSchema = z.enum(['toggle', 'expand', 'collapse']).describe('Trigger action');
|
|
36
30
|
|
|
37
31
|
// Responsive schemas
|
|
@@ -184,10 +178,7 @@ export const ShellPanelSchema = PanePropsSchema.extend({
|
|
|
184
178
|
minSize: z.number().default(200).describe('Minimum width when resizing'),
|
|
185
179
|
maxSize: z.number().default(800).describe('Maximum width when resizing'),
|
|
186
180
|
resizable: z.boolean().default(false).describe('Whether the panel can be resized'),
|
|
187
|
-
collapsible: z
|
|
188
|
-
.boolean()
|
|
189
|
-
.default(true)
|
|
190
|
-
.describe('Whether the panel can be collapsed via resize handle'),
|
|
181
|
+
collapsible: z.boolean().default(true).describe('Whether the panel can be collapsed via resize handle'),
|
|
191
182
|
}).strict();
|
|
192
183
|
|
|
193
184
|
/**
|
|
@@ -202,10 +193,7 @@ export const ShellSidebarSchema = PanePropsSchema.extend({
|
|
|
202
193
|
thinSize: z.number().default(64).describe('Width in thin mode'),
|
|
203
194
|
toggleModes: z.enum(['both', 'single']).optional().describe('Available modes in toggle sequence'),
|
|
204
195
|
resizable: z.boolean().default(false).describe('Whether the sidebar can be resized'),
|
|
205
|
-
collapsible: z
|
|
206
|
-
.boolean()
|
|
207
|
-
.default(true)
|
|
208
|
-
.describe('Whether the sidebar can be collapsed via resize handle'),
|
|
196
|
+
collapsible: z.boolean().default(true).describe('Whether the sidebar can be collapsed via resize handle'),
|
|
209
197
|
}).strict();
|
|
210
198
|
|
|
211
199
|
/**
|
|
@@ -226,17 +214,12 @@ export const ShellContentSchema = z
|
|
|
226
214
|
* Shell.Inspector component schema
|
|
227
215
|
*/
|
|
228
216
|
export const ShellInspectorSchema = PanePropsSchema.extend({
|
|
229
|
-
presentation: ResponsivePresentationSchema.default({ initial: 'overlay', lg: 'fixed' }).describe(
|
|
230
|
-
'Presentation mode',
|
|
231
|
-
),
|
|
217
|
+
presentation: ResponsivePresentationSchema.default({ initial: 'overlay', lg: 'fixed' }).describe('Presentation mode'),
|
|
232
218
|
expandedSize: z.number().default(320).describe('Default width in pixels'),
|
|
233
219
|
minSize: z.number().default(200).describe('Minimum width when resizing'),
|
|
234
220
|
maxSize: z.number().default(500).describe('Maximum width when resizing'),
|
|
235
221
|
resizable: z.boolean().default(false).describe('Whether the inspector can be resized'),
|
|
236
|
-
collapsible: z
|
|
237
|
-
.boolean()
|
|
238
|
-
.default(true)
|
|
239
|
-
.describe('Whether the inspector can be collapsed via resize handle'),
|
|
222
|
+
collapsible: z.boolean().default(true).describe('Whether the inspector can be collapsed via resize handle'),
|
|
240
223
|
}).strict();
|
|
241
224
|
|
|
242
225
|
/**
|
|
@@ -248,10 +231,7 @@ export const ShellBottomSchema = PanePropsSchema.extend({
|
|
|
248
231
|
minSize: z.number().default(100).describe('Minimum height when resizing'),
|
|
249
232
|
maxSize: z.number().default(400).describe('Maximum height when resizing'),
|
|
250
233
|
resizable: z.boolean().default(false).describe('Whether the bottom panel can be resized'),
|
|
251
|
-
collapsible: z
|
|
252
|
-
.boolean()
|
|
253
|
-
.default(true)
|
|
254
|
-
.describe('Whether the bottom panel can be collapsed via resize handle'),
|
|
234
|
+
collapsible: z.boolean().default(true).describe('Whether the bottom panel can be collapsed via resize handle'),
|
|
255
235
|
}).strict();
|
|
256
236
|
|
|
257
237
|
/**
|
|
@@ -261,10 +241,7 @@ export const ShellTriggerSchema = z
|
|
|
261
241
|
.object({
|
|
262
242
|
target: PaneTargetSchema.describe('Which pane to control'),
|
|
263
243
|
action: TriggerActionSchema.default('toggle').describe('Action to perform'),
|
|
264
|
-
peekOnHover: z
|
|
265
|
-
.boolean()
|
|
266
|
-
.default(false)
|
|
267
|
-
.describe('Whether to show peek preview on hover when collapsed'),
|
|
244
|
+
peekOnHover: z.boolean().default(false).describe('Whether to show peek preview on hover when collapsed'),
|
|
268
245
|
className: z.string().optional().describe('Additional CSS class name'),
|
|
269
246
|
style: z
|
|
270
247
|
.record(z.string(), z.union([z.string(), z.number()]))
|
|
@@ -310,7 +287,7 @@ export type ShellHandleProps = z.infer<typeof ShellHandleSchema>;
|
|
|
310
287
|
export type PaneMode = z.infer<typeof PaneModeSchema>;
|
|
311
288
|
export type SidebarMode = z.infer<typeof SidebarModeSchema>;
|
|
312
289
|
export type PresentationValue = z.infer<typeof PresentationValueSchema>;
|
|
313
|
-
export type Breakpoint = z.infer<typeof
|
|
290
|
+
export type Breakpoint = z.infer<typeof _BreakpointSchema>;
|
|
314
291
|
export type PaneTarget = z.infer<typeof PaneTargetSchema>;
|
|
315
292
|
export type TriggerAction = z.infer<typeof TriggerActionSchema>;
|
|
316
293
|
export type ResponsiveMode = z.infer<typeof ResponsiveModeSchema>;
|