@scripso-homepad/ui 0.4.10 → 0.4.11

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.
Files changed (37) hide show
  1. package/dist/index.cjs +122 -43
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +2 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.js +124 -45
  6. package/dist/index.js.map +1 -1
  7. package/dist/web/index.cjs +45 -33
  8. package/dist/web/index.cjs.map +1 -1
  9. package/dist/web/index.d.cts +2 -1
  10. package/dist/web/index.d.ts +2 -1
  11. package/dist/web/index.js +45 -33
  12. package/dist/web/index.js.map +1 -1
  13. package/package.json +3 -2
  14. package/src/components/Calendar.tsx +10 -2
  15. package/src/components/DatePicker.tsx +3 -3
  16. package/src/components/Select.tsx +133 -38
  17. package/src/theme/select.ts +1 -1
  18. package/src/utils/calendarDays.ts +15 -6
  19. package/src/web/components/Badge.tsx +1 -1
  20. package/src/web/components/ConfirmModal.tsx +2 -2
  21. package/src/web/components/Drawer.stories.tsx +7 -7
  22. package/src/web/components/Drawer.tsx +2 -2
  23. package/src/web/components/HistoryTimeline.tsx +2 -2
  24. package/src/web/components/Modal.stories.tsx +1 -1
  25. package/src/web/components/Modal.tsx +27 -10
  26. package/src/web/components/Pagination.tsx +2 -2
  27. package/src/web/components/TableActionButton.tsx +1 -1
  28. package/src/web/components/TableActionsMenu.tsx +1 -1
  29. package/src/web/components/TableIconText.tsx +1 -1
  30. package/src/web/components/Toaster.stories.tsx +7 -7
  31. package/src/web/components/table/constants.ts +2 -2
  32. package/src/web/layout/AppHeader.tsx +1 -1
  33. package/src/web/layout/BuildingSelect.tsx +2 -2
  34. package/src/web/layout/DashboardLayout.stories.tsx +1 -1
  35. package/src/web/layout/SidebarNavItem.tsx +1 -1
  36. package/src/web/layout/SidebarUserCard.tsx +3 -3
  37. package/src/web/styles/typography.css +99 -0
