@scripso-homepad/ui 0.4.13 → 0.4.15
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-3G3ZKFHX.js} +27 -5
- package/dist/chunk-3G3ZKFHX.js.map +1 -0
- package/dist/index.cjs +66 -41
- 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 +51 -14
- 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 +27 -12
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Input.tsx +17 -1
- package/src/components/PhoneInput.tsx +37 -34
- package/src/theme/input.ts +11 -1
- package/src/web/components/Modal.tsx +5 -2
- package/src/web/components/TableActionsMenu.tsx +25 -6
- package/src/web/components/table/TablePrimitives.tsx +2 -1
- package/src/web/layout/AppHeader.tsx +15 -11
- package/dist/chunk-WFMQYYH6.js.map +0 -1
package/dist/web/index.d.cts
CHANGED
|
@@ -50,6 +50,7 @@ type AppHeaderProps = {
|
|
|
50
50
|
title: string;
|
|
51
51
|
labels: AdminHeaderLabels;
|
|
52
52
|
hasBuildingSelect?: boolean;
|
|
53
|
+
showSearch?: boolean;
|
|
53
54
|
buildingOptions?: AdminBuildingOption[];
|
|
54
55
|
selectedBuildingId?: string;
|
|
55
56
|
className?: string;
|
|
@@ -69,7 +70,7 @@ type AppHeaderProps = {
|
|
|
69
70
|
onNotificationsClick?: () => void;
|
|
70
71
|
onSearchChange?: (value: string) => void;
|
|
71
72
|
};
|
|
72
|
-
declare function AppHeader({ title, labels, hasBuildingSelect, buildingOptions, selectedBuildingId, className, buildingSelectClassName, searchClassName, notificationsButtonClassName, searchValue, searchFieldStyle, buildingIcon, notificationsIcon, searchIcon, buildingChevronIcon, buildingSelectDisabled, searchDisabled, notificationsDisabled, onBuildingChange, onNotificationsClick, onSearchChange, }: AppHeaderProps): react.JSX.Element;
|
|
73
|
+
declare function AppHeader({ title, labels, hasBuildingSelect, showSearch, buildingOptions, selectedBuildingId, className, buildingSelectClassName, searchClassName, notificationsButtonClassName, searchValue, searchFieldStyle, buildingIcon, notificationsIcon, searchIcon, buildingChevronIcon, buildingSelectDisabled, searchDisabled, notificationsDisabled, onBuildingChange, onNotificationsClick, onSearchChange, }: AppHeaderProps): react.JSX.Element;
|
|
73
74
|
|
|
74
75
|
type BuildingSelectProps = {
|
|
75
76
|
options: AdminBuildingOption[];
|
|
@@ -251,8 +252,12 @@ type TableActionsMenuProps = {
|
|
|
251
252
|
triggerAriaLabel: string;
|
|
252
253
|
className?: string;
|
|
253
254
|
menuClassName?: string;
|
|
255
|
+
/** Dropdown menu width in pixels. Defaults to 231. Ignored when menuFitContent is true. */
|
|
256
|
+
menuWidth?: number;
|
|
257
|
+
/** Size the menu to its content width instead of a fixed pixel width. */
|
|
258
|
+
menuFitContent?: boolean;
|
|
254
259
|
};
|
|
255
|
-
declare function TableActionsMenu({ items, triggerAriaLabel, className, menuClassName, }: TableActionsMenuProps): react.JSX.Element | null;
|
|
260
|
+
declare function TableActionsMenu({ items, triggerAriaLabel, className, menuClassName, menuWidth, menuFitContent, }: TableActionsMenuProps): react.JSX.Element | null;
|
|
256
261
|
|
|
257
262
|
type TableRowActionsConfig = {
|
|
258
263
|
status: ReactNode;
|
package/dist/web/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ type AppHeaderProps = {
|
|
|
50
50
|
title: string;
|
|
51
51
|
labels: AdminHeaderLabels;
|
|
52
52
|
hasBuildingSelect?: boolean;
|
|
53
|
+
showSearch?: boolean;
|
|
53
54
|
buildingOptions?: AdminBuildingOption[];
|
|
54
55
|
selectedBuildingId?: string;
|
|
55
56
|
className?: string;
|
|
@@ -69,7 +70,7 @@ type AppHeaderProps = {
|
|
|
69
70
|
onNotificationsClick?: () => void;
|
|
70
71
|
onSearchChange?: (value: string) => void;
|
|
71
72
|
};
|
|
72
|
-
declare function AppHeader({ title, labels, hasBuildingSelect, buildingOptions, selectedBuildingId, className, buildingSelectClassName, searchClassName, notificationsButtonClassName, searchValue, searchFieldStyle, buildingIcon, notificationsIcon, searchIcon, buildingChevronIcon, buildingSelectDisabled, searchDisabled, notificationsDisabled, onBuildingChange, onNotificationsClick, onSearchChange, }: AppHeaderProps): react.JSX.Element;
|
|
73
|
+
declare function AppHeader({ title, labels, hasBuildingSelect, showSearch, buildingOptions, selectedBuildingId, className, buildingSelectClassName, searchClassName, notificationsButtonClassName, searchValue, searchFieldStyle, buildingIcon, notificationsIcon, searchIcon, buildingChevronIcon, buildingSelectDisabled, searchDisabled, notificationsDisabled, onBuildingChange, onNotificationsClick, onSearchChange, }: AppHeaderProps): react.JSX.Element;
|
|
73
74
|
|
|
74
75
|
type BuildingSelectProps = {
|
|
75
76
|
options: AdminBuildingOption[];
|
|
@@ -251,8 +252,12 @@ type TableActionsMenuProps = {
|
|
|
251
252
|
triggerAriaLabel: string;
|
|
252
253
|
className?: string;
|
|
253
254
|
menuClassName?: string;
|
|
255
|
+
/** Dropdown menu width in pixels. Defaults to 231. Ignored when menuFitContent is true. */
|
|
256
|
+
menuWidth?: number;
|
|
257
|
+
/** Size the menu to its content width instead of a fixed pixel width. */
|
|
258
|
+
menuFitContent?: boolean;
|
|
254
259
|
};
|
|
255
|
-
declare function TableActionsMenu({ items, triggerAriaLabel, className, menuClassName, }: TableActionsMenuProps): react.JSX.Element | null;
|
|
260
|
+
declare function TableActionsMenu({ items, triggerAriaLabel, className, menuClassName, menuWidth, menuFitContent, }: TableActionsMenuProps): react.JSX.Element | null;
|
|
256
261
|
|
|
257
262
|
type TableRowActionsConfig = {
|
|
258
263
|
status: ReactNode;
|
package/dist/web/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __commonJS, __require, __toESM, Input, Button } from '../chunk-
|
|
1
|
+
import { __commonJS, __require, __toESM, Input, Button } from '../chunk-3G3ZKFHX.js';
|
|
2
2
|
import { ChevronsUpDown, Search, LogOut, PanelLeftClose, PanelLeftOpen, X, Menu, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -28782,6 +28782,7 @@ function AppHeader({
|
|
|
28782
28782
|
title,
|
|
28783
28783
|
labels,
|
|
28784
28784
|
hasBuildingSelect = false,
|
|
28785
|
+
showSearch = true,
|
|
28785
28786
|
buildingOptions = [],
|
|
28786
28787
|
selectedBuildingId = "",
|
|
28787
28788
|
className,
|
|
@@ -28824,7 +28825,7 @@ function AppHeader({
|
|
|
28824
28825
|
chevronIcon: buildingChevronIcon
|
|
28825
28826
|
}
|
|
28826
28827
|
) : null,
|
|
28827
|
-
/* @__PURE__ */ jsx(
|
|
28828
|
+
showSearch ? /* @__PURE__ */ jsx(
|
|
28828
28829
|
Input,
|
|
28829
28830
|
{
|
|
28830
28831
|
leftIcon: searchIcon ?? /* @__PURE__ */ jsx(Search, { strokeWidth: 1.75 }),
|
|
@@ -28837,7 +28838,7 @@ function AppHeader({
|
|
|
28837
28838
|
fieldStyle: searchFieldStyle ?? defaultSearchFieldStyle,
|
|
28838
28839
|
accessibilityLabel: labels.searchPlaceholder
|
|
28839
28840
|
}
|
|
28840
|
-
),
|
|
28841
|
+
) : null,
|
|
28841
28842
|
/* @__PURE__ */ jsx(
|
|
28842
28843
|
"button",
|
|
28843
28844
|
{
|
|
@@ -29818,7 +29819,8 @@ function TableActionsCell({ className, children, ...props }) {
|
|
|
29818
29819
|
tableCellPaddingClassName,
|
|
29819
29820
|
tableBodyClassName,
|
|
29820
29821
|
tableStickyRightShadowClassName,
|
|
29821
|
-
|
|
29822
|
+
// Keep an opaque sticky background so scrolled cells never bleed through.
|
|
29823
|
+
disabled && "bg-white [&>*]:opacity-70",
|
|
29822
29824
|
className
|
|
29823
29825
|
),
|
|
29824
29826
|
...props,
|
|
@@ -29876,12 +29878,12 @@ var MENU_WIDTH_PX = 231;
|
|
|
29876
29878
|
var MENU_OFFSET_PX = 4;
|
|
29877
29879
|
var MENU_VIEWPORT_MARGIN_PX = 8;
|
|
29878
29880
|
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
29879
|
-
function clampMenuLeft(left) {
|
|
29881
|
+
function clampMenuLeft(left, menuWidth) {
|
|
29880
29882
|
if (typeof window === "undefined") {
|
|
29881
29883
|
return left;
|
|
29882
29884
|
}
|
|
29883
29885
|
const minLeft = MENU_VIEWPORT_MARGIN_PX;
|
|
29884
|
-
const maxLeft = Math.max(minLeft, window.innerWidth -
|
|
29886
|
+
const maxLeft = Math.max(minLeft, window.innerWidth - menuWidth - MENU_VIEWPORT_MARGIN_PX);
|
|
29885
29887
|
return Math.min(Math.max(left, minLeft), maxLeft);
|
|
29886
29888
|
}
|
|
29887
29889
|
function resolveMenuItemIcon(item) {
|
|
@@ -29901,7 +29903,9 @@ function TableActionsMenu({
|
|
|
29901
29903
|
items,
|
|
29902
29904
|
triggerAriaLabel,
|
|
29903
29905
|
className,
|
|
29904
|
-
menuClassName
|
|
29906
|
+
menuClassName,
|
|
29907
|
+
menuWidth = MENU_WIDTH_PX,
|
|
29908
|
+
menuFitContent = false
|
|
29905
29909
|
}) {
|
|
29906
29910
|
const [open, setOpen] = useState(false);
|
|
29907
29911
|
const [menuPosition, setMenuPosition] = useState(null);
|
|
@@ -29918,11 +29922,12 @@ function TableActionsMenu({
|
|
|
29918
29922
|
return;
|
|
29919
29923
|
}
|
|
29920
29924
|
const rect = trigger.getBoundingClientRect();
|
|
29925
|
+
const resolvedMenuWidth = menuFitContent ? menuRef.current?.getBoundingClientRect().width ?? menuWidth : menuWidth;
|
|
29921
29926
|
setMenuPosition({
|
|
29922
29927
|
top: rect.bottom + MENU_OFFSET_PX,
|
|
29923
|
-
left: clampMenuLeft(rect.right -
|
|
29928
|
+
left: clampMenuLeft(rect.right - resolvedMenuWidth, resolvedMenuWidth)
|
|
29924
29929
|
});
|
|
29925
|
-
}, []);
|
|
29930
|
+
}, [menuFitContent, menuWidth]);
|
|
29926
29931
|
useOnClickOutside([rootRef, menuRef], closeMenu, open);
|
|
29927
29932
|
useIsomorphicLayoutEffect(() => {
|
|
29928
29933
|
if (!open) {
|
|
@@ -29931,6 +29936,12 @@ function TableActionsMenu({
|
|
|
29931
29936
|
}
|
|
29932
29937
|
updateMenuPosition();
|
|
29933
29938
|
}, [open, updateMenuPosition]);
|
|
29939
|
+
useIsomorphicLayoutEffect(() => {
|
|
29940
|
+
if (!open || !menuFitContent) {
|
|
29941
|
+
return;
|
|
29942
|
+
}
|
|
29943
|
+
updateMenuPosition();
|
|
29944
|
+
}, [items, menuFitContent, open, updateMenuPosition]);
|
|
29934
29945
|
useEffect(() => {
|
|
29935
29946
|
if (!open) {
|
|
29936
29947
|
return;
|
|
@@ -29966,7 +29977,7 @@ function TableActionsMenu({
|
|
|
29966
29977
|
position: "fixed",
|
|
29967
29978
|
top: menuPosition.top,
|
|
29968
29979
|
left: menuPosition.left,
|
|
29969
|
-
width:
|
|
29980
|
+
...menuFitContent ? { width: "max-content" } : { width: menuWidth }
|
|
29970
29981
|
},
|
|
29971
29982
|
className: cn(
|
|
29972
29983
|
"z-50 overflow-hidden rounded-2xl border border-storm-gray-50 bg-white shadow-[0_4px_20px_0_rgba(0,0,0,0.05)]",
|
|
@@ -29988,7 +29999,8 @@ function TableActionsMenu({
|
|
|
29988
29999
|
item.onSelect();
|
|
29989
30000
|
},
|
|
29990
30001
|
className: cn(
|
|
29991
|
-
"flex h-[51px]
|
|
30002
|
+
"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",
|
|
30003
|
+
menuFitContent ? "w-auto" : "w-full",
|
|
29992
30004
|
index > 0 && "border-t border-storm-gray-50",
|
|
29993
30005
|
item.disabled && "cursor-not-allowed opacity-50"
|
|
29994
30006
|
),
|
|
@@ -30362,7 +30374,10 @@ function Modal({
|
|
|
30362
30374
|
"footer",
|
|
30363
30375
|
{
|
|
30364
30376
|
className: cn(
|
|
30365
|
-
footerLayout === "split" ? "grid w-full shrink-0 grid-cols-
|
|
30377
|
+
footerLayout === "split" ? "grid w-full shrink-0 grid-cols-1 gap-3 min-[400px]:grid-cols-2 min-[400px]:gap-4" : cn(
|
|
30378
|
+
"flex shrink-0 flex-col-reverse gap-3 sm:flex-row sm:gap-4",
|
|
30379
|
+
footerAlignClasses[footerAlign]
|
|
30380
|
+
)
|
|
30366
30381
|
),
|
|
30367
30382
|
children: [
|
|
30368
30383
|
/* @__PURE__ */ jsx(
|