@motor-hero/ui-kit 0.34.0 → 0.35.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.map +1 -1
- package/dist/index.cjs +29 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/date-picker.tsx +44 -25
|
@@ -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;
|
|
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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1334,29 +1334,37 @@ function toMatchers(minDate, maxDate, disabledDates) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
var triggerInputClass = "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 pr-10 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive";
|
|
1336
1336
|
var fieldInputClass = "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
1337
|
+
var navButtonClass2 = "inline-flex size-(--cell-size) shrink-0 select-none items-center justify-center rounded-md p-0 transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50";
|
|
1337
1338
|
var calendarClassNames = {
|
|
1338
|
-
months: "flex flex-col",
|
|
1339
|
-
month: "flex flex-col gap-4",
|
|
1340
|
-
month_caption: "flex
|
|
1341
|
-
caption_label: "text-sm font-medium",
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1339
|
+
months: "relative flex flex-col gap-4",
|
|
1340
|
+
month: "flex w-full flex-col gap-4",
|
|
1341
|
+
month_caption: "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
1342
|
+
caption_label: "flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm font-medium select-none [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
1343
|
+
dropdowns: "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
1344
|
+
dropdown_root: "relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
|
|
1345
|
+
dropdown: "absolute inset-0 bg-popover opacity-0",
|
|
1346
|
+
nav: "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
1347
|
+
button_previous: navButtonClass2,
|
|
1348
|
+
button_next: navButtonClass2,
|
|
1349
|
+
month_grid: "w-full border-collapse",
|
|
1346
1350
|
weekdays: "flex",
|
|
1347
|
-
weekday: "
|
|
1348
|
-
week: "flex w-full
|
|
1349
|
-
day: "relative p-0 text-center
|
|
1350
|
-
day_button: "inline-flex size-
|
|
1351
|
-
selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground rounded-md [&>button]:bg-primary [&>button]:text-primary-foreground",
|
|
1351
|
+
weekday: "flex-1 select-none rounded-md text-[0.8rem] font-normal text-muted-foreground",
|
|
1352
|
+
week: "mt-2 flex w-full",
|
|
1353
|
+
day: "relative aspect-square h-full w-full select-none p-0 text-center aria-selected:[&>button]:bg-primary aria-selected:[&>button]:text-primary-foreground aria-selected:[&>button]:hover:bg-primary",
|
|
1354
|
+
day_button: "inline-flex aspect-square size-auto w-full min-w-(--cell-size) items-center justify-center rounded-md p-0 font-normal transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
1352
1355
|
today: "bg-accent text-accent-foreground rounded-md",
|
|
1353
1356
|
outside: "text-muted-foreground opacity-50",
|
|
1354
1357
|
disabled: "text-muted-foreground opacity-50 pointer-events-none",
|
|
1355
1358
|
hidden: "invisible"
|
|
1356
1359
|
};
|
|
1357
1360
|
var calendarComponents = {
|
|
1358
|
-
Chevron: ({ orientation }) =>
|
|
1361
|
+
Chevron: ({ orientation }) => {
|
|
1362
|
+
if (orientation === "left") return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react7.ChevronLeft, { className: "size-4" });
|
|
1363
|
+
if (orientation === "right") return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react7.ChevronRight, { className: "size-4" });
|
|
1364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react7.ChevronDown, { className: "size-4" });
|
|
1365
|
+
}
|
|
1359
1366
|
};
|
|
1367
|
+
var formatMonthDropdown = (date) => date.toLocaleString("pt-BR", { month: "short" });
|
|
1360
1368
|
function DatePickerImpl({
|
|
1361
1369
|
value,
|
|
1362
1370
|
onChange,
|
|
@@ -1381,6 +1389,8 @@ function DatePickerImpl({
|
|
|
1381
1389
|
const committedDate = withTime ? dateTimeToDate(value) : dateOnlyToDate(value);
|
|
1382
1390
|
const displayValue = displayFor(value, withTime);
|
|
1383
1391
|
const matchers = toMatchers(minDate, maxDate, disabledDates);
|
|
1392
|
+
const startMonth = dateOnlyToDate(minDate) ?? (0, import_date_fns.subYears)(/* @__PURE__ */ new Date(), 100);
|
|
1393
|
+
const endMonth = dateOnlyToDate(maxDate) ?? (0, import_date_fns.endOfYear)(/* @__PURE__ */ new Date());
|
|
1384
1394
|
const setOpen = (next) => {
|
|
1385
1395
|
setOpenRaw(next);
|
|
1386
1396
|
if (next) {
|
|
@@ -1477,11 +1487,15 @@ function DatePickerImpl({
|
|
|
1477
1487
|
{
|
|
1478
1488
|
mode: "single",
|
|
1479
1489
|
locale: import_locale.ptBR,
|
|
1490
|
+
captionLayout: "dropdown",
|
|
1491
|
+
formatters: { formatMonthDropdown },
|
|
1492
|
+
startMonth,
|
|
1493
|
+
endMonth,
|
|
1480
1494
|
selected: withTime ? pendingDate : committedDate,
|
|
1481
1495
|
defaultMonth: (withTime ? pendingDate : committedDate) ?? /* @__PURE__ */ new Date(),
|
|
1482
1496
|
onSelect: (date) => date && handleCalendarSelect(date),
|
|
1483
1497
|
disabled: matchers,
|
|
1484
|
-
className: withTime ? "p-0" : "p-3",
|
|
1498
|
+
className: cn(withTime ? "p-0" : "p-3", "[--cell-size:2rem]"),
|
|
1485
1499
|
classNames: calendarClassNames,
|
|
1486
1500
|
components: calendarComponents
|
|
1487
1501
|
}
|