@@ -27567,7 +27567,7 @@ var require_react_dom_development = __commonJS({
27567
27567
  return root2;
27568
27568
  }
27569
27569
  var ReactVersion = "18.3.1";
27570
- function createPortal2(children, containerInfo, implementation) {
27570
+ function createPortal3(children, containerInfo, implementation) {
27571
27571
  var key = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
27572
27572
  {
27573
27573
  checkKeyStringCoercion(key);
@@ -28423,7 +28423,7 @@ var require_react_dom_development = __commonJS({
28423
28423
  if (!isValidContainer(container)) {
28424
28424
  throw new Error("Target container is not a DOM element.");
28425
28425
  }
28426
- return createPortal2(children, container, null, key);
28426
+ return createPortal3(children, container, null, key);
28427
28427
  }
28428
28428
  function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
28429
28429
  return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback);
@@ -29219,7 +29219,7 @@ function BuildingSelect({
29219
29219
  ),
29220
29220
  children: [
29221
29221
  buildingIcon ?? /* @__PURE__ */ jsxRuntime.jsx(BuildingIcon, { className: "shrink-0 text-navy" }),
29222
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-medium text-slate-blue", children: displayLabel }),
29222
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate typography-14 font-medium text-slate-blue", children: displayLabel }),
29223
29223
  chevronIcon ?? /* @__PURE__ */ jsxRuntime.jsx(
29224
29224
  lucideReact.ChevronsUpDown,
29225
29225
  {
@@ -29267,7 +29267,7 @@ function BuildingSelect({
29267
29267
  },
29268
29268
  onClick: () => selectOption(option),
29269
29269
  className: cn(
29270
- "flex w-full rounded-lg px-3 py-2.5 text-left text-sm font-medium text-slate-blue transition-colors",
29270
+ "flex w-full rounded-lg px-3 py-2.5 text-left typography-14 font-medium text-slate-blue transition-colors",
29271
29271
  !option.disabled && "cursor-pointer hover:bg-storm-gray-50",
29272
29272
  (isSelected || isHighlighted) && !option.disabled && "bg-storm-gray-50",
29273
29273
  option.disabled && "cursor-not-allowed opacity-50"
@@ -29320,7 +29320,7 @@ function AppHeader({
29320
29320
  className
29321
29321
  ),
29322
29322
  children: [
29323
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "truncate text-xl font-bold text-slate-blue", children: title }),
29323
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "truncate typography-title text-slate-blue", children: title }),
29324
29324
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-3", children: [
29325
29325
  hasBuildingSelect ? /* @__PURE__ */ jsxRuntime.jsx(
29326
29326
  BuildingSelect,
@@ -29423,7 +29423,7 @@ function SidebarNavItem({ item, isOpen, onNavigate }) {
29423
29423
  "span",
29424
29424
  {
29425
29425
  className: cn(
29426
- "overflow-hidden text-sm font-semibold whitespace-nowrap transition-[max-width,opacity] duration-300 ease-in-out",
29426
+ "overflow-hidden typography-14 font-semibold whitespace-nowrap transition-[max-width,opacity] duration-300 ease-in-out",
29427
29427
  isOpen ? "max-w-[180px] opacity-100" : "max-w-0 opacity-0"
29428
29428
  ),
29429
29429
  children: item.label
@@ -29460,15 +29460,15 @@ function SidebarUserCard({
29460
29460
  /* @__PURE__ */ jsxRuntime.jsx(
29461
29461
  "div",
29462
29462
  {
29463
- className: "flex size-11 shrink-0 items-center justify-center rounded-full bg-white/5 text-sm font-bold text-white",
29463
+ className: "flex size-11 shrink-0 items-center justify-center rounded-full bg-white/5 typography-14 font-bold text-white",
29464
29464
  "aria-hidden": true,
29465
29465
  children: initials
29466
29466
  }
29467
29467
  ),
29468
29468
  isOpen ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
29469
29469
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden", children: [
29470
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-bold text-white", children: user.fullName }),
29471
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs text-storm-gray-100", children: user.email })
29470
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate typography-14 font-bold text-white", children: user.fullName }),
29471
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate typography-12 text-storm-gray-100", children: user.email })
29472
29472
  ] }),
29473
29473
  /* @__PURE__ */ jsxRuntime.jsx(
29474
29474
  "button",
@@ -30049,7 +30049,7 @@ var defaultLabels = {
30049
30049
  page: (pageNumber) => `Page ${pageNumber}`,
30050
30050
  showing: ({ start, end, total }) => `Showing ${start}-${end} of ${total}`
30051
30051
  };
30052
- var paginationControlClassName = "inline-flex size-7 items-center justify-center rounded-lg border border-storm-gray-50 p-1 text-xs font-medium leading-none text-storm-gray-500 transition-colors";
30052
+ var paginationControlClassName = "inline-flex size-7 items-center justify-center rounded-lg border border-storm-gray-50 p-1 typography-12 font-medium text-storm-gray-500 transition-colors";
30053
30053
  var paginationHoverClassName = "cursor-pointer hover:bg-storm-gray-0";
30054
30054
  function Pagination({
30055
30055
  page,
@@ -30083,7 +30083,7 @@ function Pagination({
30083
30083
  className
30084
30084
  ),
30085
30085
  children: [
30086
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium leading-none text-storm-gray-200", children: mergedLabels.showing({ start, end, total }) }),
30086
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "typography-12 font-medium text-storm-gray-200", children: mergedLabels.showing({ start, end, total }) }),
30087
30087
  /* @__PURE__ */ jsxRuntime.jsxs(
30088
30088
  "nav",
30089
30089
  {
@@ -30170,8 +30170,8 @@ var tableCellPaddingClassName = "px-3 py-3";
30170
30170
  var tableHeadPaddingClassName = "px-3 py-4";
30171
30171
  var tableShellClassName = "flex flex-col overflow-hidden border bg-storm-gray-0";
30172
30172
  var tableFooterShellClassName = "overflow-hidden rounded-b-xl border bg-storm-gray-0";
30173
- var tableHeaderClassName = "bg-storm-gray-0 font-sans text-xs font-normal leading-none tracking-normal text-storm-gray-400";
30174
- var tableBodyClassName = "bg-white font-sans text-sm font-medium leading-none tracking-normal text-storm-gray-900";
30173
+ var tableHeaderClassName = "bg-storm-gray-0 typography-12 font-normal tracking-normal text-storm-gray-400";
30174
+ var tableBodyClassName = "bg-white typography-14 font-medium tracking-normal text-storm-gray-900";
30175
30175
  var tableAlignClasses = {
30176
30176
  left: "",
30177
30177
  right: "text-right",
@@ -30349,7 +30349,7 @@ function TableActionsCell({ className, children, ...props }) {
30349
30349
 
30350
30350
  // src/web/components/TableActionsMenu.tsx
30351
30351
  var import_react_dom = __toESM(require_react_dom());
30352
- var inlineActionClassName = "inline-flex cursor-pointer items-center gap-1 rounded-lg border border-storm-gray-50 bg-white px-3 py-2 font-sans text-xs font-medium leading-none text-storm-gray-900 transition-colors hover:bg-storm-gray-0";
30352
+ var inlineActionClassName = "inline-flex cursor-pointer items-center gap-1 rounded-lg border border-storm-gray-50 bg-white px-3 py-2 typography-12 font-medium text-storm-gray-900 transition-colors hover:bg-storm-gray-0";
30353
30353
  var variantClasses = {
30354
30354
  approve: inlineActionClassName,
30355
30355
  reject: inlineActionClassName,
@@ -30508,7 +30508,7 @@ function TableActionsMenu({
30508
30508
  item.onSelect();
30509
30509
  },
30510
30510
  className: cn(
30511
- "flex h-[51px] w-full cursor-pointer items-center gap-2.5 px-3 text-left font-sans text-sm font-medium leading-none text-storm-gray-900 transition-colors hover:bg-storm-gray-0",
30511
+ "flex h-[51px] w-full cursor-pointer items-center gap-2.5 px-3 text-left typography-14 font-medium text-storm-gray-900 transition-colors hover:bg-storm-gray-0",
30512
30512
  index > 0 && "border-t border-storm-gray-50",
30513
30513
  item.disabled && "cursor-not-allowed opacity-50"
30514
30514
  ),
@@ -30739,7 +30739,7 @@ function Badge({ children, variant = "neutral", icon, className }) {
30739
30739
  "span",
30740
30740
  {
30741
30741
  className: cn(
30742
- "inline-flex items-center gap-2 rounded-[28px] px-3 py-1.5 font-sans text-xs font-semibold leading-none whitespace-nowrap",
30742
+ "inline-flex items-center gap-2 rounded-[28px] px-3 py-1.5 typography-12 font-semibold whitespace-nowrap",
30743
30743
  badgeVariantClasses[variant],
30744
30744
  className
30745
30745
  ),
@@ -30758,7 +30758,7 @@ function TableIconText({ icon, children, className }) {
30758
30758
  "span",
30759
30759
  {
30760
30760
  className: cn(
30761
- "inline-flex items-center gap-2 font-sans text-sm font-medium leading-none tracking-normal text-storm-gray-900",
30761
+ "inline-flex items-center gap-2 typography-14 font-medium tracking-normal text-storm-gray-900",
30762
30762
  className
30763
30763
  ),
30764
30764
  children: [
@@ -30769,6 +30769,9 @@ function TableIconText({ icon, children, className }) {
30769
30769
  );
30770
30770
  }
30771
30771
 
30772
+ // src/web/components/Modal.tsx
30773
+ var import_react_dom2 = __toESM(require_react_dom());
30774
+
30772
30775
  // src/icons/arrowUpRightPath.ts
30773
30776
  var ARROW_UP_RIGHT_PATH = "M14.1667 14.1668V5.8335H5.83333M14.1667 5.8335L5.83333 14.1668";
30774
30777
  function ArrowUpRightIcon({
@@ -30979,6 +30982,7 @@ function Modal({
30979
30982
  cancelDisabled = false,
30980
30983
  confirmDisabled = false,
30981
30984
  closeOnBackdrop = true,
30985
+ closeOnEscape = true,
30982
30986
  containerClassName,
30983
30987
  contentClassName,
30984
30988
  buttonClassName
@@ -30987,16 +30991,19 @@ function Modal({
30987
30991
  if (!open) {
30988
30992
  return;
30989
30993
  }
30994
+ const previousOverflow = document.body.style.overflow;
30995
+ document.body.style.overflow = "hidden";
30990
30996
  const handleKeyDown = (event) => {
30991
- if (event.key === "Escape") {
30997
+ if (event.key === "Escape" && closeOnEscape) {
30992
30998
  onCancel();
30993
30999
  }
30994
31000
  };
30995
31001
  window.addEventListener("keydown", handleKeyDown);
30996
31002
  return () => {
31003
+ document.body.style.overflow = previousOverflow;
30997
31004
  window.removeEventListener("keydown", handleKeyDown);
30998
31005
  };
30999
- }, [open, onCancel]);
31006
+ }, [open, onCancel, closeOnEscape]);
31000
31007
  if (!open) {
31001
31008
  return null;
31002
31009
  }
@@ -31005,11 +31012,15 @@ function Modal({
31005
31012
  footerLayout === "split" && "min-w-0 flex-1 basis-0",
31006
31013
  footerLayout !== "split" && buttonClassName
31007
31014
  );
31008
- return /* @__PURE__ */ jsxRuntime.jsx(
31015
+ const modal = /* @__PURE__ */ jsxRuntime.jsx(
31009
31016
  "div",
31010
31017
  {
31011
- className: "fixed inset-0 z-50 flex items-center justify-center p-4 backdrop-blur-[12px] bg-storm-gray-850/40",
31012
- onClick: closeOnBackdrop ? onCancel : void 0,
31018
+ className: "fixed inset-0 z-[100] flex items-center justify-center p-4 backdrop-blur-[12px] bg-storm-gray-850/40",
31019
+ onClick: closeOnBackdrop ? (event) => {
31020
+ if (event.target === event.currentTarget) {
31021
+ onCancel();
31022
+ }
31023
+ } : void 0,
31013
31024
  role: "presentation",
31014
31025
  children: /* @__PURE__ */ jsxRuntime.jsxs(
31015
31026
  "div",
@@ -31019,14 +31030,14 @@ function Modal({
31019
31030
  "aria-labelledby": "homepad-modal-title",
31020
31031
  ...subtitle ? { "aria-describedby": "homepad-modal-subtitle" } : {},
31021
31032
  className: cn(
31022
- "flex w-full max-w-2xl flex-col gap-6 rounded-2xl bg-white p-4 opacity-100 md:p-6",
31033
+ "flex max-h-[min(90dvh,calc(100dvh-2rem))] w-full max-w-2xl flex-col gap-6 rounded-2xl bg-white p-4 opacity-100 md:p-6",
31023
31034
  containerClassName
31024
31035
  ),
31025
31036
  onClick: (event) => {
31026
31037
  event.stopPropagation();
31027
31038
  },
31028
31039
  children: [
31029
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: cn("flex", icon ? "items-center gap-2.5" : void 0), children: [
31040
+ /* @__PURE__ */ jsxRuntime.jsxs("header", { className: cn("flex shrink-0", icon ? "items-center gap-2.5" : void 0), children: [
31030
31041
  icon ? /* @__PURE__ */ jsxRuntime.jsx(
31031
31042
  "div",
31032
31043
  {
@@ -31042,7 +31053,7 @@ function Modal({
31042
31053
  "h2",
31043
31054
  {
31044
31055
  id: "homepad-modal-title",
31045
- className: "font-sans text-lg font-bold leading-6 tracking-normal text-black",
31056
+ className: "typography-title-sm tracking-normal text-black",
31046
31057
  children: title
31047
31058
  }
31048
31059
  ),
@@ -31050,13 +31061,13 @@ function Modal({
31050
31061
  "p",
31051
31062
  {
31052
31063
  id: "homepad-modal-subtitle",
31053
- className: "font-sans text-xs font-normal leading-4 tracking-normal text-storm-gray-400",
31064
+ className: "typography-caption tracking-normal text-storm-gray-400",
31054
31065
  children: subtitle
31055
31066
  }
31056
31067
  ) : null
31057
31068
  ] })
31058
31069
  ] }),
31059
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-w-0", contentClassName), children }),
31070
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-h-0 min-w-0 flex-1 overflow-y-auto", contentClassName), children }),
31060
31071
  /* @__PURE__ */ jsxRuntime.jsxs(
31061
31072
  "footer",
31062
31073
  {
@@ -31095,6 +31106,7 @@ function Modal({
31095
31106
  )
31096
31107
  }
31097
31108
  );
31109
+ return typeof document !== "undefined" ? (0, import_react_dom2.createPortal)(modal, document.body) : modal;
31098
31110
  }
31099
31111
  var DRAWER_TRANSITION_MS = 300;
31100
31112
  function Drawer({
@@ -31198,7 +31210,7 @@ function Drawer({
31198
31210
  "h2",
31199
31211
  {
31200
31212
  id: "homepad-drawer-title",
31201
- className: "font-sans text-[18px] font-bold leading-6 tracking-normal text-black",
31213
+ className: "typography-title-sm tracking-normal text-black",
31202
31214
  children: title
31203
31215
  }
31204
31216
  ),
@@ -31206,7 +31218,7 @@ function Drawer({
31206
31218
  "p",
31207
31219
  {
31208
31220
  id: "homepad-drawer-subtitle",
31209
- className: "font-sans text-sm font-normal leading-[19px] tracking-normal text-storm-gray-400",
31221
+ className: "typography-body tracking-normal text-storm-gray-400",
31210
31222
  children: subtitle
31211
31223
  }
31212
31224
  ) : null
@@ -31282,8 +31294,8 @@ function HistoryTimeline({ events }) {
31282
31294
  ) : null
31283
31295
  ] }),
31284
31296
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2 pt-1.5", children: [
31285
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-sans text-sm font-medium leading-[19px] tracking-normal text-slate-blue", children: event.title }),
31286
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-sans text-xs font-normal leading-4 tracking-normal text-storm-gray-300", children: event.timestamp })
31297
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "typography-14 font-medium tracking-normal text-slate-blue", children: event.title }),
31298
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "typography-caption tracking-normal text-storm-gray-300", children: event.timestamp })
31287
31299
  ] })
31288
31300
  ] }, event.id);
31289
31301
  }) });
@@ -31534,7 +31546,7 @@ function ConfirmModal({
31534
31546
  "h2",
31535
31547
  {
31536
31548
  id: "homepad-confirm-modal-title",
31537
- className: "font-sans text-xl font-bold leading-6.75 tracking-normal text-black",
31549
+ className: "typography-title tracking-normal text-black",
31538
31550
  children: title
31539
31551
  }
31540
31552
  ),
@@ -31542,7 +31554,7 @@ function ConfirmModal({
31542
31554
  "div",
31543
31555
  {
31544
31556
  id: "homepad-confirm-modal-description",
31545
- className: "text-center font-sans text-sm font-normal leading-4.75 tracking-normal text-storm-gray-400",
31557
+ className: "text-center typography-body tracking-normal text-storm-gray-400",
31546
31558
  children: description
31547
31559
  }
31548
31560
  )