@motor-hero/ui-kit 0.49.0 → 0.50.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
@@ -1984,6 +1984,7 @@ function PageHeader({ title, description, action, className }) {
1984
1984
  }
1985
1985
 
1986
1986
  // src/components/pagination.tsx
1987
+ import { useId as useId2, useState as useState11 } from "react";
1987
1988
  import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
1988
1989
  var navButtonClass2 = "inline-flex h-8 max-sm:h-10 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground cursor-pointer disabled:pointer-events-none disabled:opacity-50";
1989
1990
  function Pagination({
@@ -1992,6 +1993,7 @@ function Pagination({
1992
1993
  hasNextPage,
1993
1994
  hasPreviousPage,
1994
1995
  totalPages,
1996
+ showPageJump = false,
1995
1997
  showPageSizeSelector = false,
1996
1998
  pageSize,
1997
1999
  onPageSizeChange,
@@ -2027,7 +2029,7 @@ function Pagination({
2027
2029
  children: "Anterior"
2028
2030
  }
2029
2031
  ),
2030
- /* @__PURE__ */ jsxs19("span", { className: "text-sm text-muted-foreground", children: [
2032
+ showPageJump && totalPages !== void 0 ? /* @__PURE__ */ jsx23(PageJumpInput, { page, totalPages, onPageChange }) : /* @__PURE__ */ jsxs19("span", { className: "text-sm text-muted-foreground", children: [
2031
2033
  "P\xE1gina ",
2032
2034
  page,
2033
2035
  totalPages ? ` de ${totalPages}` : ""
@@ -2047,6 +2049,50 @@ function Pagination({
2047
2049
  }
2048
2050
  );
2049
2051
  }
2052
+ function PageJumpInput({ page, totalPages, onPageChange }) {
2053
+ const inputId = useId2();
2054
+ const [draft, setDraft] = useState11(null);
2055
+ const [prevPage, setPrevPage] = useState11(page);
2056
+ if (page !== prevPage) {
2057
+ setPrevPage(page);
2058
+ setDraft(null);
2059
+ }
2060
+ const commit = () => {
2061
+ if (draft === null) return;
2062
+ setDraft(null);
2063
+ if (draft === "") return;
2064
+ const target = Math.max(1, Math.min(Number(draft), totalPages));
2065
+ if (target !== page) onPageChange(target);
2066
+ };
2067
+ return /* @__PURE__ */ jsxs19("span", { className: "flex items-center gap-1.5 whitespace-nowrap text-sm text-muted-foreground", children: [
2068
+ /* @__PURE__ */ jsx23("label", { htmlFor: inputId, className: "max-sm:sr-only", children: "P\xE1gina" }),
2069
+ /* @__PURE__ */ jsx23(
2070
+ "input",
2071
+ {
2072
+ id: inputId,
2073
+ type: "text",
2074
+ inputMode: "numeric",
2075
+ enterKeyHint: "go",
2076
+ autoComplete: "off",
2077
+ "aria-label": "Ir para a p\xE1gina",
2078
+ value: draft ?? String(page),
2079
+ onChange: (e) => setDraft(e.target.value.replace(/\D/g, "")),
2080
+ onFocus: (e) => e.target.select(),
2081
+ onBlur: commit,
2082
+ onKeyDown: (e) => {
2083
+ if (e.key === "Enter") commit();
2084
+ else if (e.key === "Escape") setDraft(null);
2085
+ },
2086
+ style: { width: `${String(totalPages).length + 3}ch` },
2087
+ className: "h-8 max-sm:h-10 rounded-md border border-input bg-background px-1.5 text-center text-xs font-medium tabular-nums text-foreground shadow-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
2088
+ }
2089
+ ),
2090
+ /* @__PURE__ */ jsxs19("span", { children: [
2091
+ "de ",
2092
+ totalPages
2093
+ ] })
2094
+ ] });
2095
+ }
2050
2096
 
2051
2097
  // src/components/password-input.tsx
2052
2098
  import { Eye, EyeOff } from "lucide-react";
@@ -2169,7 +2215,7 @@ function ResponsiveDataView({
2169
2215
  // src/components/row-actions-menu.tsx
2170
2216
  import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
2171
2217
  import { ChevronRight as ChevronRight3, MoreVertical } from "lucide-react";
2172
- import { useState as useState12 } from "react";
2218
+ import { useState as useState13 } from "react";
2173
2219
  import { Drawer as DrawerPrimitive6 } from "vaul";
2174
2220
  import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
2175
2221
  var triggerClass = "inline-flex h-8 w-8 max-sm:h-10 max-sm:w-10 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50";
@@ -2183,7 +2229,7 @@ function RowActionsMenu({
2183
2229
  renderLink = defaultRenderLink
2184
2230
  }) {
2185
2231
  const isDesktop = useIsDesktop();
2186
- const [open, setOpen] = useState12(false);
2232
+ const [open, setOpen] = useState13(false);
2187
2233
  if (actions.length === 0) return null;
2188
2234
  const trigger = /* @__PURE__ */ jsx27(
2189
2235
  "button",
@@ -2527,14 +2573,14 @@ function Toaster(props) {
2527
2573
  import { RefreshCw } from "lucide-react";
2528
2574
 
2529
2575
  // src/hooks/use-version-check.ts
2530
- import { useCallback as useCallback3, useEffect as useEffect7, useState as useState13 } from "react";
2576
+ import { useCallback as useCallback3, useEffect as useEffect7, useState as useState14 } from "react";
2531
2577
  function useVersionCheck({
2532
2578
  currentBuild,
2533
2579
  url = "/version.json",
2534
2580
  intervalMs = 6e4
2535
2581
  }) {
2536
- const [latestBuild, setLatestBuild] = useState13(null);
2537
- const [staleChecks, setStaleChecks] = useState13(0);
2582
+ const [latestBuild, setLatestBuild] = useState14(null);
2583
+ const [staleChecks, setStaleChecks] = useState14(0);
2538
2584
  useEffect7(() => {
2539
2585
  if (!currentBuild) return;
2540
2586
  let cancelled = false;
@@ -2612,7 +2658,7 @@ function UpdateBanner({
2612
2658
  }
2613
2659
 
2614
2660
  // src/hooks/use-company-subdomain.ts
2615
- import { useState as useState14 } from "react";
2661
+ import { useState as useState15 } from "react";
2616
2662
  var ALWAYS_RESERVED = ["www", "localhost"];
2617
2663
  function getSubdomain(hostname, reservedSubdomains = []) {
2618
2664
  const labels = hostname.split(".");
@@ -2645,7 +2691,7 @@ function useCompanySubdomain(opts = {}) {
2645
2691
  overrideStorageKey = "company-subdomain",
2646
2692
  reservedSubdomains = []
2647
2693
  } = opts;
2648
- const [subdomain] = useState14(() => {
2694
+ const [subdomain] = useState15(() => {
2649
2695
  if (enableOverride) {
2650
2696
  const override = resolveOverride(overrideStorageKey);
2651
2697
  if (override) return override;
@@ -2657,9 +2703,9 @@ function useCompanySubdomain(opts = {}) {
2657
2703
  }
2658
2704
 
2659
2705
  // src/hooks/use-disclosure.ts
2660
- import { useCallback as useCallback4, useState as useState15 } from "react";
2706
+ import { useCallback as useCallback4, useState as useState16 } from "react";
2661
2707
  function useDisclosure(initial = false) {
2662
- const [open, setOpen] = useState15(initial);
2708
+ const [open, setOpen] = useState16(initial);
2663
2709
  const onOpen = useCallback4(() => setOpen(true), []);
2664
2710
  const onClose = useCallback4(() => setOpen(false), []);
2665
2711
  const onToggle = useCallback4(() => setOpen((v) => !v), []);