@syscore/ui-library 1.16.0 → 1.17.0
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/client/components/ui/mobile-nav.tsx +24 -16
- package/client/global.css +17 -1
- package/client/ui/MobileNav.stories.tsx +35 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/package.json +1 -1
|
@@ -39,6 +39,7 @@ interface MobileNavTriggerProps {
|
|
|
39
39
|
label: string;
|
|
40
40
|
/** If provided, fires this action instead of toggling the panel */
|
|
41
41
|
onAction?: () => void;
|
|
42
|
+
disabled?: boolean;
|
|
42
43
|
className?: string;
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -211,25 +212,30 @@ const MobileNavPanel = ({ className, children }: MobileNavPanelProps) => {
|
|
|
211
212
|
};
|
|
212
213
|
|
|
213
214
|
return (
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
style={{ height: heightMV }}
|
|
219
|
-
>
|
|
215
|
+
<>
|
|
216
|
+
{open && (
|
|
217
|
+
<div className="mobile-nav-overlay" onClick={close} aria-hidden />
|
|
218
|
+
)}
|
|
220
219
|
<motion.div
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
ref={panelRef}
|
|
221
|
+
className={cn("mobile-nav-panel", className)}
|
|
222
|
+
data-closed={!open || undefined}
|
|
223
|
+
style={{ height: heightMV }}
|
|
225
224
|
>
|
|
226
|
-
<div
|
|
225
|
+
<motion.div
|
|
226
|
+
className="mobile-nav-handle"
|
|
227
|
+
onPanStart={handlePanStart}
|
|
228
|
+
onPan={handlePan}
|
|
229
|
+
onPanEnd={handlePanEnd}
|
|
230
|
+
>
|
|
231
|
+
<div className="mobile-nav-handle-bar" />
|
|
232
|
+
</motion.div>
|
|
233
|
+
|
|
234
|
+
<div ref={contentRef} className="mobile-nav-content">
|
|
235
|
+
{activeKey ? children(activeKey) : null}
|
|
236
|
+
</div>
|
|
227
237
|
</motion.div>
|
|
228
|
-
|
|
229
|
-
<div ref={contentRef} className="mobile-nav-content">
|
|
230
|
-
{activeKey ? children(activeKey) : null}
|
|
231
|
-
</div>
|
|
232
|
-
</motion.div>
|
|
238
|
+
</>
|
|
233
239
|
);
|
|
234
240
|
};
|
|
235
241
|
|
|
@@ -244,6 +250,7 @@ const MobileNavTrigger = ({
|
|
|
244
250
|
children,
|
|
245
251
|
label,
|
|
246
252
|
onAction,
|
|
253
|
+
disabled,
|
|
247
254
|
className,
|
|
248
255
|
}: MobileNavTriggerProps) => {
|
|
249
256
|
const { activeKey, open, toggle, close } = useMobileNav();
|
|
@@ -260,6 +267,7 @@ const MobileNavTrigger = ({
|
|
|
260
267
|
return (
|
|
261
268
|
<button
|
|
262
269
|
onClick={handleClick}
|
|
270
|
+
disabled={disabled}
|
|
263
271
|
data-active={activeKey === value || undefined}
|
|
264
272
|
className={cn("mobile-nav-trigger group", className)}
|
|
265
273
|
aria-label={label}
|
package/client/global.css
CHANGED
|
@@ -3854,9 +3854,19 @@ body {
|
|
|
3854
3854
|
.mobile-nav {
|
|
3855
3855
|
display: flex;
|
|
3856
3856
|
flex-direction: column;
|
|
3857
|
+
position: relative;
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
.mobile-nav-overlay {
|
|
3861
|
+
position: absolute;
|
|
3862
|
+
inset: 0;
|
|
3863
|
+
background-color: rgba(0, 0, 0, 0.08);
|
|
3864
|
+
z-index: 10;
|
|
3857
3865
|
}
|
|
3858
3866
|
|
|
3859
3867
|
.mobile-nav-panel {
|
|
3868
|
+
position: relative;
|
|
3869
|
+
z-index: 20;
|
|
3860
3870
|
background-color: white;
|
|
3861
3871
|
border-radius: 32px 32px 0 0;
|
|
3862
3872
|
box-shadow:
|
|
@@ -3895,10 +3905,11 @@ body {
|
|
|
3895
3905
|
}
|
|
3896
3906
|
|
|
3897
3907
|
.mobile-nav-bar {
|
|
3908
|
+
position: relative;
|
|
3909
|
+
z-index: 20;
|
|
3898
3910
|
border-top: 1px solid var(--color-gray-100);
|
|
3899
3911
|
background-color: var(--color-gray-50);
|
|
3900
3912
|
flex-shrink: 0;
|
|
3901
|
-
min-height: 136px;
|
|
3902
3913
|
}
|
|
3903
3914
|
|
|
3904
3915
|
.mobile-nav-bar-inner {
|
|
@@ -3933,6 +3944,11 @@ body {
|
|
|
3933
3944
|
color: var(--color-gray-900);
|
|
3934
3945
|
}
|
|
3935
3946
|
|
|
3947
|
+
.mobile-nav-trigger:disabled {
|
|
3948
|
+
pointer-events: none;
|
|
3949
|
+
opacity: 0.4;
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3936
3952
|
/* Pagination Styles */
|
|
3937
3953
|
.pagination {
|
|
3938
3954
|
margin-left: auto;
|
|
@@ -249,7 +249,7 @@ export const Default: Story = {
|
|
|
249
249
|
<UtilityRevisionsShow className="size-6 text-gray-500 group-data-active:text-gray-900" />
|
|
250
250
|
</MobileNavTrigger>
|
|
251
251
|
<MobileNavTrigger value="comments" label="Comments">
|
|
252
|
-
<
|
|
252
|
+
<UtilityFeedback className="size-6 text-gray-500 group-data-active:text-gray-900" />
|
|
253
253
|
</MobileNavTrigger>
|
|
254
254
|
</MobileNavBar>
|
|
255
255
|
</MobileNav>
|
|
@@ -315,3 +315,37 @@ export const WithCustomAction: Story = {
|
|
|
315
315
|
args: { children: null },
|
|
316
316
|
render: () => <WithCustomActionRender />,
|
|
317
317
|
};
|
|
318
|
+
|
|
319
|
+
export const WithDisabledTrigger: Story = {
|
|
320
|
+
args: { children: null },
|
|
321
|
+
|
|
322
|
+
render: () => (
|
|
323
|
+
<MobileNav className="h-screen w-full bg-gray-50">
|
|
324
|
+
<div className="flex-1 p-6 overflow-y-auto">
|
|
325
|
+
<p className="text-sm text-gray-400">
|
|
326
|
+
The “Comments” trigger is disabled because there are no
|
|
327
|
+
comments.
|
|
328
|
+
</p>
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
<MobileNavPanel>
|
|
332
|
+
{(activeKey) => <PanelContent activeKey={activeKey} />}
|
|
333
|
+
</MobileNavPanel>
|
|
334
|
+
|
|
335
|
+
<MobileNavBar>
|
|
336
|
+
<MobileNavTrigger value="list" label="Changes">
|
|
337
|
+
<UtilityText className="size-6 text-gray-500 group-data-active:text-gray-900" />
|
|
338
|
+
</MobileNavTrigger>
|
|
339
|
+
<MobileNavTrigger value="workflow" label="Workflow">
|
|
340
|
+
<UtilityCompare className="size-6 text-gray-500 group-data-active:text-gray-900" />
|
|
341
|
+
</MobileNavTrigger>
|
|
342
|
+
<MobileNavTrigger value="edit" label="Edits">
|
|
343
|
+
<UtilityRevisionsShow className="size-6 text-gray-500 group-data-active:text-gray-900" />
|
|
344
|
+
</MobileNavTrigger>
|
|
345
|
+
<MobileNavTrigger value="comments" label="Comments" disabled>
|
|
346
|
+
<UtilityFeedback className="size-6 text-gray-500 group-data-active:text-gray-900" />
|
|
347
|
+
</MobileNavTrigger>
|
|
348
|
+
</MobileNavBar>
|
|
349
|
+
</MobileNav>
|
|
350
|
+
),
|
|
351
|
+
};
|