@koobiq/react-components 0.0.1-beta.1 → 0.0.1-beta.11
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 +14 -31
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/components/AlertIcon/utils.js +1 -1
- package/dist/components/Alert/intl.json.js +2 -6
- package/dist/components/AnimatedIcon/AnimatedIcon.d.ts +4 -0
- package/dist/components/AnimatedIcon/AnimatedIcon.js +50 -0
- package/dist/components/AnimatedIcon/AnimatedIcon.module.css.js +11 -0
- package/dist/components/AnimatedIcon/index.d.ts +2 -0
- package/dist/components/AnimatedIcon/types.d.ts +19 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.module.css.js +2 -2
- package/dist/components/Checkbox/Checkbox.js +18 -8
- package/dist/components/Container/Container.js +2 -1
- package/dist/components/Container/utils.d.ts +1 -1
- package/dist/components/Dialog/DialogContext.js +1 -1
- package/dist/components/Dialog/components/DialogContent.js +1 -1
- package/dist/components/Dialog/intl.json.js +2 -6
- package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.d.ts +8 -2
- package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.js +32 -30
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.d.ts +12 -0
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +37 -0
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.module.css.js +20 -0
- package/dist/components/FieldComponents/FieldSelect/index.d.ts +1 -0
- package/dist/components/FieldComponents/index.d.ts +1 -0
- package/dist/components/FlexBox/FlexBox.d.ts +4 -0
- package/dist/components/FlexBox/FlexBox.js +47 -0
- package/dist/components/FlexBox/index.d.ts +2 -0
- package/dist/components/FlexBox/types.d.ts +27 -0
- package/dist/components/Input/Input.d.ts +1 -0
- package/dist/components/Input/Input.js +11 -11
- package/dist/components/Input/types.d.ts +2 -1
- package/dist/components/Link/Link.js +13 -15
- package/dist/components/List/List.d.ts +9 -0
- package/dist/components/List/List.js +46 -0
- package/dist/components/List/List.module.css.js +11 -0
- package/dist/components/List/ListItem.d.ts +6 -0
- package/dist/components/List/ListItem.js +11 -0
- package/dist/components/List/ListSection.d.ts +16 -0
- package/dist/components/List/ListSection.js +11 -0
- package/dist/components/List/components/ListItemText/ListItemText.d.ts +16 -0
- package/dist/components/List/components/ListItemText/index.d.ts +1 -0
- package/dist/components/List/components/ListOption/ListOption.d.ts +5 -0
- package/dist/components/List/components/ListOption/ListOption.js +44 -0
- package/dist/components/List/components/ListOption/ListOption.module.css.js +23 -0
- package/dist/components/List/components/ListOption/index.d.ts +1 -0
- package/dist/components/List/components/ListSection/ListSection.d.ts +5 -0
- package/dist/components/List/components/ListSection/ListSection.js +33 -0
- package/dist/components/List/components/ListSection/ListSection.module.css.js +11 -0
- package/dist/components/List/components/ListSection/index.d.ts +1 -0
- package/dist/components/List/components/index.d.ts +3 -0
- package/dist/components/List/index.d.ts +4 -0
- package/dist/components/List/types.d.ts +57 -0
- package/dist/components/List/types.js +4 -0
- package/dist/components/Modal/Modal.js +14 -12
- package/dist/components/Modal/types.d.ts +7 -0
- package/dist/components/Popover/Popover.d.ts +4 -2
- package/dist/components/Popover/Popover.js +137 -127
- package/dist/components/Popover/Popover.module.css.js +3 -0
- package/dist/components/Popover/types.d.ts +25 -3
- package/dist/components/ProgressBar/ProgressBar.module.css.js +1 -2
- package/dist/components/ProgressSpinner/ProgressSpinner.module.css.js +1 -2
- package/dist/components/Provider/BreakpointsProvider.d.ts +2 -1
- package/dist/components/Provider/BreakpointsProvider.js +8 -1
- package/dist/components/Provider/Provider.d.ts +1 -1
- package/dist/components/Provider/Provider.js +9 -1
- package/dist/components/Provider/types.d.ts +5 -0
- package/dist/components/Provider/utils/useBreakpoints.d.ts +2 -1
- package/dist/components/Provider/utils/useBreakpoints.js +2 -2
- package/dist/components/RadioGroup/RadioContext.js +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +2 -1
- package/dist/components/RadioGroup/components/Radio/Radio.js +3 -2
- package/dist/components/RadioGroup/components/Radio/Radio.module.css.js +3 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.js +172 -0
- package/dist/components/Select/Select.module.css.js +20 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/types.d.ts +87 -0
- package/dist/components/SidePanel/SidePanel.js +17 -15
- package/dist/components/SidePanel/types.d.ts +7 -0
- package/dist/components/SkeletonBlock/SkeletonBlock.module.css.js +0 -1
- package/dist/components/SkeletonTypography/utils.js +3 -0
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +2 -1
- package/dist/components/Tooltip/Tooltip.js +9 -8
- package/dist/components/Tooltip/types.d.ts +9 -4
- package/dist/components/Typography/Typography.js +2 -2
- package/dist/components/Typography/Typography.module.css.js +2 -1
- package/dist/components/Typography/types.d.ts +1 -1
- package/dist/components/Typography/types.js +2 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/layout/flex/flex.d.ts +15 -4
- package/dist/components/layout/flex/flex.js +6 -1
- package/dist/components/layout/flex/flex.module.css.js +78 -39
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -1
- package/dist/style.css +484 -223
- package/dist/styles/utility.js +0 -1
- package/dist/styles/utility.module.css.js +0 -1
- package/dist/types.d.ts +1 -0
- package/package.json +6 -6
- package/dist/components/Input/components/FieldAddon/FieldAddon.d.ts +0 -10
- package/dist/components/Input/components/FieldAddon/index.d.ts +0 -1
- package/dist/components/Input/components/FieldCaption/FieldCaption.d.ts +0 -6
- package/dist/components/Input/components/FieldCaption/index.d.ts +0 -1
- package/dist/components/Input/components/FieldControl/FieldControl.d.ts +0 -9
- package/dist/components/Input/components/FieldControl/index.d.ts +0 -1
- package/dist/components/Input/components/FieldError/FieldError.d.ts +0 -7
- package/dist/components/Input/components/FieldError/index.d.ts +0 -1
- package/dist/components/Input/components/FieldInput/FieldInput.d.ts +0 -9
- package/dist/components/Input/components/FieldInput/index.d.ts +0 -1
- package/dist/components/Input/components/FieldInputGroup/FieldInputGroup.d.ts +0 -7
- package/dist/components/Input/components/FieldInputGroup/index.d.ts +0 -1
- package/dist/components/Input/components/FieldLabel/FieldLabel.d.ts +0 -9
- package/dist/components/Input/components/FieldLabel/index.d.ts +0 -1
- package/dist/components/Input/components/index.d.ts +0 -7
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { polymorphicForwardRef,
|
|
4
|
-
import {
|
|
3
|
+
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
4
|
+
import { Link as Link$1 } from "@koobiq/react-primitives";
|
|
5
5
|
import s from "./Link.module.css.js";
|
|
6
6
|
const Link = polymorphicForwardRef((props, ref) => {
|
|
7
7
|
const {
|
|
8
8
|
variant = "text-normal",
|
|
9
9
|
visitable = false,
|
|
10
10
|
pseudo = false,
|
|
11
|
+
disabled,
|
|
11
12
|
as = "a",
|
|
12
13
|
startIcon,
|
|
13
14
|
endIcon,
|
|
14
15
|
children,
|
|
15
16
|
className,
|
|
16
|
-
|
|
17
|
+
...other
|
|
17
18
|
} = props;
|
|
18
|
-
const Tag = as;
|
|
19
|
-
const domRef = useDOMRef(ref);
|
|
20
|
-
const elementType = as !== "a" && as !== "button" ? `${as}` : void 0;
|
|
21
|
-
const { linkProps, hovered, pressed, focusVisible } = useLink(
|
|
22
|
-
{ ...props, elementType },
|
|
23
|
-
domRef
|
|
24
|
-
);
|
|
25
19
|
const hasIcon = Boolean(startIcon || endIcon);
|
|
20
|
+
const elementType = as !== "a" && as !== "button" ? `${as}` : void 0;
|
|
26
21
|
return /* @__PURE__ */ jsxs(
|
|
27
|
-
|
|
22
|
+
Link$1,
|
|
28
23
|
{
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
as,
|
|
25
|
+
disabled,
|
|
26
|
+
elementType,
|
|
27
|
+
...disabled && { tabIndex: -1 },
|
|
28
|
+
className: ({ hovered, pressed, focusVisible }) => clsx(
|
|
31
29
|
s.base,
|
|
32
30
|
s[variant],
|
|
33
31
|
pseudo && s.pseudo,
|
|
@@ -38,8 +36,8 @@ const Link = polymorphicForwardRef((props, ref) => {
|
|
|
38
36
|
focusVisible && s.focusVisible,
|
|
39
37
|
className
|
|
40
38
|
),
|
|
41
|
-
|
|
42
|
-
ref
|
|
39
|
+
...other,
|
|
40
|
+
ref,
|
|
43
41
|
children: [
|
|
44
42
|
startIcon,
|
|
45
43
|
children,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
|
+
import { type ListState } from '@koobiq/react-primitives';
|
|
3
|
+
import type { ListComponent, ListBaseProps } from './types';
|
|
4
|
+
export type ListInnerProps<T extends object> = {
|
|
5
|
+
state: ListState<T>;
|
|
6
|
+
listRef?: Ref<HTMLUListElement>;
|
|
7
|
+
} & Omit<ListBaseProps<T>, 'ref'>;
|
|
8
|
+
export declare function ListInner<T extends object>(props: ListInnerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const List: ListComponent;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { useDOMRef, mergeProps, clsx, isNotNil } from "@koobiq/react-core";
|
|
5
|
+
import { useListState, useListBox } from "@koobiq/react-primitives";
|
|
6
|
+
import s from "./List.module.css.js";
|
|
7
|
+
import { ListSection } from "./components/ListSection/ListSection.js";
|
|
8
|
+
import { Typography } from "../Typography/Typography.js";
|
|
9
|
+
import { ListOption } from "./components/ListOption/ListOption.js";
|
|
10
|
+
function ListInner(props) {
|
|
11
|
+
const { label, className, style, slotProps, state, listRef } = props;
|
|
12
|
+
const domRef = useDOMRef(listRef);
|
|
13
|
+
const { listBoxProps, labelProps } = useListBox(props, state, domRef);
|
|
14
|
+
const titleProps = mergeProps(
|
|
15
|
+
{
|
|
16
|
+
className: s.label,
|
|
17
|
+
variant: "text-normal-strong"
|
|
18
|
+
},
|
|
19
|
+
slotProps?.label,
|
|
20
|
+
labelProps
|
|
21
|
+
);
|
|
22
|
+
const listProps = mergeProps(
|
|
23
|
+
{
|
|
24
|
+
style,
|
|
25
|
+
ref: domRef,
|
|
26
|
+
className: clsx(s.base, className)
|
|
27
|
+
},
|
|
28
|
+
slotProps?.list,
|
|
29
|
+
listBoxProps
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
|
+
isNotNil(label) && /* @__PURE__ */ jsx(Typography, { ...titleProps, children: label }),
|
|
33
|
+
/* @__PURE__ */ jsx("ul", { ...listProps, children: [...state.collection].map(
|
|
34
|
+
(item) => item.type === "section" ? /* @__PURE__ */ jsx(ListSection, { section: item, state }, item.key) : /* @__PURE__ */ jsx(ListOption, { item, state }, item.key)
|
|
35
|
+
) })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
function ListRender(props, ref) {
|
|
39
|
+
const state = useListState(props);
|
|
40
|
+
return /* @__PURE__ */ jsx(ListInner, { listRef: ref, ...props, state });
|
|
41
|
+
}
|
|
42
|
+
const List = forwardRef(ListRender);
|
|
43
|
+
export {
|
|
44
|
+
List,
|
|
45
|
+
ListInner
|
|
46
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ItemProps } from '@koobiq/react-primitives';
|
|
2
|
+
export type ListItemProps<T> = ItemProps<T>;
|
|
3
|
+
export declare function ListItem<T>(props: ListItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare namespace ListItem {
|
|
5
|
+
var getCollectionNode: unknown;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Item } from "@koobiq/react-primitives";
|
|
4
|
+
const ItemInner = Item;
|
|
5
|
+
function ListItem(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Item, { ...props });
|
|
7
|
+
}
|
|
8
|
+
ListItem.getCollectionNode = ItemInner.getCollectionNode;
|
|
9
|
+
export {
|
|
10
|
+
ListItem
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SectionProps } from '@koobiq/react-primitives';
|
|
3
|
+
export type ListSectionProps<T> = {
|
|
4
|
+
/** Rendered contents of the section, e.g. a header. */
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
/** An accessibility label for the section. */
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
/** Static child items or a function to render children. */
|
|
9
|
+
children: SectionProps<T>['children'];
|
|
10
|
+
/** Item objects in the section. */
|
|
11
|
+
items?: SectionProps<T>['items'];
|
|
12
|
+
};
|
|
13
|
+
export declare function ListSection<T>(props: ListSectionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare namespace ListSection {
|
|
15
|
+
var getCollectionNode: unknown;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Section } from "@koobiq/react-primitives";
|
|
4
|
+
const SectionInner = Section;
|
|
5
|
+
function ListSection(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Section, { ...props });
|
|
7
|
+
}
|
|
8
|
+
ListSection.getCollectionNode = SectionInner.getCollectionNode;
|
|
9
|
+
export {
|
|
10
|
+
ListSection
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { ExtendableComponentPropsWithRef, DataAttributeProps } from '@koobiq/react-core';
|
|
3
|
+
import type { TypographyProps } from '../../../Typography';
|
|
4
|
+
export type ListItemTextRef = ComponentRef<'div'>;
|
|
5
|
+
export type ListItemTextProps = ExtendableComponentPropsWithRef<{
|
|
6
|
+
/** The content of the component. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** The helper text content. */
|
|
9
|
+
caption?: ReactNode;
|
|
10
|
+
/** The props used for each slot inside. */
|
|
11
|
+
slotProps?: {
|
|
12
|
+
text?: TypographyProps;
|
|
13
|
+
caption?: TypographyProps;
|
|
14
|
+
};
|
|
15
|
+
} & DataAttributeProps, 'div'>;
|
|
16
|
+
export declare const ListItemText: import("react").ForwardRefExoticComponent<Omit<ListItemTextProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ListItemText';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { useHover, usePress, clsx, mergeProps } from "@koobiq/react-core";
|
|
5
|
+
import { useOption } from "@koobiq/react-primitives";
|
|
6
|
+
import { utilClasses } from "../../../../styles/utility.js";
|
|
7
|
+
import s from "./ListOption.module.css.js";
|
|
8
|
+
const textVariant = utilClasses.typography;
|
|
9
|
+
function ListOption({
|
|
10
|
+
item,
|
|
11
|
+
state
|
|
12
|
+
}) {
|
|
13
|
+
const ref = useRef(null);
|
|
14
|
+
const {
|
|
15
|
+
optionProps,
|
|
16
|
+
isSelected: selected,
|
|
17
|
+
isDisabled: disabled,
|
|
18
|
+
isFocusVisible: focusVisible
|
|
19
|
+
} = useOption({ key: item.key }, state, ref);
|
|
20
|
+
const { hoverProps, isHovered: hovered } = useHover({ isDisabled: disabled });
|
|
21
|
+
const { isPressed: pressed, pressProps } = usePress({ isDisabled: disabled });
|
|
22
|
+
const Tag = item.props.href ? "a" : "li";
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
Tag,
|
|
25
|
+
{
|
|
26
|
+
...mergeProps(optionProps, hoverProps, pressProps),
|
|
27
|
+
className: clsx(
|
|
28
|
+
s.base,
|
|
29
|
+
hovered && s.hovered,
|
|
30
|
+
pressed && s.pressed,
|
|
31
|
+
selected && s.selected,
|
|
32
|
+
textVariant["text-normal"],
|
|
33
|
+
disabled && s.disabled,
|
|
34
|
+
focusVisible && s.focusVisible
|
|
35
|
+
),
|
|
36
|
+
ref,
|
|
37
|
+
"data-focus-visible": focusVisible,
|
|
38
|
+
children: item.rendered
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
ListOption
|
|
44
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const base = "kbq-listoption-8693c5";
|
|
2
|
+
const hovered = "kbq-listoption-hovered-163e16";
|
|
3
|
+
const pressed = "kbq-listoption-pressed-292310";
|
|
4
|
+
const focusVisible = "kbq-listoption-focusVisible-dcff25";
|
|
5
|
+
const selected = "kbq-listoption-selected-012293";
|
|
6
|
+
const disabled = "kbq-listoption-disabled-dafd94";
|
|
7
|
+
const s = {
|
|
8
|
+
base,
|
|
9
|
+
hovered,
|
|
10
|
+
pressed,
|
|
11
|
+
focusVisible,
|
|
12
|
+
selected,
|
|
13
|
+
disabled
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
base,
|
|
17
|
+
s as default,
|
|
18
|
+
disabled,
|
|
19
|
+
focusVisible,
|
|
20
|
+
hovered,
|
|
21
|
+
pressed,
|
|
22
|
+
selected
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ListOption';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useListBoxSection } from "@koobiq/react-primitives";
|
|
4
|
+
import s from "./ListSection.module.css.js";
|
|
5
|
+
import { ListOption } from "../ListOption/ListOption.js";
|
|
6
|
+
import { Typography } from "../../../Typography/Typography.js";
|
|
7
|
+
function ListSection({
|
|
8
|
+
section,
|
|
9
|
+
state
|
|
10
|
+
}) {
|
|
11
|
+
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
12
|
+
heading: section.rendered,
|
|
13
|
+
"aria-label": section["aria-label"]
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("li", { ...itemProps, children: [
|
|
16
|
+
section.rendered && /* @__PURE__ */ jsx(
|
|
17
|
+
Typography,
|
|
18
|
+
{
|
|
19
|
+
as: "span",
|
|
20
|
+
display: "block",
|
|
21
|
+
variant: "caps-compact-strong",
|
|
22
|
+
color: "contrast-secondary",
|
|
23
|
+
className: s.heading,
|
|
24
|
+
...headingProps,
|
|
25
|
+
children: section.rendered
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ jsx("ul", { ...groupProps, className: s.base, children: [...section.childNodes].map((node) => /* @__PURE__ */ jsx(ListOption, { item: node, state }, node.key)) })
|
|
29
|
+
] }) });
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
ListSection
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ListSection';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { AriaListBoxProps, ListState } from '@koobiq/react-primitives';
|
|
3
|
+
import type { TypographyProps } from '../Typography';
|
|
4
|
+
export declare const listPropSelectionMode: readonly ["none", "single", "multiple"];
|
|
5
|
+
export type ListPropSelectionMode = (typeof listPropSelectionMode)[number];
|
|
6
|
+
export type ListPropItems<T extends object> = AriaListBoxProps<T>['items'];
|
|
7
|
+
export type ListPropChildren<T extends object> = AriaListBoxProps<T>['children'];
|
|
8
|
+
export type ListPropSelectedKeys<T extends object> = AriaListBoxProps<T>['selectedKeys'];
|
|
9
|
+
export type ListPropDefaultSelectedKeys<T extends object> = AriaListBoxProps<T>['defaultSelectedKeys'];
|
|
10
|
+
export type ListPropDisabledKeys<T extends object> = AriaListBoxProps<T>['disabledKeys'];
|
|
11
|
+
export type ListPropOnSelectionChange<T extends object> = AriaListBoxProps<T>['onSelectionChange'];
|
|
12
|
+
export type ListPropOnAction<T extends object> = AriaListBoxProps<T>['onAction'];
|
|
13
|
+
export type ListPropSelectionBehavior<T extends object> = AriaListBoxProps<T>['selectionBehavior'];
|
|
14
|
+
export type ListBaseProps<T extends object> = {
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
/** Additional CSS-classes. */
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Inline styles. */
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
/** The type of selection that is allowed in the collection. */
|
|
21
|
+
selectionMode?: ListPropSelectionMode;
|
|
22
|
+
/** Ref to the HTML ul-element. */
|
|
23
|
+
ref?: Ref<HTMLElement>;
|
|
24
|
+
/** The contents of the collection. */
|
|
25
|
+
children?: ListPropChildren<T>;
|
|
26
|
+
/** Item objects in the collection. */
|
|
27
|
+
items?: ListPropItems<T>;
|
|
28
|
+
/** The currently selected keys in the collection (controlled). */
|
|
29
|
+
selectedKeys?: ListPropSelectedKeys<T>;
|
|
30
|
+
/** The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with. */
|
|
31
|
+
disabledKeys?: ListPropDisabledKeys<T>;
|
|
32
|
+
/** The initial selected keys in the collection (uncontrolled). */
|
|
33
|
+
defaultSelectedKeys?: ListPropDefaultSelectedKeys<T>;
|
|
34
|
+
/** Handler that is called when the selection changes. */
|
|
35
|
+
onSelectionChange?: ListPropOnSelectionChange<T>;
|
|
36
|
+
/**
|
|
37
|
+
* Handler that is called when a user performs an action on an item. The exact user event depends on
|
|
38
|
+
* the collection's `selectionBehavior` prop and the interaction modality.
|
|
39
|
+
*/
|
|
40
|
+
onAction?: ListPropOnAction<T>;
|
|
41
|
+
/** How multiple selection should behave in the collection. */
|
|
42
|
+
selectionBehavior?: ListPropSelectionBehavior<T>;
|
|
43
|
+
/** Whether to autofocus the list or an option. */
|
|
44
|
+
autoFocus?: boolean | 'first' | 'last';
|
|
45
|
+
/** The props used for each slot inside. */
|
|
46
|
+
slotProps?: {
|
|
47
|
+
label?: TypographyProps;
|
|
48
|
+
list?: ComponentPropsWithRef<'div'>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type ListProps<T extends object> = ListBaseProps<T>;
|
|
52
|
+
export type ListRef = ComponentRef<'ul'>;
|
|
53
|
+
export type ListInnerProps<T extends object> = {
|
|
54
|
+
state: ListState<T>;
|
|
55
|
+
listRef?: Ref<HTMLUListElement>;
|
|
56
|
+
} & Omit<ListBaseProps<T>, 'ref'>;
|
|
57
|
+
export type ListComponent = <T extends object>(props: ListProps<T>) => ReactElement | null;
|
|
@@ -9,19 +9,20 @@ import { Backdrop } from "../Backdrop/Backdrop.js";
|
|
|
9
9
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
10
10
|
const Modal = forwardRef((props, ref) => {
|
|
11
11
|
const {
|
|
12
|
-
hideCloseButton = false,
|
|
13
12
|
size = "medium",
|
|
14
|
-
|
|
15
|
-
disableExitOnClickOutside,
|
|
16
|
-
disableFocusManagement,
|
|
17
|
-
portalContainer,
|
|
18
|
-
open: openProp,
|
|
19
|
-
hideBackdrop,
|
|
20
|
-
onOpenChange,
|
|
21
|
-
defaultOpen,
|
|
22
|
-
children,
|
|
13
|
+
hideCloseButton = false,
|
|
23
14
|
control,
|
|
15
|
+
children,
|
|
24
16
|
slotProps,
|
|
17
|
+
defaultOpen,
|
|
18
|
+
hideBackdrop,
|
|
19
|
+
onOpenChange,
|
|
20
|
+
open: openProp,
|
|
21
|
+
portalContainer,
|
|
22
|
+
disableFocusManagement,
|
|
23
|
+
disableExitOnClickOutside,
|
|
24
|
+
disableExitOnEscapeKeyDown,
|
|
25
|
+
shouldCloseOnInteractOutside,
|
|
25
26
|
...other
|
|
26
27
|
} = props;
|
|
27
28
|
const state = useOverlayTriggerState({
|
|
@@ -41,6 +42,7 @@ const Modal = forwardRef((props, ref) => {
|
|
|
41
42
|
const { modalProps: modalCommonProps, underlayProps } = useModalOverlay(
|
|
42
43
|
{
|
|
43
44
|
...props,
|
|
45
|
+
shouldCloseOnInteractOutside,
|
|
44
46
|
isDismissable: !disableExitOnClickOutside,
|
|
45
47
|
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
46
48
|
},
|
|
@@ -55,9 +57,9 @@ const Modal = forwardRef((props, ref) => {
|
|
|
55
57
|
};
|
|
56
58
|
const containerProps = mergeProps(
|
|
57
59
|
{
|
|
58
|
-
className: clsx(s.base, s[size]),
|
|
59
60
|
ref: containerRef,
|
|
60
|
-
"data-size": size
|
|
61
|
+
"data-size": size,
|
|
62
|
+
className: clsx(s.base, s[size])
|
|
61
63
|
},
|
|
62
64
|
other
|
|
63
65
|
);
|
|
@@ -58,6 +58,13 @@ export type ModalProps = {
|
|
|
58
58
|
* @default false
|
|
59
59
|
*/
|
|
60
60
|
disableFocusManagement?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* When user interacts with the argument element outside of the overlay ref,
|
|
63
|
+
* return true if onClose should be called. This gives you a chance to filter
|
|
64
|
+
* out interaction with elements that should not dismiss the overlay.
|
|
65
|
+
* By default, onClose will always be called on interaction outside the overlay ref.
|
|
66
|
+
*/
|
|
67
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
61
68
|
/** The props used for each slot inside. */
|
|
62
69
|
slotProps?: {
|
|
63
70
|
dialog?: DialogProps;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { PopoverInnerProps } from './types';
|
|
3
|
+
export declare const PopoverInner: FC<PopoverInnerProps>;
|
|
4
|
+
export declare const Popover: import("react").ForwardRefExoticComponent<import("./types").PopoverBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|