@admin-layout/tailwind-ui 12.2.5-alpha.2 → 12.2.5-alpha.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"InputToolBar.d.ts","sourceRoot":"","sources":["../../../src/components/InputToolBar/InputToolBar.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAER,iBAAiB,EAQpB,MAAM,SAAS,CAAC;AAqhBjB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,cAAc,EAC1B,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,gBAAgB,GACnB,EAAE,iBAAiB,2CAwFnB;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"InputToolBar.d.ts","sourceRoot":"","sources":["../../../src/components/InputToolBar/InputToolBar.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAER,iBAAiB,EAQpB,MAAM,SAAS,CAAC;AA4jBjB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,cAAc,EAC1B,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,gBAAgB,GACnB,EAAE,iBAAiB,2CAwFnB;AAED,eAAe,YAAY,CAAC"}
@@ -1,4 +1,4 @@
1
- import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Lightbulb,Zap,Search,Mic,Paperclip,Image,Camera,WandSparkles,Settings,X,Layout,Check,Plus,ArrowUpRight,StopCircle}from'lucide-react';import React__default,{useState,useMemo}from'react';import'../../utils/isBrowser/index.js';import {cn}from'../../utils/util.js';import'fast-deep-equal/react.js';const iconSize = 'h-3.5 w-3.5';
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Lightbulb,Zap,Search,Mic,Paperclip,Image,Camera,WandSparkles,Settings,X,Layout,Check,Plus,ArrowUpRight,StopCircle}from'lucide-react';import React__default,{useState,useMemo,useRef,useEffect,useLayoutEffect}from'react';import'../../utils/isBrowser/index.js';import {cn}from'../../utils/util.js';import'fast-deep-equal/react.js';const iconSize = 'h-3.5 w-3.5';
2
2
  const iconSizeRight = 'h-4 w-4';
