@syscore/ui-library 1.19.0 → 1.20.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/global.css CHANGED
@@ -2161,6 +2161,12 @@ body {
2161
2161
  transform: translateY(-50%) rotate(90deg);
2162
2162
  }
2163
2163
 
2164
+ @media (max-width: 639px) {
2165
+ .tooltip-content {
2166
+ max-width: calc(100vw - 2rem);
2167
+ }
2168
+ }
2169
+
2164
2170
  @keyframes fade-in {
2165
2171
  from {
2166
2172
  opacity: 0;
@@ -2542,6 +2548,17 @@ body {
2542
2548
  transition-duration: 300ms;
2543
2549
  }
2544
2550
 
2551
+ @media (max-width: 639px) {
2552
+ .dialog-content {
2553
+ width: 100%;
2554
+ padding-inline: 1rem;
2555
+ }
2556
+
2557
+ .dialog-content-wrapper {
2558
+ width: 100%;
2559
+ }
2560
+ }
2561
+
2545
2562
  .dialog-close {
2546
2563
  position: absolute;
2547
2564
  top: 1rem;
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react";
2
2
  import { Button } from "../components/ui/button";
3
3
  import { Input } from "../components/ui/input";
4
4
  import { Label } from "../components/ui/label";
5
- import { useState } from "react";
5
+ import { useState, useEffect } from "react";
6
6
  import { AnimatePresence, motion } from "motion/react";
7
7
  import {
8
8
  Dialog,
@@ -13,6 +13,28 @@ import {
13
13
  DialogTitle,
14
14
  DialogTrigger,
15
15
  } from "../components/ui/dialog";
16
+ import {
17
+ Drawer,
18
+ DrawerContent,
19
+ DrawerHeader,
20
+ DrawerTitle,
21
+ DrawerFooter,
22
+ DrawerClose,
23
+ DrawerTrigger,
24
+ } from "../components/ui/drawer";
25
+
26
+ function useIsMobile(breakpoint = 640) {
27
+ const [isMobile, setIsMobile] = useState(
28
+ () => window.innerWidth < breakpoint,
29
+ );
30
+ useEffect(() => {
31
+ const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
32
+ const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches);
33
+ mql.addEventListener("change", handler);
34
+ return () => mql.removeEventListener("change", handler);
35
+ }, [breakpoint]);
36
+ return isMobile;
37
+ }
16
38
 
17
39
  const meta = {
18
40
  title: "Review/Dialog",
@@ -206,8 +228,8 @@ export const LongContentScroll: Story = {
206
228
  By accessing and using the WELL Building Standard platform, you
207
229
  acknowledge that you have read, understood, and agree to be bound
208
230
  by these Terms of Service. If you do not agree to these terms, you
209
- must not use the platform. These terms constitute a legally binding
210
- agreement between you and the International WELL Building
231
+ must not use the platform. These terms constitute a legally
232
+ binding agreement between you and the International WELL Building
211
233
  Institute.
212
234
  </p>
213
235
 
@@ -290,3 +312,82 @@ export const LongContentScroll: Story = {
290
312
  );
291
313
  },
292
314
  };
315
+
316
+ export const WithResponsiveDrawer: Story = {
317
+ render: () => {
318
+ const [open, setOpen] = useState(false);
319
+ const isMobile = useIsMobile();
320
+
321
+ if (isMobile) {
322
+ return (
323
+ <Drawer open={open} onOpenChange={setOpen}>
324
+ <DrawerTrigger asChild>
325
+ <Button size="large" variant="general-primary">
326
+ Open Dialog
327
+ </Button>
328
+ </DrawerTrigger>
329
+ <DrawerContent>
330
+ <DrawerHeader>
331
+ <DrawerTitle className="text-gray-800 text-center">
332
+ Are you sure?
333
+ </DrawerTitle>
334
+ </DrawerHeader>
335
+ <div className="flex gap-4 justify-center items-center p-6">
336
+ <Button
337
+ size="utility"
338
+ variant="general-secondary"
339
+ onClick={() => setOpen(false)}
340
+ >
341
+ Nevermind
342
+ </Button>
343
+ <Button
344
+ size="utility"
345
+ variant="general-primary"
346
+ onClick={() => setOpen(false)}
347
+ >
348
+ Yes, delete user
349
+ </Button>
350
+ </div>
351
+ </DrawerContent>
352
+ </Drawer>
353
+ );
354
+ }
355
+
356
+ return (
357
+ <Dialog open={open} onOpenChange={setOpen}>
358
+ <DialogTrigger asChild>
359
+ <Button
360
+ size="large"
361
+ variant="general-primary"
362
+ onClick={() => setOpen(true)}
363
+ >
364
+ Open Dialog
365
+ </Button>
366
+ </DialogTrigger>
367
+ <DialogContent className="sm:min-w-[297px]" showCloseButton={false}>
368
+ <DialogHeader>
369
+ <DialogTitle className="text-gray-800 text-center mb-8 h-8 justify-center items-center flex">
370
+ Are you sure?
371
+ </DialogTitle>
372
+ </DialogHeader>
373
+ <div className="flex gap-4 justify-center items-center">
374
+ <Button
375
+ size="utility"
376
+ variant="general-secondary"
377
+ onClick={() => setOpen(false)}
378
+ >
379
+ Nevermind
380
+ </Button>
381
+ <Button
382
+ size="utility"
383
+ variant="general-primary"
384
+ onClick={() => setOpen(false)}
385
+ >
386
+ Yes, delete user
387
+ </Button>
388
+ </div>
389
+ </DialogContent>
390
+ </Dialog>
391
+ );
392
+ },
393
+ };
@@ -18,6 +18,21 @@ import { UtilityCompare } from "../components/icons/UtilityCompare";
18
18
  import { UtilityRevisionsShow } from "../components/icons/UtilityRevisionsShow";
19
19
  import { UtilityFeedback } from "../components/icons/UtilityFeedback";
20
20
  import { Button } from "@/components/ui/button";
21
+ import {
22
+ Dialog,
23
+ DialogTrigger,
24
+ DialogContent,
25
+ DialogHeader,
26
+ DialogTitle,
27
+ } from "@/components/ui/dialog";
28
+ import { useIsMobile } from "@/hooks/use-mobile";
29
+ import {
30
+ DrawerTitle,
31
+ DrawerHeader,
32
+ DrawerContent,
33
+ Drawer,
34
+ DrawerTrigger,
35
+ } from "@/components/ui/drawer";
21
36
 
22
37
  const meta = {
23
38
  title: "Review/MobileNav",
@@ -235,45 +250,73 @@ const PanelContent = ({ activeKey }: { activeKey: string }) => {
235
250
  export const Default: Story = {
236
251
  args: { children: null },
237
252
 
238
- render: () => (
239
- <div className="h-screen w-full bg-white">
240
- {/* Main content area */}
241
- <div className="p-6">
242
- <p className="text-sm text-gray-400">
243
- Tap an icon below to open the panel.
244
- </p>
245
- <Button
246
- size="large"
247
- variant="general-primary"
248
- onClick={() => alert("Hello")}
249
- >
250
- Open panel
251
- </Button>
253
+ render: () => {
254
+ const [open, setOpen] = useState(false);
255
+ return (
256
+ <div className="h-screen w-full bg-white">
257
+ <Dialog open={open} onOpenChange={setOpen}>
258
+ <DialogTrigger asChild>
259
+ <Button
260
+ size="large"
261
+ variant="general-primary"
262
+ onClick={() => setOpen(true)}
263
+ >
264
+ Open Dialog
265
+ </Button>
266
+ </DialogTrigger>
267
+ <DialogContent className="w-[400px]" showCloseButton={false}>
268
+ <DialogHeader>
269
+ <DialogTitle className="text-gray-800 text-center mb-8 h-8 justify-center items-center flex">
270
+ Are you sure?
271
+ </DialogTitle>
272
+ </DialogHeader>
273
+ <p className="body-small text-gray-600 text-center">
274
+ This action cannot be undone. The user will lose access to all
275
+ projects, certifications, and associated data. Please confirm you
276
+ wish to proceed.
277
+ </p>
278
+ <div className="flex gap-4 justify-center items-center">
279
+ <Button
280
+ size="utility"
281
+ variant="general-secondary"
282
+ onClick={() => setOpen(false)}
283
+ >
284
+ Nevermind
285
+ </Button>
286
+ <Button
287
+ size="utility"
288
+ variant="general-primary"
289
+ onClick={() => setOpen(false)}
290
+ >
291
+ Yes, delete user
292
+ </Button>
293
+ </div>
294
+ </DialogContent>
295
+ </Dialog>
296
+ {/* Fixed bottom nav */}
297
+ <MobileNav>
298
+ <MobileNavPanel>
299
+ {(activeKey) => <PanelContent activeKey={activeKey} />}
300
+ </MobileNavPanel>
301
+
302
+ <MobileNavBar>
303
+ <MobileNavTrigger value="list" label="Changes">
304
+ <UtilityText className="size-6" />
305
+ </MobileNavTrigger>
306
+ <MobileNavTrigger value="workflow" label="Workflow">
307
+ <UtilityCompare className="size-6" />
308
+ </MobileNavTrigger>
309
+ <MobileNavTrigger value="edit" label="Edits">
310
+ <UtilityRevisionsShow className="size-6" />
311
+ </MobileNavTrigger>
312
+ <MobileNavTrigger value="comments" label="Comments">
313
+ <UtilityFeedback className="size-6" />
314
+ </MobileNavTrigger>
315
+ </MobileNavBar>
316
+ </MobileNav>
252
317
  </div>
253
-
254
- {/* Fixed bottom nav */}
255
- <MobileNav>
256
- <MobileNavPanel>
257
- {(activeKey) => <PanelContent activeKey={activeKey} />}
258
- </MobileNavPanel>
259
-
260
- <MobileNavBar>
261
- <MobileNavTrigger value="list" label="Changes">
262
- <UtilityText className="size-6" />
263
- </MobileNavTrigger>
264
- <MobileNavTrigger value="workflow" label="Workflow">
265
- <UtilityCompare className="size-6" />
266
- </MobileNavTrigger>
267
- <MobileNavTrigger value="edit" label="Edits">
268
- <UtilityRevisionsShow className="size-6" />
269
- </MobileNavTrigger>
270
- <MobileNavTrigger value="comments" label="Comments">
271
- <UtilityFeedback className="size-6" />
272
- </MobileNavTrigger>
273
- </MobileNavBar>
274
- </MobileNav>
275
- </div>
276
- ),
318
+ );
319
+ },
277
320
  };
278
321
 
279
322
  const WithCustomActionRender = () => {
@@ -86,6 +86,30 @@ export const Simple: Story = {
86
86
  ),
87
87
  };
88
88
 
89
+ export const LongText: Story = {
90
+ render: () => (
91
+ <div className="p-16 h-screen">
92
+ <Tooltip trigger="click">
93
+ <TooltipTrigger>Click for details</TooltipTrigger>
94
+ <TooltipContent className="w-[400px]">
95
+ <div className="space-y-2">
96
+ <Text as="h1" variant="body-base" className="text-white">
97
+ WELL Feature Details
98
+ </Text>
99
+ <Text as="p" variant="body-small" className="text-white/90">
100
+ This feature requires documentation of at least two instances of
101
+ biophilic design elements incorporated into the space, including
102
+ natural materials, plants, water features, or views to the
103
+ outside. All elements must be verified by a WELL Assessor during
104
+ the on-site performance verification visit.
105
+ </Text>
106
+ </div>
107
+ </TooltipContent>
108
+ </Tooltip>
109
+ </div>
110
+ ),
111
+ };
112
+
89
113
  export const Variants: Story = {
90
114
  render: () => (
91
115
  <div className="p-16 flex gap-16">