hazo_ui 2.8.1 → 2.9.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/README.md +55 -0
- package/dist/index.cjs +118 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +108 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2965,6 +2965,61 @@ function FormDialog() {
|
|
|
2965
2965
|
| `footerClassName` | `string` | - | Footer CSS classes |
|
|
2966
2966
|
| `showCloseButton` | `boolean` | `true` | Show X close button |
|
|
2967
2967
|
|
|
2968
|
+
## Drawer
|
|
2969
|
+
|
|
2970
|
+
A vaul-backed bottom sheet primitive. Intended for mobile UIs; on desktop, prefer `Dialog`.
|
|
2971
|
+
|
|
2972
|
+
```typescript
|
|
2973
|
+
import {
|
|
2974
|
+
Drawer,
|
|
2975
|
+
DrawerTrigger,
|
|
2976
|
+
DrawerContent,
|
|
2977
|
+
DrawerHeader,
|
|
2978
|
+
DrawerTitle,
|
|
2979
|
+
DrawerDescription,
|
|
2980
|
+
DrawerFooter,
|
|
2981
|
+
DrawerClose,
|
|
2982
|
+
useMediaQuery,
|
|
2983
|
+
} from "hazo_ui";
|
|
2984
|
+
|
|
2985
|
+
function Example() {
|
|
2986
|
+
const is_mobile = useMediaQuery("(max-width: 640px)");
|
|
2987
|
+
|
|
2988
|
+
if (!is_mobile) {
|
|
2989
|
+
// Render a Dialog instead on desktop
|
|
2990
|
+
return null;
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
return (
|
|
2994
|
+
<Drawer>
|
|
2995
|
+
<DrawerTrigger asChild>
|
|
2996
|
+
<button>Open</button>
|
|
2997
|
+
</DrawerTrigger>
|
|
2998
|
+
<DrawerContent>
|
|
2999
|
+
<DrawerHeader>
|
|
3000
|
+
<DrawerTitle>Title</DrawerTitle>
|
|
3001
|
+
<DrawerDescription>Optional description</DrawerDescription>
|
|
3002
|
+
</DrawerHeader>
|
|
3003
|
+
<DrawerFooter>
|
|
3004
|
+
<DrawerClose asChild>
|
|
3005
|
+
<button>Close</button>
|
|
3006
|
+
</DrawerClose>
|
|
3007
|
+
</DrawerFooter>
|
|
3008
|
+
</DrawerContent>
|
|
3009
|
+
</Drawer>
|
|
3010
|
+
);
|
|
3011
|
+
}
|
|
3012
|
+
```
|
|
3013
|
+
|
|
3014
|
+
**Behavior:**
|
|
3015
|
+
- Drag the grab handle downward to dismiss
|
|
3016
|
+
- ESC closes
|
|
3017
|
+
- Click overlay to dismiss
|
|
3018
|
+
- `max-h-[96dvh]` keeps the sheet usable on iOS Safari when the address bar toggles
|
|
3019
|
+
- Focus trap, `aria-labelledby`, and background `aria-hidden` are wired automatically by vaul
|
|
3020
|
+
|
|
3021
|
+
**Not yet supported (deferred):** snap points, side-anchored drawers, nested drawers.
|
|
3022
|
+
|
|
2968
3023
|
---
|
|
2969
3024
|
|
|
2970
3025
|
## Troubleshooting
|
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,7 @@ var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
|
57
57
|
var Suggestion = require('@tiptap/suggestion');
|
|
58
58
|
var state = require('@tiptap/pm/state');
|
|
59
59
|
var reactDom = require('react-dom');
|
|
60
|
+
var vaul = require('vaul');
|
|
60
61
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
61
62
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
62
63
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
@@ -6798,6 +6799,112 @@ function HazoUiConfirmDialog({
|
|
|
6798
6799
|
)
|
|
6799
6800
|
] }) });
|
|
6800
6801
|
}
|
|
6802
|
+
var Drawer = ({
|
|
6803
|
+
shouldScaleBackground = true,
|
|
6804
|
+
...props
|
|
6805
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(vaul.Drawer.Root, { shouldScaleBackground, ...props });
|
|
6806
|
+
Drawer.displayName = "Drawer";
|
|
6807
|
+
var DrawerTrigger = vaul.Drawer.Trigger;
|
|
6808
|
+
var DrawerPortal = vaul.Drawer.Portal;
|
|
6809
|
+
var DrawerClose = vaul.Drawer.Close;
|
|
6810
|
+
var DrawerOverlay = React27__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6811
|
+
vaul.Drawer.Overlay,
|
|
6812
|
+
{
|
|
6813
|
+
ref,
|
|
6814
|
+
className: cn(
|
|
6815
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
6816
|
+
className
|
|
6817
|
+
),
|
|
6818
|
+
...props
|
|
6819
|
+
}
|
|
6820
|
+
));
|
|
6821
|
+
DrawerOverlay.displayName = "DrawerOverlay";
|
|
6822
|
+
var DrawerContent = React27__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DrawerPortal, { children: [
|
|
6823
|
+
/* @__PURE__ */ jsxRuntime.jsx(DrawerOverlay, {}),
|
|
6824
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6825
|
+
vaul.Drawer.Content,
|
|
6826
|
+
{
|
|
6827
|
+
ref,
|
|
6828
|
+
className: cn(
|
|
6829
|
+
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto max-h-[96dvh] flex-col rounded-t-[10px] border bg-background",
|
|
6830
|
+
className
|
|
6831
|
+
),
|
|
6832
|
+
...props,
|
|
6833
|
+
children: [
|
|
6834
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" }),
|
|
6835
|
+
children
|
|
6836
|
+
]
|
|
6837
|
+
}
|
|
6838
|
+
)
|
|
6839
|
+
] }));
|
|
6840
|
+
DrawerContent.displayName = "DrawerContent";
|
|
6841
|
+
var DrawerHeader = ({
|
|
6842
|
+
className,
|
|
6843
|
+
...props
|
|
6844
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6845
|
+
"div",
|
|
6846
|
+
{
|
|
6847
|
+
className: cn("grid gap-1.5 p-4 text-center sm:text-left", className),
|
|
6848
|
+
...props
|
|
6849
|
+
}
|
|
6850
|
+
);
|
|
6851
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
6852
|
+
var DrawerFooter = ({
|
|
6853
|
+
className,
|
|
6854
|
+
...props
|
|
6855
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6856
|
+
"div",
|
|
6857
|
+
{
|
|
6858
|
+
className: cn("mt-auto flex flex-col gap-2 p-4", className),
|
|
6859
|
+
...props
|
|
6860
|
+
}
|
|
6861
|
+
);
|
|
6862
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
6863
|
+
var DrawerTitle = React27__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6864
|
+
vaul.Drawer.Title,
|
|
6865
|
+
{
|
|
6866
|
+
ref,
|
|
6867
|
+
className: cn(
|
|
6868
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
6869
|
+
className
|
|
6870
|
+
),
|
|
6871
|
+
...props
|
|
6872
|
+
}
|
|
6873
|
+
));
|
|
6874
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
6875
|
+
var DrawerDescription = React27__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6876
|
+
vaul.Drawer.Description,
|
|
6877
|
+
{
|
|
6878
|
+
ref,
|
|
6879
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
6880
|
+
...props
|
|
6881
|
+
}
|
|
6882
|
+
));
|
|
6883
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
6884
|
+
function useMediaQuery(query) {
|
|
6885
|
+
const get_match = React27__namespace.useCallback(() => {
|
|
6886
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
6887
|
+
return false;
|
|
6888
|
+
}
|
|
6889
|
+
return window.matchMedia(query).matches;
|
|
6890
|
+
}, [query]);
|
|
6891
|
+
const [matches, set_matches] = React27__namespace.useState(false);
|
|
6892
|
+
React27__namespace.useEffect(() => {
|
|
6893
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
6894
|
+
return;
|
|
6895
|
+
}
|
|
6896
|
+
const media_query_list = window.matchMedia(query);
|
|
6897
|
+
set_matches(media_query_list.matches);
|
|
6898
|
+
const handle_change = (event) => set_matches(event.matches);
|
|
6899
|
+
if (typeof media_query_list.addEventListener === "function") {
|
|
6900
|
+
media_query_list.addEventListener("change", handle_change);
|
|
6901
|
+
return () => media_query_list.removeEventListener("change", handle_change);
|
|
6902
|
+
}
|
|
6903
|
+
media_query_list.addListener(handle_change);
|
|
6904
|
+
return () => media_query_list.removeListener(handle_change);
|
|
6905
|
+
}, [query, get_match]);
|
|
6906
|
+
return matches;
|
|
6907
|
+
}
|
|
6801
6908
|
var Accordion = AccordionPrimitive__namespace.Root;
|
|
6802
6909
|
var AccordionItem = React27__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6803
6910
|
AccordionPrimitive__namespace.Item,
|
|
@@ -7237,6 +7344,16 @@ exports.CollapsibleTrigger = CollapsibleTrigger2;
|
|
|
7237
7344
|
exports.CommandNodeExtension = CommandNodeExtension;
|
|
7238
7345
|
exports.CommandPill = CommandPill;
|
|
7239
7346
|
exports.CommandPopover = CommandPopover;
|
|
7347
|
+
exports.Drawer = Drawer;
|
|
7348
|
+
exports.DrawerClose = DrawerClose;
|
|
7349
|
+
exports.DrawerContent = DrawerContent;
|
|
7350
|
+
exports.DrawerDescription = DrawerDescription;
|
|
7351
|
+
exports.DrawerFooter = DrawerFooter;
|
|
7352
|
+
exports.DrawerHeader = DrawerHeader;
|
|
7353
|
+
exports.DrawerOverlay = DrawerOverlay;
|
|
7354
|
+
exports.DrawerPortal = DrawerPortal;
|
|
7355
|
+
exports.DrawerTitle = DrawerTitle;
|
|
7356
|
+
exports.DrawerTrigger = DrawerTrigger;
|
|
7240
7357
|
exports.DropdownMenu = DropdownMenu;
|
|
7241
7358
|
exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
|
|
7242
7359
|
exports.DropdownMenuContent = DropdownMenuContent;
|
|
@@ -7324,5 +7441,6 @@ exports.resolve_animation_classes = resolve_animation_classes;
|
|
|
7324
7441
|
exports.set_hazo_ui_config = set_hazo_ui_config;
|
|
7325
7442
|
exports.text_to_tiptap_content = text_to_tiptap_content;
|
|
7326
7443
|
exports.toggleVariants = toggleVariants;
|
|
7444
|
+
exports.useMediaQuery = useMediaQuery;
|
|
7327
7445
|
//# sourceMappingURL=index.cjs.map
|
|
7328
7446
|
//# sourceMappingURL=index.cjs.map
|