@motor-hero/ui-kit 0.38.0 → 0.40.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/components/responsive-data-view.d.ts +7 -1
- package/dist/components/responsive-data-view.d.ts.map +1 -1
- package/dist/components/row-actions-menu.d.ts +1 -0
- package/dist/components/row-actions-menu.d.ts.map +1 -1
- package/dist/index.cjs +84 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +85 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/responsive-data-view.tsx +21 -3
- package/src/components/row-actions-menu.tsx +70 -1
package/dist/index.js
CHANGED
|
@@ -2052,13 +2052,14 @@ function ResponsiveDataView({
|
|
|
2052
2052
|
cards,
|
|
2053
2053
|
isEmpty,
|
|
2054
2054
|
isLoading,
|
|
2055
|
+
isBusy = false,
|
|
2055
2056
|
emptyIcon,
|
|
2056
2057
|
emptyTitle = "Nenhum registro encontrado",
|
|
2057
2058
|
emptyDescription,
|
|
2058
2059
|
emptyAction,
|
|
2059
2060
|
pagination
|
|
2060
2061
|
}) {
|
|
2061
|
-
if (!isLoading && isEmpty) {
|
|
2062
|
+
if (!isLoading && !isBusy && isEmpty) {
|
|
2062
2063
|
return /* @__PURE__ */ jsx25("div", { className: "rounded-md border", children: /* @__PURE__ */ jsx25(
|
|
2063
2064
|
EmptyState,
|
|
2064
2065
|
{
|
|
@@ -2069,16 +2070,27 @@ function ResponsiveDataView({
|
|
|
2069
2070
|
}
|
|
2070
2071
|
) });
|
|
2071
2072
|
}
|
|
2073
|
+
const busyClass = isBusy && "pointer-events-none opacity-50";
|
|
2072
2074
|
return /* @__PURE__ */ jsxs22("div", { className: "space-y-4", children: [
|
|
2073
|
-
/* @__PURE__ */ jsx25(
|
|
2074
|
-
|
|
2075
|
+
/* @__PURE__ */ jsx25(
|
|
2076
|
+
"div",
|
|
2077
|
+
{
|
|
2078
|
+
"aria-busy": isBusy,
|
|
2079
|
+
className: cn(
|
|
2080
|
+
"hidden overflow-x-auto rounded-md border transition-opacity md:block",
|
|
2081
|
+
busyClass
|
|
2082
|
+
),
|
|
2083
|
+
children: table
|
|
2084
|
+
}
|
|
2085
|
+
),
|
|
2086
|
+
/* @__PURE__ */ jsx25("div", { "aria-busy": isBusy, className: cn("transition-opacity md:hidden", busyClass), children: cards }),
|
|
2075
2087
|
pagination
|
|
2076
2088
|
] });
|
|
2077
2089
|
}
|
|
2078
2090
|
|
|
2079
2091
|
// src/components/row-actions-menu.tsx
|
|
2080
2092
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
2081
|
-
import { MoreVertical } from "lucide-react";
|
|
2093
|
+
import { ChevronRight as ChevronRight3, MoreVertical } from "lucide-react";
|
|
2082
2094
|
import { useState as useState11 } from "react";
|
|
2083
2095
|
import { Drawer as DrawerPrimitive6 } from "vaul";
|
|
2084
2096
|
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -2119,6 +2131,45 @@ function RowActionsMenu({
|
|
|
2119
2131
|
itemClass2,
|
|
2120
2132
|
action.destructive && "text-destructive focus:bg-destructive/10"
|
|
2121
2133
|
);
|
|
2134
|
+
if (action.children?.length) {
|
|
2135
|
+
return /* @__PURE__ */ jsxs23(DropdownMenu3.Sub, { children: [
|
|
2136
|
+
/* @__PURE__ */ jsxs23(
|
|
2137
|
+
DropdownMenu3.SubTrigger,
|
|
2138
|
+
{
|
|
2139
|
+
className: cls,
|
|
2140
|
+
disabled: action.disabled,
|
|
2141
|
+
children: [
|
|
2142
|
+
action.icon,
|
|
2143
|
+
action.label,
|
|
2144
|
+
/* @__PURE__ */ jsx26(ChevronRight3, { className: "ml-auto h-4 w-4 text-muted-foreground" })
|
|
2145
|
+
]
|
|
2146
|
+
}
|
|
2147
|
+
),
|
|
2148
|
+
/* @__PURE__ */ jsx26(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx26(
|
|
2149
|
+
DropdownMenu3.SubContent,
|
|
2150
|
+
{
|
|
2151
|
+
sideOffset: 4,
|
|
2152
|
+
className: "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
|
|
2153
|
+
children: action.children.map((child) => /* @__PURE__ */ jsxs23(
|
|
2154
|
+
DropdownMenu3.Item,
|
|
2155
|
+
{
|
|
2156
|
+
className: cn(
|
|
2157
|
+
itemClass2,
|
|
2158
|
+
child.destructive && "text-destructive focus:bg-destructive/10"
|
|
2159
|
+
),
|
|
2160
|
+
disabled: child.disabled,
|
|
2161
|
+
onClick: child.onClick,
|
|
2162
|
+
children: [
|
|
2163
|
+
child.icon,
|
|
2164
|
+
child.label
|
|
2165
|
+
]
|
|
2166
|
+
},
|
|
2167
|
+
child.label
|
|
2168
|
+
))
|
|
2169
|
+
}
|
|
2170
|
+
) })
|
|
2171
|
+
] }, action.label);
|
|
2172
|
+
}
|
|
2122
2173
|
return action.href ? /* @__PURE__ */ jsx26(
|
|
2123
2174
|
DropdownMenu3.Item,
|
|
2124
2175
|
{
|
|
@@ -2168,6 +2219,36 @@ function RowActionsMenu({
|
|
|
2168
2219
|
action.icon,
|
|
2169
2220
|
action.label
|
|
2170
2221
|
] });
|
|
2222
|
+
if (action.children?.length) {
|
|
2223
|
+
return /* @__PURE__ */ jsxs23("div", { children: [
|
|
2224
|
+
/* @__PURE__ */ jsx26("div", { className: "mx-3 my-1 h-px bg-border" }),
|
|
2225
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-3 px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
|
|
2226
|
+
action.icon,
|
|
2227
|
+
action.label
|
|
2228
|
+
] }),
|
|
2229
|
+
action.children.map((child) => /* @__PURE__ */ jsxs23(
|
|
2230
|
+
"button",
|
|
2231
|
+
{
|
|
2232
|
+
type: "button",
|
|
2233
|
+
disabled: child.disabled,
|
|
2234
|
+
className: cn(
|
|
2235
|
+
sheetItemClass2,
|
|
2236
|
+
child.destructive && "text-destructive"
|
|
2237
|
+
),
|
|
2238
|
+
onClick: () => {
|
|
2239
|
+
child.onClick?.();
|
|
2240
|
+
setOpen(false);
|
|
2241
|
+
},
|
|
2242
|
+
children: [
|
|
2243
|
+
child.icon,
|
|
2244
|
+
child.label
|
|
2245
|
+
]
|
|
2246
|
+
},
|
|
2247
|
+
child.label
|
|
2248
|
+
)),
|
|
2249
|
+
/* @__PURE__ */ jsx26("div", { className: "mx-3 my-1 h-px bg-border" })
|
|
2250
|
+
] }, action.label);
|
|
2251
|
+
}
|
|
2171
2252
|
return action.href ? /* @__PURE__ */ jsx26(
|
|
2172
2253
|
"span",
|
|
2173
2254
|
{
|