@scripso-homepad/ui 0.4.13 → 0.4.14
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/README.md +2 -1
- package/dist/{chunk-WFMQYYH6.js → chunk-ANDWP4YU.js} +12 -3
- package/dist/chunk-ANDWP4YU.js.map +1 -0
- package/dist/index.cjs +51 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +43 -40
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +30 -10
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +7 -2
- package/dist/web/index.d.ts +7 -2
- package/dist/web/index.js +21 -10
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Input.tsx +8 -1
- package/src/components/PhoneInput.tsx +37 -34
- package/src/web/components/TableActionsMenu.tsx +25 -6
- package/src/web/layout/AppHeader.tsx +15 -11
- package/dist/chunk-WFMQYYH6.js.map +0 -1
package/dist/web/index.cjs
CHANGED
|
@@ -28870,6 +28870,7 @@ function Input({
|
|
|
28870
28870
|
fieldClassName,
|
|
28871
28871
|
fieldStyle,
|
|
28872
28872
|
labelClassName,
|
|
28873
|
+
labelStyles,
|
|
28873
28874
|
inputClassName,
|
|
28874
28875
|
errorClassName,
|
|
28875
28876
|
hintClassName,
|
|
@@ -28931,7 +28932,15 @@ function Input({
|
|
|
28931
28932
|
}
|
|
28932
28933
|
) : rightIcon ? renderInputIcon(rightIcon, iconColor) : null;
|
|
28933
28934
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: wrapperRef, style: [styles2.wrapper, containerStyle], children: [
|
|
28934
|
-
label ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
28935
|
+
label ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
28936
|
+
Label,
|
|
28937
|
+
{
|
|
28938
|
+
disabled: isDisabled,
|
|
28939
|
+
className: labelClassName,
|
|
28940
|
+
style: labelStyles,
|
|
28941
|
+
children: label
|
|
28942
|
+
}
|
|
28943
|
+
) : null,
|
|
28935
28944
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: fieldStyles.outline, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
28936
28945
|
reactNative.View,
|
|
28937
28946
|
{
|
|
@@ -29295,6 +29304,7 @@ function AppHeader({
|
|
|
29295
29304
|
title,
|
|
29296
29305
|
labels,
|
|
29297
29306
|
hasBuildingSelect = false,
|
|
29307
|
+
showSearch = true,
|
|
29298
29308
|
buildingOptions = [],
|
|
29299
29309
|
selectedBuildingId = "",
|
|
29300
29310
|
className,
|
|
@@ -29337,7 +29347,7 @@ function AppHeader({
|
|
|
29337
29347
|
chevronIcon: buildingChevronIcon
|
|
29338
29348
|
}
|
|
29339
29349
|
) : null,
|
|
29340
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29350
|
+
showSearch ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
29341
29351
|
Input,
|
|
29342
29352
|
{
|
|
29343
29353
|
leftIcon: searchIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { strokeWidth: 1.75 }),
|
|
@@ -29350,7 +29360,7 @@ function AppHeader({
|
|
|
29350
29360
|
fieldStyle: searchFieldStyle ?? defaultSearchFieldStyle,
|
|
29351
29361
|
accessibilityLabel: labels.searchPlaceholder
|
|
29352
29362
|
}
|
|
29353
|
-
),
|
|
29363
|
+
) : null,
|
|
29354
29364
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29355
29365
|
"button",
|
|
29356
29366
|
{
|
|
@@ -30389,12 +30399,12 @@ var MENU_WIDTH_PX = 231;
|
|
|
30389
30399
|
var MENU_OFFSET_PX = 4;
|
|
30390
30400
|
var MENU_VIEWPORT_MARGIN_PX = 8;
|
|
30391
30401
|
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
30392
|
-
function clampMenuLeft(left) {
|
|
30402
|
+
function clampMenuLeft(left, menuWidth) {
|
|
30393
30403
|
if (typeof window === "undefined") {
|
|
30394
30404
|
return left;
|
|
30395
30405
|
}
|
|
30396
30406
|
const minLeft = MENU_VIEWPORT_MARGIN_PX;
|
|
30397
|
-
const maxLeft = Math.max(minLeft, window.innerWidth -
|
|
30407
|
+
const maxLeft = Math.max(minLeft, window.innerWidth - menuWidth - MENU_VIEWPORT_MARGIN_PX);
|
|
30398
30408
|
return Math.min(Math.max(left, minLeft), maxLeft);
|
|
30399
30409
|
}
|
|
30400
30410
|
function resolveMenuItemIcon(item) {
|
|
@@ -30414,7 +30424,9 @@ function TableActionsMenu({
|
|
|
30414
30424
|
items,
|
|
30415
30425
|
triggerAriaLabel,
|
|
30416
30426
|
className,
|
|
30417
|
-
menuClassName
|
|
30427
|
+
menuClassName,
|
|
30428
|
+
menuWidth = MENU_WIDTH_PX,
|
|
30429
|
+
menuFitContent = false
|
|
30418
30430
|
}) {
|
|
30419
30431
|
const [open, setOpen] = react.useState(false);
|
|
30420
30432
|
const [menuPosition, setMenuPosition] = react.useState(null);
|
|
@@ -30431,11 +30443,12 @@ function TableActionsMenu({
|
|
|
30431
30443
|
return;
|
|
30432
30444
|
}
|
|
30433
30445
|
const rect = trigger.getBoundingClientRect();
|
|
30446
|
+
const resolvedMenuWidth = menuFitContent ? menuRef.current?.getBoundingClientRect().width ?? menuWidth : menuWidth;
|
|
30434
30447
|
setMenuPosition({
|
|
30435
30448
|
top: rect.bottom + MENU_OFFSET_PX,
|
|
30436
|
-
left: clampMenuLeft(rect.right -
|
|
30449
|
+
left: clampMenuLeft(rect.right - resolvedMenuWidth, resolvedMenuWidth)
|
|
30437
30450
|
});
|
|
30438
|
-
}, []);
|
|
30451
|
+
}, [menuFitContent, menuWidth]);
|
|
30439
30452
|
useOnClickOutside([rootRef, menuRef], closeMenu, open);
|
|
30440
30453
|
useIsomorphicLayoutEffect(() => {
|
|
30441
30454
|
if (!open) {
|
|
@@ -30444,6 +30457,12 @@ function TableActionsMenu({
|
|
|
30444
30457
|
}
|
|
30445
30458
|
updateMenuPosition();
|
|
30446
30459
|
}, [open, updateMenuPosition]);
|
|
30460
|
+
useIsomorphicLayoutEffect(() => {
|
|
30461
|
+
if (!open || !menuFitContent) {
|
|
30462
|
+
return;
|
|
30463
|
+
}
|
|
30464
|
+
updateMenuPosition();
|
|
30465
|
+
}, [items, menuFitContent, open, updateMenuPosition]);
|
|
30447
30466
|
react.useEffect(() => {
|
|
30448
30467
|
if (!open) {
|
|
30449
30468
|
return;
|
|
@@ -30479,7 +30498,7 @@ function TableActionsMenu({
|
|
|
30479
30498
|
position: "fixed",
|
|
30480
30499
|
top: menuPosition.top,
|
|
30481
30500
|
left: menuPosition.left,
|
|
30482
|
-
width:
|
|
30501
|
+
...menuFitContent ? { width: "max-content" } : { width: menuWidth }
|
|
30483
30502
|
},
|
|
30484
30503
|
className: cn(
|
|
30485
30504
|
"z-50 overflow-hidden rounded-2xl border border-storm-gray-50 bg-white shadow-[0_4px_20px_0_rgba(0,0,0,0.05)]",
|
|
@@ -30501,7 +30520,8 @@ function TableActionsMenu({
|
|
|
30501
30520
|
item.onSelect();
|
|
30502
30521
|
},
|
|
30503
30522
|
className: cn(
|
|
30504
|
-
"flex h-[51px]
|
|
30523
|
+
"flex h-[51px] 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",
|
|
30524
|
+
menuFitContent ? "w-auto" : "w-full",
|
|
30505
30525
|
index > 0 && "border-t border-storm-gray-50",
|
|
30506
30526
|
item.disabled && "cursor-not-allowed opacity-50"
|
|
30507
30527
|
),
|