@scripso-homepad/ui 0.4.12 → 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-YSDLHEJ7.js → chunk-ANDWP4YU.js} +27 -10
- package/dist/chunk-ANDWP4YU.js.map +1 -0
- package/dist/index.cjs +79 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -5
- package/dist/index.d.ts +40 -5
- package/dist/index.js +56 -52
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +68 -47
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.css +2 -2
- package/dist/web/index.css.map +1 -1
- package/dist/web/index.d.cts +9 -2
- package/dist/web/index.d.ts +9 -2
- package/dist/web/index.js +50 -40
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CountryCodeSelector.tsx +2 -1
- package/src/components/DatePicker.tsx +2 -2
- package/src/components/Input.tsx +8 -1
- package/src/components/PhoneInput.tsx +37 -34
- package/src/components/Select.tsx +2 -2
- package/src/index.ts +1 -0
- package/src/theme/calendar.ts +6 -6
- package/src/theme/tokens.ts +21 -7
- package/src/web/components/Drawer.stories.tsx +1 -1
- package/src/web/components/TableActionsMenu.tsx +25 -6
- package/src/web/components/sonner-toast.css +2 -2
- package/src/web/components/table/TablePrimitives.tsx +5 -1
- package/src/web/icons/TableMenuActivateIcon.tsx +2 -2
- package/src/web/icons/TableMenuEditIcon.tsx +2 -2
- package/src/web/icons/TableMenuSuspendIcon.tsx +2 -9
- package/src/web/layout/AppHeader.tsx +15 -11
- package/src/web/mutation-toast.ts +14 -2
- package/dist/chunk-YSDLHEJ7.js.map +0 -1
package/dist/web/index.cjs
CHANGED
|
@@ -28616,8 +28616,10 @@ var radii = {
|
|
|
28616
28616
|
var spacing = {
|
|
28617
28617
|
sm: 8};
|
|
28618
28618
|
var fontSize = {
|
|
28619
|
-
sm: 12,
|
|
28620
28619
|
md: 14};
|
|
28620
|
+
var typographyScale = {
|
|
28621
|
+
12: { fontSize: 12, lineHeight: 16 },
|
|
28622
|
+
14: { fontSize: 14, lineHeight: 19 }};
|
|
28621
28623
|
var fontWeight = {
|
|
28622
28624
|
medium: "500",
|
|
28623
28625
|
semibold: "600"};
|
|
@@ -28626,24 +28628,24 @@ var fonts = {
|
|
|
28626
28628
|
};
|
|
28627
28629
|
var labelTypography = {
|
|
28628
28630
|
fontFamily: fonts.sans,
|
|
28629
|
-
fontSize: fontSize
|
|
28631
|
+
fontSize: typographyScale[12].fontSize,
|
|
28630
28632
|
fontWeight: fontWeight.medium,
|
|
28631
|
-
lineHeight:
|
|
28633
|
+
lineHeight: typographyScale[12].lineHeight,
|
|
28632
28634
|
letterSpacing: 0
|
|
28633
28635
|
};
|
|
28634
28636
|
var buttonTypography = {
|
|
28635
28637
|
lg: {
|
|
28636
28638
|
fontFamily: fonts.sans,
|
|
28637
|
-
fontSize: 14,
|
|
28639
|
+
fontSize: typographyScale[14].fontSize,
|
|
28638
28640
|
fontWeight: fontWeight.semibold,
|
|
28639
|
-
lineHeight:
|
|
28641
|
+
lineHeight: typographyScale[14].lineHeight,
|
|
28640
28642
|
letterSpacing: 0
|
|
28641
28643
|
},
|
|
28642
28644
|
sm: {
|
|
28643
28645
|
fontFamily: fonts.sans,
|
|
28644
|
-
fontSize: 12,
|
|
28646
|
+
fontSize: typographyScale[12].fontSize,
|
|
28645
28647
|
fontWeight: fontWeight.semibold,
|
|
28646
|
-
lineHeight:
|
|
28648
|
+
lineHeight: typographyScale[12].lineHeight,
|
|
28647
28649
|
letterSpacing: 0
|
|
28648
28650
|
}
|
|
28649
28651
|
};
|
|
@@ -28868,6 +28870,7 @@ function Input({
|
|
|
28868
28870
|
fieldClassName,
|
|
28869
28871
|
fieldStyle,
|
|
28870
28872
|
labelClassName,
|
|
28873
|
+
labelStyles,
|
|
28871
28874
|
inputClassName,
|
|
28872
28875
|
errorClassName,
|
|
28873
28876
|
hintClassName,
|
|
@@ -28929,7 +28932,15 @@ function Input({
|
|
|
28929
28932
|
}
|
|
28930
28933
|
) : rightIcon ? renderInputIcon(rightIcon, iconColor) : null;
|
|
28931
28934
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: wrapperRef, style: [styles2.wrapper, containerStyle], children: [
|
|
28932
|
-
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,
|
|
28933
28944
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: fieldStyles.outline, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
28934
28945
|
reactNative.View,
|
|
28935
28946
|
{
|
|
@@ -29293,6 +29304,7 @@ function AppHeader({
|
|
|
29293
29304
|
title,
|
|
29294
29305
|
labels,
|
|
29295
29306
|
hasBuildingSelect = false,
|
|
29307
|
+
showSearch = true,
|
|
29296
29308
|
buildingOptions = [],
|
|
29297
29309
|
selectedBuildingId = "",
|
|
29298
29310
|
className,
|
|
@@ -29335,7 +29347,7 @@ function AppHeader({
|
|
|
29335
29347
|
chevronIcon: buildingChevronIcon
|
|
29336
29348
|
}
|
|
29337
29349
|
) : null,
|
|
29338
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29350
|
+
showSearch ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
29339
29351
|
Input,
|
|
29340
29352
|
{
|
|
29341
29353
|
leftIcon: searchIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { strokeWidth: 1.75 }),
|
|
@@ -29348,7 +29360,7 @@ function AppHeader({
|
|
|
29348
29360
|
fieldStyle: searchFieldStyle ?? defaultSearchFieldStyle,
|
|
29349
29361
|
accessibilityLabel: labels.searchPlaceholder
|
|
29350
29362
|
}
|
|
29351
|
-
),
|
|
29363
|
+
) : null,
|
|
29352
29364
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29353
29365
|
"button",
|
|
29354
29366
|
{
|
|
@@ -29916,9 +29928,9 @@ function TableMenuActivateIcon({ className }) {
|
|
|
29916
29928
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29917
29929
|
"path",
|
|
29918
29930
|
{
|
|
29919
|
-
d: "
|
|
29931
|
+
d: "M5.83333 9.16631V5.83297C5.83229 4.79968 6.21523 3.80286 6.90781 3.03603C7.60039 2.2692 8.55319 1.78706 9.58125 1.68321C10.6093 1.57937 11.6393 1.86123 12.4712 2.47407C13.3032 3.08691 13.8777 3.98701 14.0833 4.99964M4.16667 9.16631H15.8333C16.7538 9.16631 17.5 9.9125 17.5 10.833V16.6663C17.5 17.5868 16.7538 18.333 15.8333 18.333H4.16667C3.24619 18.333 2.5 17.5868 2.5 16.6663V10.833C2.5 9.9125 3.24619 9.16631 4.16667 9.16631Z",
|
|
29920
29932
|
stroke: "#279D54",
|
|
29921
|
-
strokeWidth: "
|
|
29933
|
+
strokeWidth: "2",
|
|
29922
29934
|
strokeLinecap: "round",
|
|
29923
29935
|
strokeLinejoin: "round"
|
|
29924
29936
|
}
|
|
@@ -29940,9 +29952,9 @@ function TableMenuEditIcon({ className }) {
|
|
|
29940
29952
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29941
29953
|
"path",
|
|
29942
29954
|
{
|
|
29943
|
-
d: "
|
|
29955
|
+
d: "M10 2.50019H4.16667C3.72464 2.50019 3.30072 2.67578 2.98816 2.98834C2.67559 3.3009 2.5 3.72483 2.5 4.16686V15.8335C2.5 16.2755 2.67559 16.6995 2.98816 17.012C3.30072 17.3246 3.72464 17.5002 4.16667 17.5002H15.8333C16.2754 17.5002 16.6993 17.3246 17.0118 17.012C17.3244 16.6995 17.5 16.2755 17.5 15.8335V10.0002M15.3125 2.18769C15.644 1.85617 16.0937 1.66992 16.5625 1.66992C17.0313 1.66992 17.481 1.85617 17.8125 2.18769C18.144 2.51921 18.3303 2.96885 18.3303 3.43769C18.3303 3.90653 18.144 4.35617 17.8125 4.68769L10.3017 12.1994C10.1038 12.3971 9.85934 12.5418 9.59083 12.6202L7.19667 13.3202C7.12496 13.3411 7.04895 13.3424 6.97659 13.3238C6.90423 13.3053 6.83819 13.2676 6.78537 13.2148C6.73255 13.162 6.69491 13.096 6.67637 13.0236C6.65783 12.9512 6.65909 12.8752 6.68 12.8035L7.38 10.4094C7.45877 10.1411 7.60378 9.8969 7.80167 9.69936L15.3125 2.18769Z",
|
|
29944
29956
|
stroke: "#B5BCC1",
|
|
29945
|
-
strokeWidth: "
|
|
29957
|
+
strokeWidth: "2",
|
|
29946
29958
|
strokeLinecap: "round",
|
|
29947
29959
|
strokeLinejoin: "round"
|
|
29948
29960
|
}
|
|
@@ -29951,7 +29963,7 @@ function TableMenuEditIcon({ className }) {
|
|
|
29951
29963
|
);
|
|
29952
29964
|
}
|
|
29953
29965
|
function TableMenuSuspendIcon({ className }) {
|
|
29954
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
29966
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29955
29967
|
"svg",
|
|
29956
29968
|
{
|
|
29957
29969
|
width: "20",
|
|
@@ -29961,28 +29973,16 @@ function TableMenuSuspendIcon({ className }) {
|
|
|
29961
29973
|
xmlns: "http://www.w3.org/2000/svg",
|
|
29962
29974
|
"aria-hidden": true,
|
|
29963
29975
|
className: cn("shrink-0", className),
|
|
29964
|
-
children:
|
|
29965
|
-
|
|
29966
|
-
|
|
29967
|
-
|
|
29968
|
-
|
|
29969
|
-
|
|
29970
|
-
|
|
29971
|
-
|
|
29972
|
-
|
|
29973
|
-
|
|
29974
|
-
),
|
|
29975
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29976
|
-
"path",
|
|
29977
|
-
{
|
|
29978
|
-
d: "M6.66667 10H13.3333",
|
|
29979
|
-
stroke: "#AE0011",
|
|
29980
|
-
strokeWidth: "1.75",
|
|
29981
|
-
strokeLinecap: "round",
|
|
29982
|
-
strokeLinejoin: "round"
|
|
29983
|
-
}
|
|
29984
|
-
)
|
|
29985
|
-
]
|
|
29976
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29977
|
+
"path",
|
|
29978
|
+
{
|
|
29979
|
+
d: "M4.08464 4.08366L15.918 15.917M18.3346 10.0003C18.3346 14.6027 14.6037 18.3337 10.0013 18.3337C5.39893 18.3337 1.66797 14.6027 1.66797 10.0003C1.66797 5.39795 5.39893 1.66699 10.0013 1.66699C14.6037 1.66699 18.3346 5.39795 18.3346 10.0003Z",
|
|
29980
|
+
stroke: "#AE0011",
|
|
29981
|
+
strokeWidth: "2",
|
|
29982
|
+
strokeLinecap: "round",
|
|
29983
|
+
strokeLinejoin: "round"
|
|
29984
|
+
}
|
|
29985
|
+
)
|
|
29986
29986
|
}
|
|
29987
29987
|
);
|
|
29988
29988
|
}
|
|
@@ -30314,13 +30314,14 @@ function TableCell({
|
|
|
30314
30314
|
...props
|
|
30315
30315
|
}) {
|
|
30316
30316
|
const disabled = useTableRowDisabled();
|
|
30317
|
+
const resolvedVariant = disabled ? "muted" : variant;
|
|
30317
30318
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
30318
30319
|
"td",
|
|
30319
30320
|
{
|
|
30320
30321
|
className: cn(
|
|
30321
30322
|
tableCellPaddingClassName,
|
|
30322
30323
|
tableBodyClassName,
|
|
30323
|
-
tableCellVariantClasses[
|
|
30324
|
+
tableCellVariantClasses[resolvedVariant],
|
|
30324
30325
|
disabled && tableRowDisabledCellClassName,
|
|
30325
30326
|
tableAlignClasses[align],
|
|
30326
30327
|
className
|
|
@@ -30331,6 +30332,7 @@ function TableCell({
|
|
|
30331
30332
|
);
|
|
30332
30333
|
}
|
|
30333
30334
|
function TableActionsCell({ className, children, ...props }) {
|
|
30335
|
+
const disabled = useTableRowDisabled();
|
|
30334
30336
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
30335
30337
|
"td",
|
|
30336
30338
|
{
|
|
@@ -30339,6 +30341,7 @@ function TableActionsCell({ className, children, ...props }) {
|
|
|
30339
30341
|
tableCellPaddingClassName,
|
|
30340
30342
|
tableBodyClassName,
|
|
30341
30343
|
tableStickyRightShadowClassName,
|
|
30344
|
+
disabled && tableRowDisabledCellClassName,
|
|
30342
30345
|
className
|
|
30343
30346
|
),
|
|
30344
30347
|
...props,
|
|
@@ -30396,12 +30399,12 @@ var MENU_WIDTH_PX = 231;
|
|
|
30396
30399
|
var MENU_OFFSET_PX = 4;
|
|
30397
30400
|
var MENU_VIEWPORT_MARGIN_PX = 8;
|
|
30398
30401
|
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
30399
|
-
function clampMenuLeft(left) {
|
|
30402
|
+
function clampMenuLeft(left, menuWidth) {
|
|
30400
30403
|
if (typeof window === "undefined") {
|
|
30401
30404
|
return left;
|
|
30402
30405
|
}
|
|
30403
30406
|
const minLeft = MENU_VIEWPORT_MARGIN_PX;
|
|
30404
|
-
const maxLeft = Math.max(minLeft, window.innerWidth -
|
|
30407
|
+
const maxLeft = Math.max(minLeft, window.innerWidth - menuWidth - MENU_VIEWPORT_MARGIN_PX);
|
|
30405
30408
|
return Math.min(Math.max(left, minLeft), maxLeft);
|
|
30406
30409
|
}
|
|
30407
30410
|
function resolveMenuItemIcon(item) {
|
|
@@ -30421,7 +30424,9 @@ function TableActionsMenu({
|
|
|
30421
30424
|
items,
|
|
30422
30425
|
triggerAriaLabel,
|
|
30423
30426
|
className,
|
|
30424
|
-
menuClassName
|
|
30427
|
+
menuClassName,
|
|
30428
|
+
menuWidth = MENU_WIDTH_PX,
|
|
30429
|
+
menuFitContent = false
|
|
30425
30430
|
}) {
|
|
30426
30431
|
const [open, setOpen] = react.useState(false);
|
|
30427
30432
|
const [menuPosition, setMenuPosition] = react.useState(null);
|
|
@@ -30438,11 +30443,12 @@ function TableActionsMenu({
|
|
|
30438
30443
|
return;
|
|
30439
30444
|
}
|
|
30440
30445
|
const rect = trigger.getBoundingClientRect();
|
|
30446
|
+
const resolvedMenuWidth = menuFitContent ? menuRef.current?.getBoundingClientRect().width ?? menuWidth : menuWidth;
|
|
30441
30447
|
setMenuPosition({
|
|
30442
30448
|
top: rect.bottom + MENU_OFFSET_PX,
|
|
30443
|
-
left: clampMenuLeft(rect.right -
|
|
30449
|
+
left: clampMenuLeft(rect.right - resolvedMenuWidth, resolvedMenuWidth)
|
|
30444
30450
|
});
|
|
30445
|
-
}, []);
|
|
30451
|
+
}, [menuFitContent, menuWidth]);
|
|
30446
30452
|
useOnClickOutside([rootRef, menuRef], closeMenu, open);
|
|
30447
30453
|
useIsomorphicLayoutEffect(() => {
|
|
30448
30454
|
if (!open) {
|
|
@@ -30451,6 +30457,12 @@ function TableActionsMenu({
|
|
|
30451
30457
|
}
|
|
30452
30458
|
updateMenuPosition();
|
|
30453
30459
|
}, [open, updateMenuPosition]);
|
|
30460
|
+
useIsomorphicLayoutEffect(() => {
|
|
30461
|
+
if (!open || !menuFitContent) {
|
|
30462
|
+
return;
|
|
30463
|
+
}
|
|
30464
|
+
updateMenuPosition();
|
|
30465
|
+
}, [items, menuFitContent, open, updateMenuPosition]);
|
|
30454
30466
|
react.useEffect(() => {
|
|
30455
30467
|
if (!open) {
|
|
30456
30468
|
return;
|
|
@@ -30486,7 +30498,7 @@ function TableActionsMenu({
|
|
|
30486
30498
|
position: "fixed",
|
|
30487
30499
|
top: menuPosition.top,
|
|
30488
30500
|
left: menuPosition.left,
|
|
30489
|
-
width:
|
|
30501
|
+
...menuFitContent ? { width: "max-content" } : { width: menuWidth }
|
|
30490
30502
|
},
|
|
30491
30503
|
className: cn(
|
|
30492
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)]",
|
|
@@ -30508,7 +30520,8 @@ function TableActionsMenu({
|
|
|
30508
30520
|
item.onSelect();
|
|
30509
30521
|
},
|
|
30510
30522
|
className: cn(
|
|
30511
|
-
"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",
|
|
30512
30525
|
index > 0 && "border-t border-storm-gray-50",
|
|
30513
30526
|
item.disabled && "cursor-not-allowed opacity-50"
|
|
30514
30527
|
),
|
|
@@ -31479,11 +31492,19 @@ function ToasterProvider() {
|
|
|
31479
31492
|
async function runMutationWithToast(action, messages, options) {
|
|
31480
31493
|
try {
|
|
31481
31494
|
await action();
|
|
31482
|
-
|
|
31495
|
+
if (messages.successDescription) {
|
|
31496
|
+
sonner.toast.success(messages.success, { description: messages.successDescription });
|
|
31497
|
+
} else {
|
|
31498
|
+
sonner.toast.success(messages.success);
|
|
31499
|
+
}
|
|
31483
31500
|
return { success: true };
|
|
31484
31501
|
} catch (error) {
|
|
31485
31502
|
const errorMessage = options?.getErrorMessage?.(error) ?? messages.error;
|
|
31486
|
-
|
|
31503
|
+
if (messages.errorDescription) {
|
|
31504
|
+
sonner.toast.error(errorMessage, { description: messages.errorDescription });
|
|
31505
|
+
} else {
|
|
31506
|
+
sonner.toast.error(errorMessage);
|
|
31507
|
+
}
|
|
31487
31508
|
return { success: false, errorMessage };
|
|
31488
31509
|
}
|
|
31489
31510
|
}
|