@motor-hero/ui-kit 0.48.0 → 0.49.0

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/index.js CHANGED
@@ -261,6 +261,8 @@ function AppShell({
261
261
  defaultCollapsed = false,
262
262
  sidebarFooter,
263
263
  banner,
264
+ sidebarClassName,
265
+ headerClassName,
264
266
  children
265
267
  }) {
266
268
  const [collapsed, setCollapsed] = useState3(defaultCollapsed);
@@ -281,18 +283,21 @@ function AppShell({
281
283
  /* @__PURE__ */ jsxs3(
282
284
  "aside",
283
285
  {
286
+ "data-slot": "sidebar",
284
287
  className: cn(
285
288
  "hidden shrink-0 flex-col border-r bg-card transition-all duration-300 md:flex",
286
- collapsed ? "w-16" : "w-60"
289
+ collapsed ? "w-16" : "w-60",
290
+ sidebarClassName
287
291
  ),
288
292
  children: [
289
- /* @__PURE__ */ jsx4("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: collapsed ? brandCollapsed ?? brand : brand }),
290
- /* @__PURE__ */ jsx4("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(collapsed) }),
291
- sidebarFooter && /* @__PURE__ */ jsx4("div", { className: "border-t px-3 py-2", "data-slot": "sidebar-footer", children: typeof sidebarFooter === "function" ? sidebarFooter(collapsed) : sidebarFooter }),
292
- collapsible && /* @__PURE__ */ jsx4("div", { className: "border-t p-2", children: /* @__PURE__ */ jsx4(
293
+ /* @__PURE__ */ jsx4("div", { className: "flex h-14 shrink-0 items-center border-b border-inherit px-4", "data-slot": "sidebar-brand", children: collapsed ? brandCollapsed ?? brand : brand }),
294
+ /* @__PURE__ */ jsx4("div", { className: "flex-1 overflow-y-auto px-2 py-4", "data-slot": "sidebar-content", children: nav(collapsed) }),
295
+ sidebarFooter && /* @__PURE__ */ jsx4("div", { className: "border-t border-inherit px-3 py-2", "data-slot": "sidebar-footer", children: typeof sidebarFooter === "function" ? sidebarFooter(collapsed) : sidebarFooter }),
296
+ collapsible && /* @__PURE__ */ jsx4("div", { className: "border-t border-inherit p-2", children: /* @__PURE__ */ jsx4(
293
297
  "button",
294
298
  {
295
299
  type: "button",
300
+ "data-slot": "sidebar-toggle",
296
301
  onClick: () => setCollapsed((v) => !v),
297
302
  className: "flex w-full items-center justify-center rounded-md px-2 py-2 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
298
303
  "aria-label": collapsed ? "Expandir menu" : "Recolher menu",
@@ -315,14 +320,16 @@ function AppShell({
315
320
  /* @__PURE__ */ jsxs3(
316
321
  "div",
317
322
  {
323
+ "data-slot": "sidebar-drawer",
318
324
  className: cn(
319
325
  "absolute left-0 top-0 flex h-full w-64 flex-col border-r bg-card transition-transform duration-300",
320
- mobileOpen ? "translate-x-0" : "-translate-x-full"
326
+ mobileOpen ? "translate-x-0" : "-translate-x-full",
327
+ sidebarClassName
321
328
  ),
322
329
  onClick: (e) => e.stopPropagation(),
323
330
  children: [
324
- /* @__PURE__ */ jsx4("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: brand }),
325
- /* @__PURE__ */ jsx4("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(false, () => setMobileOpen(false)) })
331
+ /* @__PURE__ */ jsx4("div", { className: "flex h-14 shrink-0 items-center border-b border-inherit px-4", "data-slot": "sidebar-brand", children: brand }),
332
+ /* @__PURE__ */ jsx4("div", { className: "flex-1 overflow-y-auto px-2 py-4", "data-slot": "sidebar-content", children: nav(false, () => setMobileOpen(false)) })
326
333
  ]
327
334
  }
328
335
  )
@@ -331,22 +338,29 @@ function AppShell({
331
338
  ),
332
339
  /* @__PURE__ */ jsxs3("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
333
340
  banner,
334
- /* @__PURE__ */ jsxs3("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4", children: [
335
- /* @__PURE__ */ jsx4(
336
- "button",
337
- {
338
- type: "button",
339
- onClick: () => setMobileOpen(true),
340
- className: "inline-flex h-9 w-9 max-sm:h-10 max-sm:w-10 items-center justify-center rounded-md border border-input bg-background shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground md:hidden",
341
- "aria-label": "Abrir menu",
342
- children: /* @__PURE__ */ jsx4(Menu, { className: "h-4 w-4" })
343
- }
344
- ),
345
- /* @__PURE__ */ jsxs3("div", { className: "ml-auto flex items-center gap-2", children: [
346
- headerActions,
347
- (user || onLogout) && /* @__PURE__ */ jsx4(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
348
- ] })
349
- ] }),
341
+ /* @__PURE__ */ jsxs3(
342
+ "header",
343
+ {
344
+ "data-slot": "header",
345
+ className: cn("flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4", headerClassName),
346
+ children: [
347
+ /* @__PURE__ */ jsx4(
348
+ "button",
349
+ {
350
+ type: "button",
351
+ onClick: () => setMobileOpen(true),
352
+ className: "inline-flex h-9 w-9 max-sm:h-10 max-sm:w-10 items-center justify-center rounded-md border border-input bg-background shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground md:hidden",
353
+ "aria-label": "Abrir menu",
354
+ children: /* @__PURE__ */ jsx4(Menu, { className: "h-4 w-4" })
355
+ }
356
+ ),
357
+ /* @__PURE__ */ jsxs3("div", { className: "ml-auto flex items-center gap-2", children: [
358
+ headerActions,
359
+ (user || onLogout) && /* @__PURE__ */ jsx4(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
360
+ ] })
361
+ ]
362
+ }
363
+ ),
350
364
  /* @__PURE__ */ jsx4("main", { className: "flex-1 overflow-y-auto", children })
351
365
  ] })
352
366
  ] });
@@ -748,7 +762,10 @@ function Combobox({
748
762
  const selected = fromPage ?? (value ? labelCache.current.get(value) : void 0) ?? (creatable && value ? { value, label: value } : void 0);
749
763
  const handleOpenChange = (next) => {
750
764
  setOpen(next);
751
- if (!next) setSearch("");
765
+ if (!next) {
766
+ setSearch("");
767
+ onSearchChange?.("");
768
+ }
752
769
  };
753
770
  const handleSelect = (next) => {
754
771
  onChange(deselectable && next === value ? "" : next);
@@ -1789,6 +1806,10 @@ function MultiCombobox({
1789
1806
  const [open, setOpen] = React8.useState(false);
1790
1807
  const isDesktop = useIsDesktop();
1791
1808
  const isServer = onSearchChange !== void 0;
1809
+ const handleOpenChange = (next) => {
1810
+ setOpen(next);
1811
+ if (!next) onSearchChange?.("");
1812
+ };
1792
1813
  const labelCache = React8.useRef(/* @__PURE__ */ new Map());
1793
1814
  const byValue = /* @__PURE__ */ new Map();
1794
1815
  for (const option of options) byValue.set(option.value, option);
@@ -1917,7 +1938,7 @@ function MultiCombobox({
1917
1938
  }
1918
1939
  );
1919
1940
  if (isDesktop) {
1920
- return /* @__PURE__ */ jsxs17(PopoverPrimitive5.Root, { open, onOpenChange: setOpen, children: [
1941
+ return /* @__PURE__ */ jsxs17(PopoverPrimitive5.Root, { open, onOpenChange: handleOpenChange, children: [
1921
1942
  /* @__PURE__ */ jsx21(PopoverPrimitive5.Trigger, { asChild: true, disabled, children: trigger }),
1922
1943
  /* @__PURE__ */ jsx21(PopoverPrimitive5.Portal, { children: /* @__PURE__ */ jsx21(
1923
1944
  PopoverPrimitive5.Content,
@@ -1931,7 +1952,7 @@ function MultiCombobox({
1931
1952
  ) })
1932
1953
  ] });
1933
1954
  }
1934
- return /* @__PURE__ */ jsxs17(DrawerPrimitive5.Root, { open, onOpenChange: setOpen, children: [
1955
+ return /* @__PURE__ */ jsxs17(DrawerPrimitive5.Root, { open, onOpenChange: handleOpenChange, children: [
1935
1956
  /* @__PURE__ */ jsx21(DrawerPrimitive5.Trigger, { asChild: true, disabled, children: trigger }),
1936
1957
  /* @__PURE__ */ jsxs17(DrawerPrimitive5.Portal, { children: [
1937
1958
  /* @__PURE__ */ jsx21(DrawerPrimitive5.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),