@koobiq/react-components 0.0.1-beta.12 → 0.0.1-beta.13
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/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts +4 -5
- package/dist/components/Collections/Item.d.ts +14 -0
- package/dist/components/Collections/Item.js +11 -0
- package/dist/components/{List/ListSection.d.ts → Collections/Section.d.ts} +6 -6
- package/dist/components/Collections/Section.js +11 -0
- package/dist/components/Collections/index.d.ts +2 -0
- package/dist/components/Dialog/DialogContext.js +1 -1
- package/dist/components/Dialog/components/DialogCloseButton.d.ts +14 -1
- package/dist/components/Dialog/components/DialogCloseButton.js +2 -2
- package/dist/components/Grid/Grid.d.ts +8 -2
- package/dist/components/Grid/Grid.js +5 -2
- package/dist/components/IconButton/types.d.ts +5 -4
- package/dist/components/Link/types.d.ts +4 -4
- package/dist/components/List/List.d.ts +11 -2
- package/dist/components/List/List.js +13 -4
- package/dist/components/List/List.module.css.js +0 -3
- package/dist/components/List/components/ListItemText/ListItemText.js +26 -0
- package/dist/components/List/components/ListItemText/ListItemText.module.css.js +11 -0
- package/dist/components/List/components/ListOption/ListOption.d.ts +3 -2
- package/dist/components/List/components/ListOption/ListOption.js +10 -15
- package/dist/components/List/components/ListSection/ListSection.d.ts +3 -2
- package/dist/components/List/components/ListSection/ListSection.js +1 -4
- package/dist/components/List/index.d.ts +3 -3
- package/dist/components/List/types.d.ts +2 -6
- package/dist/components/Modal/Modal.d.ts +9 -1
- package/dist/components/Modal/Modal.js +10 -4
- package/dist/components/Modal/index.d.ts +15 -2
- package/dist/components/Modal/index.js +11 -0
- package/dist/components/Popover/Popover.d.ts +9 -1
- package/dist/components/Popover/Popover.js +10 -4
- package/dist/components/Popover/index.d.ts +15 -2
- package/dist/components/Popover/index.js +11 -0
- package/dist/components/Popover/types.d.ts +4 -2
- package/dist/components/Popover/types.js +9 -1
- package/dist/components/Select/Select.d.ts +11 -2
- package/dist/components/Select/Select.js +9 -2
- package/dist/components/Select/types.d.ts +1 -1
- package/dist/components/SidePanel/SidePanel.d.ts +9 -1
- package/dist/components/SidePanel/SidePanel.js +10 -4
- package/dist/components/SidePanel/index.d.ts +15 -2
- package/dist/components/SidePanel/index.js +11 -0
- package/dist/index.js +22 -21
- package/dist/style.css +146 -134
- package/dist/styles/utility.d.ts +2 -0
- package/dist/styles/utility.js +3 -1
- package/dist/styles/utility.module.css.js +5 -1
- package/dist/types.d.ts +1 -0
- package/package.json +5 -5
- package/dist/components/List/ListItem.d.ts +0 -6
- package/dist/components/List/ListItem.js +0 -11
- package/dist/components/List/ListSection.js +0 -11
- package/dist/components/List/components/ListOption/ListOption.module.css.js +0 -23
|
@@ -34,7 +34,7 @@ export type AlertBaseProps = {
|
|
|
34
34
|
/** Override default icon. */
|
|
35
35
|
icon?: ReactNode;
|
|
36
36
|
/** A callback function called when the user clicks the alert's close button. */
|
|
37
|
-
onClose?: IconButtonProps['
|
|
37
|
+
onClose?: IconButtonProps['onPress'];
|
|
38
38
|
slotProps?: {
|
|
39
39
|
content?: ComponentPropsWithRef<'div'>;
|
|
40
40
|
statusIcon?: ComponentPropsWithRef<'div'>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
|
+
import type { HoverEvent, UseButtonProps } from '@koobiq/react-primitives';
|
|
3
4
|
export declare const buttonPropVariant: readonly ["contrast-filled", "contrast-transparent", "fade-contrast-filled", "fade-contrast-outline", "fade-theme-outline", "theme-transparent"];
|
|
4
5
|
export type ButtonPropVariant = (typeof buttonPropVariant)[number];
|
|
5
|
-
export type
|
|
6
|
-
export type ButtonBaseProps = {
|
|
6
|
+
export type ButtonBaseProps = ExtendableProps<{
|
|
7
7
|
/** The content of the component. */
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
/**
|
|
@@ -43,5 +43,4 @@ export type ButtonBaseProps = {
|
|
|
43
43
|
onHoverStart?: (e: HoverEvent) => void;
|
|
44
44
|
/** Handler that is called when a hover interaction ends. */
|
|
45
45
|
onHoverEnd?: (e: HoverEvent) => void;
|
|
46
|
-
|
|
47
|
-
};
|
|
46
|
+
}, UseButtonProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ItemProps } from '@koobiq/react-primitives';
|
|
3
|
+
export type ListItemProps<T> = ItemProps<T> & {
|
|
4
|
+
/** Additional CSS-classes. */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Inline styles. */
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
/** Unique identifier for testing purposes. */
|
|
9
|
+
'data-testid'?: string | number;
|
|
10
|
+
};
|
|
11
|
+
export declare function Item<T>(props: ListItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare namespace Item {
|
|
13
|
+
var getCollectionNode: unknown;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Item as Item$1 } from "@koobiq/react-primitives";
|
|
4
|
+
const ItemInner = Item$1;
|
|
5
|
+
function Item(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Item, { ...props });
|
|
7
|
+
}
|
|
8
|
+
Item.getCollectionNode = ItemInner.getCollectionNode;
|
|
9
|
+
export {
|
|
10
|
+
Item
|
|
11
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { SectionProps } from '@koobiq/react-primitives';
|
|
3
|
-
export type
|
|
2
|
+
import type { SectionProps as AriaSectionProps } from '@koobiq/react-primitives';
|
|
3
|
+
export type SectionProps<T> = {
|
|
4
4
|
/** Rendered contents of the section, e.g. a header. */
|
|
5
5
|
title?: ReactNode;
|
|
6
6
|
/** An accessibility label for the section. */
|
|
7
7
|
'aria-label'?: string;
|
|
8
8
|
/** Static child items or a function to render children. */
|
|
9
|
-
children:
|
|
9
|
+
children: AriaSectionProps<T>['children'];
|
|
10
10
|
/** Item objects in the section. */
|
|
11
|
-
items?:
|
|
11
|
+
items?: AriaSectionProps<T>['items'];
|
|
12
12
|
};
|
|
13
|
-
export declare function
|
|
14
|
-
export declare namespace
|
|
13
|
+
export declare function Section<T>(props: SectionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare namespace Section {
|
|
15
15
|
var getCollectionNode: unknown;
|
|
16
16
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Section as Section$1 } from "@koobiq/react-primitives";
|
|
4
|
+
const SectionInner = Section$1;
|
|
5
|
+
function Section(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Section, { ...props });
|
|
7
|
+
}
|
|
8
|
+
Section.getCollectionNode = SectionInner.getCollectionNode;
|
|
9
|
+
export {
|
|
10
|
+
Section
|
|
11
|
+
};
|
|
@@ -4,6 +4,19 @@ export type DialogCloseButtonRef = ComponentRef<'button'>;
|
|
|
4
4
|
export type DialogCloseButtonProps = ButtonProps;
|
|
5
5
|
export declare const DialogCloseButton: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
6
6
|
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
7
|
-
}, "as" |
|
|
7
|
+
}, "children" | "progress" | "as" | "className" | "autoFocus" | "id" | "rel" | "aria-controls" | "aria-describedby" | "aria-details" | "aria-expanded" | "aria-haspopup" | "aria-label" | "aria-labelledby" | "aria-pressed" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "target" | "type" | "href" | "disabled" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onPressUp" | "onFocusChange" | "elementType" | "preventFocusOnPress" | "excludeFromTabOrder" | "variant" | "onHoverStart" | "onHoverEnd" | "onlyIcon" | "fullWidth" | "startIcon" | "endIcon" | "data-testid"> & Omit<import("@koobiq/react-primitives").ButtonOptions, "children" | "progress" | "className" | "disabled" | "variant" | "onHoverStart" | "onHoverEnd" | "onlyIcon" | "fullWidth" | "startIcon" | "endIcon" | "data-testid"> & {
|
|
8
|
+
children?: import("react").ReactNode;
|
|
9
|
+
variant?: import("../..").ButtonPropVariant;
|
|
10
|
+
progress?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onlyIcon?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
startIcon?: import("react").ReactNode;
|
|
16
|
+
endIcon?: import("react").ReactNode;
|
|
17
|
+
'data-testid'?: string | number;
|
|
18
|
+
onHoverStart?: (e: import("@react-types/shared").HoverEvent) => void;
|
|
19
|
+
onHoverEnd?: (e: import("@react-types/shared").HoverEvent) => void;
|
|
20
|
+
} & {
|
|
8
21
|
as?: "button" | undefined;
|
|
9
22
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -8,13 +8,13 @@ import s from "../Dialog.module.css.js";
|
|
|
8
8
|
import intlMessages from "../intl.json.js";
|
|
9
9
|
import { useDialogProvider } from "../DialogContext.js";
|
|
10
10
|
import { Button } from "../../Button/Button.js";
|
|
11
|
-
const DialogCloseButton = forwardRef(({
|
|
11
|
+
const DialogCloseButton = forwardRef(({ onPress, ...other }, ref) => {
|
|
12
12
|
const { close } = useDialogProvider();
|
|
13
13
|
const stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
14
14
|
return /* @__PURE__ */ jsx("div", { className: s.closeButton, children: /* @__PURE__ */ jsx(
|
|
15
15
|
Button,
|
|
16
16
|
{
|
|
17
|
-
...mergeProps({
|
|
17
|
+
...mergeProps({ onPress: close }, { onPress }),
|
|
18
18
|
"aria-label": stringFormatter.format("close"),
|
|
19
19
|
startIcon: /* @__PURE__ */ jsx(IconXmark16, {}),
|
|
20
20
|
variant: "contrast-transparent",
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import { GridItem } from './components';
|
|
2
3
|
import type { GridBaseProps } from './types';
|
|
3
|
-
|
|
4
|
-
export type GridProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof
|
|
4
|
+
declare const GridComponent: import("@koobiq/react-core").PolyForwardComponent<"div", GridBaseProps, ElementType>;
|
|
5
|
+
export type GridProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof GridComponent<As>>;
|
|
6
|
+
type CompoundedComponent = typeof GridComponent & {
|
|
7
|
+
Item: typeof GridItem;
|
|
8
|
+
};
|
|
9
|
+
export declare const Grid: CompoundedComponent;
|
|
10
|
+
export {};
|
|
@@ -3,9 +3,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
4
4
|
import s from "./Grid.module.css.js";
|
|
5
5
|
import { normalizeGap } from "./utils.js";
|
|
6
|
+
import { GridItem } from "./components/GridItem/GridItem.js";
|
|
6
7
|
import { useMatchedBreakpoints } from "../Provider/BreakpointsContext.js";
|
|
7
8
|
import { getResponsiveValue } from "../../utils/getResponsiveValue/getResponsiveValue.js";
|
|
8
|
-
const
|
|
9
|
+
const GridComponent = polymorphicForwardRef(
|
|
9
10
|
({
|
|
10
11
|
as: Tag = "div",
|
|
11
12
|
gap: gapProp,
|
|
@@ -46,7 +47,9 @@ const Grid = polymorphicForwardRef(
|
|
|
46
47
|
);
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
|
-
|
|
50
|
+
GridComponent.displayName = "Grid";
|
|
51
|
+
const Grid = GridComponent;
|
|
52
|
+
Grid.Item = GridItem;
|
|
50
53
|
export {
|
|
51
54
|
Grid
|
|
52
55
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
|
+
import type { HoverEvent, UseButtonProps } from '@koobiq/react-primitives';
|
|
3
4
|
export declare const iconButtonPropVariant: readonly ["theme", "theme-contrast", "fade-contrast", "error", "success", "warning"];
|
|
4
5
|
export type IconButtonPropVariant = (typeof iconButtonPropVariant)[number];
|
|
5
6
|
export declare const iconButtonPropSize: readonly ["l", "xl"];
|
|
6
7
|
export type IconButtonPropSize = (typeof iconButtonPropSize)[number];
|
|
7
|
-
export type IconButtonBaseProps = {
|
|
8
|
+
export type IconButtonBaseProps = ExtendableProps<{
|
|
8
9
|
/** The content of the component. */
|
|
9
10
|
children?: ReactNode;
|
|
10
11
|
/**
|
|
@@ -32,5 +33,5 @@ export type IconButtonBaseProps = {
|
|
|
32
33
|
/** Handler that is called when a hover interaction starts. */
|
|
33
34
|
onHoverStart?: (e: HoverEvent) => void;
|
|
34
35
|
/** Handler that is called when a hover interaction ends. */
|
|
35
|
-
|
|
36
|
-
}
|
|
36
|
+
onHoverEnd?: (e: HoverEvent) => void;
|
|
37
|
+
}, UseButtonProps>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
|
+
import type { UseLinkProps } from '@koobiq/react-primitives';
|
|
3
4
|
import type { TypographyPropVariant } from '../Typography';
|
|
4
5
|
export type LinkPropVariant = Extract<TypographyPropVariant, 'text-compact' | 'text-normal' | 'text-big' | 'inherit'>;
|
|
5
|
-
export type LinkBaseProps = {
|
|
6
|
+
export type LinkBaseProps = ExtendableProps<{
|
|
6
7
|
/** The content of the component. */
|
|
7
8
|
children?: ReactNode;
|
|
8
9
|
/** The variant of the component. */
|
|
@@ -21,5 +22,4 @@ export type LinkBaseProps = {
|
|
|
21
22
|
className?: string;
|
|
22
23
|
/** Inline styles */
|
|
23
24
|
style?: CSSProperties;
|
|
24
|
-
|
|
25
|
-
};
|
|
25
|
+
}, UseLinkProps>;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
import { type ListState } from '@koobiq/react-primitives';
|
|
3
|
-
import
|
|
3
|
+
import { Item, Section } from '../Collections';
|
|
4
|
+
import { ListItemText } from './components';
|
|
5
|
+
import type { ListComponentProps, ListBaseProps } from './types';
|
|
4
6
|
export type ListInnerProps<T extends object> = {
|
|
5
7
|
state: ListState<T>;
|
|
6
8
|
listRef?: Ref<HTMLUListElement>;
|
|
7
9
|
} & Omit<ListBaseProps<T>, 'ref'>;
|
|
8
10
|
export declare function ListInner<T extends object>(props: ListInnerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
|
|
11
|
+
declare const ListComponent: ListComponentProps;
|
|
12
|
+
type CompoundedComponent = typeof ListComponent & {
|
|
13
|
+
Item: typeof Item;
|
|
14
|
+
Section: typeof Section;
|
|
15
|
+
ItemText: typeof ListItemText;
|
|
16
|
+
};
|
|
17
|
+
export declare const List: CompoundedComponent;
|
|
18
|
+
export {};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useDOMRef, mergeProps, clsx, isNotNil } from "@koobiq/react-core";
|
|
5
|
-
import {
|
|
5
|
+
import { useListBox, useListState } from "@koobiq/react-primitives";
|
|
6
|
+
import { utilClasses } from "../../styles/utility.js";
|
|
6
7
|
import s from "./List.module.css.js";
|
|
7
8
|
import { ListSection } from "./components/ListSection/ListSection.js";
|
|
9
|
+
import { Item } from "../Collections/Item.js";
|
|
10
|
+
import { Section } from "../Collections/Section.js";
|
|
11
|
+
import { ListItemText } from "./components/ListItemText/ListItemText.js";
|
|
8
12
|
import { Typography } from "../Typography/Typography.js";
|
|
9
13
|
import { ListOption } from "./components/ListOption/ListOption.js";
|
|
14
|
+
const { list } = utilClasses;
|
|
10
15
|
function ListInner(props) {
|
|
11
16
|
const { label, className, style, slotProps, state, listRef } = props;
|
|
12
17
|
const domRef = useDOMRef(listRef);
|
|
@@ -23,7 +28,7 @@ function ListInner(props) {
|
|
|
23
28
|
{
|
|
24
29
|
style,
|
|
25
30
|
ref: domRef,
|
|
26
|
-
className: clsx(
|
|
31
|
+
className: clsx(list, className)
|
|
27
32
|
},
|
|
28
33
|
slotProps?.list,
|
|
29
34
|
listBoxProps
|
|
@@ -39,7 +44,11 @@ function ListRender(props, ref) {
|
|
|
39
44
|
const state = useListState(props);
|
|
40
45
|
return /* @__PURE__ */ jsx(ListInner, { listRef: ref, ...props, state });
|
|
41
46
|
}
|
|
42
|
-
const
|
|
47
|
+
const ListComponent = forwardRef(ListRender);
|
|
48
|
+
const List = ListComponent;
|
|
49
|
+
List.Item = Item;
|
|
50
|
+
List.Section = Section;
|
|
51
|
+
List.ItemText = ListItemText;
|
|
43
52
|
export {
|
|
44
53
|
List,
|
|
45
54
|
ListInner
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { isNotNil, clsx } from "@koobiq/react-core";
|
|
5
|
+
import s from "./ListItemText.module.css.js";
|
|
6
|
+
import { Typography } from "../../../Typography/Typography.js";
|
|
7
|
+
const ListItemText = forwardRef(
|
|
8
|
+
({ className, children, caption, slotProps, ...other }, ref) => /* @__PURE__ */ jsxs("div", { className: clsx(s.base, className), ...other, ref, children: [
|
|
9
|
+
/* @__PURE__ */ jsx(Typography, { as: "span", ...slotProps?.text, children }),
|
|
10
|
+
isNotNil(caption) && /* @__PURE__ */ jsx(
|
|
11
|
+
Typography,
|
|
12
|
+
{
|
|
13
|
+
as: "span",
|
|
14
|
+
color: "contrast-secondary",
|
|
15
|
+
className: s.caption,
|
|
16
|
+
variant: "text-compact",
|
|
17
|
+
...slotProps?.caption,
|
|
18
|
+
children: caption
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
] })
|
|
22
|
+
);
|
|
23
|
+
ListItemText.displayName = "ListItemText";
|
|
24
|
+
export {
|
|
25
|
+
ListItemText
|
|
26
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ListState, Node } from '@koobiq/react-primitives';
|
|
2
|
-
export
|
|
2
|
+
export type ListOptionProps<T> = {
|
|
3
3
|
item: Node<T>;
|
|
4
4
|
state: ListState<T>;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
export declare function ListOption<T>({ item, state }: ListOptionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,12 +4,10 @@ import { useRef } from "react";
|
|
|
4
4
|
import { useHover, usePress, clsx, mergeProps } from "@koobiq/react-core";
|
|
5
5
|
import { useOption } from "@koobiq/react-primitives";
|
|
6
6
|
import { utilClasses } from "../../../../styles/utility.js";
|
|
7
|
-
import s from "./ListOption.module.css.js";
|
|
8
7
|
const textVariant = utilClasses.typography;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) {
|
|
8
|
+
const { listItem } = utilClasses;
|
|
9
|
+
function ListOption({ item, state }) {
|
|
10
|
+
const { href, className, style } = item.props;
|
|
13
11
|
const ref = useRef(null);
|
|
14
12
|
const {
|
|
15
13
|
optionProps,
|
|
@@ -19,21 +17,18 @@ function ListOption({
|
|
|
19
17
|
} = useOption({ key: item.key }, state, ref);
|
|
20
18
|
const { hoverProps, isHovered: hovered } = useHover({ isDisabled: disabled });
|
|
21
19
|
const { isPressed: pressed, pressProps } = usePress({ isDisabled: disabled });
|
|
22
|
-
const Tag =
|
|
20
|
+
const Tag = href ? "a" : "li";
|
|
23
21
|
return /* @__PURE__ */ jsx(
|
|
24
22
|
Tag,
|
|
25
23
|
{
|
|
26
24
|
...mergeProps(optionProps, hoverProps, pressProps),
|
|
27
|
-
className: clsx(
|
|
28
|
-
|
|
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
|
-
),
|
|
25
|
+
className: clsx(listItem, textVariant["text-normal"], className),
|
|
26
|
+
style,
|
|
36
27
|
ref,
|
|
28
|
+
"data-hovered": hovered,
|
|
29
|
+
"data-pressed": pressed,
|
|
30
|
+
"data-disabled": disabled,
|
|
31
|
+
"data-selected": selected,
|
|
37
32
|
"data-focus-visible": focusVisible,
|
|
38
33
|
children: item.rendered
|
|
39
34
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ListState, Node } from '@koobiq/react-primitives';
|
|
2
|
-
export
|
|
2
|
+
export type ListSectionProps<T> = {
|
|
3
3
|
section: Node<T>;
|
|
4
4
|
state: ListState<T>;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
export declare function ListSection<T>({ section, state }: ListSectionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,10 +4,7 @@ import { useListBoxSection } from "@koobiq/react-primitives";
|
|
|
4
4
|
import s from "./ListSection.module.css.js";
|
|
5
5
|
import { ListOption } from "../ListOption/ListOption.js";
|
|
6
6
|
import { Typography } from "../../../Typography/Typography.js";
|
|
7
|
-
function ListSection({
|
|
8
|
-
section,
|
|
9
|
-
state
|
|
10
|
-
}) {
|
|
7
|
+
function ListSection({ section, state }) {
|
|
11
8
|
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
12
9
|
heading: section.rendered,
|
|
13
10
|
"aria-label": section["aria-label"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './List';
|
|
2
|
+
export * from './components/ListItemText';
|
|
2
3
|
export * from './types';
|
|
3
|
-
export
|
|
4
|
-
export * from './ListSection';
|
|
4
|
+
export { Item as ListItem, Section as ListSection } from '../Collections';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
-
import type { AriaListBoxProps
|
|
2
|
+
import type { AriaListBoxProps } from '@koobiq/react-primitives';
|
|
3
3
|
import type { TypographyProps } from '../Typography';
|
|
4
4
|
export declare const listPropSelectionMode: readonly ["none", "single", "multiple"];
|
|
5
5
|
export type ListPropSelectionMode = (typeof listPropSelectionMode)[number];
|
|
@@ -50,8 +50,4 @@ export type ListBaseProps<T extends object> = {
|
|
|
50
50
|
};
|
|
51
51
|
export type ListProps<T extends object> = ListBaseProps<T>;
|
|
52
52
|
export type ListRef = ComponentRef<'ul'>;
|
|
53
|
-
export type
|
|
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;
|
|
53
|
+
export type ListComponentProps = <T extends object>(props: ListProps<T>) => ReactElement | null;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
import { DialogHeader, DialogFooter, DialogContent } from '../Dialog';
|
|
1
2
|
import type { ModalProps } from './types';
|
|
2
|
-
|
|
3
|
+
declare const ModalComponent: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
type CompoundedComponent = typeof ModalComponent & {
|
|
5
|
+
Header: typeof DialogHeader;
|
|
6
|
+
Body: typeof DialogContent;
|
|
7
|
+
Footer: typeof DialogFooter;
|
|
8
|
+
};
|
|
9
|
+
export declare const Modal: CompoundedComponent;
|
|
10
|
+
export {};
|
|
@@ -7,7 +7,10 @@ import { Transition } from "react-transition-group";
|
|
|
7
7
|
import s from "./Modal.module.css.js";
|
|
8
8
|
import { Backdrop } from "../Backdrop/Backdrop.js";
|
|
9
9
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
10
|
-
|
|
10
|
+
import { DialogHeader } from "../Dialog/components/DialoglHeader.js";
|
|
11
|
+
import { DialogContent } from "../Dialog/components/DialogContent.js";
|
|
12
|
+
import { DialogFooter } from "../Dialog/components/DialogFooter.js";
|
|
13
|
+
const ModalComponent = forwardRef((props, ref) => {
|
|
11
14
|
const {
|
|
12
15
|
size = "medium",
|
|
13
16
|
hideCloseButton = false,
|
|
@@ -85,10 +88,9 @@ const Modal = forwardRef((props, ref) => {
|
|
|
85
88
|
},
|
|
86
89
|
slotProps?.modal
|
|
87
90
|
);
|
|
88
|
-
const { isDisabled,
|
|
91
|
+
const { isDisabled, ...otherTriggerProps } = triggerProps;
|
|
89
92
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
90
93
|
control?.({
|
|
91
|
-
onClick: onPress,
|
|
92
94
|
disabled: isDisabled,
|
|
93
95
|
...otherTriggerProps
|
|
94
96
|
}),
|
|
@@ -117,7 +119,11 @@ const Modal = forwardRef((props, ref) => {
|
|
|
117
119
|
)
|
|
118
120
|
] });
|
|
119
121
|
});
|
|
120
|
-
|
|
122
|
+
ModalComponent.displayName = "Modal";
|
|
123
|
+
const Modal = ModalComponent;
|
|
124
|
+
Modal.Header = DialogHeader;
|
|
125
|
+
Modal.Body = DialogContent;
|
|
126
|
+
Modal.Footer = DialogFooter;
|
|
121
127
|
export {
|
|
122
128
|
Modal
|
|
123
129
|
};
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export * from './Modal';
|
|
2
2
|
export * from './types';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
* This component has been deprecated, please use `Modal.Header` instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ModalHeader: import("react").ForwardRefExoticComponent<Omit<import("../Dialog").DialogHeaderProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
* This component has been deprecated, please use `Modal.Body` instead.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ModalContent: import("react").ForwardRefExoticComponent<Omit<import("../Dialog").DialogContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* This component has been deprecated, please use `Modal.Footer` instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ModalFooter: import("react").ForwardRefExoticComponent<Omit<import("../Dialog").DialogFooterProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DialogHeader } from "../Dialog/components/DialoglHeader.js";
|
|
2
|
+
import { DialogContent } from "../Dialog/components/DialogContent.js";
|
|
3
|
+
import { DialogFooter } from "../Dialog/components/DialogFooter.js";
|
|
4
|
+
const ModalHeader = DialogHeader;
|
|
5
|
+
const ModalContent = DialogContent;
|
|
6
|
+
const ModalFooter = DialogFooter;
|
|
7
|
+
export {
|
|
8
|
+
ModalContent,
|
|
9
|
+
ModalFooter,
|
|
10
|
+
ModalHeader
|
|
11
|
+
};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
+
import { DialogContent, DialogFooter, DialogHeader } from '../Dialog';
|
|
2
3
|
import type { PopoverInnerProps } from './types';
|
|
3
4
|
export declare const PopoverInner: FC<PopoverInnerProps>;
|
|
4
|
-
|
|
5
|
+
declare const PopoverComponent: import("react").ForwardRefExoticComponent<import("./types").PopoverBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
type CompoundedComponent = typeof PopoverComponent & {
|
|
7
|
+
Header: typeof DialogHeader;
|
|
8
|
+
Body: typeof DialogContent;
|
|
9
|
+
Footer: typeof DialogFooter;
|
|
10
|
+
};
|
|
11
|
+
export declare const Popover: CompoundedComponent;
|
|
12
|
+
export {};
|
|
@@ -7,6 +7,9 @@ import { Transition } from "react-transition-group";
|
|
|
7
7
|
import s from "./Popover.module.css.js";
|
|
8
8
|
import { normalizeInlineSize } from "./utils.js";
|
|
9
9
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
10
|
+
import { DialogHeader } from "../Dialog/components/DialoglHeader.js";
|
|
11
|
+
import { DialogContent } from "../Dialog/components/DialogContent.js";
|
|
12
|
+
import { DialogFooter } from "../Dialog/components/DialogFooter.js";
|
|
10
13
|
const PopoverInner = (props) => {
|
|
11
14
|
const {
|
|
12
15
|
offset = 0,
|
|
@@ -69,7 +72,7 @@ const PopoverInner = (props) => {
|
|
|
69
72
|
if (isValidElement(children)) return cloneElement(children, overlayProps);
|
|
70
73
|
return children;
|
|
71
74
|
};
|
|
72
|
-
const { isDisabled,
|
|
75
|
+
const { isDisabled, ...otherTriggerProps } = triggerProps;
|
|
73
76
|
const arrowProps = mergeProps(
|
|
74
77
|
{ className: s.arrow },
|
|
75
78
|
arrowPropsCommon,
|
|
@@ -104,7 +107,6 @@ const PopoverInner = (props) => {
|
|
|
104
107
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
105
108
|
control?.({
|
|
106
109
|
ref: controlRef,
|
|
107
|
-
onClick: onPress,
|
|
108
110
|
disabled: isDisabled,
|
|
109
111
|
...otherTriggerProps
|
|
110
112
|
}),
|
|
@@ -140,7 +142,7 @@ const PopoverInner = (props) => {
|
|
|
140
142
|
) })
|
|
141
143
|
] });
|
|
142
144
|
};
|
|
143
|
-
const
|
|
145
|
+
const PopoverComponent = forwardRef(
|
|
144
146
|
(props, ref) => {
|
|
145
147
|
const { open, onOpenChange, defaultOpen, ...other } = props;
|
|
146
148
|
const state = useOverlayTriggerState({
|
|
@@ -152,7 +154,11 @@ const Popover = forwardRef(
|
|
|
152
154
|
return /* @__PURE__ */ jsx(PopoverInner, { popoverRef: ref, ...other, state });
|
|
153
155
|
}
|
|
154
156
|
);
|
|
155
|
-
|
|
157
|
+
PopoverComponent.displayName = "Popover";
|
|
158
|
+
const Popover = PopoverComponent;
|
|
159
|
+
Popover.Header = DialogHeader;
|
|
160
|
+
Popover.Body = DialogContent;
|
|
161
|
+
Popover.Footer = DialogFooter;
|
|
156
162
|
export {
|
|
157
163
|
Popover,
|
|
158
164
|
PopoverInner
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export * from './Popover';
|
|
2
2
|
export * from './types';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
* This component has been deprecated, please use `Popover.Header` instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PopoverHeader: import("react").ForwardRefExoticComponent<Omit<import("../Dialog").DialogHeaderProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
* This component has been deprecated, please use `Popover.Body` instead.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PopoverContent: import("react").ForwardRefExoticComponent<Omit<import("../Dialog").DialogContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* This component has been deprecated, please use `Popover.Footer` instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PopoverFooter: import("react").ForwardRefExoticComponent<Omit<import("../Dialog").DialogFooterProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|