@fayz-ai/ui 0.19.0 → 0.22.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.
Files changed (63) hide show
  1. package/dist/{chunk-5NEADAIP.js → chunk-7G3O54CC.js} +140 -16
  2. package/dist/chunk-7G3O54CC.js.map +1 -0
  3. package/dist/{chunk-SB6DWHXI.js → chunk-DHNUZF2X.js} +10 -3
  4. package/dist/chunk-DHNUZF2X.js.map +1 -0
  5. package/dist/{chunk-6YFPPK7X.js → chunk-PQUS22JE.js} +146 -38
  6. package/dist/chunk-PQUS22JE.js.map +1 -0
  7. package/dist/{chunk-ERSX3C7T.js → chunk-SUSW4LSW.js} +37 -6
  8. package/dist/chunk-SUSW4LSW.js.map +1 -0
  9. package/dist/{chunk-5WSKZU7M.js → chunk-ZSOT7KTE.js} +85 -118
  10. package/dist/chunk-ZSOT7KTE.js.map +1 -0
  11. package/dist/dashboard/OnboardingWidget.d.ts +4 -1
  12. package/dist/dashboard/OnboardingWidget.d.ts.map +1 -1
  13. package/dist/dashboard/SidebarOnboarding.d.ts +11 -1
  14. package/dist/dashboard/SidebarOnboarding.d.ts.map +1 -1
  15. package/dist/dashboard/index.js +2 -2
  16. package/dist/icons.js +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +445 -87
  20. package/dist/index.js.map +1 -1
  21. package/dist/layout/AppShell.d.ts +3 -1
  22. package/dist/layout/AppShell.d.ts.map +1 -1
  23. package/dist/layout/ModulePage.d.ts +13 -0
  24. package/dist/layout/ModulePage.d.ts.map +1 -1
  25. package/dist/layout/SaveBar.d.ts.map +1 -1
  26. package/dist/layout/Sidebar.d.ts +7 -1
  27. package/dist/layout/Sidebar.d.ts.map +1 -1
  28. package/dist/layout/Takeover.d.ts +31 -0
  29. package/dist/layout/Takeover.d.ts.map +1 -0
  30. package/dist/layout/index.d.ts +1 -0
  31. package/dist/layout/index.d.ts.map +1 -1
  32. package/dist/layout/index.js +3 -3
  33. package/dist/primitives/header-tabs.d.ts +23 -1
  34. package/dist/primitives/header-tabs.d.ts.map +1 -1
  35. package/dist/primitives/index.js +3 -3
  36. package/dist/primitives/list-view.d.ts.map +1 -1
  37. package/dist/primitives/page-actions.d.ts.map +1 -1
  38. package/dist/primitives/refresh-button.d.ts.map +1 -1
  39. package/dist/primitives/row-actions.d.ts.map +1 -1
  40. package/dist/primitives/search-select.d.ts +3 -1
  41. package/dist/primitives/search-select.d.ts.map +1 -1
  42. package/dist/primitives/stock-entry-form.d.ts +4 -1
  43. package/dist/primitives/stock-entry-form.d.ts.map +1 -1
  44. package/dist/styles.css +99 -0
  45. package/dist/tour/PracticeOverlay.d.ts +12 -0
  46. package/dist/tour/PracticeOverlay.d.ts.map +1 -0
  47. package/dist/tour/TourSpotlight.d.ts.map +1 -1
  48. package/dist/tour/confetti.d.ts +17 -0
  49. package/dist/tour/confetti.d.ts.map +1 -0
  50. package/dist/tour/index.d.ts +3 -0
  51. package/dist/tour/index.d.ts.map +1 -1
  52. package/dist/tour/practice.store.d.ts +28 -0
  53. package/dist/tour/practice.store.d.ts.map +1 -0
  54. package/dist/tour/tour.store.d.ts +4 -0
  55. package/dist/tour/tour.store.d.ts.map +1 -1
  56. package/dist/tour/types.d.ts +17 -0
  57. package/dist/tour/types.d.ts.map +1 -1
  58. package/package.json +2 -2
  59. package/dist/chunk-5NEADAIP.js.map +0 -1
  60. package/dist/chunk-5WSKZU7M.js.map +0 -1
  61. package/dist/chunk-6YFPPK7X.js.map +0 -1
  62. package/dist/chunk-ERSX3C7T.js.map +0 -1
  63. package/dist/chunk-SB6DWHXI.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { useHasPageHeaderHost, usePageHeader, PageTitlePortal, useLayoutStore, useHasPageHeaderBack, useRegisterPageActions, usePageHeaderClaimed, usePageTitleSlotHost, useHasPageHeaderOutlet, useHasPageActions, usePageHeaderHost } from './chunk-HKGTF2YA.js';
