Skip to content

Commit

Permalink
Adds PopoverAnchor, PopoverClose (#1)
Browse files Browse the repository at this point in the history
* added PopoverAnchor, PopoverClose
* bumped version number
  • Loading branch information
amorey authored Feb 19, 2024
1 parent 8c7929e commit 2465729
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
4 changes: 3 additions & 1 deletion elements/Popover.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as React from 'react';
import * as PopoverPrimitive from '@radix-ui/react-popover';
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
declare const PopoverClose: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
export { Popover, PopoverTrigger, PopoverContent };
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, };
6 changes: 5 additions & 1 deletion elements/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ var __rest = (this && this.__rest) || function (s, e) {
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PopoverContent = exports.PopoverTrigger = exports.Popover = void 0;
exports.PopoverTrigger = exports.PopoverContent = exports.PopoverClose = exports.PopoverAnchor = exports.Popover = void 0;
const React = __importStar(require("react"));
const PopoverPrimitive = __importStar(require("@radix-ui/react-popover"));
const utils_1 = require("@/lib/utils");
const Popover = PopoverPrimitive.Root;
exports.Popover = Popover;
const PopoverAnchor = PopoverPrimitive.Anchor;
exports.PopoverAnchor = PopoverAnchor;
const PopoverClose = PopoverPrimitive.Close;
exports.PopoverClose = PopoverClose;
const PopoverTrigger = PopoverPrimitive.Trigger;
exports.PopoverTrigger = PopoverTrigger;
const PopoverContent = React.forwardRef((_a, ref) => {
Expand Down
4 changes: 3 additions & 1 deletion esm/elements/Popover.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as React from 'react';
import * as PopoverPrimitive from '@radix-ui/react-popover';
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
declare const PopoverClose: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
export { Popover, PopoverTrigger, PopoverContent };
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, };
4 changes: 3 additions & 1 deletion esm/elements/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import * as React from 'react';
import * as PopoverPrimitive from '@radix-ui/react-popover';
import { cn } from '@/lib/utils';
const Popover = PopoverPrimitive.Root;
const PopoverAnchor = PopoverPrimitive.Anchor;
const PopoverClose = PopoverPrimitive.Close;
const PopoverTrigger = PopoverPrimitive.Trigger;
const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React.createElement(PopoverPrimitive.Portal, null,
React.createElement(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, className: cn('z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className), ...props }))));
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
export { Popover, PopoverTrigger, PopoverContent };
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kubetail-ui",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"sideEffects": false,
"description": "Kubetail shared component library",
Expand Down
10 changes: 9 additions & 1 deletion src/elements/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { cn } from '@/lib/utils';

const Popover = PopoverPrimitive.Root;

const PopoverAnchor = PopoverPrimitive.Anchor;
const PopoverClose = PopoverPrimitive.Close;
const PopoverTrigger = PopoverPrimitive.Trigger;

type T1 = React.ElementRef<typeof PopoverPrimitive.Content>;
Expand All @@ -33,4 +35,10 @@ const PopoverContent = React.forwardRef<T1, T2>(({
));
PopoverContent.displayName = PopoverPrimitive.Content.displayName;

export { Popover, PopoverTrigger, PopoverContent };
export {
Popover,
PopoverAnchor,
PopoverClose,
PopoverContent,
PopoverTrigger,
};

0 comments on commit 2465729

Please sign in to comment.