@koobiq/react-components 0.23.0 → 0.25.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/dist/components/ContenPanel/ContentPanel.d.ts +3 -2
- package/dist/components/ContenPanel/ContentPanel.js +9 -9
- package/dist/components/Divider/Divider.d.ts +14 -4
- package/dist/components/Divider/Divider.js +23 -8
- package/dist/components/Divider/types.d.ts +4 -3
- package/dist/components/Navbar/Navbar.d.ts +15 -0
- package/dist/components/Navbar/Navbar.js +80 -0
- package/dist/components/Navbar/Navbar.module.css.js +41 -0
- package/dist/components/Navbar/NavbarContext.d.ts +5 -0
- package/dist/components/Navbar/NavbarContext.js +8 -0
- package/dist/components/Navbar/components/NavbarAppItem.d.ts +7 -0
- package/dist/components/Navbar/components/NavbarAppItem.js +10 -0
- package/dist/components/Navbar/components/NavbarBody.d.ts +6 -0
- package/dist/components/Navbar/components/NavbarBody.js +15 -0
- package/dist/components/Navbar/components/NavbarFooter.d.ts +6 -0
- package/dist/components/Navbar/components/NavbarFooter.js +15 -0
- package/dist/components/Navbar/components/NavbarHeader.d.ts +6 -0
- package/dist/components/Navbar/components/NavbarHeader.js +15 -0
- package/dist/components/Navbar/components/NavbarItem.d.ts +29 -0
- package/dist/components/Navbar/components/NavbarItem.js +65 -0
- package/dist/components/Navbar/components/index.d.ts +5 -0
- package/dist/components/Navbar/index.d.ts +2 -0
- package/dist/components/Navbar/intl.json.js +7 -0
- package/dist/components/Navbar/types.d.ts +26 -0
- package/dist/components/Navbar/types.js +4 -0
- package/dist/components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +4 -0
- package/dist/components/SelectNext/Select.d.ts +13 -0
- package/dist/components/SelectNext/Select.js +258 -0
- package/dist/components/SelectNext/Select.module.css.js +23 -0
- package/dist/components/SelectNext/SelectContext.d.ts +2 -0
- package/dist/components/SelectNext/SelectContext.js +5 -0
- package/dist/components/SelectNext/components/SelectList/SelectList.d.ts +37 -0
- package/dist/components/SelectNext/components/SelectList/SelectList.js +131 -0
- package/dist/components/SelectNext/components/SelectList/SelectList.module.css.js +11 -0
- package/dist/components/SelectNext/components/SelectList/index.d.ts +1 -0
- package/dist/components/SelectNext/components/SelectOption/SelectOption.d.ts +37 -0
- package/dist/components/SelectNext/components/SelectOption/SelectOption.js +48 -0
- package/dist/components/SelectNext/components/SelectOption/index.d.ts +1 -0
- package/dist/components/SelectNext/components/SelectSection/SelectSection.d.ts +9 -0
- package/dist/components/SelectNext/components/SelectSection/SelectSection.js +51 -0
- package/dist/components/SelectNext/components/SelectSection/index.d.ts +1 -0
- package/dist/components/SelectNext/components/Tag/Tag.d.ts +18 -0
- package/dist/components/SelectNext/components/Tag/Tag.js +67 -0
- package/dist/components/SelectNext/components/Tag/index.d.ts +1 -0
- package/dist/components/SelectNext/components/Tag/intl.json.js +7 -0
- package/dist/components/SelectNext/components/Tag/utils.d.ts +3 -0
- package/dist/components/SelectNext/components/Tag/utils.js +9 -0
- package/dist/components/SelectNext/components/TagGroup/TagGroup.d.ts +13 -0
- package/dist/components/SelectNext/components/TagGroup/TagGroup.js +25 -0
- package/dist/components/SelectNext/components/TagGroup/TagGroup.module.css.js +20 -0
- package/dist/components/SelectNext/components/TagGroup/TagGroupMultiline.d.ts +3 -0
- package/dist/components/SelectNext/components/TagGroup/TagGroupMultiline.js +44 -0
- package/dist/components/SelectNext/components/TagGroup/TagGroupResponsive.d.ts +3 -0
- package/dist/components/SelectNext/components/TagGroup/TagGroupResponsive.js +65 -0
- package/dist/components/SelectNext/components/TagGroup/index.d.ts +1 -0
- package/dist/components/SelectNext/components/TagGroup/utils.d.ts +1 -0
- package/dist/components/SelectNext/components/TagGroup/utils.js +4 -0
- package/dist/components/SelectNext/components/index.d.ts +5 -0
- package/dist/components/SelectNext/index.d.ts +2 -0
- package/dist/components/SelectNext/intl.d.ts +2 -0
- package/dist/components/SelectNext/intl.js +21 -0
- package/dist/components/SelectNext/types.d.ts +99 -0
- package/dist/components/SelectNext/types.js +12 -0
- package/dist/components/SelectNext/utils.d.ts +9 -0
- package/dist/components/SelectNext/utils.js +26 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/index.js +13 -1
- package/dist/style.css +328 -43
- package/package.json +5 -5
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { useLocalizedStringFormatter, mergeProps, clsx, isNotNil } from "@koobiq/react-core";
|
|
5
|
+
import { IconXmarkS16 } from "@koobiq/react-icons";
|
|
6
|
+
import { utilClasses } from "../../../../styles/utility.js";
|
|
7
|
+
import s from "../../../TagGroup/components/Tag/Tag.module.css.js";
|
|
8
|
+
import intlMessages from "./intl.json.js";
|
|
9
|
+
import { matchVariantToCloseButton } from "./utils.js";
|
|
10
|
+
import { IconButton } from "../../../IconButton/IconButton.js";
|
|
11
|
+
const textNormalMedium = utilClasses.typography["text-normal-medium"];
|
|
12
|
+
const Tag = forwardRef((props, ref) => {
|
|
13
|
+
const {
|
|
14
|
+
variant = "theme-fade",
|
|
15
|
+
icon,
|
|
16
|
+
className,
|
|
17
|
+
style,
|
|
18
|
+
isDisabled,
|
|
19
|
+
children,
|
|
20
|
+
onRemove,
|
|
21
|
+
...other
|
|
22
|
+
} = props;
|
|
23
|
+
const stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
24
|
+
const rootProps = mergeProps({
|
|
25
|
+
className: clsx(
|
|
26
|
+
s.base,
|
|
27
|
+
s[variant],
|
|
28
|
+
isDisabled && s.disabled,
|
|
29
|
+
textNormalMedium,
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...other,
|
|
33
|
+
style
|
|
34
|
+
});
|
|
35
|
+
const removeButtonProps = {
|
|
36
|
+
isCompact: true,
|
|
37
|
+
isDisabled,
|
|
38
|
+
className: s.cancelIcon,
|
|
39
|
+
variant: matchVariantToCloseButton[variant],
|
|
40
|
+
"aria-label": stringFormatter.format("remove")
|
|
41
|
+
};
|
|
42
|
+
const contentProps = mergeProps({
|
|
43
|
+
className: s.content
|
|
44
|
+
});
|
|
45
|
+
const iconProps = mergeProps({
|
|
46
|
+
className: s.icon
|
|
47
|
+
});
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { ref, ...rootProps, children: [
|
|
49
|
+
isNotNil(icon) && /* @__PURE__ */ jsx("span", { ...iconProps, children: icon }),
|
|
50
|
+
isNotNil(children) && /* @__PURE__ */ jsx("span", { ...contentProps, children }),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
IconButton,
|
|
53
|
+
{
|
|
54
|
+
as: "div",
|
|
55
|
+
size: "l",
|
|
56
|
+
...removeButtonProps,
|
|
57
|
+
tabIndex: void 0,
|
|
58
|
+
onPress: onRemove,
|
|
59
|
+
children: /* @__PURE__ */ jsx(IconXmarkS16, {})
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] });
|
|
63
|
+
});
|
|
64
|
+
Tag.displayName = "SelectTag";
|
|
65
|
+
export {
|
|
66
|
+
Tag
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tag';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SelectState } from '@koobiq/react-primitives';
|
|
2
|
+
import type { SelectionMode } from '@react-types/select';
|
|
3
|
+
import type { SelectNextPropSelectedTagsOverflow } from '../../types';
|
|
4
|
+
export type TagGroupProps<T extends object, M extends SelectionMode = 'single'> = {
|
|
5
|
+
state: SelectState<T, M>;
|
|
6
|
+
states: {
|
|
7
|
+
isInvalid?: boolean;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
isRequired?: boolean;
|
|
10
|
+
};
|
|
11
|
+
selectedTagsOverflow?: SelectNextPropSelectedTagsOverflow;
|
|
12
|
+
};
|
|
13
|
+
export declare function TagGroup<T extends object, M extends SelectionMode = 'single'>({ selectedTagsOverflow, ...rest }: TagGroupProps<T, M>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { logger } from "@koobiq/logger";
|
|
4
|
+
import { TagGroupMultiline } from "./TagGroupMultiline.js";
|
|
5
|
+
import { TagGroupResponsive } from "./TagGroupResponsive.js";
|
|
6
|
+
function assertNever(x) {
|
|
7
|
+
logger.error(`Unhandled selectedTagsOverflow variant: ${x}`);
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
function TagGroup({
|
|
11
|
+
selectedTagsOverflow = "responsive",
|
|
12
|
+
...rest
|
|
13
|
+
}) {
|
|
14
|
+
switch (selectedTagsOverflow) {
|
|
15
|
+
case "responsive":
|
|
16
|
+
return /* @__PURE__ */ jsx(TagGroupResponsive, { ...rest });
|
|
17
|
+
case "multiline":
|
|
18
|
+
return /* @__PURE__ */ jsx(TagGroupMultiline, { ...rest });
|
|
19
|
+
default:
|
|
20
|
+
return assertNever(selectedTagsOverflow);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
TagGroup
|
|
25
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const container = "kbq-taggroup-container-5d455a";
|
|
2
|
+
const hasStartAddon = "kbq-taggroup-hasStartAddon-eb7d88";
|
|
3
|
+
const base = "kbq-taggroup-b97495";
|
|
4
|
+
const tag = "kbq-taggroup-tag-262753";
|
|
5
|
+
const more = "kbq-taggroup-more-db5a34";
|
|
6
|
+
const s = {
|
|
7
|
+
container,
|
|
8
|
+
hasStartAddon,
|
|
9
|
+
base,
|
|
10
|
+
tag,
|
|
11
|
+
more
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
base,
|
|
15
|
+
container,
|
|
16
|
+
s as default,
|
|
17
|
+
hasStartAddon,
|
|
18
|
+
more,
|
|
19
|
+
tag
|
|
20
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SelectionMode } from '@react-types/select';
|
|
2
|
+
import type { TagGroupProps } from './TagGroup';
|
|
3
|
+
export declare function TagGroupMultiline<T extends object, M extends SelectionMode = 'single'>({ state, states }: TagGroupProps<T, M>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLocalizedStringFormatter, clsx } from "@koobiq/react-core";
|
|
3
|
+
import intlMessages from "../../intl.js";
|
|
4
|
+
import s from "./TagGroup.module.css.js";
|
|
5
|
+
import { Tag } from "../Tag/Tag.js";
|
|
6
|
+
import { useFormFieldControlGroup } from "../../../FormField/FormFieldControlGroup/FormFieldControlGroupContext.js";
|
|
7
|
+
function TagGroupMultiline({ state, states }) {
|
|
8
|
+
const { isDisabled, isInvalid } = states;
|
|
9
|
+
const t = useLocalizedStringFormatter(intlMessages);
|
|
10
|
+
const { hasStartAddon } = useFormFieldControlGroup();
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: clsx(s.container, hasStartAddon && s.hasStartAddon),
|
|
15
|
+
"aria-hidden": true,
|
|
16
|
+
children: /* @__PURE__ */ jsx(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: s.base,
|
|
20
|
+
"data-limit-tags": "multiline",
|
|
21
|
+
"aria-label": t.format("selected items"),
|
|
22
|
+
children: state.selectedItems?.map((item) => /* @__PURE__ */ jsx(
|
|
23
|
+
Tag,
|
|
24
|
+
{
|
|
25
|
+
className: s.tag,
|
|
26
|
+
isDisabled,
|
|
27
|
+
variant: isInvalid ? "error-fade" : "contrast-fade",
|
|
28
|
+
onRemove: () => {
|
|
29
|
+
if (state.selectionManager.isSelected(item.key)) {
|
|
30
|
+
state.selectionManager.toggleSelection(item.key);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
children: item.textValue
|
|
34
|
+
},
|
|
35
|
+
item.key
|
|
36
|
+
))
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
TagGroupMultiline
|
|
44
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SelectionMode } from '@react-types/select';
|
|
2
|
+
import type { TagGroupProps } from './TagGroup';
|
|
3
|
+
export declare function TagGroupResponsive<T extends object, M extends SelectionMode = 'single'>({ state, states }: TagGroupProps<T, M>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useHideOverflowItems, useLocalizedStringFormatter, clsx } from "@koobiq/react-core";
|
|
3
|
+
import intlMessages from "../../intl.js";
|
|
4
|
+
import s from "./TagGroup.module.css.js";
|
|
5
|
+
import { getHiddenCount } from "./utils.js";
|
|
6
|
+
import { useFormFieldControlGroup } from "../../../FormField/FormFieldControlGroup/FormFieldControlGroupContext.js";
|
|
7
|
+
import { Tag } from "../Tag/Tag.js";
|
|
8
|
+
function TagGroupResponsive({ state, states }) {
|
|
9
|
+
const { isDisabled, isInvalid } = states;
|
|
10
|
+
const length = state?.selectedItems?.length || 0;
|
|
11
|
+
const { parentRef, visibleMap, itemsRefs } = useHideOverflowItems({
|
|
12
|
+
length: length + 1,
|
|
13
|
+
pinnedIndex: 0
|
|
14
|
+
});
|
|
15
|
+
const hiddenCount = getHiddenCount(visibleMap);
|
|
16
|
+
const t = useLocalizedStringFormatter(intlMessages);
|
|
17
|
+
const { hasStartAddon } = useFormFieldControlGroup();
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: clsx(s.container, hasStartAddon && s.hasStartAddon),
|
|
22
|
+
ref: parentRef,
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: s.base,
|
|
29
|
+
"data-limit-tags": "responsive",
|
|
30
|
+
"aria-label": t.format("selected items"),
|
|
31
|
+
children: state.selectedItems?.map((item, i) => /* @__PURE__ */ jsx(
|
|
32
|
+
Tag,
|
|
33
|
+
{
|
|
34
|
+
className: s.tag,
|
|
35
|
+
ref: itemsRefs[i],
|
|
36
|
+
isDisabled,
|
|
37
|
+
"aria-hidden": !visibleMap[i] || void 0,
|
|
38
|
+
variant: isInvalid ? "error-fade" : "contrast-fade",
|
|
39
|
+
onRemove: () => {
|
|
40
|
+
if (state.selectionManager.isSelected(item.key)) {
|
|
41
|
+
state.selectionManager.toggleSelection(item.key);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
children: item.textValue
|
|
45
|
+
},
|
|
46
|
+
item.key
|
|
47
|
+
))
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: s.more,
|
|
54
|
+
ref: itemsRefs[itemsRefs.length - 1],
|
|
55
|
+
"aria-hidden": !visibleMap[length] || void 0,
|
|
56
|
+
children: t.format("more", { count: hiddenCount })
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
TagGroupResponsive
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TagGroup';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getHiddenCount: (map: boolean[]) => number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const intlMessages = {
|
|
2
|
+
"ru-RU": {
|
|
3
|
+
"empty items": "Нет вариантов выбора",
|
|
4
|
+
"nothing found": "Ничего не найдено",
|
|
5
|
+
loading: "Загрузка…",
|
|
6
|
+
"selected items": "Выбранные элементы",
|
|
7
|
+
search: "Поиск",
|
|
8
|
+
more: ({ count }) => `+${count}`
|
|
9
|
+
},
|
|
10
|
+
"en-US": {
|
|
11
|
+
"empty items": "No options available",
|
|
12
|
+
"nothing found": "Nothing found",
|
|
13
|
+
"selected items": "Selected items",
|
|
14
|
+
loading: "Loading…",
|
|
15
|
+
search: "Search",
|
|
16
|
+
more: ({ count }) => `+${count}`
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
intlMessages as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
|
+
import type { AriaSelectProps, SelectState } from '@koobiq/react-primitives';
|
|
4
|
+
import type { SelectionMode } from '@react-types/select';
|
|
5
|
+
import type { FormFieldLabelProps, FormFieldErrorProps, FormFieldSelectProps, FormFieldCaptionProps, FormFieldPropLabelAlign, FormFieldControlGroupProps, FormFieldPropLabelPlacement } from '../FormField';
|
|
6
|
+
import type { IconButtonProps } from '../IconButton';
|
|
7
|
+
import type { PopoverProps } from '../Popover';
|
|
8
|
+
import type { SearchInputProps } from '../SearchInput';
|
|
9
|
+
import type { SelectListProps } from './components';
|
|
10
|
+
export declare const selectNextPropSelectedTagsOverflow: readonly ["multiline", "responsive"];
|
|
11
|
+
export type SelectNextPropSelectedTagsOverflow = (typeof selectNextPropSelectedTagsOverflow)[number];
|
|
12
|
+
export declare const selectNextPropLabelPlacement: readonly ["top", "side"];
|
|
13
|
+
export type SelectNextPropLabelPlacement = FormFieldPropLabelPlacement;
|
|
14
|
+
export declare const selectNextPropLabelAlign: readonly ["start", "end"];
|
|
15
|
+
export type SelectNextPropLabelAlign = FormFieldPropLabelAlign;
|
|
16
|
+
export type SelectNextProps<T extends object, M extends SelectionMode = 'single'> = ExtendableProps<{
|
|
17
|
+
/**
|
|
18
|
+
* Defines how selected tags are displayed when they exceed the available space.
|
|
19
|
+
*
|
|
20
|
+
*- `"multiline"` — tags wrap to multiple lines.
|
|
21
|
+
*- `"responsive"` — tags collapse into a summary (e.g., "3 more").
|
|
22
|
+
* @default 'responsive'
|
|
23
|
+
*/
|
|
24
|
+
selectedTagsOverflow?: SelectNextPropSelectedTagsOverflow;
|
|
25
|
+
/** Handler that is called when the clear button is clicked. */
|
|
26
|
+
onClear?: () => void;
|
|
27
|
+
/** Sets the CSS [`className`](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. */
|
|
28
|
+
className?: string;
|
|
29
|
+
/** Whether the field can be emptied. */
|
|
30
|
+
isClearable?: boolean;
|
|
31
|
+
/** Addon placed before the children. */
|
|
32
|
+
startAddon?: ReactNode;
|
|
33
|
+
/** Addon placed after the children. */
|
|
34
|
+
endAddon?: ReactNode;
|
|
35
|
+
/** Inline styles. */
|
|
36
|
+
style?: CSSProperties;
|
|
37
|
+
/**
|
|
38
|
+
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
39
|
+
*/
|
|
40
|
+
isLabelHidden?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The label's overall position relative to the element it is labeling.
|
|
43
|
+
* @default 'top'
|
|
44
|
+
*/
|
|
45
|
+
labelPlacement?: SelectNextPropLabelPlacement;
|
|
46
|
+
/**
|
|
47
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
48
|
+
* @default 'start'
|
|
49
|
+
*/
|
|
50
|
+
labelAlign?: SelectNextPropLabelAlign;
|
|
51
|
+
/** The helper text content. */
|
|
52
|
+
caption?: ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* If true, the input will take up the full width of its container.
|
|
55
|
+
*/
|
|
56
|
+
fullWidth?: boolean;
|
|
57
|
+
/** The load more spinner to render when loading additional items. */
|
|
58
|
+
isLoading?: boolean;
|
|
59
|
+
/** Handler that is called when more items should be loaded, e.g. while scrolling near the bottom. */
|
|
60
|
+
onLoadMore?: () => void;
|
|
61
|
+
/** Unique identifier for testing purposes. */
|
|
62
|
+
'data-testid'?: string | number;
|
|
63
|
+
/** Ref to the control */
|
|
64
|
+
ref?: Ref<HTMLDivElement>;
|
|
65
|
+
/** A render function for displaying the selected value. */
|
|
66
|
+
renderValue?: (state: SelectState<T, M>, states: {
|
|
67
|
+
isInvalid?: boolean;
|
|
68
|
+
isDisabled?: boolean;
|
|
69
|
+
isRequired?: boolean;
|
|
70
|
+
}) => ReactNode;
|
|
71
|
+
/** Content to display when no items are available. */
|
|
72
|
+
noItemsText?: ReactNode;
|
|
73
|
+
/** Content to display when items are loading. */
|
|
74
|
+
loadingText?: ReactNode;
|
|
75
|
+
/** Enables search input for filtering items in the list. */
|
|
76
|
+
isSearchable?: boolean;
|
|
77
|
+
/** The value of the Select search input (controlled). */
|
|
78
|
+
inputValue?: string;
|
|
79
|
+
/** The default value of the Select search input (uncontrolled). */
|
|
80
|
+
defaultInputValue?: string;
|
|
81
|
+
/** Handler that is called when the Select search input value changes. */
|
|
82
|
+
onInputChange?: (value: string) => void;
|
|
83
|
+
/** The filter function used to determine if an option should be included in the Select list. */
|
|
84
|
+
defaultFilter?: (textValue: string, inputValue: string) => boolean;
|
|
85
|
+
/** The props used for each slot inside. */
|
|
86
|
+
slotProps?: {
|
|
87
|
+
popover?: PopoverProps;
|
|
88
|
+
label?: FormFieldLabelProps;
|
|
89
|
+
clearButton?: IconButtonProps;
|
|
90
|
+
control?: FormFieldSelectProps;
|
|
91
|
+
caption?: FormFieldCaptionProps;
|
|
92
|
+
group?: FormFieldControlGroupProps;
|
|
93
|
+
errorMessage?: FormFieldErrorProps;
|
|
94
|
+
list?: Omit<SelectListProps<T, M>, 'state'>;
|
|
95
|
+
'search-input'?: SearchInputProps;
|
|
96
|
+
};
|
|
97
|
+
}, Omit<AriaSelectProps<T, M>, 'description' | 'validationState' | 'selectedKey' | 'onSelectionChange' | 'defaultSelectedKey'>>;
|
|
98
|
+
export type SelectNextComponent = <T extends object, M extends SelectionMode = 'single'>(props: SelectNextProps<T, M>) => ReactElement | null;
|
|
99
|
+
export type SelectNextRef = ComponentRef<'div'>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { formFieldPropLabelPlacement, formFieldPropLabelAlign } from "../FormField/types.js";
|
|
2
|
+
const selectNextPropSelectedTagsOverflow = [
|
|
3
|
+
"multiline",
|
|
4
|
+
"responsive"
|
|
5
|
+
];
|
|
6
|
+
const selectNextPropLabelPlacement = formFieldPropLabelPlacement;
|
|
7
|
+
const selectNextPropLabelAlign = formFieldPropLabelAlign;
|
|
8
|
+
export {
|
|
9
|
+
selectNextPropLabelAlign,
|
|
10
|
+
selectNextPropLabelPlacement,
|
|
11
|
+
selectNextPropSelectedTagsOverflow
|
|
12
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Collection, Node } from '@react-types/shared';
|
|
2
|
+
export declare function useCollectionRender<T>(collection: Collection<Node<T>>, parent: Node<T> | null): import("react").ReactNode;
|
|
3
|
+
export declare function CollectionRoot<T>({ collection, }: {
|
|
4
|
+
collection: Collection<Node<T>>;
|
|
5
|
+
}): import("react").ReactNode;
|
|
6
|
+
export declare function CollectionBranch<T>({ collection, parent, }: {
|
|
7
|
+
collection: Collection<Node<T>>;
|
|
8
|
+
parent: Node<T>;
|
|
9
|
+
}): import("react").ReactNode;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useCachedChildren } from "@koobiq/react-primitives";
|
|
2
|
+
function useCollectionRender(collection, parent) {
|
|
3
|
+
return useCachedChildren({
|
|
4
|
+
items: parent ? collection.getChildren(parent.key) : collection,
|
|
5
|
+
dependencies: [],
|
|
6
|
+
children(node) {
|
|
7
|
+
return node.render(node);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function CollectionRoot({
|
|
12
|
+
collection
|
|
13
|
+
}) {
|
|
14
|
+
return useCollectionRender(collection, null);
|
|
15
|
+
}
|
|
16
|
+
function CollectionBranch({
|
|
17
|
+
collection,
|
|
18
|
+
parent
|
|
19
|
+
}) {
|
|
20
|
+
return useCollectionRender(collection, parent);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
CollectionBranch,
|
|
24
|
+
CollectionRoot,
|
|
25
|
+
useCollectionRender
|
|
26
|
+
};
|
|
@@ -27,6 +27,7 @@ export * from './Tooltip';
|
|
|
27
27
|
export * from './List';
|
|
28
28
|
export * from './AnimatedIcon';
|
|
29
29
|
export * from './Select';
|
|
30
|
+
export * from './SelectNext';
|
|
30
31
|
export * from './Divider';
|
|
31
32
|
export * from './Menu';
|
|
32
33
|
export * from './ButtonToggleGroup';
|
|
@@ -44,6 +45,7 @@ export * from './ToastProvider';
|
|
|
44
45
|
export * from './Breadcrumbs';
|
|
45
46
|
export * from './Accordion';
|
|
46
47
|
export * from './ContenPanel';
|
|
48
|
+
export * from './Navbar';
|
|
47
49
|
export * from './layout';
|
|
48
50
|
export { useListData, useAsyncList, type ListData, type ListOptions, type AsyncListData, type AsyncListOptions, type AsyncListLoadFunction, type AsyncListLoadOptions, type TimeValue, type DateValue, } from '@koobiq/react-primitives';
|
|
49
|
-
export { useRouter, useLocale, useFilter, type Locale, type SortDescriptor, type Selection, RouterProvider, useDateFormatter, } from '@koobiq/react-core';
|
|
51
|
+
export { useRouter, useLocale, useFilter, type Locale, type Key, type SortDescriptor, type Selection, RouterProvider, useDateFormatter, } from '@koobiq/react-core';
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,9 @@ import { ListItemText } from "./components/List/components/ListItemText/ListItem
|
|
|
75
75
|
import { AnimatedIcon } from "./components/AnimatedIcon/AnimatedIcon.js";
|
|
76
76
|
import { Select } from "./components/Select/Select.js";
|
|
77
77
|
import { selectPropLabelAlign, selectPropLabelPlacement, selectPropSelectedTagsOverflow } from "./components/Select/types.js";
|
|
78
|
-
import {
|
|
78
|
+
import { SelectNext } from "./components/SelectNext/Select.js";
|
|
79
|
+
import { selectNextPropLabelAlign, selectNextPropLabelPlacement, selectNextPropSelectedTagsOverflow } from "./components/SelectNext/types.js";
|
|
80
|
+
import { Divider, DividerNode } from "./components/Divider/Divider.js";
|
|
79
81
|
import { dividerPropDisplay } from "./components/Divider/types.js";
|
|
80
82
|
import { Menu } from "./components/Menu/Menu.js";
|
|
81
83
|
import { ButtonToggleGroup } from "./components/ButtonToggleGroup/ButtonToggleGroup.js";
|
|
@@ -111,6 +113,8 @@ import { AccordionStateContext } from "./components/Accordion/AccordionStateCont
|
|
|
111
113
|
import { ContentPanel } from "./components/ContenPanel/ContentPanel.js";
|
|
112
114
|
import { ContentPanelContainer } from "./components/ContenPanel/components/ContentPanelContainer/ContentPanelContainer.js";
|
|
113
115
|
import { ContentPanelContainerContext } from "./components/ContenPanel/components/ContentPanelContainer/ContentPanelContainerContext.js";
|
|
116
|
+
import { Navbar, NavbarComponent } from "./components/Navbar/Navbar.js";
|
|
117
|
+
import { navbarPropVariant } from "./components/Navbar/types.js";
|
|
114
118
|
import { flex, flexPropAlignItems, flexPropDirection, flexPropFlex, flexPropGap, flexPropJustifyContent, flexPropOrder, flexPropWrap } from "./components/layout/flex/flex.js";
|
|
115
119
|
import { spacing, spacingGap } from "./components/layout/spacing/spacing.js";
|
|
116
120
|
export {
|
|
@@ -143,6 +147,7 @@ export {
|
|
|
143
147
|
DatePicker,
|
|
144
148
|
DatePickerRender,
|
|
145
149
|
Divider,
|
|
150
|
+
DividerNode,
|
|
146
151
|
FlexBox,
|
|
147
152
|
Form,
|
|
148
153
|
FormContext,
|
|
@@ -173,6 +178,8 @@ export {
|
|
|
173
178
|
ModalContent,
|
|
174
179
|
ModalFooter,
|
|
175
180
|
ModalHeader,
|
|
181
|
+
Navbar,
|
|
182
|
+
NavbarComponent,
|
|
176
183
|
Popover,
|
|
177
184
|
PopoverContent,
|
|
178
185
|
PopoverFooter,
|
|
@@ -187,6 +194,7 @@ export {
|
|
|
187
194
|
RouterProvider,
|
|
188
195
|
SearchInput,
|
|
189
196
|
Select,
|
|
197
|
+
SelectNext,
|
|
190
198
|
SidePanel,
|
|
191
199
|
SidePanelContent,
|
|
192
200
|
SidePanelFooter,
|
|
@@ -253,6 +261,7 @@ export {
|
|
|
253
261
|
inputPropLabelPlacement,
|
|
254
262
|
inputPropVariant,
|
|
255
263
|
modalPropSize,
|
|
264
|
+
navbarPropVariant,
|
|
256
265
|
popoverPropPlacement,
|
|
257
266
|
popoverPropSize,
|
|
258
267
|
popoverPropType,
|
|
@@ -268,6 +277,9 @@ export {
|
|
|
268
277
|
searchInputPropLabelAlign,
|
|
269
278
|
searchInputPropLabelPlacement,
|
|
270
279
|
searchInputPropVariant,
|
|
280
|
+
selectNextPropLabelAlign,
|
|
281
|
+
selectNextPropLabelPlacement,
|
|
282
|
+
selectNextPropSelectedTagsOverflow,
|
|
271
283
|
selectPropLabelAlign,
|
|
272
284
|
selectPropLabelPlacement,
|
|
273
285
|
selectPropSelectedTagsOverflow,
|