@motor-hero/ui-kit 0.39.0 → 0.42.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/date-picker.d.ts +4 -2
- package/dist/components/date-picker.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 +73 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +74 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/date-picker.tsx +8 -5
- package/src/components/row-actions-menu.tsx +70 -1
package/dist/index.js
CHANGED
|
@@ -978,6 +978,7 @@ var MASK_REPLACEMENT = { _: /\d/ };
|
|
|
978
978
|
var DATE_FORMAT = "dd/MM/yyyy";
|
|
979
979
|
var TIME_FORMAT = "HH:mm";
|
|
980
980
|
var DATE_VALUE_FORMAT = "yyyy-MM-dd";
|
|
981
|
+
var DATETIME_VALUE_FORMAT = "yyyy-MM-dd'T'HH:mm";
|
|
981
982
|
function pad(n) {
|
|
982
983
|
return String(n).padStart(2, "0");
|
|
983
984
|
}
|
|
@@ -993,8 +994,8 @@ function dateOnlyToDate(value) {
|
|
|
993
994
|
}
|
|
994
995
|
function dateTimeToDate(value) {
|
|
995
996
|
if (!value) return void 0;
|
|
996
|
-
const parsed = new Date(
|
|
997
|
-
return
|
|
997
|
+
const parsed = parse(value, DATETIME_VALUE_FORMAT, /* @__PURE__ */ new Date());
|
|
998
|
+
return isValid(parsed) ? parsed : void 0;
|
|
998
999
|
}
|
|
999
1000
|
function displayFor(value, withTime) {
|
|
1000
1001
|
const date = withTime ? dateTimeToDate(value) : dateOnlyToDate(value);
|
|
@@ -1089,7 +1090,7 @@ function DatePickerImpl({
|
|
|
1089
1090
|
if (!time) return;
|
|
1090
1091
|
const combined = new Date(date);
|
|
1091
1092
|
combined.setHours(time.getHours(), time.getMinutes(), 0, 0);
|
|
1092
|
-
onChange(combined
|
|
1093
|
+
onChange(format(combined, DATETIME_VALUE_FORMAT));
|
|
1093
1094
|
setOpen(false);
|
|
1094
1095
|
};
|
|
1095
1096
|
const handleCalendarSelect = (date) => {
|
|
@@ -2090,7 +2091,7 @@ function ResponsiveDataView({
|
|
|
2090
2091
|
|
|
2091
2092
|
// src/components/row-actions-menu.tsx
|
|
2092
2093
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
2093
|
-
import { MoreVertical } from "lucide-react";
|
|
2094
|
+
import { ChevronRight as ChevronRight3, MoreVertical } from "lucide-react";
|
|
2094
2095
|
import { useState as useState11 } from "react";
|
|
2095
2096
|
import { Drawer as DrawerPrimitive6 } from "vaul";
|
|
2096
2097
|
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -2131,6 +2132,45 @@ function RowActionsMenu({
|
|
|
2131
2132
|
itemClass2,
|
|
2132
2133
|
action.destructive && "text-destructive focus:bg-destructive/10"
|
|
2133
2134
|
);
|
|
2135
|
+
if (action.children?.length) {
|
|
2136
|
+
return /* @__PURE__ */ jsxs23(DropdownMenu3.Sub, { children: [
|
|
2137
|
+
/* @__PURE__ */ jsxs23(
|
|
2138
|
+
DropdownMenu3.SubTrigger,
|
|
2139
|
+
{
|
|
2140
|
+
className: cls,
|
|
2141
|
+
disabled: action.disabled,
|
|
2142
|
+
children: [
|
|
2143
|
+
action.icon,
|
|
2144
|
+
action.label,
|
|
2145
|
+
/* @__PURE__ */ jsx26(ChevronRight3, { className: "ml-auto h-4 w-4 text-muted-foreground" })
|
|
2146
|
+
]
|
|
2147
|
+
}
|
|
2148
|
+
),
|
|
2149
|
+
/* @__PURE__ */ jsx26(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx26(
|
|
2150
|
+
DropdownMenu3.SubContent,
|
|
2151
|
+
{
|
|
2152
|
+
sideOffset: 4,
|
|
2153
|
+
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",
|
|
2154
|
+
children: action.children.map((child) => /* @__PURE__ */ jsxs23(
|
|
2155
|
+
DropdownMenu3.Item,
|
|
2156
|
+
{
|
|
2157
|
+
className: cn(
|
|
2158
|
+
itemClass2,
|
|
2159
|
+
child.destructive && "text-destructive focus:bg-destructive/10"
|
|
2160
|
+
),
|
|
2161
|
+
disabled: child.disabled,
|
|
2162
|
+
onClick: child.onClick,
|
|
2163
|
+
children: [
|
|
2164
|
+
child.icon,
|
|
2165
|
+
child.label
|
|
2166
|
+
]
|
|
2167
|
+
},
|
|
2168
|
+
child.label
|
|
2169
|
+
))
|
|
2170
|
+
}
|
|
2171
|
+
) })
|
|
2172
|
+
] }, action.label);
|
|
2173
|
+
}
|
|
2134
2174
|
return action.href ? /* @__PURE__ */ jsx26(
|
|
2135
2175
|
DropdownMenu3.Item,
|
|
2136
2176
|
{
|
|
@@ -2180,6 +2220,36 @@ function RowActionsMenu({
|
|
|
2180
2220
|
action.icon,
|
|
2181
2221
|
action.label
|
|
2182
2222
|
] });
|
|
2223
|
+
if (action.children?.length) {
|
|
2224
|
+
return /* @__PURE__ */ jsxs23("div", { children: [
|
|
2225
|
+
/* @__PURE__ */ jsx26("div", { className: "mx-3 my-1 h-px bg-border" }),
|
|
2226
|
+
/* @__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: [
|
|
2227
|
+
action.icon,
|
|
2228
|
+
action.label
|
|
2229
|
+
] }),
|
|
2230
|
+
action.children.map((child) => /* @__PURE__ */ jsxs23(
|
|
2231
|
+
"button",
|
|
2232
|
+
{
|
|
2233
|
+
type: "button",
|
|
2234
|
+
disabled: child.disabled,
|
|
2235
|
+
className: cn(
|
|
2236
|
+
sheetItemClass2,
|
|
2237
|
+
child.destructive && "text-destructive"
|
|
2238
|
+
),
|
|
2239
|
+
onClick: () => {
|
|
2240
|
+
child.onClick?.();
|
|
2241
|
+
setOpen(false);
|
|
2242
|
+
},
|
|
2243
|
+
children: [
|
|
2244
|
+
child.icon,
|
|
2245
|
+
child.label
|
|
2246
|
+
]
|
|
2247
|
+
},
|
|
2248
|
+
child.label
|
|
2249
|
+
)),
|
|
2250
|
+
/* @__PURE__ */ jsx26("div", { className: "mx-3 my-1 h-px bg-border" })
|
|
2251
|
+
] }, action.label);
|
|
2252
|
+
}
|
|
2183
2253
|
return action.href ? /* @__PURE__ */ jsx26(
|
|
2184
2254
|
"span",
|
|
2185
2255
|
{
|