@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.
@@ -1,7 +1,9 @@
1
1
  import * as React from "react";
2
2
  export interface DatePickerProps {
3
- /** `DatePicker`: data pura `"yyyy-MM-dd"`, sem conversão de fuso. `DateTimePicker`:
4
- * ISO UTC completo (`...Z`). `""`/`undefined` = sem valor. */
3
+ /** `DatePicker`: data pura `"yyyy-MM-dd"`. `DateTimePicker`: hora de parede
4
+ * `"yyyy-MM-ddTHH:mm"` — os dígitos digitados, tal qual. Nenhum dos dois
5
+ * passa por conversão de fuso: o significado (Brasília, local, UTC) é
6
+ * decisão do consumidor. `""`/`undefined` = sem valor. */
5
7
  value?: string;
6
8
  onChange: (value: string) => void;
7
9
  placeholder?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/components/date-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAc9B,MAAM,WAAW,eAAe;IAC9B;mEAC+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACvC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAqUD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAEhD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,qBAEpD"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/components/date-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAe9B,MAAM,WAAW,eAAe;IAC9B;;;+DAG2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACvC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAqUD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAEhD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,qBAEpD"}
@@ -7,6 +7,7 @@ export interface RowAction {
7
7
  href?: string;
8
8
  destructive?: boolean;
9
9
  disabled?: boolean;
10
+ children?: RowAction[];
10
11
  }
11
12
  export interface RowActionsMenuProps {
12
13
  actions: RowAction[];
@@ -1 +1 @@
1
- {"version":3,"file":"row-actions-menu.d.ts","sourceRoot":"","sources":["../../src/components/row-actions-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAIhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;A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AG,KAAK,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAWD,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAgB,EAChB,KAAa,EACb,KAAe,EACf,UAA8B,GAC/B,EAAE,mBAAmB,sCA2LrB"}
package/dist/index.cjs CHANGED
@@ -1055,6 +1055,7 @@ var MASK_REPLACEMENT = { _: /\d/ };
1055
1055
  var DATE_FORMAT = "dd/MM/yyyy";
1056
1056
  var TIME_FORMAT = "HH:mm";
1057
1057
  var DATE_VALUE_FORMAT = "yyyy-MM-dd";
1058
+ var DATETIME_VALUE_FORMAT = "yyyy-MM-dd'T'HH:mm";
1058
1059
  function pad(n) {
1059
1060
  return String(n).padStart(2, "0");
1060
1061
  }
@@ -1070,8 +1071,8 @@ function dateOnlyToDate(value) {
1070
1071
  }
1071
1072
  function dateTimeToDate(value) {
1072
1073
  if (!value) return void 0;
1073
- const parsed = new Date(value);
1074
- return Number.isNaN(parsed.getTime()) ? void 0 : parsed;
1074
+ const parsed = (0, import_date_fns.parse)(value, DATETIME_VALUE_FORMAT, /* @__PURE__ */ new Date());
1075
+ return (0, import_date_fns.isValid)(parsed) ? parsed : void 0;
1075
1076
  }
1076
1077
  function displayFor(value, withTime) {
1077
1078
  const date = withTime ? dateTimeToDate(value) : dateOnlyToDate(value);
@@ -1166,7 +1167,7 @@ function DatePickerImpl({
1166
1167
  if (!time) return;
1167
1168
  const combined = new Date(date);
1168
1169
  combined.setHours(time.getHours(), time.getMinutes(), 0, 0);
1169
- onChange(combined.toISOString());
1170
+ onChange((0, import_date_fns.format)(combined, DATETIME_VALUE_FORMAT));
1170
1171
  setOpen(false);
1171
1172
  };
1172
1173
  const handleCalendarSelect = (date) => {
@@ -2208,6 +2209,45 @@ function RowActionsMenu({
2208
2209
  itemClass2,
2209
2210
  action.destructive && "text-destructive focus:bg-destructive/10"
2210
2211
  );
2212
+ if (action.children?.length) {
2213
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenu3.Sub, { children: [
2214
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2215
+ DropdownMenu3.SubTrigger,
2216
+ {
2217
+ className: cls,
2218
+ disabled: action.disabled,
2219
+ children: [
2220
+ action.icon,
2221
+ action.label,
2222
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react12.ChevronRight, { className: "ml-auto h-4 w-4 text-muted-foreground" })
2223
+ ]
2224
+ }
2225
+ ),
2226
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownMenu3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2227
+ DropdownMenu3.SubContent,
2228
+ {
2229
+ sideOffset: 4,
2230
+ 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",
2231
+ children: action.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2232
+ DropdownMenu3.Item,
2233
+ {
2234
+ className: cn(
2235
+ itemClass2,
2236
+ child.destructive && "text-destructive focus:bg-destructive/10"
2237
+ ),
2238
+ disabled: child.disabled,
2239
+ onClick: child.onClick,
2240
+ children: [
2241
+ child.icon,
2242
+ child.label
2243
+ ]
2244
+ },
2245
+ child.label
2246
+ ))
2247
+ }
2248
+ ) })
2249
+ ] }, action.label);
2250
+ }
2211
2251
  return action.href ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2212
2252
  DropdownMenu3.Item,
2213
2253
  {
@@ -2257,6 +2297,36 @@ function RowActionsMenu({
2257
2297
  action.icon,
2258
2298
  action.label
2259
2299
  ] });
2300
+ if (action.children?.length) {
2301
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
2302
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mx-3 my-1 h-px bg-border" }),
2303
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-3 px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
2304
+ action.icon,
2305
+ action.label
2306
+ ] }),
2307
+ action.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2308
+ "button",
2309
+ {
2310
+ type: "button",
2311
+ disabled: child.disabled,
2312
+ className: cn(
2313
+ sheetItemClass2,
2314
+ child.destructive && "text-destructive"
2315
+ ),
2316
+ onClick: () => {
2317
+ child.onClick?.();
2318
+ setOpen(false);
2319
+ },
2320
+ children: [
2321
+ child.icon,
2322
+ child.label
2323
+ ]
2324
+ },
2325
+ child.label
2326
+ )),
2327
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mx-3 my-1 h-px bg-border" })
2328
+ ] }, action.label);
2329
+ }
2260
2330
  return action.href ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2261
2331
  "span",
2262
2332
  {