ag-common 0.0.773 → 0.0.775

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.
@@ -4,8 +4,8 @@ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
4
4
  declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
5
  declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
6
6
  declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
7
- declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
- declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const DialogOverlay: ({ className, ...props }: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>) => React.JSX.Element;
8
+ declare const DialogContent: ({ className, children, ...props }: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>) => React.JSX.Element;
9
9
  declare const DialogHeader: {
10
10
  ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
11
11
  displayName: string;
@@ -14,6 +14,6 @@ declare const DialogFooter: {
14
14
  ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
15
15
  displayName: string;
16
16
  };
17
- declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
18
- declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
17
+ declare const DialogTitle: ({ className, ...props }: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>) => React.JSX.Element;
18
+ declare const DialogDescription: ({ className, ...props }: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>) => React.JSX.Element;
19
19
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -58,24 +58,22 @@ const DialogPortal = DialogPrimitive.Portal;
58
58
  exports.DialogPortal = DialogPortal;
59
59
  const DialogClose = DialogPrimitive.Close;
60
60
  exports.DialogClose = DialogClose;
61
- const DialogOverlay = React.forwardRef((_a, ref) => {
61
+ const DialogOverlay = (_a) => {
62
62
  var { className } = _a, props = __rest(_a, ["className"]);
63
- return (React.createElement(DialogPrimitive.Overlay, Object.assign({ ref: ref, className: (0, utils_1.cn)('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', className) }, props)));
64
- });
63
+ return (React.createElement(DialogPrimitive.Overlay, Object.assign({ className: (0, utils_1.cn)('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', className) }, props)));
64
+ };
65
65
  exports.DialogOverlay = DialogOverlay;
66
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
67
- const DialogContent = React.forwardRef((_a, ref) => {
66
+ const DialogContent = (_a) => {
68
67
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
69
68
  return (React.createElement(DialogPortal, null,
70
69
  React.createElement(DialogOverlay, null),
71
- React.createElement(DialogPrimitive.Content, Object.assign({ ref: ref, className: (0, utils_1.cn)('fixed left-[50%] top-[50%] z-50 grid max-w-[80dvw] max-h-[80dvh] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-2 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-none', className) }, props),
70
+ React.createElement(DialogPrimitive.Content, Object.assign({ className: (0, utils_1.cn)('fixed left-[50%] top-[50%] z-50 grid max-w-[80dvw] max-h-[80dvh] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-2 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-none', className) }, props),
72
71
  children,
73
72
  React.createElement(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground" },
74
73
  React.createElement(react_icons_1.Cross2Icon, { className: "h-4 w-4" }),
75
74
  React.createElement("span", { className: "sr-only" }, "Close")))));
76
- });
75
+ };
77
76
  exports.DialogContent = DialogContent;
78
- DialogContent.displayName = DialogPrimitive.Content.displayName;
79
77
  const DialogHeader = (_a) => {
80
78
  var { className } = _a, props = __rest(_a, ["className"]);
81
79
  return (React.createElement("div", Object.assign({ className: (0, utils_1.cn)('flex flex-col space-y-1.5 text-center sm:text-left', className) }, props)));
@@ -88,19 +86,17 @@ const DialogFooter = (_a) => {
88
86
  };
89
87
  exports.DialogFooter = DialogFooter;
90
88
  DialogFooter.displayName = 'DialogFooter';
91
- const DialogTitle = React.forwardRef((_a, ref) => {
89
+ const DialogTitle = (_a) => {
92
90
  var { className } = _a, props = __rest(_a, ["className"]);
93
- return (React.createElement(DialogPrimitive.Title, Object.assign({ ref: ref, className: (0, utils_1.cn)(
91
+ return (React.createElement(DialogPrimitive.Title, Object.assign({ className: (0, utils_1.cn)(
94
92
  //no width or height if no content
95
93
  props.children
96
94
  ? 'text-lg font-semibold leading-none tracking-tight'
97
95
  : 'hidden', className) }, props)));
98
- });
96
+ };
99
97
  exports.DialogTitle = DialogTitle;
100
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
101
- const DialogDescription = React.forwardRef((_a, ref) => {
98
+ const DialogDescription = (_a) => {
102
99
  var { className } = _a, props = __rest(_a, ["className"]);
103
- return (React.createElement(DialogPrimitive.Description, Object.assign({ ref: ref, className: (0, utils_1.cn)('text-sm text-muted-foreground', className) }, props)));
104
- });
100
+ return (React.createElement(DialogPrimitive.Description, Object.assign({ className: (0, utils_1.cn)('text-sm text-muted-foreground', className) }, props)));
101
+ };
105
102
  exports.DialogDescription = DialogDescription;
106
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
@@ -1,7 +1,7 @@
1
1
  import * as SwitchPrimitive from '@radix-ui/react-switch';
2
2
  import * as React from 'react';
3
- interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {
3
+ export type SwitchProps = React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> & {
4
4
  icon?: React.ReactNode;
5
- }
6
- declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
5
+ };
6
+ declare const Switch: ({ className, icon, ...props }: SwitchProps) => React.JSX.Element;
7
7
  export { Switch };
@@ -49,10 +49,9 @@ exports.Switch = void 0;
49
49
  const SwitchPrimitive = __importStar(require("@radix-ui/react-switch"));
50
50
  const React = __importStar(require("react"));
51
51
  const utils_1 = require("../../helpers/utils");
52
- const Switch = React.forwardRef((_a, ref) => {
52
+ const Switch = (_a) => {
53
53
  var { className, icon } = _a, props = __rest(_a, ["className", "icon"]);
54
- return (React.createElement(SwitchPrimitive.Root, Object.assign({ className: (0, utils_1.cn)('peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-sm border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input', className) }, props, { ref: ref }),
54
+ return (React.createElement(SwitchPrimitive.Root, Object.assign({ className: (0, utils_1.cn)('peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-sm border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input', className) }, props),
55
55
  React.createElement(SwitchPrimitive.Thumb, { className: (0, utils_1.cn)('pointer-events-none flex items-center justify-center h-4 w-4 rounded-sm bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0') }, icon)));
56
- });
56
+ };
57
57
  exports.Switch = Switch;
58
- Switch.displayName = SwitchPrimitive.Root.displayName;
@@ -1,4 +1,3 @@
1
- export declare const isServer: boolean;
2
1
  /**
3
2
  * hook for query string value
4
3
  * @param param0 can provide for SSR - queryValues will default to window if available
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
  'use client';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useQueryStringSingle = exports.useQueryStringArray = exports.useQueryStringRaw = exports.isServer = void 0;
4
+ exports.useQueryStringSingle = exports.useQueryStringArray = exports.useQueryStringRaw = void 0;
5
5
  const react_1 = require("react");
6
6
  const log_1 = require("../../common/helpers/log");
7
7
  const object_1 = require("../../common/helpers/object");
8
- exports.isServer = typeof window === 'undefined';
9
8
  /**
10
9
  * hook for query string value
11
10
  * @param param0 can provide for SSR - queryValues will default to window if available
12
11
  * @returns
13
12
  */
14
13
  const useQueryStringRaw = ({ name, queryValues, defaultValue, stringify, parse, }) => {
15
- const qv = exports.isServer
16
- ? (queryValues !== null && queryValues !== void 0 ? queryValues : {})
17
- : (0, object_1.paramsToObject)(new URLSearchParams(window.location.search));
14
+ const qv = queryValues !== null && queryValues !== void 0 ? queryValues : (0, object_1.paramsToObject)(new URLSearchParams(window.location.search));
18
15
  const qsv = parse(qv[name]) || defaultValue;
19
16
  const [state, setStateRaw] = (0, react_1.useState)(qsv);
20
17
  //
@@ -27,7 +24,7 @@ const useQueryStringRaw = ({ name, queryValues, defaultValue, stringify, parse,
27
24
  delete qv[name];
28
25
  }
29
26
  const qs = '?' + (0, object_1.objectToString)(qv, '=', '&');
30
- if (!exports.isServer) {
27
+ if (typeof window !== 'undefined') {
31
28
  const loc = window.location.pathname + qs + window.location.hash;
32
29
  window.history.replaceState({}, '', loc);
33
30
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.773",
2
+ "version": "0.0.775",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",