@astroapps/aria-base 1.0.0 → 1.1.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/.rush/temp/operation/build/state.json +1 -1
- package/lib/Popover.d.ts +2 -1
- package/lib/index.js +6 -5
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Dialog.tsx +1 -3
- package/src/Popover.tsx +3 -1
package/lib/Popover.d.ts
CHANGED
|
@@ -9,10 +9,11 @@ export interface PopoverClasses {
|
|
|
9
9
|
export interface PopoverProps extends Omit<AriaPopoverProps, "popoverRef">, PopoverClasses {
|
|
10
10
|
children: React.ReactNode;
|
|
11
11
|
state: OverlayTriggerState;
|
|
12
|
+
portalContainer?: Element;
|
|
12
13
|
renderArrow?: (props: DOMAttributes) => ReactNode;
|
|
13
14
|
}
|
|
14
15
|
export declare const DefaultPopoverClasses: {
|
|
15
16
|
underlayClass: string;
|
|
16
17
|
popoverClass: string;
|
|
17
18
|
};
|
|
18
|
-
export declare function Popover({ children, state, renderArrow, ...props }: PopoverProps): React.JSX.Element;
|
|
19
|
+
export declare function Popover({ children, state, renderArrow, portalContainer, ...props }: PopoverProps): React.JSX.Element;
|
package/lib/index.js
CHANGED
|
@@ -39,9 +39,7 @@ function Button(_ref) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
var _excluded$1 = ["title", "children"];
|
|
42
|
-
var DefaultDialogClasses = {
|
|
43
|
-
className: "p-8"
|
|
44
|
-
};
|
|
42
|
+
var DefaultDialogClasses = {};
|
|
45
43
|
function Dialog(_ref) {
|
|
46
44
|
var title = _ref.title,
|
|
47
45
|
children = _ref.children,
|
|
@@ -61,7 +59,7 @@ function Dialog(_ref) {
|
|
|
61
59
|
}), title), children);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
var _excluded = ["children", "state", "renderArrow"];
|
|
62
|
+
var _excluded = ["children", "state", "renderArrow", "portalContainer"];
|
|
65
63
|
var DefaultPopoverClasses = {
|
|
66
64
|
underlayClass: "fixed inset-0",
|
|
67
65
|
popoverClass: "bg-white"
|
|
@@ -70,6 +68,7 @@ function Popover(_ref) {
|
|
|
70
68
|
var children = _ref.children,
|
|
71
69
|
state = _ref.state,
|
|
72
70
|
renderArrow = _ref.renderArrow,
|
|
71
|
+
portalContainer = _ref.portalContainer,
|
|
73
72
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
74
73
|
var popoverRef = React.useRef(null);
|
|
75
74
|
var _DefaultPopoverClasse = _extends({}, DefaultPopoverClasses, props),
|
|
@@ -81,7 +80,9 @@ function Popover(_ref) {
|
|
|
81
80
|
popoverProps = _usePopover.popoverProps,
|
|
82
81
|
underlayProps = _usePopover.underlayProps,
|
|
83
82
|
arrowProps = _usePopover.arrowProps;
|
|
84
|
-
return /*#__PURE__*/React__default["default"].createElement(reactAria.Overlay,
|
|
83
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAria.Overlay, {
|
|
84
|
+
portalContainer: portalContainer
|
|
85
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", _extends({}, underlayProps, {
|
|
85
86
|
className: underlayClass
|
|
86
87
|
})), /*#__PURE__*/React__default["default"].createElement("div", _extends({}, popoverProps, {
|
|
87
88
|
ref: popoverRef,
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/Button.tsx","../src/Dialog.tsx","../src/Popover.tsx"],"sourcesContent":["import { AriaButtonProps, useButton } from \"react-aria\";\nimport React, { useRef } from \"react\";\n\nexport function Button({\n children,\n className,\n ...props\n}: AriaButtonProps<\"button\"> & { className?: string }) {\n const ref = useRef(null);\n const { buttonProps } = useButton(props, ref);\n return <button {...buttonProps} className={className} children={children} />;\n}\n","import type { AriaDialogProps } from \"react-aria\";\nimport { useDialog } from \"react-aria\";\nimport React, { useRef } from \"react\";\n\nexport interface DialogClasses {\n className?: string;\n titleClass?: string;\n}\nexport interface DialogProps extends AriaDialogProps, DialogClasses {\n title?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport const DefaultDialogClasses: DialogClasses = {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/Button.tsx","../src/Dialog.tsx","../src/Popover.tsx"],"sourcesContent":["import { AriaButtonProps, useButton } from \"react-aria\";\nimport React, { useRef } from \"react\";\n\nexport function Button({\n children,\n className,\n ...props\n}: AriaButtonProps<\"button\"> & { className?: string }) {\n const ref = useRef(null);\n const { buttonProps } = useButton(props, ref);\n return <button {...buttonProps} className={className} children={children} />;\n}\n","import type { AriaDialogProps } from \"react-aria\";\nimport { useDialog } from \"react-aria\";\nimport React, { useRef } from \"react\";\n\nexport interface DialogClasses {\n className?: string;\n titleClass?: string;\n}\nexport interface DialogProps extends AriaDialogProps, DialogClasses {\n title?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport const DefaultDialogClasses: DialogClasses = {};\nexport function Dialog({ title, children, ...props }: DialogProps) {\n let ref = useRef(null);\n const { className, titleClass } = {\n ...DefaultDialogClasses,\n ...props,\n };\n let { dialogProps, titleProps } = useDialog(props, ref);\n\n return (\n <div {...dialogProps} ref={ref} className={className}>\n {title && (\n <h3 {...titleProps} className={titleClass}>\n {title}\n </h3>\n )}\n {children}\n </div>\n );\n}\n","import type { AriaPopoverProps } from \"react-aria\";\nimport { DismissButton, Overlay, usePopover } from \"react-aria\";\nimport type { OverlayTriggerState } from \"react-stately\";\nimport React, { ReactNode, useRef } from \"react\";\nimport { DOMAttributes } from \"@react-types/shared\";\n\nexport interface PopoverClasses {\n underlayClass?: string;\n popoverClass?: string;\n}\nexport interface PopoverProps\n extends Omit<AriaPopoverProps, \"popoverRef\">,\n PopoverClasses {\n children: React.ReactNode;\n state: OverlayTriggerState;\n portalContainer?: Element;\n renderArrow?: (props: DOMAttributes) => ReactNode;\n}\n\nexport const DefaultPopoverClasses = {\n underlayClass: \"fixed inset-0\",\n popoverClass: \"bg-white\",\n};\n\nexport function Popover({\n children,\n state,\n renderArrow,\n portalContainer,\n ...props\n}: PopoverProps) {\n let popoverRef = useRef(null);\n const { popoverClass, underlayClass } = {\n ...DefaultPopoverClasses,\n ...props,\n };\n let { popoverProps, underlayProps, arrowProps } = usePopover(\n {\n ...props,\n popoverRef,\n },\n state,\n );\n\n return (\n <Overlay portalContainer={portalContainer}>\n <div {...underlayProps} className={underlayClass} />\n <div\n {...popoverProps}\n ref={popoverRef}\n className={popoverClass}\n style={popoverProps.style}\n >\n {renderArrow?.(arrowProps)}\n <DismissButton onDismiss={state.close} />\n {children}\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":["Button","_ref","children","className","props","_objectWithoutPropertiesLoose","_excluded","ref","useRef","_useButton","useButton","buttonProps","React","createElement","_extends","DefaultDialogClasses","Dialog","title","_DefaultDialogClasses","titleClass","_useDialog","useDialog","dialogProps","titleProps","DefaultPopoverClasses","underlayClass","popoverClass","Popover","state","renderArrow","portalContainer","popoverRef","_DefaultPopoverClasse","_usePopover","usePopover","popoverProps","underlayProps","arrowProps","Overlay","style","DismissButton","onDismiss","close"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGM,SAAUA,MAAMA,CAAAC,IAAA,EAI+B;AAAA,EAAA,IAHnDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,SAAS,GAAAF,IAAA,CAATE,SAAS;AACNC,IAAAA,KAAK,GAAAC,6BAAA,CAAAJ,IAAA,EAAAK,WAAA,CAAA,CAAA;AAER,EAAA,IAAMC,GAAG,GAAGC,YAAM,CAAC,IAAI,CAAC,CAAA;AACxB,EAAA,IAAAC,UAAA,GAAwBC,mBAAS,CAACN,KAAK,EAAEG,GAAG,CAAC;IAArCI,WAAW,GAAAF,UAAA,CAAXE,WAAW,CAAA;AACnB,EAAA,oBAAOC,yBAAA,CAAAC,aAAA,CAAAC,QAAAA,EAAAA,QAAA,KAAYH,WAAW,EAAA;AAAER,IAAAA,SAAS,EAAEA,SAAU;AAACD,IAAAA,QA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,GAAAA,WAAW,CAAGQ,UAAU,CAAC,eAC1BzB,yBAAA,CAAAC,aAAA,CAAC2B,uBAAa,EAAA;IAACC,SAAS,EAAEb,KAAK,CAACc,KAAAA;GAChC,CAAA,EAACxC,QAAQ,eACTU,yBAAA,CAAAC,aAAA,CAAC2B,uBAAa,EAAA;IAACC,SAAS,EAAEb,KAAK,CAACc,KAAAA;GAClC,CAAK,CACE,CAAC,CAAA;AAEd;;;;;;;;"}
|
package/package.json
CHANGED
package/src/Dialog.tsx
CHANGED
|
@@ -11,9 +11,7 @@ export interface DialogProps extends AriaDialogProps, DialogClasses {
|
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const DefaultDialogClasses: DialogClasses = {
|
|
15
|
-
className: "p-8",
|
|
16
|
-
};
|
|
14
|
+
export const DefaultDialogClasses: DialogClasses = {};
|
|
17
15
|
export function Dialog({ title, children, ...props }: DialogProps) {
|
|
18
16
|
let ref = useRef(null);
|
|
19
17
|
const { className, titleClass } = {
|
package/src/Popover.tsx
CHANGED
|
@@ -13,6 +13,7 @@ export interface PopoverProps
|
|
|
13
13
|
PopoverClasses {
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
state: OverlayTriggerState;
|
|
16
|
+
portalContainer?: Element;
|
|
16
17
|
renderArrow?: (props: DOMAttributes) => ReactNode;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -25,6 +26,7 @@ export function Popover({
|
|
|
25
26
|
children,
|
|
26
27
|
state,
|
|
27
28
|
renderArrow,
|
|
29
|
+
portalContainer,
|
|
28
30
|
...props
|
|
29
31
|
}: PopoverProps) {
|
|
30
32
|
let popoverRef = useRef(null);
|
|
@@ -41,7 +43,7 @@ export function Popover({
|
|
|
41
43
|
);
|
|
42
44
|
|
|
43
45
|
return (
|
|
44
|
-
<Overlay>
|
|
46
|
+
<Overlay portalContainer={portalContainer}>
|
|
45
47
|
<div {...underlayProps} className={underlayClass} />
|
|
46
48
|
<div
|
|
47
49
|
{...popoverProps}
|