@scripso-homepad/ui 0.4.23 → 0.4.25

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.
@@ -29069,8 +29069,8 @@ var styles2 = reactNative.StyleSheet.create({
29069
29069
  gap: spacing.sm
29070
29070
  },
29071
29071
  iconSlot: {
29072
- width: INPUT_ICON_SIZE,
29073
- height: INPUT_ICON_SIZE,
29072
+ minWidth: INPUT_ICON_SIZE,
29073
+ minHeight: INPUT_ICON_SIZE,
29074
29074
  alignItems: "center",
29075
29075
  justifyContent: "center",
29076
29076
  flexShrink: 0
@@ -29212,6 +29212,24 @@ function useOnClickOutside(ref, handler, enabled = true) {
29212
29212
  };
29213
29213
  }, [enabled]);
29214
29214
  }
29215
+ function useTruncatedTitle(text) {
29216
+ const ref = react.useRef(null);
29217
+ const [isTruncated, setIsTruncated] = react.useState(false);
29218
+ react.useLayoutEffect(() => {
29219
+ const element = ref.current;
29220
+ if (!element) {
29221
+ return;
29222
+ }
29223
+ const update = () => {
29224
+ setIsTruncated(element.scrollWidth > element.clientWidth + 1);
29225
+ };
29226
+ update();
29227
+ const observer = new ResizeObserver(update);
29228
+ observer.observe(element);
29229
+ return () => observer.disconnect();
29230
+ }, [text]);
29231
+ return { ref, title: isTruncated ? text : void 0 };
29232
+ }
29215
29233
  function BuildingSelect({
29216
29234
  options,
29217
29235
  value,
@@ -29230,6 +29248,7 @@ function BuildingSelect({
29230
29248
  const selectedOption = options.find((option) => option.value === value);
29231
29249
  const displayLabel = selectedOption?.label ?? labels.selectBuilding;
29232
29250
  const selectableOptions = options.filter((option) => !option.disabled);
29251
+ const { ref: labelRef, title: truncatedTitle } = useTruncatedTitle(displayLabel);
29233
29252
  const closeMenu = react.useCallback(() => {
29234
29253
  setOpen(false);
29235
29254
  setHighlightedIndex(-1);
@@ -29300,7 +29319,7 @@ function BuildingSelect({
29300
29319
  break;
29301
29320
  }
29302
29321
  };
29303
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: cn("relative w-57.5", className), children: [
29322
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: cn("relative w-72", className), children: [
29304
29323
  /* @__PURE__ */ jsxRuntime.jsxs(
29305
29324
  "button",
29306
29325
  {
@@ -29310,17 +29329,25 @@ function BuildingSelect({
29310
29329
  "aria-expanded": open,
29311
29330
  "aria-controls": listboxId,
29312
29331
  "aria-label": labels.selectBuilding,
29332
+ title: truncatedTitle,
29313
29333
  onClick: () => open ? closeMenu() : openMenu(),
29314
29334
  onKeyDown: handleTriggerKeyDown,
29315
29335
  className: cn(
29316
- "flex h-11 w-full items-center gap-3 rounded-xl border border-storm-gray-50 bg-white p-3 text-left transition-colors",
29336
+ "flex h-11 w-full items-center gap-3 rounded-xl border border-storm-gray-50 bg-white px-3.5 py-3 text-left transition-colors",
29317
29337
  !disabled && "cursor-pointer hover:bg-storm-gray-50/60",
29318
29338
  open && "bg-storm-gray-50/60",
29319
29339
  disabled && "cursor-not-allowed opacity-60"
29320
29340
  ),
29321
29341
  children: [
29322
- buildingIcon ?? /* @__PURE__ */ jsxRuntime.jsx(BuildingIcon, { className: "shrink-0 text-navy" }),
29323
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate typography-14 font-medium text-slate-blue", children: displayLabel }),
29342
+ buildingIcon ?? /* @__PURE__ */ jsxRuntime.jsx(BuildingIcon, { className: "size-5 shrink-0 text-navy" }),
29343
+ /* @__PURE__ */ jsxRuntime.jsx(
29344
+ "span",
29345
+ {
29346
+ ref: labelRef,
29347
+ className: "min-w-0 flex-1 truncate typography-14 font-medium text-slate-blue",
29348
+ children: displayLabel
29349
+ }
29350
+ ),
29324
29351
  chevronIcon ?? /* @__PURE__ */ jsxRuntime.jsx(
29325
29352
  lucideReact.ChevronsUpDown,
29326
29353
  {
@@ -29373,7 +29400,7 @@ function BuildingSelect({
29373
29400
  (isSelected || isHighlighted) && !option.disabled && "bg-storm-gray-50",
29374
29401
  option.disabled && "cursor-not-allowed opacity-50"
29375
29402
  ),
29376
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: option.label })
29403
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", title: option.label, children: option.label })
29377
29404
  }
29378
29405
  ) }, option.value);
29379
29406
  })
@@ -30265,10 +30292,6 @@ function Pagination({
30265
30292
 
30266
30293
  // src/web/components/table/constants.ts
30267
30294
  var tableBorderClassName = "border-storm-gray-50";
30268
- var tableStickyRightShadowClassName = "table-sticky-right-shadow";
30269
- var tableStickyRightHeadClassName = "table-sticky-right-head";
30270
- var tableScrollAtEndClassName = "table-scroll-at-end";
30271
- var tableScrollHasOverflowClassName = "table-scroll-has-overflow";
30272
30295
  var tableRowDisabledCellClassName = "bg-[#ECEEF0]/30 [&>*]:opacity-70";
30273
30296
  var DEFAULT_TABLE_BODY_MIN_HEIGHT = 320;
30274
30297
  var tableCellPaddingClassName = "px-3 py-3";
@@ -30367,7 +30390,6 @@ function resolveAriaSort(sortDirection, isSortable) {
30367
30390
  function TableHead({
30368
30391
  className,
30369
30392
  align = "left",
30370
- stickyRight = false,
30371
30393
  sortable = false,
30372
30394
  sortDirection = null,
30373
30395
  onSort,
@@ -30397,11 +30419,6 @@ function TableHead({
30397
30419
  "sticky top-0 z-10",
30398
30420
  tableHeadPaddingClassName,
30399
30421
  tableHeaderClassName,
30400
- stickyRight && [
30401
- "sticky right-0 z-20",
30402
- tableStickyRightHeadClassName,
30403
- tableStickyRightShadowClassName
30404
- ],
30405
30422
  !isSortable && tableAlignClasses[align],
30406
30423
  className
30407
30424
  ),
@@ -30442,16 +30459,14 @@ function TableActionsCell({ className, children, ...props }) {
30442
30459
  "td",
30443
30460
  {
30444
30461
  className: cn(
30445
- "sticky right-0 z-10 whitespace-nowrap bg-white",
30462
+ "whitespace-nowrap",
30446
30463
  tableCellPaddingClassName,
30447
30464
  tableBodyClassName,
30448
- tableStickyRightShadowClassName,
30449
- // Keep an opaque sticky background so scrolled cells never bleed through.
30450
- disabled && "bg-white [&>*]:opacity-70",
30465
+ disabled && tableRowDisabledCellClassName,
30451
30466
  className
30452
30467
  ),
30453
30468
  ...props,
30454
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-[1] flex items-center justify-end gap-2", children })
30469
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end gap-2", children })
30455
30470
  }
30456
30471
  );
30457
30472
  }
@@ -30688,57 +30703,6 @@ function TableStatusActionsCell({
30688
30703
  }
30689
30704
  );
30690
30705
  }
30691
- var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
30692
- function getHorizontalScrollState(element) {
30693
- const inner = element.firstElementChild;
30694
- const table = inner?.querySelector("table");
30695
- const contentWidth = table?.scrollWidth ?? inner?.scrollWidth ?? element.scrollWidth;
30696
- const viewportWidth = element.clientWidth;
30697
- const maxScrollLeft = element.scrollWidth - element.clientWidth;
30698
- const hasOverflow = contentWidth > viewportWidth + 1;
30699
- const atEnd = !hasOverflow || element.scrollLeft >= maxScrollLeft - 1;
30700
- return { hasOverflow, atEnd };
30701
- }
30702
- function useHorizontalScrollState() {
30703
- const scrollRef = react.useRef(null);
30704
- const [scrollState, setScrollState] = react.useState({
30705
- hasOverflow: false,
30706
- atEnd: true
30707
- });
30708
- const updateScrollState = react.useCallback(() => {
30709
- const element = scrollRef.current;
30710
- if (!element) {
30711
- return;
30712
- }
30713
- setScrollState(getHorizontalScrollState(element));
30714
- }, []);
30715
- useIsomorphicLayoutEffect2(() => {
30716
- const element = scrollRef.current;
30717
- if (!element) {
30718
- return;
30719
- }
30720
- updateScrollState();
30721
- element.addEventListener("scroll", updateScrollState, { passive: true });
30722
- if (typeof ResizeObserver === "undefined") {
30723
- window.addEventListener("resize", updateScrollState);
30724
- return () => {
30725
- element.removeEventListener("scroll", updateScrollState);
30726
- window.removeEventListener("resize", updateScrollState);
30727
- };
30728
- }
30729
- const resizeObserver = new ResizeObserver(updateScrollState);
30730
- resizeObserver.observe(element);
30731
- const inner = element.firstElementChild;
30732
- if (inner) {
30733
- resizeObserver.observe(inner);
30734
- }
30735
- return () => {
30736
- element.removeEventListener("scroll", updateScrollState);
30737
- resizeObserver.disconnect();
30738
- };
30739
- }, [updateScrollState]);
30740
- return { scrollRef, scrollState };
30741
- }
30742
30706
  function TableScrollArea({
30743
30707
  children,
30744
30708
  minWidth = 980,
@@ -30747,15 +30711,11 @@ function TableScrollArea({
30747
30711
  height,
30748
30712
  fillHeight = false
30749
30713
  }) {
30750
- const { scrollRef, scrollState } = useHorizontalScrollState();
30751
30714
  return /* @__PURE__ */ jsxRuntime.jsx(
30752
30715
  "div",
30753
30716
  {
30754
- ref: scrollRef,
30755
30717
  className: cn(
30756
30718
  "table-scroll-area w-full overflow-auto",
30757
- scrollState.hasOverflow && tableScrollHasOverflowClassName,
30758
- scrollState.atEnd && tableScrollAtEndClassName,
30759
30719
  fillHeight && "min-h-0 flex-1",
30760
30720
  className
30761
30721
  ),
@@ -31190,7 +31150,7 @@ function Modal({
31190
31150
  ) : null
31191
31151
  ] })
31192
31152
  ] }),
31193
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-h-0 min-w-0 flex-1 overflow-y-auto", contentClassName), children }),
31153
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("drawer-scroll-area min-h-0 min-w-0 flex-1 overflow-y-auto", contentClassName), children }),
31194
31154
  /* @__PURE__ */ jsxRuntime.jsxs(
31195
31155
  "footer",
31196
31156
  {