@wellingtonhlc/shared-ui 0.24.11 → 0.24.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.
|
@@ -31,9 +31,9 @@ TopbarRoot.displayName = 'AppShell.Topbar';
|
|
|
31
31
|
export const Topbar = Object.assign(TopbarRoot, {
|
|
32
32
|
Button: TopbarButton,
|
|
33
33
|
});
|
|
34
|
-
const Main = forwardRef(({ children, className, contentPaddingClassName, contentMode = 'default', disableContentPadding = false, scrollable = true, }, ref) => {
|
|
34
|
+
const Main = forwardRef(({ children, className, contentPaddingClassName = 'p-3', contentMode = 'default', disableContentPadding = false, scrollable = true, }, ref) => {
|
|
35
35
|
const isFullscreen = contentMode === 'fullscreen';
|
|
36
|
-
return (_jsx("main", { ref: ref, className: cn('flex h-full min-h-0 w-full flex-1 flex-col bg-background', !isFullscreen && 'overflow-x-hidden
|
|
36
|
+
return (_jsx("main", { ref: ref, className: cn('flex h-full min-h-0 w-full flex-1 flex-col bg-background', !isFullscreen && 'overflow-x-hidden', contentMode === 'default' && 'flex flex-col gap-3', contentMode === 'fluid' && 'flex flex-col gap-3 overflow-y-hidden', contentMode === 'fullscreen' && 'overflow-hidden p-0', !isFullscreen && !disableContentPadding && contentPaddingClassName, !isFullscreen && (scrollable ? 'overflow-y-auto' : 'overflow-y-hidden'), className), children: children }));
|
|
37
37
|
});
|
|
38
38
|
Main.displayName = 'AppShell.Main';
|
|
39
39
|
export const AppShell = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../src/components/Page.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAIL,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,6BAA6B,EACnC,MAAM,oBAAoB,CAAC;AAI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eAAe,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,wBAAwB,+BAK3E;AAED,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,oBAAoB,sCAoBjE;AAED,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAChE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAExE,iBAAS,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,+BAM/D;AAED,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,+BAM3E;AAED,iBAAS,MAAM,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,eAAe,+BAexE;AAED,eAAO,MAAM,IAAI;;;;;;;;;;;CAWhB,CAAC"}
|
package/dist/components/Page.js
CHANGED
|
@@ -12,6 +12,12 @@ const positionLabels = {
|
|
|
12
12
|
right: 'Direita',
|
|
13
13
|
bottom: 'Rodape',
|
|
14
14
|
};
|
|
15
|
+
function PageActionsMoveOption({ active, label, onSelect, position }) {
|
|
16
|
+
function handleClick() {
|
|
17
|
+
onSelect(position);
|
|
18
|
+
}
|
|
19
|
+
return (_jsx("button", { type: "button", role: "menuitemradio", "aria-checked": active, className: cn('hover:bg-background-secondary flex w-full cursor-pointer items-center rounded px-2 py-1.5 text-left', active && 'font-semibold text-brand'), onClick: handleClick, children: label }));
|
|
20
|
+
}
|
|
15
21
|
function ActionsHelpContent({ children, className, items, title }) {
|
|
16
22
|
return (_jsxs("div", { className: cn('max-w-[22rem] space-y-2 text-xs leading-5 [overflow-wrap:anywhere]', className), children: [title && _jsx("p", { className: "font-semibold text-foreground", children: title }), children && _jsx("div", { className: "text-foreground-muted", children: children }), items?.length ? (_jsx("ul", { className: "list-disc space-y-1 pl-4 text-foreground-muted", children: items.map((item, index) => (_jsx("li", { children: item }, index))) })) : null] }));
|
|
17
23
|
}
|
|
@@ -72,10 +78,14 @@ function useIsMobile() {
|
|
|
72
78
|
return isMobile;
|
|
73
79
|
}
|
|
74
80
|
function getPointerPosition(event) {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
81
|
+
const workspace = event.currentTarget instanceof HTMLElement
|
|
82
|
+
? event.currentTarget.closest('[data-page-actions-workspace]')
|
|
83
|
+
: null;
|
|
84
|
+
const rect = workspace?.getBoundingClientRect();
|
|
85
|
+
const width = rect?.width || window.innerWidth || 1;
|
|
86
|
+
const height = rect?.height || window.innerHeight || 1;
|
|
87
|
+
const x = rect ? event.clientX - rect.left : event.clientX;
|
|
88
|
+
const y = rect ? event.clientY - rect.top : event.clientY;
|
|
79
89
|
const leftDistance = x;
|
|
80
90
|
const rightDistance = width - x;
|
|
81
91
|
const topDistance = y;
|
|
@@ -150,8 +160,8 @@ function Actions({ align = 'start', __fromSlot = false, children, className, def
|
|
|
150
160
|
const positionClasses = {
|
|
151
161
|
top: 'w-full max-w-full self-stretch border-b border-app-border bg-background-secondary p-1',
|
|
152
162
|
bottom: 'w-full border-t border-app-border bg-background-secondary p-1',
|
|
153
|
-
left: 'h-full min-h-0 self-stretch w-[min(10rem,24vw)] max-w-40 flex-none flex-col items-stretch border-r border-app-border bg-background-secondary p-1
|
|
154
|
-
right: 'h-full min-h-0 self-stretch w-[min(10rem,24vw)] max-w-40 flex-none flex-col items-stretch border-l border-app-border bg-background-secondary p-1
|
|
163
|
+
left: 'h-full min-h-0 self-stretch w-[min(10rem,24vw)] max-w-40 flex-none flex-col items-stretch border-r border-app-border bg-background-secondary p-1',
|
|
164
|
+
right: 'h-full min-h-0 self-stretch w-[min(10rem,24vw)] max-w-40 flex-none flex-col items-stretch border-l border-app-border bg-background-secondary p-1',
|
|
155
165
|
};
|
|
156
166
|
const alignClasses = {
|
|
157
167
|
start: effectivePosition === 'left' || effectivePosition === 'right' ? 'justify-start' : 'justify-start',
|
|
@@ -209,12 +219,14 @@ function Actions({ align = 'start', __fromSlot = false, children, className, def
|
|
|
209
219
|
setIsMenuOpen(false);
|
|
210
220
|
}
|
|
211
221
|
const helpButton = helpVisible ? (_jsx("div", { className: cn('flex shrink-0', isVertical && 'w-full justify-center'), children: _jsx(Tooltip, { className: cn('max-w-[22rem] px-3 py-2', helpClassName), content: helpContent, delayDuration: 120, openOnClick: true, side: getHelpSide(effectivePosition), children: _jsx(ActionButtonPrimitive, { "aria-label": helpLabel, icon: _jsx(CircleHelpIcon, { "aria-hidden": "true" }), tooltip: helpLabel }) }) })) : null;
|
|
212
|
-
const moveButton = canMove ? (_jsxs("div", { className: cn('relative flex shrink-0', isVertical && 'w-full justify-
|
|
213
|
-
const actions = (_jsxs(
|
|
222
|
+
const moveButton = canMove ? (_jsxs("div", { className: cn('relative flex shrink-0', isVertical && 'w-full justify-end'), children: [_jsx(ActionButtonPrimitive, { "aria-haspopup": "menu", "aria-label": "Mover barra de acoes", "aria-expanded": isMenuOpen, className: cn('touch-none [&]:cursor-grab [&_*]:cursor-grab active:[&]:cursor-grabbing active:[&_*]:cursor-grabbing', isDragging && '[&]:cursor-grabbing [&_*]:cursor-grabbing'), icon: _jsx(GripVerticalIcon, { "aria-hidden": "true" }), tooltip: "Mover barra de acoes", onClick: handleMoveMenuToggle, onKeyDown: handleMoveKeyDown, onPointerCancel: handleMovePointerCancel, onPointerDown: handleMovePointerDown, onPointerMove: handleMovePointerMove, onPointerUp: handleMovePointerUp }), isMenuOpen ? (_jsx("div", { role: "menu", className: cn('border-app-border bg-surface text-foreground absolute z-40 min-w-36 rounded-md border p-1 text-xs shadow-lg', isVertical ? 'left-full top-0 ml-2' : 'right-0 top-full mt-2'), children: effectiveAllowedPositions.map((nextPosition) => (_jsx(PageActionsMoveOption, { active: nextPosition === effectivePosition, label: positionLabels[nextPosition], onSelect: handleSelectPosition, position: nextPosition }, nextPosition))) })) : null] })) : null;
|
|
223
|
+
const actions = (_jsxs("div", { className: cn('flex min-h-0 min-w-0 gap-2', isVertical ? 'h-full w-full flex-col' : 'w-full items-center'), children: [_jsxs(ActionGroupPrimitive, { align: align, size: size, className: cn('min-w-0 flex-1', isVertical
|
|
224
|
+
? 'min-h-0 w-full flex-col items-stretch content-start [&>button]:w-full [&>button]:justify-start [&>[role=separator]]:h-px [&>[role=separator]]:min-h-0 [&>[role=separator]]:w-auto [&>div]:w-full [&>div>button]:w-full [&>div>button]:justify-start'
|
|
225
|
+
: 'overflow-x-auto overflow-y-hidden', alignClasses[align]), children: [helpButton, children] }), moveButton ? (_jsx("div", { className: cn('flex shrink-0', isVertical ? 'w-full justify-end' : 'ml-auto'), children: moveButton })) : null] }));
|
|
214
226
|
return (_jsxs("div", { className: cn('flex min-w-0', positionClasses[effectivePosition], isVertical ? 'flex-col' : 'items-center', className), children: [actions, isDragging ? _jsx(PageActionsDropZones, { activePosition: dragTarget ?? effectivePosition, allowedPositions: effectiveAllowedPositions }) : null] }));
|
|
215
227
|
}
|
|
216
228
|
function PageActionsDropZones({ activePosition, allowedPositions }) {
|
|
217
|
-
return (_jsx("div", { "aria-hidden": "true", className: "pointer-events-none
|
|
229
|
+
return (_jsx("div", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-50", children: allPositions.map((position) => {
|
|
218
230
|
if (!allowedPositions.includes(position))
|
|
219
231
|
return null;
|
|
220
232
|
return (_jsx("div", { className: cn('absolute border-2 border-dashed border-brand/50 bg-brand/10 transition-colors', position === 'left' && 'left-2 top-2 h-[calc(100%-1rem)] w-20 rounded-md', position === 'right' && 'right-2 top-2 h-[calc(100%-1rem)] w-20 rounded-md', position === 'top' && 'left-2 top-2 h-14 w-[calc(100%-1rem)] rounded-md', position === 'bottom' && 'bottom-2 left-2 h-14 w-[calc(100%-1rem)] rounded-md', activePosition === position && 'border-brand bg-brand/20 shadow-[0_0_0_4px_color-mix(in_srgb,var(--brand)_18%,transparent)]') }, position));
|
package/dist/styles.css
CHANGED
|
@@ -1484,12 +1484,6 @@ h2.react-datepicker__current-month {
|
|
|
1484
1484
|
.animate-pulse {
|
|
1485
1485
|
animation: var(--animate-pulse);
|
|
1486
1486
|
}
|
|
1487
|
-
.cursor-grab {
|
|
1488
|
-
cursor: grab;
|
|
1489
|
-
}
|
|
1490
|
-
.cursor-grabbing {
|
|
1491
|
-
cursor: grabbing;
|
|
1492
|
-
}
|
|
1493
1487
|
.cursor-not-allowed {
|
|
1494
1488
|
cursor: not-allowed;
|
|
1495
1489
|
}
|
|
@@ -1499,6 +1493,9 @@ h2.react-datepicker__current-month {
|
|
|
1499
1493
|
.cursor-wait {
|
|
1500
1494
|
cursor: wait;
|
|
1501
1495
|
}
|
|
1496
|
+
.touch-none {
|
|
1497
|
+
touch-action: none;
|
|
1498
|
+
}
|
|
1502
1499
|
.list-disc {
|
|
1503
1500
|
list-style-type: disc;
|
|
1504
1501
|
}
|
|
@@ -1544,6 +1541,9 @@ h2.react-datepicker__current-month {
|
|
|
1544
1541
|
.place-items-center {
|
|
1545
1542
|
place-items: center;
|
|
1546
1543
|
}
|
|
1544
|
+
.content-start {
|
|
1545
|
+
align-content: flex-start;
|
|
1546
|
+
}
|
|
1547
1547
|
.items-center {
|
|
1548
1548
|
align-items: center;
|
|
1549
1549
|
}
|
|
@@ -3853,6 +3853,34 @@ h2.react-datepicker__current-month {
|
|
|
3853
3853
|
}
|
|
3854
3854
|
}
|
|
3855
3855
|
}
|
|
3856
|
+
.\[\&\]\:cursor-grab {
|
|
3857
|
+
cursor: grab;
|
|
3858
|
+
}
|
|
3859
|
+
.\[\&\]\:cursor-grabbing {
|
|
3860
|
+
cursor: grabbing;
|
|
3861
|
+
}
|
|
3862
|
+
.active\:\[\&\]\:cursor-grabbing {
|
|
3863
|
+
&:active {
|
|
3864
|
+
cursor: grabbing;
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
.\[\&_\*\]\:cursor-grab {
|
|
3868
|
+
& * {
|
|
3869
|
+
cursor: grab;
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
.\[\&_\*\]\:cursor-grabbing {
|
|
3873
|
+
& * {
|
|
3874
|
+
cursor: grabbing;
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
.active\:\[\&_\*\]\:cursor-grabbing {
|
|
3878
|
+
&:active {
|
|
3879
|
+
& * {
|
|
3880
|
+
cursor: grabbing;
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3856
3884
|
.\[\&_\[data-slot\=modal-description\]\]\:text-sm {
|
|
3857
3885
|
& [data-slot=modal-description] {
|
|
3858
3886
|
font-size: var(--text-sm);
|
|
@@ -3955,6 +3983,21 @@ h2.react-datepicker__current-month {
|
|
|
3955
3983
|
justify-content: flex-start;
|
|
3956
3984
|
}
|
|
3957
3985
|
}
|
|
3986
|
+
.\[\&\>div\]\:w-full {
|
|
3987
|
+
&>div {
|
|
3988
|
+
width: 100%;
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
.\[\&\>div\>button\]\:w-full {
|
|
3992
|
+
&>div>button {
|
|
3993
|
+
width: 100%;
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
.\[\&\>div\>button\]\:justify-start {
|
|
3997
|
+
&>div>button {
|
|
3998
|
+
justify-content: flex-start;
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
3958
4001
|
.\[\&\>h2\]\:h-auto {
|
|
3959
4002
|
&>h2 {
|
|
3960
4003
|
height: auto;
|