@hilum/ui 3.6.5 → 3.6.7

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": "@hilum/ui",
3
- "version": "3.6.5",
3
+ "version": "3.6.7",
4
4
  "private": false,
5
5
  "description": "Hilum UI — design system primitives (Button, Input, Dialog, Combobox, …) + tokens + fonts + icons",
6
6
  "license": "MIT",
@@ -7,6 +7,7 @@ import { focusRingClasses, motionClasses, pressClasses } from "../lib/interactio
7
7
  import {
8
8
  desktopDialogContentClassName,
9
9
  dialogSheetMotionClassName,
10
+ mobileDialogSheetStyle,
10
11
  mobileDialogSheetContentClassName,
11
12
  } from "../lib/mobile-popper-sheet";
12
13
 
@@ -37,13 +38,15 @@ const AlertDialogContent = React.forwardRef<
37
38
  React.ComponentPropsWithoutRef<typeof AlertDialog.Content>
38
39
  >(({ className, children, ...props }, ref) => (
39
40
  <AlertDialog.Portal>
41
+ <style>{mobileDialogSheetStyle}</style>
40
42
  <AlertDialogOverlay />
41
43
  <AlertDialog.Content
42
44
  ref={ref}
45
+ data-hilum-dialog-sheet="true"
43
46
  className={cn(
44
47
  mobileDialogSheetContentClassName,
45
48
  desktopDialogContentClassName,
46
- "border border-border shadow-elevated sm:max-w-md",
49
+ "border border-border shadow-elevated max-w-md",
47
50
  dialogSheetMotionClassName,
48
51
  className,
49
52
  )}
@@ -2,6 +2,7 @@
2
2
 
3
3
  import {
4
4
  createContext,
5
+ createElement,
5
6
  forwardRef,
6
7
  useContext,
7
8
  useEffect,
@@ -20,6 +21,7 @@ import { surfaceClasses } from "../lib/surface-classes";
20
21
  import {
21
22
  desktopDialogContentClassName,
22
23
  dialogSheetMotionClassName,
24
+ mobileDialogSheetStyle,
23
25
  mobileDialogSheetContentClassName,
24
26
  } from "../lib/mobile-popper-sheet";
25
27
  import { Button } from "./button";
@@ -84,13 +86,14 @@ const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(
84
86
  size === "sm"
85
87
  ? container
86
88
  ? "max-w-[400px]"
87
- : "lg:max-w-[400px]"
89
+ : "max-w-[400px]"
88
90
  : container
89
91
  ? "max-w-[540px]"
90
- : "lg:max-w-[540px]";
92
+ : "max-w-[540px]";
91
93
 
92
94
  return (
93
95
  <DialogPrimitive.Portal forceMount container={container ?? undefined}>
96
+ {!container && <style>{mobileDialogSheetStyle}</style>}
94
97
  <DialogPrimitive.Overlay asChild forceMount>
95
98
  <motion.div
96
99
  className={cn(
@@ -104,6 +107,7 @@ const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(
104
107
  </DialogPrimitive.Overlay>
105
108
  <DialogPrimitive.Content ref={ref} asChild forceMount {...props}>
106
109
  <motion.div
110
+ data-hilum-dialog-sheet={container ? undefined : "true"}
107
111
  className={cn(
108
112
  container
109
113
  ? "absolute left-1/2 top-1/2 z-50 w-[calc(100%-2rem)]"
@@ -137,7 +141,7 @@ const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(
137
141
  {children}
138
142
  <DialogPrimitive.Close asChild>
139
143
  <Button variant="ghost" size="icon-sm" className="absolute right-3 top-3">
140
- <XIcon />
144
+ {createElement(XIcon)}
141
145
  <span className="sr-only">Close</span>
142
146
  </Button>
143
147
  </DialogPrimitive.Close>
@@ -17,6 +17,24 @@ export const dialogSheetMotionClassName = [
17
17
  "lg:data-[state=closed]:zoom-out-95 lg:data-[state=open]:zoom-in-95",
18
18
  ].join(" ");
19
19
 
20
+ export const mobileDialogSheetStyle = `
21
+ @media (max-width: 1023px) {
22
+ [data-hilum-dialog-sheet="true"] {
23
+ position: fixed !important;
24
+ left: 0 !important;
25
+ right: 0 !important;
26
+ bottom: 0 !important;
27
+ top: auto !important;
28
+ width: 100% !important;
29
+ max-width: none !important;
30
+ max-height: calc(100dvh - 1rem) !important;
31
+ border-bottom-left-radius: 0 !important;
32
+ border-bottom-right-radius: 0 !important;
33
+ transform-origin: bottom center !important;
34
+ }
35
+ }
36
+ `;
37
+
20
38
  export const mobilePopperSheetPositionClassName = [
21
39
  "max-md:!fixed max-md:!inset-x-3 max-md:!bottom-3 max-md:!top-auto max-md:!left-3 max-md:!right-3",
22
40
  "max-md:!w-auto max-md:!min-w-0 max-md:!max-w-none max-md:!transform-none",