@astroapps/aria-base 1.3.2 → 1.5.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/chunked-rush-logs/aria-base.build.chunks.jsonl +2 -2
- package/.rush/temp/chunked-rush-logs/aria-base.watch.chunks.jsonl +4 -0
- package/.rush/temp/package-deps_build.json +10 -6
- package/.rush/temp/package-deps_watch.json +14 -0
- package/.rush/temp/shrinkwrap-deps.json +280 -260
- package/lib/Button.d.ts +2 -2
- package/lib/Field.d.ts +73 -0
- package/lib/ListBox.d.ts +76 -0
- package/lib/Modal.d.ts +2 -1
- package/lib/Popover.d.ts +8 -11
- package/lib/Select.d.ts +13 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +239 -47
- package/lib/index.js.map +1 -1
- package/lib/utils.d.ts +17 -0
- package/package.json +10 -6
- package/src/Button.tsx +14 -6
- package/src/Field.tsx +97 -0
- package/src/ListBox.tsx +130 -0
- package/src/Modal.tsx +8 -2
- package/src/Popover.tsx +56 -49
- package/src/Select.tsx +90 -0
- package/src/index.ts +3 -0
- package/src/utils.ts +20 -0
package/lib/Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonProps as RACButtonProps } from "react-aria-components";
|
|
2
2
|
import React from "react";
|
|
3
|
-
export declare function Button({ children, className, ...props }:
|
|
3
|
+
export declare function Button({ children, className, ...props }: RACButtonProps & {
|
|
4
4
|
className?: string;
|
|
5
5
|
}): React.JSX.Element;
|
package/lib/Field.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FieldErrorProps, GroupProps, InputProps, LabelProps, TextProps } from "react-aria-components";
|
|
3
|
+
export declare function Label(props: LabelProps): React.JSX.Element;
|
|
4
|
+
export declare function Description(props: TextProps): React.JSX.Element;
|
|
5
|
+
export declare function FieldError(props: FieldErrorProps): React.JSX.Element;
|
|
6
|
+
export declare const fieldBorderStyles: import("tailwind-variants").TVReturnType<{
|
|
7
|
+
isFocusWithin: {
|
|
8
|
+
false: string;
|
|
9
|
+
true: string;
|
|
10
|
+
};
|
|
11
|
+
isInvalid: {
|
|
12
|
+
true: string;
|
|
13
|
+
};
|
|
14
|
+
isDisabled: {
|
|
15
|
+
true: string;
|
|
16
|
+
};
|
|
17
|
+
}, undefined, "transition", {
|
|
18
|
+
isFocusWithin: {
|
|
19
|
+
false: string;
|
|
20
|
+
true: string;
|
|
21
|
+
};
|
|
22
|
+
isInvalid: {
|
|
23
|
+
true: string;
|
|
24
|
+
};
|
|
25
|
+
isDisabled: {
|
|
26
|
+
true: string;
|
|
27
|
+
};
|
|
28
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
29
|
+
isFocusWithin: {
|
|
30
|
+
false: string;
|
|
31
|
+
true: string;
|
|
32
|
+
};
|
|
33
|
+
isInvalid: {
|
|
34
|
+
true: string;
|
|
35
|
+
};
|
|
36
|
+
isDisabled: {
|
|
37
|
+
true: string;
|
|
38
|
+
};
|
|
39
|
+
}, undefined, "transition", unknown, unknown, undefined>>;
|
|
40
|
+
export declare const fieldGroupStyles: import("tailwind-variants").TVReturnType<{
|
|
41
|
+
isFocusWithin: {
|
|
42
|
+
false: string;
|
|
43
|
+
true: string;
|
|
44
|
+
};
|
|
45
|
+
isInvalid: {
|
|
46
|
+
true: string;
|
|
47
|
+
};
|
|
48
|
+
isDisabled: {
|
|
49
|
+
true: string;
|
|
50
|
+
};
|
|
51
|
+
}, undefined, "group flex items-center h-9 box-border bg-white dark:bg-neutral-900 forced-colors:bg-[Field] border rounded-lg overflow-hidden transition", {
|
|
52
|
+
isFocusVisible: {
|
|
53
|
+
false: string;
|
|
54
|
+
true: string;
|
|
55
|
+
};
|
|
56
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
57
|
+
isFocusVisible: {
|
|
58
|
+
false: string;
|
|
59
|
+
true: string;
|
|
60
|
+
};
|
|
61
|
+
}, undefined, "outline outline-secondary-600 dark:outline-secondary-500 forced-colors:outline-[Highlight] outline-offset-2", {
|
|
62
|
+
isFocusVisible: {
|
|
63
|
+
false: string;
|
|
64
|
+
true: string;
|
|
65
|
+
};
|
|
66
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
67
|
+
isFocusVisible: {
|
|
68
|
+
false: string;
|
|
69
|
+
true: string;
|
|
70
|
+
};
|
|
71
|
+
}, undefined, "outline outline-secondary-600 dark:outline-secondary-500 forced-colors:outline-[Highlight] outline-offset-2", unknown, unknown, undefined>>>;
|
|
72
|
+
export declare function FieldGroup(props: GroupProps): React.JSX.Element;
|
|
73
|
+
export declare function Input(props: InputProps): React.JSX.Element;
|
package/lib/ListBox.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ListBoxProps as AriaListBoxProps, ListBoxItemProps, SectionProps } from "react-aria-components";
|
|
3
|
+
interface ListBoxProps<T> extends Omit<AriaListBoxProps<T>, "layout" | "orientation"> {
|
|
4
|
+
}
|
|
5
|
+
export declare function ListBox<T extends object>({ children, ...props }: ListBoxProps<T>): React.JSX.Element;
|
|
6
|
+
export declare const itemStyles: import("tailwind-variants").TVReturnType<{
|
|
7
|
+
isSelected: {
|
|
8
|
+
false: string;
|
|
9
|
+
true: string;
|
|
10
|
+
};
|
|
11
|
+
isDisabled: {
|
|
12
|
+
true: string;
|
|
13
|
+
};
|
|
14
|
+
}, undefined, "group relative flex items-center gap-8 cursor-default select-none py-1.5 px-2.5 rounded-md will-change-transform text-sm forced-color-adjust-none", {
|
|
15
|
+
isFocusVisible: {
|
|
16
|
+
false: string;
|
|
17
|
+
true: string;
|
|
18
|
+
};
|
|
19
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
20
|
+
isFocusVisible: {
|
|
21
|
+
false: string;
|
|
22
|
+
true: string;
|
|
23
|
+
};
|
|
24
|
+
}, undefined, "outline outline-secondary-600 dark:outline-secondary-500 forced-colors:outline-[Highlight] outline-offset-2", {
|
|
25
|
+
isFocusVisible: {
|
|
26
|
+
false: string;
|
|
27
|
+
true: string;
|
|
28
|
+
};
|
|
29
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
30
|
+
isFocusVisible: {
|
|
31
|
+
false: string;
|
|
32
|
+
true: string;
|
|
33
|
+
};
|
|
34
|
+
}, undefined, "outline outline-secondary-600 dark:outline-secondary-500 forced-colors:outline-[Highlight] outline-offset-2", unknown, unknown, undefined>>>;
|
|
35
|
+
export declare function ListBoxItem(props: ListBoxItemProps): React.JSX.Element;
|
|
36
|
+
export declare const dropdownItemStyles: import("tailwind-variants").TVReturnType<{
|
|
37
|
+
isDisabled: {
|
|
38
|
+
false: string;
|
|
39
|
+
true: string;
|
|
40
|
+
};
|
|
41
|
+
isPressed: {
|
|
42
|
+
true: string;
|
|
43
|
+
};
|
|
44
|
+
isFocused: {
|
|
45
|
+
true: string;
|
|
46
|
+
};
|
|
47
|
+
}, undefined, "group flex items-center gap-4 cursor-default select-none py-2 pl-3 pr-3 selected:pr-1 rounded-lg outline outline-0 text-sm forced-color-adjust-none no-underline [&[href]]:cursor-pointer [-webkit-tap-highlight-color:transparent]", {
|
|
48
|
+
isDisabled: {
|
|
49
|
+
false: string;
|
|
50
|
+
true: string;
|
|
51
|
+
};
|
|
52
|
+
isPressed: {
|
|
53
|
+
true: string;
|
|
54
|
+
};
|
|
55
|
+
isFocused: {
|
|
56
|
+
true: string;
|
|
57
|
+
};
|
|
58
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
59
|
+
isDisabled: {
|
|
60
|
+
false: string;
|
|
61
|
+
true: string;
|
|
62
|
+
};
|
|
63
|
+
isPressed: {
|
|
64
|
+
true: string;
|
|
65
|
+
};
|
|
66
|
+
isFocused: {
|
|
67
|
+
true: string;
|
|
68
|
+
};
|
|
69
|
+
}, undefined, "group flex items-center gap-4 cursor-default select-none py-2 pl-3 pr-3 selected:pr-1 rounded-lg outline outline-0 text-sm forced-color-adjust-none no-underline [&[href]]:cursor-pointer [-webkit-tap-highlight-color:transparent]", unknown, unknown, undefined>>;
|
|
70
|
+
export declare function DropdownItem(props: ListBoxItemProps): React.JSX.Element;
|
|
71
|
+
export interface DropdownSectionProps<T> extends SectionProps<T> {
|
|
72
|
+
title?: string;
|
|
73
|
+
items?: any;
|
|
74
|
+
}
|
|
75
|
+
export declare function DropdownSection<T extends object>(props: DropdownSectionProps<T>): React.JSX.Element;
|
|
76
|
+
export {};
|
package/lib/Modal.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const DefaultModalDialogClasses: ModalDialogClasses;
|
|
|
12
12
|
export interface ModalProps extends AriaModalOverlayProps, ModalClasses {
|
|
13
13
|
state: OverlayTriggerState;
|
|
14
14
|
children: React.ReactElement;
|
|
15
|
+
portalContainer?: Element;
|
|
15
16
|
}
|
|
16
17
|
export interface ModalDialogTriggerProps extends OverlayTriggerProps, AriaModalOverlayProps {
|
|
17
18
|
trigger: React.ReactElement;
|
|
@@ -20,6 +21,6 @@ export interface ModalDialogTriggerProps extends OverlayTriggerProps, AriaModalO
|
|
|
20
21
|
export interface ModalDialogProps extends ModalDialogTriggerProps, Omit<DialogProps, "children">, ModalDialogClasses {
|
|
21
22
|
footer?: React.ReactNode;
|
|
22
23
|
}
|
|
23
|
-
export declare function Modal({ state, children, isDismissable, isKeyboardDismissDisabled, shouldCloseOnInteractOutside, ...props }: ModalProps): React.JSX.Element;
|
|
24
|
+
export declare function Modal({ state, children, isDismissable, isKeyboardDismissDisabled, shouldCloseOnInteractOutside, portalContainer, ...props }: ModalProps): React.JSX.Element;
|
|
24
25
|
export declare function ModalTrigger({ trigger, children, ...props }: ModalDialogTriggerProps): React.JSX.Element;
|
|
25
26
|
export declare function ModalDialog({ children, footer, defaultOpen, isDismissable, titleClass, ...props }: ModalDialogProps): React.JSX.Element;
|
package/lib/Popover.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { PopoverProps as AriaPopoverProps } from "react-aria-components";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { OverlayTriggerState } from "react-stately";
|
|
4
|
+
export interface PopoverProps extends Omit<AriaPopoverProps, "children"> {
|
|
5
|
+
showArrow?: boolean;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function Popover({ children, showArrow, className, ...props }: PopoverProps): React.JSX.Element;
|
|
5
9
|
export interface PopoverClasses {
|
|
6
10
|
underlayClass?: string;
|
|
7
11
|
popoverClass?: string;
|
|
8
12
|
}
|
|
9
|
-
export interface PopoverProps extends Omit<AriaPopoverProps, "popoverRef">, PopoverClasses {
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
state: OverlayTriggerState;
|
|
12
|
-
portalContainer?: Element;
|
|
13
|
-
renderArrow?: (props: DOMAttributes) => ReactNode;
|
|
14
|
-
}
|
|
15
13
|
export declare const DefaultPopoverClasses: {
|
|
16
14
|
underlayClass: string;
|
|
17
15
|
popoverClass: string;
|
|
18
16
|
};
|
|
19
|
-
export declare function Popover({ children, state, renderArrow, portalContainer, ...props }: PopoverProps): React.JSX.Element;
|
|
20
17
|
export declare function createOverlayState(ref: {
|
|
21
18
|
value: boolean;
|
|
22
19
|
}): OverlayTriggerState;
|
package/lib/Select.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SelectProps as AriaSelectProps, ListBoxItemProps, ValidationResult } from "react-aria-components";
|
|
3
|
+
import { DropdownSectionProps } from "./ListBox";
|
|
4
|
+
export interface SelectProps<T extends object> extends Omit<AriaSelectProps<T>, "children"> {
|
|
5
|
+
label?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
8
|
+
items?: Iterable<T>;
|
|
9
|
+
children: React.ReactNode | ((item: T) => React.ReactNode);
|
|
10
|
+
}
|
|
11
|
+
export declare function Select<T extends object>({ label, description, errorMessage, children, items, ...props }: SelectProps<T>): React.JSX.Element;
|
|
12
|
+
export declare function SelectItem(props: ListBoxItemProps): React.JSX.Element;
|
|
13
|
+
export declare function SelectSection<T extends object>(props: DropdownSectionProps<T>): React.JSX.Element;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
var
|
|
1
|
+
var reactAriaComponents = require('react-aria-components');
|
|
2
2
|
var React = require('react');
|
|
3
|
+
var reactAria = require('react-aria');
|
|
4
|
+
var tailwindVariants = require('tailwind-variants');
|
|
3
5
|
var reactStately = require('react-stately');
|
|
6
|
+
var tailwindMerge = require('tailwind-merge');
|
|
4
7
|
|
|
5
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
9
|
|
|
@@ -19,32 +22,30 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
19
22
|
if (null == r) return {};
|
|
20
23
|
var t = {};
|
|
21
24
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
22
|
-
if (e.
|
|
25
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
23
26
|
t[n] = r[n];
|
|
24
27
|
}
|
|
25
28
|
return t;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
var _excluded$
|
|
31
|
+
var _excluded$4 = ["children", "className"];
|
|
29
32
|
function Button(_ref) {
|
|
30
33
|
var children = _ref.children,
|
|
31
34
|
className = _ref.className,
|
|
32
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className: className,
|
|
38
|
-
children: children
|
|
35
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
36
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Button, _extends({}, props, {
|
|
37
|
+
className: className
|
|
38
|
+
}), reactAriaComponents.composeRenderProps(children, function (children, _ref2) {
|
|
39
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
39
40
|
}));
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
var _excluded$
|
|
43
|
+
var _excluded$3 = ["title", "children"];
|
|
43
44
|
var DefaultDialogClasses = {};
|
|
44
45
|
function Dialog(_ref) {
|
|
45
46
|
var title = _ref.title,
|
|
46
47
|
children = _ref.children,
|
|
47
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
48
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
48
49
|
var ref = React.useRef(null);
|
|
49
50
|
var _DefaultDialogClasses = _extends({}, DefaultDialogClasses, props),
|
|
50
51
|
className = _DefaultDialogClasses.className,
|
|
@@ -60,41 +61,47 @@ function Dialog(_ref) {
|
|
|
60
61
|
}), title), children);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
var _excluded$
|
|
64
|
+
var _excluded$2 = ["children", "showArrow", "className"];
|
|
65
|
+
var styles$1 = tailwindVariants.tv({
|
|
66
|
+
base: "font-sans bg-white dark:bg-neutral-900/70 dark:backdrop-blur-2xl dark:backdrop-saturate-200 forced-colors:bg-[Canvas] shadow-2xl rounded-xl bg-clip-padding border border-black/10 dark:border-white/10 text-neutral-700 dark:text-neutral-300 outline-0",
|
|
67
|
+
variants: {
|
|
68
|
+
isEntering: {
|
|
69
|
+
"true": "animate-in fade-in placement-bottom:slide-in-from-top-1 placement-top:slide-in-from-bottom-1 placement-left:slide-in-from-right-1 placement-right:slide-in-from-left-1 ease-out duration-200"
|
|
70
|
+
},
|
|
71
|
+
isExiting: {
|
|
72
|
+
"true": "animate-out fade-out placement-bottom:slide-out-to-top-1 placement-top:slide-out-to-bottom-1 placement-left:slide-out-to-right-1 placement-right:slide-out-to-left-1 ease-in duration-150"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
function Popover(_ref) {
|
|
77
|
+
var children = _ref.children,
|
|
78
|
+
showArrow = _ref.showArrow,
|
|
79
|
+
className = _ref.className,
|
|
80
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
81
|
+
var offset = showArrow ? 12 : 8;
|
|
82
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Popover, _extends({
|
|
83
|
+
offset: offset
|
|
84
|
+
}, props, {
|
|
85
|
+
className: reactAriaComponents.composeRenderProps(className, function (className, renderProps) {
|
|
86
|
+
return styles$1(_extends({}, renderProps, {
|
|
87
|
+
className: className
|
|
88
|
+
}));
|
|
89
|
+
})
|
|
90
|
+
}), showArrow && /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.OverlayArrow, {
|
|
91
|
+
className: "group"
|
|
92
|
+
}, /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
93
|
+
width: 12,
|
|
94
|
+
height: 12,
|
|
95
|
+
viewBox: "0 0 12 12",
|
|
96
|
+
className: "block fill-white dark:fill-[#1f1f21] forced-colors:fill-[Canvas] stroke-1 stroke-black/10 dark:stroke-neutral-700 forced-colors:stroke-[ButtonBorder] group-placement-bottom:rotate-180 group-placement-left:-rotate-90 group-placement-right:rotate-90"
|
|
97
|
+
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
98
|
+
d: "M0 0 L6 6 L12 0"
|
|
99
|
+
}))), children);
|
|
100
|
+
}
|
|
64
101
|
var DefaultPopoverClasses = {
|
|
65
102
|
underlayClass: "fixed inset-0",
|
|
66
103
|
popoverClass: "bg-white"
|
|
67
104
|
};
|
|
68
|
-
function Popover(_ref) {
|
|
69
|
-
var children = _ref.children,
|
|
70
|
-
state = _ref.state,
|
|
71
|
-
renderArrow = _ref.renderArrow,
|
|
72
|
-
portalContainer = _ref.portalContainer,
|
|
73
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
74
|
-
var popoverRef = React.useRef(null);
|
|
75
|
-
var _DefaultPopoverClasse = _extends({}, DefaultPopoverClasses, props),
|
|
76
|
-
popoverClass = _DefaultPopoverClasse.popoverClass,
|
|
77
|
-
underlayClass = _DefaultPopoverClasse.underlayClass;
|
|
78
|
-
var _usePopover = reactAria.usePopover(_extends({}, props, {
|
|
79
|
-
popoverRef: popoverRef
|
|
80
|
-
}), state),
|
|
81
|
-
popoverProps = _usePopover.popoverProps,
|
|
82
|
-
underlayProps = _usePopover.underlayProps,
|
|
83
|
-
arrowProps = _usePopover.arrowProps;
|
|
84
|
-
return /*#__PURE__*/React__default["default"].createElement(reactAria.Overlay, {
|
|
85
|
-
portalContainer: portalContainer
|
|
86
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", _extends({}, underlayProps, {
|
|
87
|
-
className: underlayClass
|
|
88
|
-
})), /*#__PURE__*/React__default["default"].createElement("div", _extends({}, popoverProps, {
|
|
89
|
-
ref: popoverRef,
|
|
90
|
-
className: popoverClass,
|
|
91
|
-
style: popoverProps.style
|
|
92
|
-
}), renderArrow == null ? void 0 : renderArrow(arrowProps), /*#__PURE__*/React__default["default"].createElement(reactAria.DismissButton, {
|
|
93
|
-
onDismiss: state.close
|
|
94
|
-
}), children, /*#__PURE__*/React__default["default"].createElement(reactAria.DismissButton, {
|
|
95
|
-
onDismiss: state.close
|
|
96
|
-
})));
|
|
97
|
-
}
|
|
98
105
|
function createOverlayState(ref) {
|
|
99
106
|
return {
|
|
100
107
|
isOpen: ref.value,
|
|
@@ -113,7 +120,7 @@ function createOverlayState(ref) {
|
|
|
113
120
|
};
|
|
114
121
|
}
|
|
115
122
|
|
|
116
|
-
var _excluded = ["state", "children", "isDismissable", "isKeyboardDismissDisabled", "shouldCloseOnInteractOutside"],
|
|
123
|
+
var _excluded$1 = ["state", "children", "isDismissable", "isKeyboardDismissDisabled", "shouldCloseOnInteractOutside", "portalContainer"],
|
|
117
124
|
_excluded2 = ["trigger", "children"],
|
|
118
125
|
_excluded3 = ["onPress"],
|
|
119
126
|
_excluded4 = ["children", "footer", "defaultOpen", "isDismissable", "titleClass"];
|
|
@@ -127,7 +134,8 @@ function Modal(_ref) {
|
|
|
127
134
|
isDismissable = _ref.isDismissable,
|
|
128
135
|
isKeyboardDismissDisabled = _ref.isKeyboardDismissDisabled,
|
|
129
136
|
shouldCloseOnInteractOutside = _ref.shouldCloseOnInteractOutside,
|
|
130
|
-
|
|
137
|
+
portalContainer = _ref.portalContainer,
|
|
138
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
131
139
|
var ref = React__default["default"].useRef(null);
|
|
132
140
|
var _useModalOverlay = reactAria.useModalOverlay({
|
|
133
141
|
isDismissable: isDismissable,
|
|
@@ -139,7 +147,9 @@ function Modal(_ref) {
|
|
|
139
147
|
var _DefaultModalDialogCl = _extends({}, DefaultModalDialogClasses, props),
|
|
140
148
|
underlayClass = _DefaultModalDialogCl.underlayClass,
|
|
141
149
|
containerClass = _DefaultModalDialogCl.containerClass;
|
|
142
|
-
return /*#__PURE__*/React__default["default"].createElement(reactAria.Overlay,
|
|
150
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAria.Overlay, {
|
|
151
|
+
portalContainer: portalContainer
|
|
152
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", _extends({
|
|
143
153
|
className: underlayClass
|
|
144
154
|
}, underlayProps), /*#__PURE__*/React__default["default"].createElement("div", _extends({}, modalProps, {
|
|
145
155
|
ref: ref,
|
|
@@ -158,7 +168,7 @@ function ModalTrigger(_ref2) {
|
|
|
158
168
|
overlayProps = _useOverlayTrigger.overlayProps;
|
|
159
169
|
var onPress = triggerProps.onPress,
|
|
160
170
|
otherTriggerProps = _objectWithoutPropertiesLoose(triggerProps, _excluded3);
|
|
161
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].cloneElement(trigger, _extends({}, otherTriggerProps, {
|
|
171
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, "// TODO: react-19", React__default["default"].cloneElement(trigger, _extends({}, otherTriggerProps, {
|
|
162
172
|
onClick: onPress
|
|
163
173
|
})), state.isOpen && /*#__PURE__*/React__default["default"].createElement(Modal, _extends({
|
|
164
174
|
state: state
|
|
@@ -182,14 +192,196 @@ function ModalDialog(_ref3) {
|
|
|
182
192
|
}, props), children, footer));
|
|
183
193
|
}
|
|
184
194
|
|
|
195
|
+
var focusRing = tailwindVariants.tv({
|
|
196
|
+
base: "outline outline-secondary-600 dark:outline-secondary-500 forced-colors:outline-[Highlight] outline-offset-2",
|
|
197
|
+
variants: {
|
|
198
|
+
isFocusVisible: {
|
|
199
|
+
"false": "outline-0",
|
|
200
|
+
"true": "outline-2"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
function composeTailwindRenderProps(className, tw) {
|
|
205
|
+
return reactAriaComponents.composeRenderProps(className, function (className) {
|
|
206
|
+
return tailwindMerge.twMerge(tw, className);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function Label(props) {
|
|
211
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Label, _extends({}, props, {
|
|
212
|
+
className: tailwindMerge.twMerge("font-sans text-sm text-neutral-600 dark:text-neutral-300 font-medium cursor-default w-fit", props.className)
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
function Description(props) {
|
|
216
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Text, _extends({}, props, {
|
|
217
|
+
slot: "description",
|
|
218
|
+
className: tailwindMerge.twMerge("text-sm text-neutral-600", props.className)
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
function FieldError(props) {
|
|
222
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.FieldError, _extends({}, props, {
|
|
223
|
+
className: composeTailwindRenderProps(props.className, "text-sm text-red-600 forced-colors:text-[Mark]")
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
var fieldBorderStyles = tailwindVariants.tv({
|
|
227
|
+
base: "transition",
|
|
228
|
+
variants: {
|
|
229
|
+
isFocusWithin: {
|
|
230
|
+
"false": "border-neutral-300 hover:border-neutral-400 dark:border-neutral-600 dark:hover:border-neutral-500 forced-colors:border-[ButtonBorder]",
|
|
231
|
+
"true": "border-neutral-600 dark:border-neutral-300 forced-colors:border-[Highlight]"
|
|
232
|
+
},
|
|
233
|
+
isInvalid: {
|
|
234
|
+
"true": "border-red-600 dark:border-red-600 forced-colors:border-[Mark]"
|
|
235
|
+
},
|
|
236
|
+
isDisabled: {
|
|
237
|
+
"true": "border-neutral-200 dark:border-neutral-700 forced-colors:border-[GrayText]"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
var fieldGroupStyles = tailwindVariants.tv({
|
|
242
|
+
extend: focusRing,
|
|
243
|
+
base: "group flex items-center h-9 box-border bg-white dark:bg-neutral-900 forced-colors:bg-[Field] border rounded-lg overflow-hidden transition",
|
|
244
|
+
variants: fieldBorderStyles.variants
|
|
245
|
+
});
|
|
246
|
+
function FieldGroup(props) {
|
|
247
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Group, _extends({}, props, {
|
|
248
|
+
className: reactAriaComponents.composeRenderProps(props.className, function (className, renderProps) {
|
|
249
|
+
return fieldGroupStyles(_extends({}, renderProps, {
|
|
250
|
+
className: className
|
|
251
|
+
}));
|
|
252
|
+
})
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
function Input(props) {
|
|
256
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Input, _extends({}, props, {
|
|
257
|
+
className: composeTailwindRenderProps(props.className, "px-3 py-0 min-h-9 flex-1 min-w-0 border-0 outline outline-0 bg-white dark:bg-neutral-900 font-sans text-sm text-neutral-800 dark:text-neutral-200 placeholder:text-neutral-600 dark:placeholder:text-neutral-400 disabled:text-neutral-200 dark:disabled:text-neutral-600 disabled:placeholder:text-neutral-200 dark:disabled:placeholder:text-neutral-600 [-webkit-tap-highlight-color:transparent]")
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
tailwindVariants.tv({
|
|
262
|
+
extend: focusRing,
|
|
263
|
+
base: "group relative flex items-center gap-8 cursor-default select-none py-1.5 px-2.5 rounded-md will-change-transform text-sm forced-color-adjust-none",
|
|
264
|
+
variants: {
|
|
265
|
+
isSelected: {
|
|
266
|
+
"false": "text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 pressed:bg-neutral-100 dark:hover:bg-neutral-800 dark:pressed:bg-neutral-800 -outline-offset-2",
|
|
267
|
+
"true": "bg-secondary-600 text-white forced-colors:bg-[Highlight] forced-colors:text-[HighlightText] [&:has(+[data-selected])]:rounded-b-none [&+[data-selected]]:rounded-t-none -outline-offset-4 outline-white dark:outline-white forced-colors:outline-[HighlightText]"
|
|
268
|
+
},
|
|
269
|
+
isDisabled: {
|
|
270
|
+
"true": "text-neutral-300 dark:text-neutral-600 forced-colors:text-[GrayText]"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
var dropdownItemStyles = tailwindVariants.tv({
|
|
275
|
+
base: "group flex items-center gap-4 cursor-default select-none py-2 pl-3 pr-3 selected:pr-1 rounded-lg outline outline-0 text-sm forced-color-adjust-none no-underline [&[href]]:cursor-pointer [-webkit-tap-highlight-color:transparent]",
|
|
276
|
+
variants: {
|
|
277
|
+
isDisabled: {
|
|
278
|
+
"false": "text-neutral-900 dark:text-neutral-100",
|
|
279
|
+
"true": "text-neutral-300 dark:text-neutral-600 forced-colors:text-[GrayText]"
|
|
280
|
+
},
|
|
281
|
+
isPressed: {
|
|
282
|
+
"true": "bg-neutral-100 dark:bg-neutral-800"
|
|
283
|
+
},
|
|
284
|
+
isFocused: {
|
|
285
|
+
"true": "bg-secondary-600 dark:bg-secondary-600 text-white forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
compoundVariants: [{
|
|
289
|
+
isFocused: false,
|
|
290
|
+
isOpen: true,
|
|
291
|
+
className: "bg-neutral-100 dark:bg-neutral-700/60"
|
|
292
|
+
}]
|
|
293
|
+
});
|
|
294
|
+
function DropdownItem(props) {
|
|
295
|
+
var textValue = props.textValue || (typeof props.children === "string" ? props.children : undefined);
|
|
296
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.ListBoxItem, _extends({}, props, {
|
|
297
|
+
textValue: textValue,
|
|
298
|
+
className: dropdownItemStyles
|
|
299
|
+
}), reactAriaComponents.composeRenderProps(props.children, function (children, _ref2) {
|
|
300
|
+
var isSelected = _ref2.isSelected;
|
|
301
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
302
|
+
className: "flex items-center flex-1 gap-2 font-normal truncate group-selected:font-semibold"
|
|
303
|
+
}, children), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
304
|
+
className: "flex items-center w-5"
|
|
305
|
+
}, isSelected && /*#__PURE__*/React__default["default"].createElement("i", {
|
|
306
|
+
className: "w-4 h-4 fa fa-check"
|
|
307
|
+
})));
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
function DropdownSection(props) {
|
|
311
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.ListBoxSection, {
|
|
312
|
+
className: "first:-mt-[5px] after:content-[''] after:block after:h-[5px] last:after:hidden"
|
|
313
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Header, {
|
|
314
|
+
className: "text-sm font-semibold text-neutral-500 dark:text-neutral-300 px-4 py-1 truncate sticky -top-[5px] -mt-px -mx-1 z-10 bg-neutral-100/60 dark:bg-neutral-700/60 backdrop-blur-md supports-[-moz-appearance:none]:bg-neutral-100 border-y border-y-neutral-200 dark:border-y-neutral-700 [&+*]:mt-1"
|
|
315
|
+
}, props.title), /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Collection, {
|
|
316
|
+
items: props.items
|
|
317
|
+
}, props.children));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
var _excluded = ["label", "description", "errorMessage", "children", "items"];
|
|
321
|
+
var styles = tailwindVariants.tv({
|
|
322
|
+
extend: focusRing,
|
|
323
|
+
base: "flex items-center text-start gap-4 w-full font-sans border border-black/10 dark:border-white/10 cursor-default rounded-lg pl-3 pr-2 h-9 min-w-[64px] transition bg-neutral-50 dark:bg-neutral-700 [-webkit-tap-highlight-color:transparent]",
|
|
324
|
+
variants: {
|
|
325
|
+
isDisabled: {
|
|
326
|
+
"false": "text-neutral-800 dark:text-neutral-300 hover:bg-neutral-100 pressed:bg-neutral-200 dark:hover:bg-neutral-600 dark:pressed:bg-neutral-500 group-invalid:outline group-invalid:outline-red-600 forced-colors:group-invalid:outline-[Mark]",
|
|
327
|
+
"true": "border-transparent dark:border-transparent text-neutral-200 dark:text-neutral-600 forced-colors:text-[GrayText] bg-neutral-100 dark:bg-neutral-800"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
function Select(_ref) {
|
|
332
|
+
var label = _ref.label,
|
|
333
|
+
description = _ref.description,
|
|
334
|
+
errorMessage = _ref.errorMessage,
|
|
335
|
+
children = _ref.children,
|
|
336
|
+
items = _ref.items,
|
|
337
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
338
|
+
return /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Select, _extends({}, props, {
|
|
339
|
+
className: composeTailwindRenderProps(props.className, "group flex flex-col gap-1 relative font-sans")
|
|
340
|
+
}), label && /*#__PURE__*/React__default["default"].createElement(Label, null, label), /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.Button, {
|
|
341
|
+
className: styles
|
|
342
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.SelectValue, {
|
|
343
|
+
className: "flex-1 text-sm"
|
|
344
|
+
}, function (_ref2) {
|
|
345
|
+
var selectedText = _ref2.selectedText,
|
|
346
|
+
defaultChildren = _ref2.defaultChildren;
|
|
347
|
+
return selectedText || defaultChildren;
|
|
348
|
+
}), /*#__PURE__*/React__default["default"].createElement("i", {
|
|
349
|
+
"aria-hidden": true,
|
|
350
|
+
className: "w-4 h-4 fa fa-chevron-down text-neutral-600 dark:text-neutral-400 forced-colors:text-[ButtonText] group-disabled:text-neutral-200 dark:group-disabled:text-neutral-600 forced-colors:group-disabled:text-[GrayText]"
|
|
351
|
+
})), description && /*#__PURE__*/React__default["default"].createElement(Description, null, description), /*#__PURE__*/React__default["default"].createElement(FieldError, null, errorMessage), /*#__PURE__*/React__default["default"].createElement(Popover, {
|
|
352
|
+
className: "min-w-(--trigger-width)"
|
|
353
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactAriaComponents.ListBox, {
|
|
354
|
+
items: items,
|
|
355
|
+
className: "outline-hidden box-border p-1 max-h-[inherit] overflow-auto [clip-path:inset(0_0_0_0_round_.75rem)]"
|
|
356
|
+
}, children)));
|
|
357
|
+
}
|
|
358
|
+
function SelectItem(props) {
|
|
359
|
+
return /*#__PURE__*/React__default["default"].createElement(DropdownItem, props);
|
|
360
|
+
}
|
|
361
|
+
function SelectSection(props) {
|
|
362
|
+
return /*#__PURE__*/React__default["default"].createElement(DropdownSection, props);
|
|
363
|
+
}
|
|
364
|
+
|
|
185
365
|
exports.Button = Button;
|
|
186
366
|
exports.DefaultDialogClasses = DefaultDialogClasses;
|
|
187
367
|
exports.DefaultModalDialogClasses = DefaultModalDialogClasses;
|
|
188
368
|
exports.DefaultPopoverClasses = DefaultPopoverClasses;
|
|
369
|
+
exports.Description = Description;
|
|
189
370
|
exports.Dialog = Dialog;
|
|
371
|
+
exports.FieldError = FieldError;
|
|
372
|
+
exports.FieldGroup = FieldGroup;
|
|
373
|
+
exports.Input = Input;
|
|
374
|
+
exports.Label = Label;
|
|
190
375
|
exports.Modal = Modal;
|
|
191
376
|
exports.ModalDialog = ModalDialog;
|
|
192
377
|
exports.ModalTrigger = ModalTrigger;
|
|
193
378
|
exports.Popover = Popover;
|
|
379
|
+
exports.Select = Select;
|
|
380
|
+
exports.SelectItem = SelectItem;
|
|
381
|
+
exports.SelectSection = SelectSection;
|
|
382
|
+
exports.composeTailwindRenderProps = composeTailwindRenderProps;
|
|
194
383
|
exports.createOverlayState = createOverlayState;
|
|
384
|
+
exports.fieldBorderStyles = fieldBorderStyles;
|
|
385
|
+
exports.fieldGroupStyles = fieldGroupStyles;
|
|
386
|
+
exports.focusRing = focusRing;
|
|
195
387
|
//# sourceMappingURL=index.js.map
|