@cdx-ui/primitives 0.0.1-beta.50 → 0.0.1-beta.52
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 +1 -1
- package/lib/commonjs/dialog/createDialogContent.js +7 -127
- package/lib/commonjs/dialog/createDialogContent.js.map +1 -1
- package/lib/commonjs/dialog/createDialogPopup.js +157 -0
- package/lib/commonjs/dialog/createDialogPopup.js.map +1 -0
- package/lib/commonjs/dialog/index.js +8 -8
- package/lib/commonjs/dialog/index.js.map +1 -1
- package/lib/module/dialog/createDialogContent.js +7 -128
- package/lib/module/dialog/createDialogContent.js.map +1 -1
- package/lib/module/dialog/createDialogPopup.js +152 -0
- package/lib/module/dialog/createDialogPopup.js.map +1 -0
- package/lib/module/dialog/index.js +8 -8
- package/lib/module/dialog/index.js.map +1 -1
- package/lib/typescript/dialog/createDialogContent.d.ts +2 -2
- package/lib/typescript/dialog/createDialogContent.d.ts.map +1 -1
- package/lib/typescript/dialog/createDialogPopup.d.ts +4 -0
- package/lib/typescript/dialog/createDialogPopup.d.ts.map +1 -0
- package/lib/typescript/dialog/index.d.ts +5 -5
- package/lib/typescript/dialog/index.d.ts.map +1 -1
- package/lib/typescript/dialog/types.d.ts +16 -5
- package/lib/typescript/dialog/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/dialog/createDialogContent.tsx +6 -117
- package/src/dialog/createDialogPopup.tsx +146 -0
- package/src/dialog/index.tsx +16 -16
- package/src/dialog/types.ts +20 -9
- package/lib/commonjs/dialog/createDialogBody.js +0 -21
- package/lib/commonjs/dialog/createDialogBody.js.map +0 -1
- package/lib/module/dialog/createDialogBody.js +0 -15
- package/lib/module/dialog/createDialogBody.js.map +0 -1
- package/lib/typescript/dialog/createDialogBody.d.ts +0 -4
- package/lib/typescript/dialog/createDialogBody.d.ts.map +0 -1
- package/src/dialog/createDialogBody.tsx +0 -11
package/src/dialog/index.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { createDialogRoot } from './createDialogRoot';
|
|
3
3
|
import { createDialogTrigger } from './createDialogTrigger';
|
|
4
|
-
import {
|
|
4
|
+
import { createDialogPopup } from './createDialogPopup';
|
|
5
5
|
import { createDialogHeader } from './createDialogHeader';
|
|
6
6
|
import { createDialogTitle } from './createDialogTitle';
|
|
7
7
|
import { createDialogDescription } from './createDialogDescription';
|
|
8
|
-
import {
|
|
8
|
+
import { createDialogContent } from './createDialogContent';
|
|
9
9
|
import { createDialogFooter } from './createDialogFooter';
|
|
10
10
|
import { createDialogClose } from './createDialogClose';
|
|
11
11
|
import { DialogProvider, useDialog } from './context';
|
|
@@ -16,12 +16,12 @@ export type {
|
|
|
16
16
|
IDialogContextType,
|
|
17
17
|
IDialogRootProps,
|
|
18
18
|
IDialogTriggerProps,
|
|
19
|
-
|
|
19
|
+
IDialogPopupProps,
|
|
20
20
|
IDialogOverlayProps,
|
|
21
21
|
IDialogHeaderProps,
|
|
22
22
|
IDialogTitleProps,
|
|
23
23
|
IDialogDescriptionProps,
|
|
24
|
-
|
|
24
|
+
IDialogContentProps,
|
|
25
25
|
IDialogFooterProps,
|
|
26
26
|
IDialogCloseProps,
|
|
27
27
|
} from './types';
|
|
@@ -29,64 +29,64 @@ export type {
|
|
|
29
29
|
export function createDialog<
|
|
30
30
|
RootProps,
|
|
31
31
|
TriggerProps,
|
|
32
|
-
|
|
32
|
+
PopupProps,
|
|
33
33
|
OverlayProps,
|
|
34
34
|
HeaderProps,
|
|
35
35
|
TitleProps,
|
|
36
36
|
DescriptionProps,
|
|
37
|
-
|
|
37
|
+
ContentProps,
|
|
38
38
|
FooterProps,
|
|
39
39
|
CloseProps,
|
|
40
40
|
>(BaseComponents: {
|
|
41
41
|
Root: React.ComponentType<RootProps>;
|
|
42
42
|
Trigger: React.ComponentType<TriggerProps>;
|
|
43
|
-
|
|
43
|
+
Popup: React.ComponentType<PopupProps>;
|
|
44
44
|
Overlay: React.ComponentType<OverlayProps>;
|
|
45
45
|
Header: React.ComponentType<HeaderProps>;
|
|
46
46
|
Title: React.ComponentType<TitleProps>;
|
|
47
47
|
Description: React.ComponentType<DescriptionProps>;
|
|
48
|
-
|
|
48
|
+
Content: React.ComponentType<ContentProps>;
|
|
49
49
|
Footer: React.ComponentType<FooterProps>;
|
|
50
50
|
Close: React.ComponentType<CloseProps>;
|
|
51
51
|
}) {
|
|
52
52
|
const Root = createDialogRoot(BaseComponents.Root);
|
|
53
53
|
const Trigger = createDialogTrigger(BaseComponents.Trigger);
|
|
54
|
-
const
|
|
54
|
+
const Popup = createDialogPopup(BaseComponents.Popup, BaseComponents.Overlay);
|
|
55
55
|
const Header = createDialogHeader(BaseComponents.Header);
|
|
56
56
|
const Title = createDialogTitle(BaseComponents.Title);
|
|
57
57
|
const Description = createDialogDescription(BaseComponents.Description);
|
|
58
|
-
const
|
|
58
|
+
const Content = createDialogContent(BaseComponents.Content);
|
|
59
59
|
const Footer = createDialogFooter(BaseComponents.Footer);
|
|
60
60
|
const Close = createDialogClose(BaseComponents.Close);
|
|
61
61
|
|
|
62
62
|
Root.displayName = 'DialogPrimitive.Root';
|
|
63
63
|
Trigger.displayName = 'DialogPrimitive.Trigger';
|
|
64
|
-
|
|
64
|
+
Popup.displayName = 'DialogPrimitive.Popup';
|
|
65
65
|
Header.displayName = 'DialogPrimitive.Header';
|
|
66
66
|
Title.displayName = 'DialogPrimitive.Title';
|
|
67
67
|
Description.displayName = 'DialogPrimitive.Description';
|
|
68
|
-
|
|
68
|
+
Content.displayName = 'DialogPrimitive.Content';
|
|
69
69
|
Footer.displayName = 'DialogPrimitive.Footer';
|
|
70
70
|
Close.displayName = 'DialogPrimitive.Close';
|
|
71
71
|
|
|
72
72
|
return Object.assign(Root, {
|
|
73
73
|
Root,
|
|
74
74
|
Trigger,
|
|
75
|
-
|
|
75
|
+
Popup,
|
|
76
76
|
Header,
|
|
77
77
|
Title,
|
|
78
78
|
Description,
|
|
79
|
-
|
|
79
|
+
Content,
|
|
80
80
|
Footer,
|
|
81
81
|
Close,
|
|
82
82
|
}) as IDialogComponentType<
|
|
83
83
|
RootProps,
|
|
84
84
|
TriggerProps,
|
|
85
|
-
|
|
85
|
+
PopupProps,
|
|
86
86
|
HeaderProps,
|
|
87
87
|
TitleProps,
|
|
88
88
|
DescriptionProps,
|
|
89
|
-
|
|
89
|
+
ContentProps,
|
|
90
90
|
FooterProps,
|
|
91
91
|
CloseProps
|
|
92
92
|
>;
|
package/src/dialog/types.ts
CHANGED
|
@@ -24,8 +24,19 @@ export interface IDialogTriggerProps extends PressableProps {
|
|
|
24
24
|
readonly asChild?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export interface
|
|
27
|
+
export interface IDialogPopupProps extends ViewProps {
|
|
28
28
|
readonly forceMount?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the popup shifts up to clear the on-screen keyboard (native only).
|
|
31
|
+
* No-op on web. Defaults to `true`.
|
|
32
|
+
*/
|
|
33
|
+
readonly avoidKeyboard?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Distance (in px) between the keyboard and the popup when keyboard avoidance
|
|
36
|
+
* is active. Forwarded to the underlying keyboard-avoiding layer on native.
|
|
37
|
+
* Defaults to `0`.
|
|
38
|
+
*/
|
|
39
|
+
readonly keyboardVerticalOffset?: number;
|
|
29
40
|
}
|
|
30
41
|
|
|
31
42
|
export interface IDialogOverlayProps extends PressableProps {}
|
|
@@ -36,7 +47,7 @@ export interface IDialogTitleProps extends TextProps {}
|
|
|
36
47
|
|
|
37
48
|
export interface IDialogDescriptionProps extends TextProps {}
|
|
38
49
|
|
|
39
|
-
export interface
|
|
50
|
+
export interface IDialogContentProps extends ViewProps {}
|
|
40
51
|
|
|
41
52
|
export interface IDialogFooterProps extends ViewProps {}
|
|
42
53
|
|
|
@@ -48,14 +59,14 @@ export interface IDialogCloseProps extends PressableProps {
|
|
|
48
59
|
export type IDialogComponentType<
|
|
49
60
|
RootProps,
|
|
50
61
|
TriggerProps,
|
|
51
|
-
|
|
62
|
+
PopupProps,
|
|
52
63
|
HeaderProps,
|
|
53
64
|
TitleProps,
|
|
54
65
|
DescriptionProps,
|
|
55
|
-
|
|
66
|
+
ContentProps,
|
|
56
67
|
FooterProps,
|
|
57
68
|
CloseProps,
|
|
58
|
-
|
|
69
|
+
PopupRef = unknown,
|
|
59
70
|
TriggerRef = unknown,
|
|
60
71
|
CloseRef = unknown,
|
|
61
72
|
> = React.ForwardRefExoticComponent<
|
|
@@ -64,8 +75,8 @@ export type IDialogComponentType<
|
|
|
64
75
|
Trigger: React.ForwardRefExoticComponent<
|
|
65
76
|
PropsWithoutRef<TriggerProps & IDialogTriggerProps> & RefAttributes<TriggerRef>
|
|
66
77
|
>;
|
|
67
|
-
|
|
68
|
-
PropsWithoutRef<
|
|
78
|
+
Popup: React.ForwardRefExoticComponent<
|
|
79
|
+
PropsWithoutRef<PopupProps & IDialogPopupProps> & RefAttributes<PopupRef>
|
|
69
80
|
>;
|
|
70
81
|
Header: React.ForwardRefExoticComponent<
|
|
71
82
|
PropsWithoutRef<HeaderProps & IDialogHeaderProps> & RefAttributes<unknown>
|
|
@@ -76,8 +87,8 @@ export type IDialogComponentType<
|
|
|
76
87
|
Description: React.ForwardRefExoticComponent<
|
|
77
88
|
PropsWithoutRef<DescriptionProps & IDialogDescriptionProps> & RefAttributes<unknown>
|
|
78
89
|
>;
|
|
79
|
-
|
|
80
|
-
PropsWithoutRef<
|
|
90
|
+
Content: React.ForwardRefExoticComponent<
|
|
91
|
+
PropsWithoutRef<ContentProps & IDialogContentProps> & RefAttributes<unknown>
|
|
81
92
|
>;
|
|
82
93
|
Footer: React.ForwardRefExoticComponent<
|
|
83
94
|
PropsWithoutRef<FooterProps & IDialogFooterProps> & RefAttributes<unknown>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createDialogBody = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
-
const createDialogBody = BaseBody => /*#__PURE__*/(0, _react.forwardRef)(({
|
|
11
|
-
children,
|
|
12
|
-
...props
|
|
13
|
-
}, ref) => {
|
|
14
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BaseBody, {
|
|
15
|
-
ref: ref,
|
|
16
|
-
...props,
|
|
17
|
-
children: children
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
exports.createDialogBody = createDialogBody;
|
|
21
|
-
//# sourceMappingURL=createDialogBody.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createDialogBody","BaseBody","forwardRef","children","props","ref","jsx","exports"],"sourceRoot":"../../../src","sources":["dialog/createDialogBody.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE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|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { forwardRef } from 'react';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export const createDialogBody = BaseBody => /*#__PURE__*/forwardRef(({
|
|
6
|
-
children,
|
|
7
|
-
...props
|
|
8
|
-
}, ref) => {
|
|
9
|
-
return /*#__PURE__*/_jsx(BaseBody, {
|
|
10
|
-
ref: ref,
|
|
11
|
-
...props,
|
|
12
|
-
children: children
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=createDialogBody.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","jsx","_jsx","createDialogBody","BaseBody","children","props","ref"],"sourceRoot":"../../../src","sources":["dialog/createDialogBody.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG1C,OAAO,MAAMC,gBAAgB,GAAQC,QAAgC,iBACnEJ,UAAU,CAA4B,CAAC;EAAEK,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACrE,oBACEL,IAAA,CAACE,QAAQ;IAACG,GAAG,EAAEA,GAAI;IAAA,GAAMD,KAAK;IAAAD,QAAA,EAC3BA;EAAQ,CACD,CAAC;AAEf,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { IDialogBodyProps } from './types';
|
|
3
|
-
export declare const createDialogBody: <T>(BaseBody: React.ComponentType<T>) => React.ForwardRefExoticComponent<IDialogBodyProps & React.RefAttributes<unknown>>;
|
|
4
|
-
//# sourceMappingURL=createDialogBody.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDialogBody.d.ts","sourceRoot":"","sources":["../../../src/dialog/createDialogBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAG,UAAU,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,qFAOjE,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import type { IDialogBodyProps } from './types';
|
|
3
|
-
|
|
4
|
-
export const createDialogBody = <T,>(BaseBody: React.ComponentType<T>) =>
|
|
5
|
-
forwardRef<unknown, IDialogBodyProps>(({ children, ...props }, ref) => {
|
|
6
|
-
return (
|
|
7
|
-
<BaseBody ref={ref} {...(props as T)}>
|
|
8
|
-
{children}
|
|
9
|
-
</BaseBody>
|
|
10
|
-
);
|
|
11
|
-
});
|