2
2
  import { cn } from './chunk-OKZ6WQB3.js';
3
- import { ICON_MAP } from './chunk-SB6DWHXI.js';
3
+ import { ICON_MAP } from './chunk-DHNUZF2X.js';
4
4
  import * as React2 from 'react';
5
5
  import * as DialogPrimitive from '@radix-ui/react-dialog';
6
6
  import { X, Loader2, ArrowLeft, Search, Bell, PanelLeft, PanelLeftClose, Menu, Crown, ChevronDown, ChevronRight, ChevronLeft, ExternalLink, CreditCard, Sparkles, Home, Plus, UserCog, Settings, LogOut } from 'lucide-react';
@@ -264,6 +264,7 @@ function SaveBar({ className }) {
264
264
  "button",
265
265
  {
266
266
  type: "button",
267
+ "data-tour": "savebar.discard",
267
268
  disabled: saving,
268
269
  onClick: () => api.handlers.current.onDiscard?.(),
269
270
  className: "rounded-full px-3 py-1.5 text-sm font-medium text-background/70 transition-colors hover:bg-background/10 hover:text-background disabled:opacity-50",
@@ -274,6 +275,7 @@ function SaveBar({ className }) {
274
275
  "button",
275
276
  {
276
277
  type: "button",
278
+ "data-tour": "savebar.save",
277
279
  disabled: saving,
278
280
  onClick: () => api.handlers.current.onSave?.(),
279
281
  className: "inline-flex items-center rounded-full bg-background px-4 py-1.5 text-sm font-semibold text-foreground transition-colors hover:bg-background/90 disabled:opacity-60",
@@ -742,7 +744,13 @@ function NavGroup({
742
744
  childExternal && /* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50", "aria-hidden": true }),
743
745
  child.premium && /* @__PURE__ */ jsx(Crown, { className: "h-3 w-3 shrink-0 text-amber-500", "aria-hidden": true })
744
746
  ] });
745
- const row = childExternal ? /* @__PURE__ */ jsx("a", { href: child.href, target: "_blank", rel: "noopener noreferrer", className: childClass, children: childInner }) : /* @__PURE__ */ jsx("button", { onClick: () => onNavigate(child.route), className: childClass, children: childInner });
747
+ const row = childExternal ? /* @__PURE__ */ jsx("a", { href: child.href, target: "_blank", rel: "noopener noreferrer", className: childClass, children: childInner }) : (
748
+ // `nav.<route>` on group children too, matching the top-level rows
749
+ // above — without it a guided tour cannot point at "Cardápio",
750
+ // "Reservas" or any other row that lives under a group (the normal
751
+ // case in an app that groups its rail).
752
+ /* @__PURE__ */ jsx("button", { "data-tour": `nav.${child.route}`, onClick: () => onNavigate(child.route), className: childClass, children: childInner })
753
+ );
746
754
  if (!childConnector) return /* @__PURE__ */ jsx(React2.Fragment, { children: row }, child.id);
747
755
  const activeIndex = item.children.findIndex((c) => c.route === activeRoute);
748
756
  const onPath = activeIndex >= 0 && childIndex < activeIndex;
@@ -821,6 +829,7 @@ function Sidebar({
821
829
  topContent,
822
830
  identity,
823
831
  navTop,
832
+ beforeNav,
824
833
  footerContent,
825
834
  borderless,
826
835
  userMenuSlot,
@@ -995,6 +1004,7 @@ function Sidebar({
995
1004
  }
996
1005
  ) })
997
1006
  ),
1007
+ beforeNav && /* @__PURE__ */ jsx("div", { className: cn("px-2 pb-1 empty:hidden", collapsed && "flex justify-center"), children: withCollapsed(beforeNav, collapsed) }),
998
1008
  /* @__PURE__ */ jsxs(
999
1009
  "nav",
1000
1010
  {
@@ -1390,6 +1400,7 @@ function SidebarLayout({
1390
1400
  sidebarTopContent,
1391
1401
  sidebarIdentity,
1392
1402
  sidebarNavTop,
1403
+ sidebarBeforeNav,
1393
1404
  sidebarFooterContent,
1394
1405
  frame,
1395
1406
  immersive,
@@ -1448,6 +1459,7 @@ function SidebarLayout({
1448
1459
  topContent: sidebarTopContent,
1449
1460
  identity: sidebarIdentity,
1450
1461
  navTop: sidebarNavTop,
1462
+ beforeNav: sidebarBeforeNav,
1451
1463
  footerContent: sidebarFooterContent,
1452
1464
  borderless: frame,
1453
1465
  userMenuSlot,
@@ -1527,6 +1539,7 @@ function SidebarLayout({
1527
1539
  topContent: sidebarTopContent,
1528
1540
  identity: sidebarIdentity,
1529
1541
  navTop: sidebarNavTop,
1542
+ beforeNav: sidebarBeforeNav,
1530
1543
  footerContent: sidebarFooterContent,
1531
1544
  userMenuSlot,
1532
1545
  notificationSlot,
@@ -1855,6 +1868,7 @@ function AppShell({
1855
1868
  sidebarTopContent,
1856
1869
  sidebarIdentity,
1857
1870
  sidebarNavTop,
1871
+ sidebarBeforeNav,
1858
1872
  sidebarFooterContent,
1859
1873
  bottomNav,
1860
1874
  onBottomNavAction,
@@ -1922,6 +1936,7 @@ function AppShell({
1922
1936
  sidebarTopContent,
1923
1937
  sidebarIdentity,
1924
1938
  sidebarNavTop,
1939
+ sidebarBeforeNav,
1925
1940
  sidebarFooterContent,
1926
1941
  frame: contentFrame,
1927
1942
  immersive,
@@ -2131,6 +2146,7 @@ function HeaderTabs({
2131
2146
  onChange,
2132
2147
  className,
2133
2148
  fill,
2149
+ anchorPrefix,
2134
2150
  ...rest
2135
2151
  }) {
2136
2152
  return /* @__PURE__ */ jsx(
@@ -2146,33 +2162,56 @@ function HeaderTabs({
2146
2162
  children: tabs.map((tab) => {
2147
2163
  const active = tab.value === value;
2148
2164
  const Icon = tab.icon;
2149
- return /* @__PURE__ */ jsxs(
2150
- "button",
2151
- {
2152
- type: "button",
2153
- role: "tab",
2154
- "aria-selected": active,
2155
- onClick: () => onChange(tab.value),
2156
- className: cn(
2157
- "relative flex shrink-0 items-center gap-1.5 whitespace-nowrap text-sm transition-colors",
2158
- // Filled: the row owns the band's height and the underline sits on
2159
- // its bottom edge. Otherwise the underline trails the label by 6px.
2160
- fill ? "h-full" : "pb-1.5",
2161
- active ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground"
2162
- ),
2163
- children: [
2164
- Icon ? /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 shrink-0" }) : null,
2165
- /* @__PURE__ */ jsx("span", { children: tab.label }),
2166
- tab.count != null && /* @__PURE__ */ jsx("span", { className: cn(
2167
- "ml-0.5 rounded-full px-1.5 text-[11px] tabular-nums",
2168
- active ? "bg-muted text-foreground" : "bg-muted/70 text-muted-foreground"
2169
- ), children: tab.count }),
2170
- tab.badge,
2171
- active && /* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-foreground" })
2172
- ]
2173
- },
2174
- tab.value
2165
+ const box = cn(
2166
+ "relative flex shrink-0 items-center gap-1.5 whitespace-nowrap text-sm transition-colors",
2167
+ fill ? "h-full" : "pb-1.5",
2168
+ active ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground",
2169
+ tab.dim && "opacity-50 hover:opacity-100"
2175
2170
  );
2171
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
2172
+ Icon ? /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 shrink-0" }) : null,
2173
+ /* @__PURE__ */ jsx("span", { children: tab.label }),
2174
+ tab.count != null && /* @__PURE__ */ jsx("span", { className: cn(
2175
+ "ml-0.5 rounded-full px-1.5 text-[11px] tabular-nums",
2176
+ active ? "bg-muted text-foreground" : "bg-muted/70 text-muted-foreground"
2177
+ ), children: tab.count }),
2178
+ tab.badge
2179
+ ] });
2180
+ const underline = active ? /* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-foreground" }) : null;
2181
+ if (!tab.trailing) {
2182
+ return /* @__PURE__ */ jsxs(
2183
+ "button",
2184
+ {
2185
+ type: "button",
2186
+ role: "tab",
2187
+ "aria-selected": active,
2188
+ "data-tour": anchorPrefix ? `${anchorPrefix}.${tab.value}` : void 0,
2189
+ onClick: () => onChange(tab.value),
2190
+ className: box,
2191
+ children: [
2192
+ inner,
2193
+ underline
2194
+ ]
2195
+ },
2196
+ tab.value
2197
+ );
2198
+ }
2199
+ return /* @__PURE__ */ jsxs("div", { className: box, children: [
2200
+ /* @__PURE__ */ jsx(
2201
+ "button",
2202
+ {
2203
+ type: "button",
2204
+ role: "tab",
2205
+ "aria-selected": active,
2206
+ "data-tour": anchorPrefix ? `${anchorPrefix}.${tab.value}` : void 0,
2207
+ onClick: () => onChange(tab.value),
2208
+ className: "flex items-center gap-1.5 whitespace-nowrap",
2209
+ children: inner
2210
+ }
2211
+ ),
2212
+ tab.trailing,
2213
+ underline
2214
+ ] }, tab.value);
2176
2215
  })
2177
2216
  }
2178
2217
  );
@@ -2187,11 +2226,56 @@ function PageTabs({ actions, className, ...props }) {
2187
2226
  ),
2188
2227
  children: [
2189
2228
  /* @__PURE__ */ jsx(HeaderTabs, { ...props, className: "-mb-px" }),
2190
- actions && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2 pb-1.5", children: actions })
2229
+ actions && /* @__PURE__ */ jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2 pb-1.5", children: actions })
2191
2230
  ]
2192
2231
  }
2193
2232
  );
2194
2233
  }
2234
+ var SIZE = {
2235
+ sm: { container: "h-[26px]", segment: "px-2.5 text-xs" },
2236
+ md: { container: "h-[30px]", segment: "px-3 text-sm" }
2237
+ };
2238
+ function SegmentedControl({
2239
+ options,
2240
+ value,
2241
+ onChange,
2242
+ size = "sm",
2243
+ className,
2244
+ ...rest
2245
+ }) {
2246
+ const items = options.map((o) => typeof o === "string" ? { value: o, label: o } : o);
2247
+ return /* @__PURE__ */ jsx(
2248
+ "div",
2249
+ {
2250
+ role: "tablist",
2251
+ "aria-label": rest["aria-label"],
2252
+ className: cn(
2253
+ "inline-flex items-center rounded-button border border-border bg-card p-0.5 shadow-button",
2254
+ SIZE[size].container,
2255
+ className
2256
+ ),
2257
+ children: items.map((item) => {
2258
+ const active = item.value === value;
2259
+ return /* @__PURE__ */ jsx(
2260
+ "button",
2261
+ {
2262
+ type: "button",
2263
+ role: "tab",
2264
+ "aria-selected": active,
2265
+ onClick: () => onChange(item.value),
2266
+ className: cn(
2267
+ "flex h-full items-center rounded-button font-semibold transition-colors",
2268
+ SIZE[size].segment,
2269
+ active ? "bg-foreground text-background" : "text-muted-foreground hover:bg-muted/60"
2270
+ ),
2271
+ children: item.label
2272
+ },
2273
+ item.value
2274
+ );
2275
+ })
2276
+ }
2277
+ );
2278
+ }
2195
2279
  var NavTransitionContext = React2.createContext("slide");
2196
2280
  function NavTransitionProvider({ value, children }) {
2197
2281
  return /* @__PURE__ */ jsx(NavTransitionContext.Provider, { value, children });
@@ -2250,6 +2334,7 @@ function RailNavItem({ item }) {
2250
2334
  "button",
2251
2335
  {
2252
2336
  type: "button",
2337
+ "data-tour": `modnav.${item.id}`,
2253
2338
  onClick: () => hasChildren ? setExpanded(!expanded) : item.onClick?.(),
2254
2339
  className: cn(
2255
2340
  "flex items-center gap-2 w-full rounded-md px-2.5 py-1.5 text-sm transition-colors",
@@ -2267,6 +2352,7 @@ function RailNavItem({ item }) {
2267
2352
  "button",
2268
2353
  {
2269
2354
  type: "button",
2355
+ "data-tour": `modnav.${child.id}`,
2270
2356
  onClick: child.onClick,
2271
2357
  className: cn(
2272
2358
  "flex items-center w-full rounded-md px-2.5 py-1 text-xs transition-colors",
@@ -2282,7 +2368,7 @@ function RailNavItem({ item }) {
2282
2368
  ] });
2283
2369
  }
2284
2370
  function defaultChildOf(item) {
2285
- const kids = item.children ?? [];
2371
+ const kids = (item.children ?? []).filter((c) => c.kind !== "action");
2286
2372
  return kids.find((c) => c.defaultChild) ?? kids.find((c) => /(^|-)list$/i.test(c.id)) ?? kids.find((c) => !/(^|-)(new|novo|nova|create)$/i.test(c.id)) ?? kids[0];
2287
2373
  }
2288
2374
  function MobileTabs({ nav }) {
@@ -2337,8 +2423,9 @@ function MobileTabs({ nav }) {
2337
2423
  }) }),
2338
2424
  expandedId && (() => {
2339
2425
  const item = nav.find((n) => n.id === expandedId);
2340
- if (!item?.children) return null;
2341
- return /* @__PURE__ */ jsx("div", { className: "flex gap-1 px-2 pb-2 animate-in fade-in-0 slide-in-from-top-1", children: item.children.map((child) => /* @__PURE__ */ jsxs(
2426
+ const shown = (item?.children ?? []).filter((c) => c.kind !== "action");
2427
+ if (shown.length < 2) return null;
2428
+ return /* @__PURE__ */ jsx("div", { className: "flex gap-1 px-2 pb-2 animate-in fade-in-0 slide-in-from-top-1", children: shown.map((child) => /* @__PURE__ */ jsxs(
2342
2429
  "button",
2343
2430
  {
2344
2431
  type: "button",
@@ -2470,8 +2557,8 @@ function ShellSubpageHeader({
2470
2557
  }
2471
2558
  function ModuleHeader({ nav }) {
2472
2559
  function defaultChild(item) {
2473
- const kids = item.children ?? [];
2474
- return kids.find((c) => /list/i.test(c.id) || /^list$/i.test(c.label)) ?? kids[kids.length - 1];
2560
+ const kids2 = (item.children ?? []).filter((c) => c.kind !== "action");
2561
+ return kids2.find((c) => /list/i.test(c.id) || /^list$/i.test(c.label)) ?? kids2[kids2.length - 1];
2475
2562
  }
2476
2563
  const activeItem = nav.find((item) => item.active || item.children?.some((c) => c.active));
2477
2564
  const tabs = nav.map((item) => ({
@@ -2489,7 +2576,28 @@ function ModuleHeader({ nav }) {
2489
2576
  if (hasChildren) defaultChild(item)?.onClick?.();
2490
2577
  else item.onClick?.();
2491
2578
  };
2492
- return /* @__PURE__ */ jsx(PageTabs, { tabs, value: activeItem?.id ?? nav[0]?.id ?? "", onChange });
2579
+ const kids = (activeItem?.children ?? []).filter((c) => c.kind !== "action");
2580
+ const activeKid = kids.find((c) => c.active)?.id ?? kids[0]?.id;
2581
+ const childControl = kids.length > 1 ? /* @__PURE__ */ jsx(
2582
+ SegmentedControl,
2583
+ {
2584
+ size: "sm",
2585
+ "aria-label": activeItem?.label,
2586
+ options: kids.map((c) => ({ value: c.id, label: c.label })),
2587
+ value: activeKid ?? "",
2588
+ onChange: (id) => kids.find((c) => c.id === id)?.onClick?.()
2589
+ }
2590
+ ) : void 0;
2591
+ return /* @__PURE__ */ jsx(
2592
+ PageTabs,
2593
+ {
2594
+ tabs,
2595
+ value: activeItem?.id ?? nav[0]?.id ?? "",
2596
+ onChange,
2597
+ actions: childControl,
2598
+ anchorPrefix: "modnav"
2599
+ }
2600
+ );
2493
2601
  }
2494
2602
  function ModulePage({ title: _title, subtitle, nav, children, className, headerAction, showHeader = true, sidebarFooter, navVariant, viewKey, direction }) {
2495
2603
  const ctxVariant = useModuleLayout();
@@ -2522,6 +2630,6 @@ function ModulePage({ title: _title, subtitle, nav, children, className, headerA
2522
2630
  ] });
2523
2631
  }
2524
2632
 
2525
- export { AppShell, BackStyleProvider, HeaderTabs, ModuleLayoutProvider, ModulePage, NavTransitionProvider, PageHeader, PageHeaderActions, PageHeaderCrumb, PageRail, PageTabs, PageTransition, RailNavItem, SaveBar, SaveBarProvider, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SubpageHeader, Topbar, bottomNavReachesAll, useBackHandler, useBackStyle, useCrossModuleBack, useModuleHeaderActionsSlot, useModuleHeaderSlot, useModuleLayout, useNavTransition, useRailRow, useSaveBar, useSaveBarVisible };
2526
- //# sourceMappingURL=chunk-6YFPPK7X.js.map
2527
- //# sourceMappingURL=chunk-6YFPPK7X.js.map
2633
+ export { AppShell, BackStyleProvider, HeaderTabs, ModuleLayoutProvider, ModulePage, NavTransitionProvider, PageHeader, PageHeaderActions, PageHeaderCrumb, PageRail, PageTabs, PageTransition, RailNavItem, SaveBar, SaveBarProvider, SegmentedControl, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SubpageHeader, Topbar, bottomNavReachesAll, useBackHandler, useBackStyle, useCrossModuleBack, useModuleHeaderActionsSlot, useModuleHeaderSlot, useModuleLayout, useNavTransition, useRailRow, useSaveBar, useSaveBarVisible };
2634
+ //# sourceMappingURL=chunk-PQUS22JE.js.map
2635
+ //# sourceMappingURL=chunk-PQUS22JE.js.map