@hanzo/ui 3.3.0 → 3.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -53,8 +53,7 @@
53
53
  "class-variance-authority": "^0.7.0",
54
54
  "clsx": "^2.1.0",
55
55
  "cmdk": "^0.2.0",
56
- "embla-carousel-autoplay": "8.0.0-rc15",
57
- "embla-carousel-react": "8.0.0-rc15",
56
+ "embla-carousel-react": "8.0.1",
58
57
  "input-otp": "^1.0.1",
59
58
  "lodash.castarray": "^4.4.0",
60
59
  "lodash.isplainobject": "^4.0.6",
@@ -5,7 +5,7 @@ const BreakpointIndicator: React.FC = () => {
5
5
  if (process.env.NODE_ENV === "production") return null
6
6
 
7
7
  return (
8
- <div className="fixed bottom-1 left-1 z-50 flex h-6 w-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-primary">
8
+ <div className="fixed bottom-1 left-1 z-floating flex h-6 w-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-primary">
9
9
  <div className="block sm:hidden">xs</div>
10
10
  <div className="hidden sm:block md:hidden">sm</div>
11
11
  <div className="hidden md:block lg:hidden">md</div>
@@ -37,7 +37,7 @@ function Calendar({
37
37
  "text-muted-1 rounded-md w-8 font-normal text-[0.8rem]",
38
38
  row: "flex w-full mt-2",
39
39
  cell: cn(
40
- "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-level-1 [&:has([aria-selected].day-outside)]:bg-level-1/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
40
+ "relative p-0 text-center text-sm focus-within:relative focus-within:z-above-content [&:has([aria-selected])]:bg-level-1 [&:has([aria-selected].day-outside)]:bg-level-1/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
41
41
  props.mode === "range"
42
42
  ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
43
43
  : "[&:has([aria-selected])]:rounded-md"
@@ -2,7 +2,6 @@
2
2
 
3
3
  import * as React from 'react'
4
4
  import useEmblaCarousel, { type EmblaOptionsType, type EmblaCarouselType } from 'embla-carousel-react'
5
- import Autoplay from 'embla-carousel-autoplay'
6
5
  import { ArrowLeft, ArrowRight } from 'lucide-react'
7
6
 
8
7
  import { cn } from '../util'
@@ -42,6 +41,9 @@ function useCarousel(): CarouselContextProps {
42
41
  return context
43
42
  }
44
43
 
44
+ // https://github.com/emilkowalski/vaul/pull/250
45
+ // See data-vaul-no-drag throughout
46
+
45
47
  const Carousel = React.forwardRef<
46
48
  HTMLDivElement,
47
49
  React.HTMLAttributes<HTMLDivElement> & CarouselProps
@@ -267,5 +269,4 @@ export {
267
269
  CarouselItem,
268
270
  CarouselPrevious,
269
271
  CarouselNext,
270
- Autoplay as CarouselAutoplayPlugin
271
272
  }
@@ -17,7 +17,7 @@ const DialogPortal = React.forwardRef<
17
17
  DialogPortalProps
18
18
  >(({ className, children, ...props }, ref) => (
19
19
  <DialogPrimitive.Portal {...props}>
20
- <div className={cn("fixed inset-0 z-50 flex items-end justify-center sm:items-center", className)}>
20
+ <div className={cn("fixed inset-0 z-modal flex items-end justify-center sm:items-center", className)}>
21
21
  {children}
22
22
  </div>
23
23
  </DialogPrimitive.Portal>
@@ -32,7 +32,7 @@ const DialogOverlay = React.forwardRef<
32
32
  React.ElementRef<typeof DialogPrimitive.Overlay>,
33
33
  DialogOverlayProps
34
34
  >(({ className, ...props }, ref) => (
35
- <div className={cn("fixed inset-0 z-50 flex items-end justify-center sm:items-center", className)}>
35
+ <div className={cn("bg-overlay backdrop-blur-sm fixed inset-0 z-below-modal flex items-end justify-center sm:items-center", className)}>
36
36
  <DialogPrimitive.Overlay ref={ref} {...props} />
37
37
  </div>
38
38
  ))
@@ -26,7 +26,7 @@ const DrawerOverlay = React.forwardRef<
26
26
  >(({ className, ...props }, ref) => (
27
27
  <DrawerPrimitive.Overlay
28
28
  ref={ref}
29
- className={cn('fixed inset-0 bg-background opacity-50', className)}
29
+ className={cn('fixed inset-0 bg-overlay backdrop-blur-sm', className)}
30
30
  {...props}
31
31
  />
32
32
  ))
@@ -40,10 +40,10 @@ const DrawerContent = React.forwardRef<
40
40
  >(({ className, children, overlayClx='', ...props }, ref) => (
41
41
  <DrawerPortal>
42
42
  {/* If no or same z index, overlay should precede content */}
43
- <DrawerOverlay className={overlayClx}/>
43
+ <DrawerOverlay className={cn('z-below-modal', overlayClx)}/>
44
44
  <DrawerPrimitive.Content
45
45
  ref={ref}
46
- className={cn('fixed left-0 right-0 bottom-0 ',
46
+ className={cn('fixed left-0 right-0 bottom-0 z-modal',
47
47
  'mt-24 flex flex-col h-[80%] rounded-t-[10px] pt-6 border bg-background',
48
48
  className
49
49
  )}
@@ -36,7 +36,7 @@ const InputOTPSlot = React.forwardRef<
36
36
  className={cn(
37
37
  'relative flex h-10 w-10 items-center justify-center border-y border-r border-muted-2 text-sm ',
38
38
  'transition-all first:rounded-l-md first:border-l last:rounded-r-md',
39
- isActive && 'z-10 ring-2 ring-muted', // TODO: couldn't find: 'ring-offset-background'
39
+ isActive && 'z-above-content ring-2 ring-muted', // TODO: couldn't find: 'ring-offset-background'
40
40
  className
41
41
  )}
42
42
  {...props}
@@ -21,7 +21,7 @@ const PopoverContent = React.forwardRef<
21
21
  align={align}
22
22
  sideOffset={sideOffset}
23
23
  className={cn(
24
- 'z-50 w-72 rounded-md border bg-level-1 p-4 text-foreground shadow-md outline-none ' +
24
+ 'z-modal w-72 rounded-md border bg-level-1 p-4 text-foreground shadow-md outline-none ' +
25
25
  'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 ' +
26
26
  'data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ' +
27
27
  'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 ' +
@@ -76,7 +76,7 @@ const SelectContent = React.forwardRef<
76
76
  <SelectPrimitive.Content
77
77
  ref={ref}
78
78
  className={cn(
79
- 'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border ' +
79
+ 'relative z-popup max-h-96 min-w-[8rem] overflow-hidden rounded-md border ' +
80
80
  'bg-level-1 text-foreground shadow-md data-[state=open]:animate-in ' +
81
81
  'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ' +
82
82
  'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ' +
@@ -22,7 +22,8 @@ const SheetOverlay = React.forwardRef<
22
22
  >(({ className, ...props }, ref) => (
23
23
  <SheetPrimitive.Overlay
24
24
  className={cn(
25
- 'fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
25
+ 'fixed inset-0 z-below-modal bg-overlay backdrop-blur-sm',
26
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
26
27
  className
27
28
  )}
28
29
  {...props}
@@ -32,7 +33,7 @@ const SheetOverlay = React.forwardRef<
32
33
  SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
33
34
 
34
35
  const sheetVariants = cva(
35
- 'fixed z-50 gap-4 bg-background p-3 sm:p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-300',
36
+ 'fixed z-modal gap-4 bg-background p-3 sm:p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-300',
36
37
  {
37
38
  variants: {
38
39
  side: {
@@ -89,17 +90,17 @@ const SheetContent = React.forwardRef<
89
90
  {children}
90
91
 
91
92
  {closeElement && (
92
- <SheetPrimitive.Close className={cn(closeUIclx, 'absolute z-10 top-3', xOfCloseUIClass, closeButtonClass)}>
93
+ <SheetPrimitive.Close className={cn(closeUIclx, 'absolute z-above-content top-3', xOfCloseUIClass, closeButtonClass)}>
93
94
  {closeElement}
94
95
  </SheetPrimitive.Close>
95
96
  )}
96
97
  {closeElement && duplicateCloseOnBottom && (
97
- <SheetPrimitive.Close className={cn(closeUIclx, 'absolute z-10 bottom-3', xOfCloseUIClass, closeButtonClass)}>
98
+ <SheetPrimitive.Close className={cn(closeUIclx, 'absolute z-above-content bottom-3', xOfCloseUIClass, closeButtonClass)}>
98
99
  {closeElement}
99
100
  </SheetPrimitive.Close>
100
101
  )}
101
102
  {centerElement && (
102
- <div className={'absolute z-0 top-3 left-0 right-0 flex flex-row justify-center align-start'} >
103
+ <div className={'absolute z-content top-3 left-0 right-0 flex flex-row justify-center align-start'} >
103
104
  {centerElement}
104
105
  </div>
105
106
  )}
@@ -60,7 +60,7 @@ const YouTubeEmbed: React.FC<{
60
60
  />
61
61
  <div
62
62
  className={ //https://stackoverflow.com/a/23384995/11645689
63
- 'absolute z-50 left-[50%] top-[50%] -translate-y-2/4 -translate-x-2/4 ' +
63
+ 'absolute z-above-content-2 left-[50%] top-[50%] -translate-y-2/4 -translate-x-2/4 ' +
64
64
  'grid place-items-center ' +
65
65
  'text-xl text-white opacity-90'
66
66
  }
@@ -73,7 +73,7 @@ const YouTubeEmbed: React.FC<{
73
73
  {...{'aria-hidden': true}}
74
74
  />
75
75
  </div>
76
- {caption && <p className='hidden md:block whitespace-nowrap typography absolute z-50 left-[50%] top-[20px] -translate-x-2/4 '>{caption}</p>}
76
+ {caption && <p className='hidden md:block whitespace-nowrap typography absolute z-above-content left-[50%] top-[20px] -translate-x-2/4 '>{caption}</p>}
77
77
  </button>
78
78
  )}
79
79
  </div>
@@ -17,8 +17,10 @@
17
17
  --hz-ui-bg-2: hsl(0 0% 75%);
18
18
  --hz-ui-bg-3: hsl(0 0% 55%);
19
19
 
20
+ --hz-ui-bg-overlay: hsla(0 0% 100% 0.60);
21
+
20
22
  --hz-ui-bg-inverted: var(--hz-ui-fg-0);
21
- --hz-ui-bg-inverted-hover: hsla(0, 0%, 0%, 0.85);
23
+ --hz-ui-bg-inverted-hover: hsla(0 0% 0% 0.85);
22
24
 
23
25
  --hz-ui-fg-inverted: var(--hz-ui-bg-0);
24
26
 
@@ -52,7 +54,7 @@
52
54
  .hanzo-ui-dark-theme {
53
55
 
54
56
  --hz-ui-fg-0: hsl(0 0% 100%);
55
- --hz-ui-fg-body: hsl(0, 0%, 97%);
57
+ --hz-ui-fg-body: hsl(0, 100%, 0%);
56
58
  --hz-ui-fg-1: hsl(0 0% 85%);
57
59
  --hz-ui-fg-2: hsl(0 0% 70%);
58
60
  --hz-ui-fg-3: hsl(0 0% 55%);
@@ -67,6 +69,8 @@
67
69
  --hz-ui-bg-1: hsl(0 0% 12%);
68
70
  --hz-ui-bg-0: hsl(0 0% 0%);
69
71
 
72
+ --hz-ui-bg-overlay: hsla(0 0% 0% 0.60);
73
+
70
74
  --hz-ui-fg-inverted: var(--hz-ui-bg-0);
71
75
 
72
76
  --hz-ui-secondary-0: hsl(266, 79%, 40%);
@@ -5,6 +5,10 @@ export default ({ colors }) => ({
5
5
  input: "var(--hz-ui-input)",
6
6
  ring: "var(--hz-ui-ring)",
7
7
  background: 'var(--hz-ui-bg-0)',
8
+ // Should be partially transparent,
9
+ // so opacity animations in 'vaul' module and other 3rd party stuff work
10
+ overlay: 'var(--hz-ui-bg-overlay)',
11
+
8
12
  // levels forward in z-index (a la Material Design)
9
13
  level: {
10
14
  DEFAULT: "var(--hz-ui-bg-0)",
@@ -8,6 +8,7 @@ import screens from './screens.tailwind'
8
8
  import spacing from './spacing.tailwind'
9
9
  import fontSize from './fontSize.tailwind'
10
10
  import fontFamily from './fontFamily.tailwind'
11
+ import zIndex from './z-index.tailwind'
11
12
  import typographyPlugin from './typo-plugin'
12
13
 
13
14
  export default {
@@ -905,14 +906,6 @@ export default {
905
906
  contents: 'contents',
906
907
  transform: 'transform',
907
908
  },
908
- zIndex: {
909
- auto: 'auto',
910
- 0: '0',
911
- 10: '10',
912
- 20: '20',
913
- 30: '30',
914
- 40: '40',
915
- 50: '50',
916
- },
909
+ zIndex,
917
910
  },
918
911
  }
@@ -0,0 +1,71 @@
1
+ const zIndex = {
2
+
3
+ auto: 'auto',
4
+ unset: 'unset',
5
+
6
+ ...{
7
+ 'below-content-3': '-3',
8
+ 'below-content-2': '-2',
9
+ 'below-content-1': '-1',
10
+ 'below-content': '-1',
11
+ 'content': '0',
12
+ 'above-content': '1',
13
+ 'above-content-1': '1',
14
+ 'above-content-2': '2',
15
+ 'above-content-3': '3',
16
+ },
17
+ // popups that may scroll w content, appear below header, etc
18
+ // for larger, modal popups, please use 'modal'
19
+ ...{
20
+ 'below-popup-3': '7',
21
+ 'below-popup-2': '8',
22
+ 'below-popup-1': '9',
23
+ 'below-popup': '9',
24
+ 'popup': '10',
25
+ 'above-popup': '11',
26
+ 'above-popup-1': '11',
27
+ 'above-popup-2': '12',
28
+ 'above-popup-3': '13',
29
+ },
30
+ ...{
31
+ 'below-header-3': '17',
32
+ 'below-header-2': '18',
33
+ 'below-header-1': '19',
34
+ 'below-header': '19',
35
+ 'header': '20',
36
+ 'above-header': '21',
37
+ 'above-header-1': '21',
38
+ 'above-header-2': '22',
39
+ 'above-header-3': '23',
40
+ },
41
+ // drawer, dialog, full screen menu
42
+ ...{
43
+ 'below-modal-3': '27',
44
+ 'below-modal-2': '28',
45
+ 'below-modal-1': '29',
46
+ 'below-modal': '29',
47
+ 'modal': '30',
48
+ 'above-modal': '31',
49
+ 'above-modal-1': '31',
50
+ 'above-modal-2': '32',
51
+ 'above-modal-3': '33',
52
+ },
53
+ // "highest": help button, other UI that floats above everything.
54
+ ...{
55
+ 'below-floating-3': '37',
56
+ 'below-floating-2': '38',
57
+ 'below-floating-1': '39',
58
+ 'below-floating': '39',
59
+ 'floating': '40',
60
+ 'above-floating': '41',
61
+ 'above-floating-1': '41',
62
+ 'above-floating-2': '42',
63
+ 'above-floating-3': '43',
64
+ },
65
+ }
66
+
67
+ for (let i = 0; i <= 50; i++) {
68
+ zIndex[`${i}`] = `${i}`
69
+ }
70
+
71
+ export default zIndex