3
3
  const defaultLeftIconMap = {
4
4
  search: jsx(Search, {
@@ -237,13 +237,37 @@ function TemplatePill({
237
237
  });
238
238
  }
239
239
  const getRightIcon = id => defaultRightIconMap[id] ?? null;
240
- /** Below `lg`, the right action cluster collapses into this "+" button → popover. Send/mic stays inline. */
240
+ // Layout effects warn during SSR on React 18; the menu is closed on the server anyway.
241
+ const useClientLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
242
+ /** Gap between the "+" button and its menu (Tailwind `mb-2` / `mt-2`). */
243
+ const MENU_GAP_PX = 8;
244
+ /**
245
+ * Below `lg`, the right action cluster collapses into this "+" button → popover. Send/mic stays inline.
246
+ *
247
+ * The menu opens upward, over the conversation, since the composer normally docks at the bottom.
248
+ * When the composer sits near the top of the screen instead (e.g. a template gallery below it),
249
+ * there is no room above, so it flips below the button. Placement is measured before paint.
250
+ */
241
251
  function RightOverflowMenu({
242
252
  items,
243
253
  classNames
244
254
  }) {
245
255
  const [open, setOpen] = useState(false);
256
+ const [placement, setPlacement] = useState('above');
257
+ const rootRef = useRef(null);
258
+ const menuRef = useRef(null);
259
+ useClientLayoutEffect(() => {
260
+ if (!open) return;
261
+ const trigger = rootRef.current?.getBoundingClientRect();
262
+ const menuHeight = menuRef.current?.offsetHeight;
263
+ if (!trigger || !menuHeight) return;
264
+ const spaceAbove = trigger.top;
265
+ const spaceBelow = window.innerHeight - trigger.bottom;
266
+ const fitsAbove = spaceAbove >= menuHeight + MENU_GAP_PX;
267
+ setPlacement(fitsAbove || spaceAbove >= spaceBelow ? 'above' : 'below');
268
+ }, [open]);
246
269
  return jsxs("div", {
270
+ ref: rootRef,
247
271
  className: "relative",
248
272
  children: [jsx("button", {
249
273
  type: "button",
@@ -263,15 +287,24 @@ function RightOverflowMenu({
263
287
  className: "fixed inset-0 z-40 cursor-default",
264
288
  onClick: () => setOpen(false)
265
289
  }), jsx("div", {
290
+ ref: menuRef,
266
291
  role: "menu",
267
- className: "absolute bottom-full right-0 z-50 mb-2 flex w-56 flex-col gap-0.5 rounded-2xl border border-border bg-card p-1.5 text-foreground shadow-lg",
292
+ className: cn('absolute right-0 z-50 flex w-56 flex-col gap-0.5 rounded-2xl border border-border bg-card p-1.5 text-foreground shadow-lg', placement === 'above' ? 'bottom-full mb-2' : 'top-full mt-2'),
268
293
  children: items.map(item => jsxs("div", {
269
294
  role: "menuitem",
270
- // ponytail: row click forwards to the inner button so the whole row is a hit
271
- // target — without nesting <button> in <button> (customButton items render their own).
272
295
  onClick: e => {
273
- if (e.target.closest('button')) return;
274
- e.currentTarget.querySelector('button')?.click();
296
+ // React bubbles events out of a portal along the COMPONENT tree, so a
297
+ // click inside a dialog or sheet that a customButton portaled out still
298
+ // arrives here. It is not a click on this row: ignore it.
299
+ if (!e.currentTarget.contains(e.target)) return;
300
+ // ponytail: row click forwards to the inner button so the whole row is a hit
301
+ // target — without nesting <button> in <button> (customButton items render their own).
302
+ if (!e.target.closest('button')) {
303
+ e.currentTarget.querySelector('button')?.click();
304
+ }
305
+ // A plain action is done once picked. A customButton owns whatever it opens
306
+ // (a dialog, a sheet); closing the menu would unmount it, so it stays.
307
+ if (!item.customButton && !item.disabled && !item.loading) setOpen(false);
275
308
  },
276
309
  className: "flex cursor-pointer items-center gap-2.5 rounded-xl px-1.5 py-1 hover:bg-secondary/60",
277
310
  children: [jsx(ToolbarIconButton, {
@@ -1 +1 @@
1
- {"version":3,"file":"InputToolBar.js","sources":["../../../src/components/InputToolBar/InputToolBar.tsx"],"sourcesContent":[null],"names":[],"mappings":"gWAqjBG,MAAA,QAAA,GAAA,aAAA;AACH,MAAA,aAAA,GAAA;AA4GA,MAAA,qBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"InputToolBar.js","sources":["../../../src/components/InputToolBar/InputToolBar.tsx"],"sourcesContent":[null],"names":[],"mappings":"iYA4lBG,MAAA,QAAA,GAAA,aAAA;AACH,MAAA,aAAA,GAAA;AA4GA,MAAA,qBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The "+" overflow menu that holds the right-hand actions below `lg`. It opens above the button
3
+ * unless there is no room there (a composer near the top of the screen), closes once a plain
4
+ * action is picked, keeps custom buttons (which own their own dialogs) mounted, and ignores
5
+ * clicks that React bubbles out of a customButton's portal.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=RightOverflowMenu.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RightOverflowMenu.test.d.ts","sourceRoot":"","sources":["../../../../src/components/InputToolBar/__tests__/RightOverflowMenu.test.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/tailwind-ui",
3
- "version": "12.2.5-alpha.2",
3
+ "version": "12.2.5-alpha.5",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -111,5 +111,5 @@
111
111
  "typescript": {
112
112
  "definition": "lib/index.d.ts"
113
113
  },
114
- "gitHead": "5ccfbf6ff024031ed38926197c3aef7b3f4dc8ee"
114
+ "gitHead": "0c32922aae5711a5f01e978fda3b10ea6494328a"
115
115
  }