@scripso-homepad/ui 0.4.14 → 0.4.16
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/dist/{chunk-ANDWP4YU.js → chunk-U7OSCJKA.js} +39 -8
- package/dist/chunk-U7OSCJKA.js.map +1 -0
- package/dist/index.cjs +37 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/web/index.cjs +105 -47
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +23 -5
- package/dist/web/index.d.ts +23 -5
- package/dist/web/index.js +69 -43
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -6
- package/src/components/Button.tsx +4 -0
- package/src/components/Input.tsx +10 -0
- package/src/theme/input.ts +11 -1
- package/src/utils/useApplyWebClassName.ts +25 -5
- package/src/web/components/ConfirmModal.tsx +11 -3
- package/src/web/components/Modal.tsx +5 -2
- package/src/web/components/TableActionsMenu.tsx +67 -65
- package/src/web/components/table/TablePrimitives.tsx +2 -1
- package/src/web/index.ts +2 -0
- package/src/web/layout/DashboardLayout.stories.tsx +1 -0
- package/src/web/layout/Sidebar.stories.tsx +1 -0
- package/src/web/layout/Sidebar.tsx +17 -6
- package/src/web/layout/SidebarNavItem.tsx +46 -35
- package/src/web/layout/nav-active.ts +13 -0
- package/dist/chunk-ANDWP4YU.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -48,7 +48,7 @@ interface InputProps extends TextInputProps {
|
|
|
48
48
|
/** When `secureTextEntry` is set, show a toggleable eye icon. Pass `false` to disable. */
|
|
49
49
|
showPasswordToggle?: boolean;
|
|
50
50
|
}
|
|
51
|
-
declare function Input({ label, leftIcon, rightIcon, error, invalid, hint, containerStyle, style, className, fieldClassName, fieldStyle, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, secureTextEntry, showPasswordToggle, onFocus, onBlur, ...props }: InputProps): react.JSX.Element;
|
|
51
|
+
declare function Input({ label, leftIcon, rightIcon, error, invalid, hint, containerStyle, style, className, fieldClassName, fieldStyle, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, secureTextEntry, showPasswordToggle, onFocus, onBlur, multiline, textAlignVertical, ...props }: InputProps): react.JSX.Element;
|
|
52
52
|
|
|
53
53
|
type SelectOption = {
|
|
54
54
|
value: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface InputProps extends TextInputProps {
|
|
|
48
48
|
/** When `secureTextEntry` is set, show a toggleable eye icon. Pass `false` to disable. */
|
|
49
49
|
showPasswordToggle?: boolean;
|
|
50
50
|
}
|
|
51
|
-
declare function Input({ label, leftIcon, rightIcon, error, invalid, hint, containerStyle, style, className, fieldClassName, fieldStyle, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, secureTextEntry, showPasswordToggle, onFocus, onBlur, ...props }: InputProps): react.JSX.Element;
|
|
51
|
+
declare function Input({ label, leftIcon, rightIcon, error, invalid, hint, containerStyle, style, className, fieldClassName, fieldStyle, labelClassName, labelStyles, inputClassName, errorClassName, hintClassName, editable, secureTextEntry, showPasswordToggle, onFocus, onBlur, multiline, textAlignVertical, ...props }: InputProps): react.JSX.Element;
|
|
52
52
|
|
|
53
53
|
type SelectOption = {
|
|
54
54
|
value: string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { spacing, colors, fontWeight, fontSize, fonts, radii, INPUT_ICON_GAP, useApplyWebClassName, resolveInputVisualState, Label, getInputFieldStyles, inputFieldMetrics } from './chunk-
|
|
2
|
-
export { Button, Input, Label, brand, buttonTypography, colors, emeraldGreen, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray, typographyScale } from './chunk-
|
|
1
|
+
import { spacing, colors, fontWeight, fontSize, fonts, radii, INPUT_ICON_GAP, useApplyWebClassName, resolveInputVisualState, Label, getInputFieldStyles, inputFieldMetrics } from './chunk-U7OSCJKA.js';
|
|
2
|
+
export { Button, Input, Label, brand, buttonTypography, colors, emeraldGreen, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray, typographyScale } from './chunk-U7OSCJKA.js';
|
|
3
3
|
import { createContext, useRef, useState, useMemo, useEffect, useLayoutEffect, useContext, isValidElement, cloneElement } from 'react';
|
|
4
4
|
import { Platform, StyleSheet, Animated, Easing, View, Pressable, Text, Modal, ScrollView, TextInput, Dimensions } from 'react-native';
|
|
5
5
|
import Svg2, { Path } from 'react-native-svg';
|
package/dist/web/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ var Svg = require('react-native-svg');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var clsx = require('clsx');
|
|
9
9
|
var tailwindMerge = require('tailwind-merge');
|
|
10
|
-
var reactRouterDom = require('react-router-dom');
|
|
11
10
|
var sonner = require('sonner');
|
|
12
11
|
require('sonner/dist/styles.css');
|
|
13
12
|
|
|
@@ -7409,7 +7408,7 @@ var require_react_dom_development = __commonJS({
|
|
|
7409
7408
|
var HostPortal = 4;
|
|
7410
7409
|
var HostComponent = 5;
|
|
7411
7410
|
var HostText = 6;
|
|
7412
|
-
var
|
|
7411
|
+
var Fragment4 = 7;
|
|
7413
7412
|
var Mode = 8;
|
|
7414
7413
|
var ContextConsumer = 9;
|
|
7415
7414
|
var ContextProvider = 10;
|
|
@@ -8564,7 +8563,7 @@ var require_react_dom_development = __commonJS({
|
|
|
8564
8563
|
return "DehydratedFragment";
|
|
8565
8564
|
case ForwardRef:
|
|
8566
8565
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
|
8567
|
-
case
|
|
8566
|
+
case Fragment4:
|
|
8568
8567
|
return "Fragment";
|
|
8569
8568
|
case HostComponent:
|
|
8570
8569
|
return type;
|
|
@@ -16989,7 +16988,7 @@ var require_react_dom_development = __commonJS({
|
|
|
16989
16988
|
}
|
|
16990
16989
|
}
|
|
16991
16990
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
|
16992
|
-
if (current2 === null || current2.tag !==
|
|
16991
|
+
if (current2 === null || current2.tag !== Fragment4) {
|
|
16993
16992
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
|
16994
16993
|
created.return = returnFiber;
|
|
16995
16994
|
return created;
|
|
@@ -17392,7 +17391,7 @@ var require_react_dom_development = __commonJS({
|
|
|
17392
17391
|
if (child.key === key) {
|
|
17393
17392
|
var elementType = element.type;
|
|
17394
17393
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
|
17395
|
-
if (child.tag ===
|
|
17394
|
+
if (child.tag === Fragment4) {
|
|
17396
17395
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
17397
17396
|
var existing = useFiber(child, element.props.children);
|
|
17398
17397
|
existing.return = returnFiber;
|
|
@@ -22866,7 +22865,7 @@ var require_react_dom_development = __commonJS({
|
|
|
22866
22865
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
22867
22866
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
|
22868
22867
|
}
|
|
22869
|
-
case
|
|
22868
|
+
case Fragment4:
|
|
22870
22869
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
|
22871
22870
|
case Mode:
|
|
22872
22871
|
return updateMode(current2, workInProgress2, renderLanes2);
|
|
@@ -23138,7 +23137,7 @@ var require_react_dom_development = __commonJS({
|
|
|
23138
23137
|
case SimpleMemoComponent:
|
|
23139
23138
|
case FunctionComponent:
|
|
23140
23139
|
case ForwardRef:
|
|
23141
|
-
case
|
|
23140
|
+
case Fragment4:
|
|
23142
23141
|
case Mode:
|
|
23143
23142
|
case Profiler:
|
|
23144
23143
|
case ContextConsumer:
|
|
@@ -27390,7 +27389,7 @@ var require_react_dom_development = __commonJS({
|
|
|
27390
27389
|
return fiber;
|
|
27391
27390
|
}
|
|
27392
27391
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
|
27393
|
-
var fiber = createFiber(
|
|
27392
|
+
var fiber = createFiber(Fragment4, elements, key, mode);
|
|
27394
27393
|
fiber.lanes = lanes;
|
|
27395
27394
|
return fiber;
|
|
27396
27395
|
}
|
|
@@ -28766,22 +28765,28 @@ var inputFieldMetrics = reactNative.StyleSheet.create({
|
|
|
28766
28765
|
input: {
|
|
28767
28766
|
flex: 1,
|
|
28768
28767
|
minWidth: 0,
|
|
28768
|
+
width: "100%",
|
|
28769
28769
|
fontFamily: fonts.sans,
|
|
28770
28770
|
fontSize: fontSize.md,
|
|
28771
28771
|
fontWeight: fontWeight.medium,
|
|
28772
|
-
lineHeight: INPUT_TEXT_LINE_HEIGHT,
|
|
28773
28772
|
paddingVertical: 0,
|
|
28774
28773
|
paddingHorizontal: 0,
|
|
28775
28774
|
margin: 0,
|
|
28776
28775
|
borderWidth: 0,
|
|
28777
28776
|
backgroundColor: colors.transparent,
|
|
28778
28777
|
...reactNative.Platform.OS === "android" ? { includeFontPadding: false } : null,
|
|
28778
|
+
...reactNative.Platform.OS === "ios" ? { lineHeight: INPUT_TEXT_LINE_HEIGHT, paddingVertical: 2 } : null,
|
|
28779
28779
|
...reactNative.Platform.OS === "web" ? {
|
|
28780
28780
|
alignSelf: "center",
|
|
28781
|
-
outlineStyle: "none"
|
|
28781
|
+
outlineStyle: "none",
|
|
28782
|
+
lineHeight: INPUT_TEXT_LINE_HEIGHT
|
|
28782
28783
|
} : {
|
|
28783
28784
|
alignSelf: "stretch"
|
|
28784
28785
|
}
|
|
28786
|
+
},
|
|
28787
|
+
/** Single-line: avoid Android lineHeight jump between placeholder and typed text. */
|
|
28788
|
+
inputSingleLine: {
|
|
28789
|
+
...reactNative.Platform.OS === "android" ? { textAlignVertical: "center" } : null
|
|
28785
28790
|
}
|
|
28786
28791
|
});
|
|
28787
28792
|
function hasClassList(node) {
|
|
@@ -28802,12 +28807,25 @@ function resolveWebElement(ref) {
|
|
|
28802
28807
|
function useApplyWebClassName(ref, className, enabled = true) {
|
|
28803
28808
|
react.useLayoutEffect(() => {
|
|
28804
28809
|
if (!enabled || reactNative.Platform.OS !== "web" || !className?.trim()) return;
|
|
28805
|
-
|
|
28806
|
-
|
|
28810
|
+
let cancelled = false;
|
|
28811
|
+
let rafId = 0;
|
|
28812
|
+
let appliedElement = null;
|
|
28807
28813
|
const classes = className.trim().split(/\s+/);
|
|
28808
|
-
|
|
28814
|
+
const apply = () => {
|
|
28815
|
+
if (cancelled) return;
|
|
28816
|
+
const element = resolveWebElement(ref);
|
|
28817
|
+
if (!element) {
|
|
28818
|
+
rafId = requestAnimationFrame(apply);
|
|
28819
|
+
return;
|
|
28820
|
+
}
|
|
28821
|
+
appliedElement = element;
|
|
28822
|
+
element.classList.add(...classes);
|
|
28823
|
+
};
|
|
28824
|
+
apply();
|
|
28809
28825
|
return () => {
|
|
28810
|
-
|
|
28826
|
+
cancelled = true;
|
|
28827
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
28828
|
+
appliedElement?.classList.remove(...classes);
|
|
28811
28829
|
};
|
|
28812
28830
|
}, [ref, className, enabled]);
|
|
28813
28831
|
}
|
|
@@ -28879,6 +28897,8 @@ function Input({
|
|
|
28879
28897
|
showPasswordToggle,
|
|
28880
28898
|
onFocus,
|
|
28881
28899
|
onBlur,
|
|
28900
|
+
multiline,
|
|
28901
|
+
textAlignVertical,
|
|
28882
28902
|
...props
|
|
28883
28903
|
}) {
|
|
28884
28904
|
const wrapperRef = react.useRef(null);
|
|
@@ -28895,6 +28915,7 @@ function Input({
|
|
|
28895
28915
|
const hasError = Boolean(error) || Boolean(invalid);
|
|
28896
28916
|
const passwordToggleEnabled = secureTextEntry === true && showPasswordToggle !== false && rightIcon == null;
|
|
28897
28917
|
const effectiveSecureTextEntry = passwordToggleEnabled ? !passwordVisible : secureTextEntry;
|
|
28918
|
+
const resolvedTextAlignVertical = textAlignVertical ?? (multiline ? "top" : "center");
|
|
28898
28919
|
const visualState = resolveInputVisualState({
|
|
28899
28920
|
focused,
|
|
28900
28921
|
error: hasError,
|
|
@@ -28954,12 +28975,16 @@ function Input({
|
|
|
28954
28975
|
ref: inputRef,
|
|
28955
28976
|
style: [
|
|
28956
28977
|
inputFieldMetrics.input,
|
|
28978
|
+
!multiline ? inputFieldMetrics.inputSingleLine : null,
|
|
28957
28979
|
fieldStyles.text,
|
|
28958
28980
|
style
|
|
28959
28981
|
],
|
|
28960
28982
|
placeholderTextColor: fieldStyles.placeholder,
|
|
28961
28983
|
editable,
|
|
28984
|
+
multiline,
|
|
28962
28985
|
secureTextEntry: effectiveSecureTextEntry,
|
|
28986
|
+
textAlign: "left",
|
|
28987
|
+
textAlignVertical: resolvedTextAlignVertical,
|
|
28963
28988
|
onFocus: handleFocus,
|
|
28964
28989
|
onBlur: handleBlur,
|
|
28965
28990
|
accessibilityState: { disabled: isDisabled },
|
|
@@ -28976,6 +29001,7 @@ function Input({
|
|
|
28976
29001
|
var styles2 = reactNative.StyleSheet.create({
|
|
28977
29002
|
wrapper: {
|
|
28978
29003
|
width: "100%",
|
|
29004
|
+
minWidth: 0,
|
|
28979
29005
|
gap: spacing.sm
|
|
28980
29006
|
},
|
|
28981
29007
|
iconSlot: {
|
|
@@ -29397,29 +29423,48 @@ function useMediaQuery(query) {
|
|
|
29397
29423
|
}, [query]);
|
|
29398
29424
|
return matches;
|
|
29399
29425
|
}
|
|
29400
|
-
|
|
29426
|
+
|
|
29427
|
+
// src/web/layout/nav-active.ts
|
|
29428
|
+
function isNavItemActive(pathname, item) {
|
|
29429
|
+
if (item.end) {
|
|
29430
|
+
return pathname === item.to;
|
|
29431
|
+
}
|
|
29432
|
+
return pathname === item.to || pathname.startsWith(`${item.to}/`);
|
|
29433
|
+
}
|
|
29434
|
+
function isModifiedClick(event) {
|
|
29435
|
+
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0;
|
|
29436
|
+
}
|
|
29437
|
+
function SidebarNavItem({ item, isOpen, isActive, onNavigate }) {
|
|
29401
29438
|
if (item.hidden) {
|
|
29402
29439
|
return null;
|
|
29403
29440
|
}
|
|
29404
|
-
const handleClick = () => {
|
|
29441
|
+
const handleClick = (event) => {
|
|
29442
|
+
if (item.disabled) {
|
|
29443
|
+
event.preventDefault();
|
|
29444
|
+
return;
|
|
29445
|
+
}
|
|
29446
|
+
if (event.defaultPrevented || isModifiedClick(event)) {
|
|
29447
|
+
return;
|
|
29448
|
+
}
|
|
29449
|
+
event.preventDefault();
|
|
29405
29450
|
item.onClick?.();
|
|
29406
29451
|
onNavigate?.(item);
|
|
29407
29452
|
};
|
|
29408
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
29409
|
-
|
|
29453
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29454
|
+
"a",
|
|
29410
29455
|
{
|
|
29411
|
-
|
|
29412
|
-
end: item.end,
|
|
29456
|
+
href: item.to,
|
|
29413
29457
|
onClick: handleClick,
|
|
29458
|
+
"aria-current": isActive ? "page" : void 0,
|
|
29414
29459
|
"aria-disabled": item.disabled,
|
|
29415
29460
|
tabIndex: item.disabled ? -1 : void 0,
|
|
29416
|
-
className:
|
|
29461
|
+
className: cn(
|
|
29417
29462
|
"relative flex items-center rounded-xl px-4 py-3 transition-[background-color,color,gap,padding] duration-300 ease-in-out",
|
|
29418
29463
|
isOpen ? "w-full gap-4" : "justify-center gap-0 px-3",
|
|
29419
29464
|
item.disabled && "pointer-events-none opacity-50",
|
|
29420
29465
|
isActive ? "bg-black/12 text-white" : "text-navy-100 hover:bg-white/5"
|
|
29421
29466
|
),
|
|
29422
|
-
children:
|
|
29467
|
+
children: [
|
|
29423
29468
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29424
29469
|
"span",
|
|
29425
29470
|
{
|
|
@@ -29441,7 +29486,7 @@ function SidebarNavItem({ item, isOpen, onNavigate }) {
|
|
|
29441
29486
|
children: item.label
|
|
29442
29487
|
}
|
|
29443
29488
|
)
|
|
29444
|
-
]
|
|
29489
|
+
]
|
|
29445
29490
|
}
|
|
29446
29491
|
);
|
|
29447
29492
|
}
|
|
@@ -29516,6 +29561,7 @@ function Sidebar({
|
|
|
29516
29561
|
branding,
|
|
29517
29562
|
labels,
|
|
29518
29563
|
sidebarStorageKey,
|
|
29564
|
+
pathname,
|
|
29519
29565
|
user,
|
|
29520
29566
|
onLogout,
|
|
29521
29567
|
className,
|
|
@@ -29529,7 +29575,6 @@ function Sidebar({
|
|
|
29529
29575
|
collapsed,
|
|
29530
29576
|
onCollapsedChange
|
|
29531
29577
|
}) {
|
|
29532
|
-
const location = reactRouterDom.useLocation();
|
|
29533
29578
|
const isDesktop = useMediaQuery("(min-width: 768px)");
|
|
29534
29579
|
const [internalCollapsed, setInternalCollapsed] = react.useState(
|
|
29535
29580
|
() => readInitialCollapsedState(sidebarStorageKey, initialCollapsed)
|
|
@@ -29565,16 +29610,16 @@ function Sidebar({
|
|
|
29565
29610
|
},
|
|
29566
29611
|
[isDesktop, onMobileClose, onNavItemClick]
|
|
29567
29612
|
);
|
|
29568
|
-
const pathnameRef = react.useRef(
|
|
29613
|
+
const pathnameRef = react.useRef(pathname);
|
|
29569
29614
|
react.useEffect(() => {
|
|
29570
|
-
if (pathnameRef.current ===
|
|
29615
|
+
if (pathnameRef.current === pathname) {
|
|
29571
29616
|
return;
|
|
29572
29617
|
}
|
|
29573
|
-
pathnameRef.current =
|
|
29618
|
+
pathnameRef.current = pathname;
|
|
29574
29619
|
if (!isDesktop) {
|
|
29575
29620
|
onMobileClose?.();
|
|
29576
29621
|
}
|
|
29577
|
-
}, [
|
|
29622
|
+
}, [pathname, isDesktop, onMobileClose]);
|
|
29578
29623
|
react.useEffect(() => {
|
|
29579
29624
|
if (!mobileOpen || isDesktop) {
|
|
29580
29625
|
return;
|
|
@@ -29655,6 +29700,7 @@ function Sidebar({
|
|
|
29655
29700
|
{
|
|
29656
29701
|
item,
|
|
29657
29702
|
isOpen: isExpanded,
|
|
29703
|
+
isActive: isNavItemActive(pathname, item),
|
|
29658
29704
|
onNavigate: handleNavItemNavigate
|
|
29659
29705
|
},
|
|
29660
29706
|
item.to
|
|
@@ -29665,6 +29711,7 @@ function Sidebar({
|
|
|
29665
29711
|
{
|
|
29666
29712
|
item,
|
|
29667
29713
|
isOpen: isExpanded,
|
|
29714
|
+
isActive: isNavItemActive(pathname, item),
|
|
29668
29715
|
onNavigate: handleNavItemNavigate
|
|
29669
29716
|
},
|
|
29670
29717
|
item.to
|
|
@@ -30341,7 +30388,8 @@ function TableActionsCell({ className, children, ...props }) {
|
|
|
30341
30388
|
tableCellPaddingClassName,
|
|
30342
30389
|
tableBodyClassName,
|
|
30343
30390
|
tableStickyRightShadowClassName,
|
|
30344
|
-
|
|
30391
|
+
// Keep an opaque sticky background so scrolled cells never bleed through.
|
|
30392
|
+
disabled && "bg-white [&>*]:opacity-70",
|
|
30345
30393
|
className
|
|
30346
30394
|
),
|
|
30347
30395
|
...props,
|
|
@@ -30426,7 +30474,7 @@ function TableActionsMenu({
|
|
|
30426
30474
|
className,
|
|
30427
30475
|
menuClassName,
|
|
30428
30476
|
menuWidth = MENU_WIDTH_PX,
|
|
30429
|
-
menuFitContent =
|
|
30477
|
+
menuFitContent = true
|
|
30430
30478
|
}) {
|
|
30431
30479
|
const [open, setOpen] = react.useState(false);
|
|
30432
30480
|
const [menuPosition, setMenuPosition] = react.useState(null);
|
|
@@ -30439,11 +30487,14 @@ function TableActionsMenu({
|
|
|
30439
30487
|
}, []);
|
|
30440
30488
|
const updateMenuPosition = react.useCallback(() => {
|
|
30441
30489
|
const trigger = triggerRef.current;
|
|
30490
|
+
const menuEl = menuRef.current;
|
|
30442
30491
|
if (!trigger) {
|
|
30443
30492
|
return;
|
|
30444
30493
|
}
|
|
30445
30494
|
const rect = trigger.getBoundingClientRect();
|
|
30446
|
-
const
|
|
30495
|
+
const viewportMaxWidth = typeof window === "undefined" ? menuWidth : Math.max(menuWidth, window.innerWidth - MENU_VIEWPORT_MARGIN_PX * 2);
|
|
30496
|
+
const measuredWidth = menuFitContent ? menuEl?.offsetWidth || menuEl?.getBoundingClientRect().width || menuWidth : menuWidth;
|
|
30497
|
+
const resolvedMenuWidth = Math.min(Math.max(measuredWidth, 1), viewportMaxWidth);
|
|
30447
30498
|
setMenuPosition({
|
|
30448
30499
|
top: rect.bottom + MENU_OFFSET_PX,
|
|
30449
30500
|
left: clampMenuLeft(rect.right - resolvedMenuWidth, resolvedMenuWidth)
|
|
@@ -30456,13 +30507,7 @@ function TableActionsMenu({
|
|
|
30456
30507
|
return;
|
|
30457
30508
|
}
|
|
30458
30509
|
updateMenuPosition();
|
|
30459
|
-
}, [open, updateMenuPosition]);
|
|
30460
|
-
useIsomorphicLayoutEffect(() => {
|
|
30461
|
-
if (!open || !menuFitContent) {
|
|
30462
|
-
return;
|
|
30463
|
-
}
|
|
30464
|
-
updateMenuPosition();
|
|
30465
|
-
}, [items, menuFitContent, open, updateMenuPosition]);
|
|
30510
|
+
}, [open, items, menuFitContent, updateMenuPosition]);
|
|
30466
30511
|
react.useEffect(() => {
|
|
30467
30512
|
if (!open) {
|
|
30468
30513
|
return;
|
|
@@ -30488,7 +30533,7 @@ function TableActionsMenu({
|
|
|
30488
30533
|
if (items.length === 0) {
|
|
30489
30534
|
return null;
|
|
30490
30535
|
}
|
|
30491
|
-
const menu = open
|
|
30536
|
+
const menu = open ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
30492
30537
|
"div",
|
|
30493
30538
|
{
|
|
30494
30539
|
ref: menuRef,
|
|
@@ -30496,9 +30541,13 @@ function TableActionsMenu({
|
|
|
30496
30541
|
role: "menu",
|
|
30497
30542
|
style: {
|
|
30498
30543
|
position: "fixed",
|
|
30499
|
-
top: menuPosition
|
|
30500
|
-
left: menuPosition
|
|
30501
|
-
|
|
30544
|
+
top: menuPosition?.top ?? 0,
|
|
30545
|
+
left: menuPosition?.left ?? 0,
|
|
30546
|
+
maxWidth: `calc(100vw - ${MENU_VIEWPORT_MARGIN_PX * 2}px)`,
|
|
30547
|
+
...menuFitContent ? { width: "max-content" } : { width: menuWidth },
|
|
30548
|
+
// Hide until we have a measured viewport-safe position.
|
|
30549
|
+
visibility: menuPosition != null ? "visible" : "hidden",
|
|
30550
|
+
pointerEvents: menuPosition != null ? "auto" : "none"
|
|
30502
30551
|
},
|
|
30503
30552
|
className: cn(
|
|
30504
30553
|
"z-50 overflow-hidden rounded-2xl border border-storm-gray-50 bg-white shadow-[0_4px_20px_0_rgba(0,0,0,0.05)]",
|
|
@@ -30520,14 +30569,13 @@ function TableActionsMenu({
|
|
|
30520
30569
|
item.onSelect();
|
|
30521
30570
|
},
|
|
30522
30571
|
className: cn(
|
|
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",
|
|
30572
|
+
"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",
|
|
30525
30573
|
index > 0 && "border-t border-storm-gray-50",
|
|
30526
30574
|
item.disabled && "cursor-not-allowed opacity-50"
|
|
30527
30575
|
),
|
|
30528
30576
|
children: [
|
|
30529
30577
|
icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex size-5 shrink-0 items-center justify-center text-storm-gray-200", children: icon }) : null,
|
|
30530
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
30578
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "whitespace-nowrap", children: item.label })
|
|
30531
30579
|
]
|
|
30532
30580
|
},
|
|
30533
30581
|
item.id
|
|
@@ -30831,6 +30879,8 @@ var variantConfig = {
|
|
|
30831
30879
|
};
|
|
30832
30880
|
var sizeConfig = {
|
|
30833
30881
|
lg: {
|
|
30882
|
+
/** Matches Tailwind `h-13` so size stays stable before web classNames attach. */
|
|
30883
|
+
minHeight: 52,
|
|
30834
30884
|
borderRadius: 16,
|
|
30835
30885
|
paddingTop: 8,
|
|
30836
30886
|
paddingRight: 8,
|
|
@@ -30844,6 +30894,7 @@ var sizeConfig = {
|
|
|
30844
30894
|
iconSize: 20
|
|
30845
30895
|
},
|
|
30846
30896
|
sm: {
|
|
30897
|
+
minHeight: 40,
|
|
30847
30898
|
borderRadius: 12,
|
|
30848
30899
|
paddingTop: 8,
|
|
30849
30900
|
paddingRight: 8,
|
|
@@ -30889,6 +30940,7 @@ function Button({
|
|
|
30889
30940
|
const containerStyle = [
|
|
30890
30941
|
styles3.base,
|
|
30891
30942
|
{
|
|
30943
|
+
minHeight: metrics.minHeight,
|
|
30892
30944
|
borderRadius: metrics.borderRadius,
|
|
30893
30945
|
backgroundColor: preset.backgroundColor,
|
|
30894
30946
|
paddingTop: metrics.paddingTop,
|
|
@@ -31085,7 +31137,10 @@ function Modal({
|
|
|
31085
31137
|
"footer",
|
|
31086
31138
|
{
|
|
31087
31139
|
className: cn(
|
|
31088
|
-
footerLayout === "split" ? "grid w-full shrink-0 grid-cols-
|
|
31140
|
+
footerLayout === "split" ? "grid w-full shrink-0 grid-cols-1 gap-3 min-[400px]:grid-cols-2 min-[400px]:gap-4" : cn(
|
|
31141
|
+
"flex shrink-0 flex-col-reverse gap-3 sm:flex-row sm:gap-4",
|
|
31142
|
+
footerAlignClasses[footerAlign]
|
|
31143
|
+
)
|
|
31089
31144
|
),
|
|
31090
31145
|
children: [
|
|
31091
31146
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -31516,6 +31571,7 @@ function ConfirmModal({
|
|
|
31516
31571
|
confirmText,
|
|
31517
31572
|
onCancel,
|
|
31518
31573
|
onConfirm,
|
|
31574
|
+
icon,
|
|
31519
31575
|
cancelDisabled = false,
|
|
31520
31576
|
confirmDisabled = false,
|
|
31521
31577
|
closeOnBackdrop = true,
|
|
@@ -31561,7 +31617,8 @@ function ConfirmModal({
|
|
|
31561
31617
|
event.stopPropagation();
|
|
31562
31618
|
},
|
|
31563
31619
|
children: [
|
|
31564
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 text-center", children: [
|
|
31620
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
31621
|
+
icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-14 items-center justify-center rounded-2xl bg-storm-gray-50 text-storm-gray-500", children: icon }) : null,
|
|
31565
31622
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31566
31623
|
"h2",
|
|
31567
31624
|
{
|
|
@@ -31722,6 +31779,7 @@ exports.cn = cn;
|
|
|
31722
31779
|
exports.getPaginationRange = getPaginationRange;
|
|
31723
31780
|
exports.getTotalPages = getTotalPages;
|
|
31724
31781
|
exports.getVisiblePageNumbers = getVisiblePageNumbers;
|
|
31782
|
+
exports.isNavItemActive = isNavItemActive;
|
|
31725
31783
|
exports.runMutationWithToast = runMutationWithToast;
|
|
31726
31784
|
exports.tableRowDisabledCellClassName = tableRowDisabledCellClassName;
|
|
31727
31785
|
exports.useMediaQuery = useMediaQuery;
|