@redis-ui/components 51.7.1 → 51.8.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/README.md +8 -4
- package/dist/Breadcrumbs/Breadcrumbs.style.cjs +8 -0
- package/dist/Breadcrumbs/Breadcrumbs.style.d.ts +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.style.js +8 -0
- package/dist/Breadcrumbs/components/Current/Current.style.cjs +2 -1
- package/dist/Breadcrumbs/components/Current/Current.style.js +2 -1
- package/dist/Breadcrumbs/components/Link/Link.style.cjs +2 -1
- package/dist/Breadcrumbs/components/Link/Link.style.js +2 -1
- package/dist/Breadcrumbs/components/Separator/Separator.style.cjs +2 -1
- package/dist/Breadcrumbs/components/Separator/Separator.style.js +2 -1
- package/dist/MultiSelect/MultiSelect.d.ts +4 -2
- package/dist/MultiSelect/MultiSelect.types.d.ts +1 -1
- package/dist/MultiSelect/components/Content/Content.d.ts +4 -2
- package/dist/Pagination/Pagination.style.d.ts +5 -2
- package/dist/Select/Select.d.ts +5 -2
- package/dist/Select/Select.types.d.ts +1 -1
- package/dist/Select/components/Content/Content.cjs +3 -1
- package/dist/Select/components/Content/Content.d.ts +5 -2
- package/dist/Select/components/Content/Content.js +3 -1
- package/dist/Select/components/Content/components/Compose/Compose.cjs +30 -1
- package/dist/Select/components/Content/components/Compose/Compose.d.ts +1 -1
- package/dist/Select/components/Content/components/Compose/Compose.js +30 -1
- package/dist/Select/components/Content/components/Compose/Compose.style.cjs +12 -2
- package/dist/Select/components/Content/components/Compose/Compose.style.d.ts +2 -0
- package/dist/Select/components/Content/components/Compose/Compose.style.js +12 -2
- package/dist/Select/components/Content/components/Compose/Compose.types.d.ts +3 -0
- package/dist/Select/components/Content/components/Footer/Footer.style.cjs +1 -1
- package/dist/Select/components/Content/components/Footer/Footer.style.js +1 -1
- package/dist/Select/components/Content/components/FooterAction/FooterAction.cjs +13 -0
- package/dist/Select/components/Content/components/FooterAction/FooterAction.d.ts +3 -0
- package/dist/Select/components/Content/components/FooterAction/FooterAction.js +14 -0
- package/dist/Select/components/Content/components/FooterAction/FooterAction.style.cjs +60 -0
- package/dist/Select/components/Content/components/FooterAction/FooterAction.style.d.ts +1 -0
- package/dist/Select/components/Content/components/FooterAction/FooterAction.style.js +58 -0
- package/dist/Select/components/Content/components/FooterAction/FooterAction.types.d.ts +6 -0
- package/dist/Select/components/Content/components/FooterAction/FooterAction.types.js +1 -0
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.cjs +1 -0
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.js +1 -0
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.cjs +17 -1
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.js +17 -1
- package/dist/Select/components/Content/components/Search/SelectSearchInput.cjs +4 -1
- package/dist/Select/components/Content/components/Search/SelectSearchInput.d.ts +3 -1
- package/dist/Select/components/Content/components/Search/SelectSearchInput.js +4 -1
- package/dist/Select/components/Content/components/Search/SelectSearchInput.style.cjs +33 -1
- package/dist/Select/components/Content/components/Search/SelectSearchInput.style.d.ts +3 -1
- package/dist/Select/components/Content/components/Search/SelectSearchInput.style.js +34 -2
- package/dist/Select/components/Content/components/Search/SelectSearchInput.types.d.ts +5 -1
- package/dist/Select/index.d.ts +3 -0
- package/package.json +2 -2
- package/skills/redis-ui-components/references/Breadcrumbs.md +1 -0
- package/skills/redis-ui-components/references/MultiSelect.md +3 -3
- package/skills/redis-ui-components/references/Select.md +36 -2
- package/skills/redis-ui-components/references/Tooltip.md +8 -2
package/README.md
CHANGED
|
@@ -30,15 +30,18 @@ Components read all design tokens (colors, spacing, typography, etc.) from a sty
|
|
|
30
30
|
|
|
31
31
|
You also need to render the `CommonStyles` global style component inside the theme provider. It applies theme-aware base styles to the body, scrollbars, and reduced-motion preferences.
|
|
32
32
|
|
|
33
|
+
Finally, wrap the app in `TooltipProvider`. Every `Tooltip`, including tooltips rendered inside other components, throws at render time without it.
|
|
34
|
+
|
|
33
35
|
```tsx
|
|
34
36
|
import { ThemeProvider } from 'styled-components';
|
|
35
37
|
import { themes, CommonStyles } from '@redis-ui/styles';
|
|
38
|
+
import { TooltipProvider } from '@redis-ui/components';
|
|
36
39
|
|
|
37
40
|
function App() {
|
|
38
41
|
return (
|
|
39
42
|
<ThemeProvider theme={themes.light}>
|
|
40
43
|
<CommonStyles />
|
|
41
|
-
{/* your app */}
|
|
44
|
+
<TooltipProvider>{/* your app */}</TooltipProvider>
|
|
42
45
|
</ThemeProvider>
|
|
43
46
|
);
|
|
44
47
|
}
|
|
@@ -59,6 +62,7 @@ For automatic light/dark mode switching with persistence, use the `SwitchableMod
|
|
|
59
62
|
|
|
60
63
|
```tsx
|
|
61
64
|
import { SwitchableModeThemeProvider, themes, CommonStyles } from '@redis-ui/styles';
|
|
65
|
+
import { TooltipProvider } from '@redis-ui/components';
|
|
62
66
|
|
|
63
67
|
function App() {
|
|
64
68
|
return (
|
|
@@ -68,7 +72,7 @@ function App() {
|
|
|
68
72
|
storageKey="redis-ui-theme-mode"
|
|
69
73
|
>
|
|
70
74
|
<CommonStyles />
|
|
71
|
-
{/* your app */}
|
|
75
|
+
<TooltipProvider>{/* your app */}</TooltipProvider>
|
|
72
76
|
</SwitchableModeThemeProvider>
|
|
73
77
|
);
|
|
74
78
|
}
|
|
@@ -92,8 +96,8 @@ function MyPage() {
|
|
|
92
96
|
|
|
93
97
|
## Documentation
|
|
94
98
|
|
|
95
|
-
- **Storybook**:
|
|
96
|
-
- **Agent skill**: `skills/redis-ui-components` ships in this package, with a reference
|
|
99
|
+
- **Storybook**: live examples, props tables and composition guides for the components: https://redislabsdev.github.io/redis-ui/
|
|
100
|
+
- **Agent skill**: `skills/redis-ui-components` ships in this package, with a reference for nearly every component (`Skeleton` and `TreeView` are still missing). See [Redis UI Skills](https://github.com/redislabsdev/redis-ui#redis-ui-skills) to link it into your project.
|
|
97
101
|
- **Release notes**: [GitHub Releases](https://github.com/redislabsdev/redis-ui/releases)
|
|
98
102
|
|
|
99
103
|
## Contributing
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
2
|
+
//#region src/Breadcrumbs/Breadcrumbs.style.ts
|
|
3
|
+
var getFontSize = () => {
|
|
4
|
+
const { breadcrumbs, typography } = (0, _redislabsdev_redis_ui_styles.useTheme)().components;
|
|
5
|
+
return breadcrumbs.fontSize ?? typography.body.fontSizes.M;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.getFontSize = getFontSize;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getFontSize: () => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useTheme } from "@redis-ui/styles";
|
|
2
|
+
//#region src/Breadcrumbs/Breadcrumbs.style.ts
|
|
3
|
+
var getFontSize = () => {
|
|
4
|
+
const { breadcrumbs, typography } = useTheme().components;
|
|
5
|
+
return breadcrumbs.fontSize ?? typography.body.fontSizes.M;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getFontSize };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_Breadcrumbs_style = require("../../Breadcrumbs.style.cjs");
|
|
2
3
|
let styled_components = require("styled-components");
|
|
3
4
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
4
5
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -12,6 +13,6 @@ var BreadcrumbsCurrent = styled_components.default.span.withConfig({
|
|
|
12
13
|
";font-size:",
|
|
13
14
|
";font-weight:",
|
|
14
15
|
";"
|
|
15
|
-
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.breadcrumbs.current.textColor, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.typography.body.fontFamily,
|
|
16
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.breadcrumbs.current.textColor, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.typography.body.fontFamily, require_Breadcrumbs_style.getFontSize, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.breadcrumbs.current.fontWeight);
|
|
16
17
|
//#endregion
|
|
17
18
|
exports.BreadcrumbsCurrent = BreadcrumbsCurrent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getFontSize } from "../../Breadcrumbs.style.js";
|
|
1
2
|
import _styled from "styled-components";
|
|
2
3
|
import { useTheme } from "@redis-ui/styles";
|
|
3
4
|
//#region src/Breadcrumbs/components/Current/Current.style.ts
|
|
@@ -10,6 +11,6 @@ var BreadcrumbsCurrent = _styled.span.withConfig({
|
|
|
10
11
|
";font-size:",
|
|
11
12
|
";font-weight:",
|
|
12
13
|
";"
|
|
13
|
-
], () => useTheme().components.breadcrumbs.current.textColor, () => useTheme().components.typography.body.fontFamily,
|
|
14
|
+
], () => useTheme().components.breadcrumbs.current.textColor, () => useTheme().components.typography.body.fontFamily, getFontSize, () => useTheme().components.breadcrumbs.current.fontWeight);
|
|
14
15
|
//#endregion
|
|
15
16
|
export { BreadcrumbsCurrent };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_css_utils = require("../../../Helpers/css.utils.cjs");
|
|
3
3
|
const require_Button_style_utils = require("../../../Button/Button.style.utils.cjs");
|
|
4
|
+
const require_Breadcrumbs_style = require("../../Breadcrumbs.style.cjs");
|
|
4
5
|
let styled_components = require("styled-components");
|
|
5
6
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
6
7
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -14,6 +15,6 @@ var BreadcrumbsLink = styled_components.default.a.withConfig({
|
|
|
14
15
|
";font-weight:inherit;cursor:pointer;",
|
|
15
16
|
";&:hover{text-decoration:underline;}&[aria-disabled='true']{cursor:not-allowed;text-decoration:none;}",
|
|
16
17
|
""
|
|
17
|
-
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.typography.body.fontFamily,
|
|
18
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.typography.body.fontFamily, require_Breadcrumbs_style.getFontSize, () => require_Button_style_utils.getButtonStatesStyle((0, _redislabsdev_redis_ui_styles.useTheme)().components.breadcrumbs.link.states, [require_css_utils.tokenMaps.textColor]), (0, _redislabsdev_redis_ui_styles.getFocusStyle)());
|
|
18
19
|
//#endregion
|
|
19
20
|
exports.BreadcrumbsLink = BreadcrumbsLink;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { tokenMaps } from "../../../Helpers/css.utils.js";
|
|
2
2
|
import { getButtonStatesStyle } from "../../../Button/Button.style.utils.js";
|
|
3
|
+
import { getFontSize } from "../../Breadcrumbs.style.js";
|
|
3
4
|
import _styled from "styled-components";
|
|
4
5
|
import { getFocusStyle, useTheme } from "@redis-ui/styles";
|
|
5
6
|
//#region src/Breadcrumbs/components/Link/Link.style.ts
|
|
@@ -12,6 +13,6 @@ var BreadcrumbsLink = _styled.a.withConfig({
|
|
|
12
13
|
";font-weight:inherit;cursor:pointer;",
|
|
13
14
|
";&:hover{text-decoration:underline;}&[aria-disabled='true']{cursor:not-allowed;text-decoration:none;}",
|
|
14
15
|
""
|
|
15
|
-
], () => useTheme().components.typography.body.fontFamily,
|
|
16
|
+
], () => useTheme().components.typography.body.fontFamily, getFontSize, () => getButtonStatesStyle(useTheme().components.breadcrumbs.link.states, [tokenMaps.textColor]), getFocusStyle());
|
|
16
17
|
//#endregion
|
|
17
18
|
export { BreadcrumbsLink };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_Breadcrumbs_style = require("../../Breadcrumbs.style.cjs");
|
|
2
3
|
let styled_components = require("styled-components");
|
|
3
4
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
4
5
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -11,6 +12,6 @@ var BreadcrumbsSeparator = styled_components.default.span.withConfig({
|
|
|
11
12
|
";font-family:",
|
|
12
13
|
";font-size:",
|
|
13
14
|
";user-select:none;"
|
|
14
|
-
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.breadcrumbs.separator.textColor, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.typography.body.fontFamily,
|
|
15
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.breadcrumbs.separator.textColor, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.typography.body.fontFamily, require_Breadcrumbs_style.getFontSize);
|
|
15
16
|
//#endregion
|
|
16
17
|
exports.BreadcrumbsSeparator = BreadcrumbsSeparator;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getFontSize } from "../../Breadcrumbs.style.js";
|
|
1
2
|
import _styled from "styled-components";
|
|
2
3
|
import { useTheme } from "@redis-ui/styles";
|
|
3
4
|
//#region src/Breadcrumbs/components/Separator/Separator.style.ts
|
|
@@ -9,6 +10,6 @@ var BreadcrumbsSeparator = _styled.span.withConfig({
|
|
|
9
10
|
";font-family:",
|
|
10
11
|
";font-size:",
|
|
11
12
|
";user-select:none;"
|
|
12
|
-
], () => useTheme().components.breadcrumbs.separator.textColor, () => useTheme().components.typography.body.fontFamily,
|
|
13
|
+
], () => useTheme().components.breadcrumbs.separator.textColor, () => useTheme().components.typography.body.fontFamily, getFontSize);
|
|
13
14
|
//#endregion
|
|
14
15
|
export { BreadcrumbsSeparator };
|
|
@@ -13,9 +13,11 @@ declare const MultiSelect: (<TValue extends string = string, TOption extends Sel
|
|
|
13
13
|
ErrorIcon: ({ className, style, size, ...restProps }: import("@redis-ui/icons").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "className" | "style">) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
14
|
};
|
|
15
15
|
Content: (<TOption extends SelectOption = SelectOption>({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, allowSelectAll, ...restProps }: import("./components/Content/Content.types").MultiSelectContentProps<TOption> & import("../Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
16
|
-
Compose: ({ children, placement, contentWidth, ...restProps }: import("../Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("../Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Compose: ({ children, placement, contentWidth, variant, onKeyDown, ...restProps }: import("../Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("../Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
OptionList: <TOption extends SelectOption = SelectOption>({ optionComponent, ...restProps }: import("../Select/components/Content/components/OptionList/OptionList.types").OptionListProps<TOption> & import("../Select/components/Content/components/OptionList/OptionList.types").RestOptionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
Search: import("react").ForwardRefExoticComponent<Omit<import("
|
|
18
|
+
Search: import("react").ForwardRefExoticComponent<Omit<import("..").SearchInputProps, "variant"> & {
|
|
19
|
+
variant?: import("..").SelectSearchVariant;
|
|
20
|
+
} & import("..").RestInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
21
|
Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
20
22
|
SelectAll: ({ selectAllTitle, unselectAllTitle, ...restProps }: import("./components/Content/components/SelectAll/SelectAll.types").SelectAllActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
};
|
|
@@ -2,7 +2,7 @@ import { MultiSelectComposeProps } from './components/Compose/Compose.types';
|
|
|
2
2
|
import { SelectContextType, SelectOption } from '../Select';
|
|
3
3
|
import { MultiSelectTriggerProps } from './components/Trigger/Trigger.types';
|
|
4
4
|
import { MultiSelectContentProps } from './components/Content/Content.types';
|
|
5
|
-
export type MultiSelectProps<TValue extends string = string, TOption extends SelectOption<TValue> = SelectOption<TValue>> = Omit<MultiSelectComposeProps<TValue, TOption>, 'allowResetDisabledItems'> & MultiSelectTriggerProps<TOption> & Omit<MultiSelectContentProps<TOption>, 'optionComponent' | 'optionValueRender'> & {
|
|
5
|
+
export type MultiSelectProps<TValue extends string = string, TOption extends SelectOption<TValue> = SelectOption<TValue>> = Omit<MultiSelectComposeProps<TValue, TOption>, 'allowResetDisabledItems'> & MultiSelectTriggerProps<TOption> & Omit<MultiSelectContentProps<TOption>, 'optionComponent' | 'optionValueRender' | 'variant'> & {
|
|
6
6
|
className?: string;
|
|
7
7
|
};
|
|
8
8
|
export interface MultiSelectContextType<TOption extends SelectOption = SelectOption> extends SelectContextType<TOption> {
|
|
@@ -2,9 +2,11 @@ import { MultiSelectContentProps } from './Content.types';
|
|
|
2
2
|
import { RestSelectContentComposeProps } from '../../../Select/components/Content/components/Compose/Compose.types';
|
|
3
3
|
import { SelectOption } from '../../../Select';
|
|
4
4
|
declare const Content: (<TOption extends SelectOption = SelectOption>({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, allowSelectAll, ...restProps }: MultiSelectContentProps<TOption> & RestSelectContentComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
5
|
-
Compose: ({ children, placement, contentWidth, ...restProps }: import("../../../Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & RestSelectContentComposeProps & import("../../..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Compose: ({ children, placement, contentWidth, variant, onKeyDown, ...restProps }: import("../../../Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & RestSelectContentComposeProps & import("../../..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
OptionList: <TOption extends SelectOption = SelectOption>({ optionComponent, ...restProps }: import("../../../Select/components/Content/components/OptionList/OptionList.types").OptionListProps<TOption> & import("../../../Select/components/Content/components/OptionList/OptionList.types").RestOptionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
Search: import("react").ForwardRefExoticComponent<Omit<import("
|
|
7
|
+
Search: import("react").ForwardRefExoticComponent<Omit<import("../../..").SearchInputProps, "variant"> & {
|
|
8
|
+
variant?: import("../../..").SelectSearchVariant;
|
|
9
|
+
} & import("../../..").RestInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
8
10
|
Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
11
|
SelectAll: ({ selectAllTitle, unselectAllTitle, ...restProps }: import("./components/SelectAll/SelectAll.types").SelectAllActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
};
|
|
@@ -13,10 +13,13 @@ export declare const Select: import("styled-components").StyledComponent<(<TValu
|
|
|
13
13
|
ErrorIcon: ({ className, style, size, ...restProps }: import("@redis-ui/icons").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "className" | "style">) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
14
|
};
|
|
15
15
|
Content: (<TOption extends import("..").SelectOption = import("..").SelectOption>({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, ...restProps }: import("../Select/components/Content/Content.types").SelectContentProps<TOption> & import("../Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
16
|
-
Compose: ({ children, placement, contentWidth, ...restProps }: import("../Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("../Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Compose: ({ children, placement, contentWidth, variant, onKeyDown, ...restProps }: import("../Select/components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("../Select/components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
OptionList: <TOption extends import("..").SelectOption = import("..").SelectOption>({ optionValueRender, optionComponent: OptionComponent, maxVisibleItems, virtualized, ...restProps }: import("../Select/components/Content/components/OptionList/OptionList.types").OptionListProps<TOption> & import("../Select/components/Content/components/OptionList/OptionList.types").RestOptionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
Search: import("react").ForwardRefExoticComponent<Omit<import("
|
|
18
|
+
Search: import("react").ForwardRefExoticComponent<Omit<import("..").SearchInputProps, "variant"> & {
|
|
19
|
+
variant?: import("..").SelectSearchVariant;
|
|
20
|
+
} & import("..").RestInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
21
|
Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
|
+
FooterAction: import("react").ForwardRefExoticComponent<import("..").SelectFooterActionProps & import("..").RestSelectFooterActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
20
23
|
};
|
|
21
24
|
Option: (<TOption extends import("..").SelectOption = import("..").SelectOption>({ option, content, ...restProps }: import("..").SelectOptionProps<TOption> & import("..").RestSelectOptionProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
22
25
|
Compose: import("react").ForwardRefExoticComponent<import("../Select/components/Content/components/Option/components/Compose/Compose.types").SelectOptionComposeProps & import("../Select/components/Content/components/Option/components/Compose/Compose.types").RestSelectOptionComposeProps & import("..").ComposeChildrenProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/Select/Select.d.ts
CHANGED
|
@@ -12,10 +12,13 @@ declare const Select: (<TValue extends string = string, TOption extends SelectOp
|
|
|
12
12
|
ErrorIcon: ({ className, style, size, ...restProps }: import("@redis-ui/icons").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "className" | "style">) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
13
|
};
|
|
14
14
|
Content: (<TOption extends SelectOption = SelectOption>({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, ...restProps }: import("./components/Content/Content.types").SelectContentProps<TOption> & import("./components/Content/components/Compose/Compose.types").RestSelectContentComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
15
|
-
Compose: ({ children, placement, contentWidth, ...restProps }: import("./components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("./components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
Compose: ({ children, placement, contentWidth, variant, onKeyDown, ...restProps }: import("./components/Content/components/Compose/Compose.types").SelectContentComposeProps & import("./components/Content/components/Compose/Compose.types").RestSelectContentComposeProps & import("..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
OptionList: <TOption extends SelectOption = SelectOption>({ optionValueRender, optionComponent: OptionComponent, maxVisibleItems, virtualized, ...restProps }: import("./components/Content/components/OptionList/OptionList.types").OptionListProps<TOption> & import("./components/Content/components/OptionList/OptionList.types").RestOptionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
Search: import("react").ForwardRefExoticComponent<Omit<import("
|
|
17
|
+
Search: import("react").ForwardRefExoticComponent<Omit<import("..").SearchInputProps, "variant"> & {
|
|
18
|
+
variant?: import(".").SelectSearchVariant;
|
|
19
|
+
} & import("..").RestInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
18
20
|
Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
|
+
FooterAction: import("react").ForwardRefExoticComponent<import(".").SelectFooterActionProps & import(".").RestSelectFooterActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
19
22
|
};
|
|
20
23
|
Option: (<TOption extends SelectOption = SelectOption>({ option, content, ...restProps }: import(".").SelectOptionProps<TOption> & import(".").RestSelectOptionProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
21
24
|
Compose: import("react").ForwardRefExoticComponent<import("./components/Content/components/Option/components/Compose/Compose.types").SelectOptionComposeProps & import("./components/Content/components/Option/components/Compose/Compose.types").RestSelectOptionComposeProps & import("..").ComposeChildrenProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -16,7 +16,7 @@ export type SelectOption<TValue extends string = string> = Record<string, unknow
|
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
hidden?: boolean;
|
|
18
18
|
};
|
|
19
|
-
export type SelectProps<TValue extends string = string, TOption extends SelectOption<TValue> = SelectOption<TValue>> = SelectComposeProps<TValue, TOption> & SelectTriggerProps<TOption> & Omit<SelectContentProps<TOption>, 'optionComponent' | 'optionValueRender'>;
|
|
19
|
+
export type SelectProps<TValue extends string = string, TOption extends SelectOption<TValue> = SelectOption<TValue>> = SelectComposeProps<TValue, TOption> & SelectTriggerProps<TOption> & Omit<SelectContentProps<TOption>, 'optionComponent' | 'optionValueRender' | 'variant'>;
|
|
20
20
|
export type SelectCompareHandler<TOption extends SelectOption> = (option: TOption, searchValue: string) => boolean;
|
|
21
21
|
export type SelectContextType<TOption extends SelectOption = SelectOption> = Record<string, unknown> & {
|
|
22
22
|
searchValue: string;
|
|
@@ -2,6 +2,7 @@ const require_Compose = require("./components/Compose/Compose.cjs");
|
|
|
2
2
|
const require_OptionList = require("./components/OptionList/OptionList.cjs");
|
|
3
3
|
const require_SelectSearchInput = require("./components/Search/SelectSearchInput.cjs");
|
|
4
4
|
const require_Footer_style = require("./components/Footer/Footer.style.cjs");
|
|
5
|
+
const require_FooterAction = require("./components/FooterAction/FooterAction.cjs");
|
|
5
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
7
|
//#region src/Select/components/Content/Content.tsx
|
|
7
8
|
var Content = Object.assign(({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Content.Compose, {
|
|
@@ -16,7 +17,8 @@ var Content = Object.assign(({ searchable, optionValueRender, optionComponent, m
|
|
|
16
17
|
Compose: require_Compose.default,
|
|
17
18
|
OptionList: require_OptionList.default,
|
|
18
19
|
Search: require_SelectSearchInput.default,
|
|
19
|
-
Footer: require_Footer_style.ContentFooter
|
|
20
|
+
Footer: require_Footer_style.ContentFooter,
|
|
21
|
+
FooterAction: require_FooterAction.default
|
|
20
22
|
});
|
|
21
23
|
//#endregion
|
|
22
24
|
exports.default = Content;
|
|
@@ -2,9 +2,12 @@ import { SelectContentProps } from './Content.types';
|
|
|
2
2
|
import { RestSelectContentComposeProps } from './components/Compose/Compose.types';
|
|
3
3
|
import { SelectOption } from '../../Select.types';
|
|
4
4
|
declare const Content: (<TOption extends SelectOption = SelectOption>({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, ...restProps }: SelectContentProps<TOption> & RestSelectContentComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
5
|
-
Compose: ({ children, placement, contentWidth, ...restProps }: import("./components/Compose/Compose.types").SelectContentComposeProps & RestSelectContentComposeProps & import("../../..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Compose: ({ children, placement, contentWidth, variant, onKeyDown, ...restProps }: import("./components/Compose/Compose.types").SelectContentComposeProps & RestSelectContentComposeProps & import("../../..").ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
OptionList: <TOption extends SelectOption = SelectOption>({ optionValueRender, optionComponent: OptionComponent, maxVisibleItems, virtualized, ...restProps }: import("./components/OptionList/OptionList.types").OptionListProps<TOption> & import("./components/OptionList/OptionList.types").RestOptionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
Search: import("react").ForwardRefExoticComponent<Omit<import("
|
|
7
|
+
Search: import("react").ForwardRefExoticComponent<Omit<import("../../..").SearchInputProps, "variant"> & {
|
|
8
|
+
variant?: import("../..").SelectSearchVariant;
|
|
9
|
+
} & import("../../..").RestInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
8
10
|
Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
FooterAction: import("react").ForwardRefExoticComponent<import("../..").SelectFooterActionProps & import("../..").RestSelectFooterActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
12
|
};
|
|
10
13
|
export default Content;
|
|
@@ -2,6 +2,7 @@ import Compose from "./components/Compose/Compose.js";
|
|
|
2
2
|
import OptionList from "./components/OptionList/OptionList.js";
|
|
3
3
|
import SelectSearchInput from "./components/Search/SelectSearchInput.js";
|
|
4
4
|
import { ContentFooter } from "./components/Footer/Footer.style.js";
|
|
5
|
+
import FooterAction from "./components/FooterAction/FooterAction.js";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
//#region src/Select/components/Content/Content.tsx
|
|
7
8
|
var Content = Object.assign(({ searchable, optionValueRender, optionComponent, maxVisibleItems, virtualized, ...restProps }) => /* @__PURE__ */ jsxs(Content.Compose, {
|
|
@@ -16,7 +17,8 @@ var Content = Object.assign(({ searchable, optionValueRender, optionComponent, m
|
|
|
16
17
|
Compose,
|
|
17
18
|
OptionList,
|
|
18
19
|
Search: SelectSearchInput,
|
|
19
|
-
Footer: ContentFooter
|
|
20
|
+
Footer: ContentFooter,
|
|
21
|
+
FooterAction
|
|
20
22
|
});
|
|
21
23
|
//#endregion
|
|
22
24
|
export { Content as default };
|
|
@@ -4,11 +4,38 @@ const require_Compose_style = require("./Compose.style.cjs");
|
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
//#region src/Select/components/Content/components/Compose/Compose.tsx
|
|
7
|
-
var Compose = ({ children, placement = "bottom", contentWidth, ...restProps }) => {
|
|
7
|
+
var Compose = ({ children, placement = "bottom", contentWidth, variant, onKeyDown, ...restProps }) => {
|
|
8
8
|
const ref = (0, react.useRef)(null);
|
|
9
9
|
const { options } = require_Context.useSelectContext();
|
|
10
10
|
const hasOptions = options.length > 0;
|
|
11
|
+
const getFooterActionTarget = (key) => {
|
|
12
|
+
const container = ref.current;
|
|
13
|
+
const actions = Array.from(container?.querySelectorAll("[data-role=\"footer-action\"]:not(:disabled)") ?? []);
|
|
14
|
+
if (!container || !actions.length) return null;
|
|
15
|
+
const optionElements = container.querySelectorAll("[role=\"option\"]:not([data-hidden]):not([data-disabled])");
|
|
16
|
+
const lastOption = optionElements[optionElements.length - 1];
|
|
17
|
+
const active = document.activeElement;
|
|
18
|
+
const actionIndex = actions.indexOf(active);
|
|
19
|
+
if (actionIndex < 0) return key === "ArrowDown" && (!lastOption || active === lastOption) ? actions[0] : null;
|
|
20
|
+
if (key === "ArrowDown") return actions[actionIndex + 1] ?? actions[actionIndex];
|
|
21
|
+
return actions[actionIndex - 1] ?? lastOption ?? container.querySelector("input[data-role=\"search\"]");
|
|
22
|
+
};
|
|
11
23
|
const handleKeyDown = (e) => {
|
|
24
|
+
onKeyDown?.(e);
|
|
25
|
+
if (e.defaultPrevented) return;
|
|
26
|
+
const target = e.target;
|
|
27
|
+
const footerActionTarget = (e.key === "ArrowDown" || e.key === "ArrowUp") && getFooterActionTarget(e.key);
|
|
28
|
+
if (footerActionTarget) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
footerActionTarget.focus();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (target.dataset.role === "footer-action" && (e.key === " " || e.key === "Enter")) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
if (!e.repeat) target.click();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (onKeyDown) return;
|
|
12
39
|
const isModifierKey = e.ctrlKey || e.altKey || e.metaKey;
|
|
13
40
|
if (e.key.length === 1 && !isModifierKey) {
|
|
14
41
|
const searchInput = ref.current?.querySelector("input[data-role=\"search\"]");
|
|
@@ -25,6 +52,8 @@ var Compose = ({ children, placement = "bottom", contentWidth, ...restProps }) =
|
|
|
25
52
|
onKeyDown: handleKeyDown,
|
|
26
53
|
...restProps,
|
|
27
54
|
asChild: false,
|
|
55
|
+
"data-content-variant": variant,
|
|
56
|
+
$variant: variant,
|
|
28
57
|
$contentWidth: contentWidth,
|
|
29
58
|
$hasOptions: hasOptions,
|
|
30
59
|
children
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RestSelectContentComposeProps, SelectContentComposeProps } from './Compose.types';
|
|
2
2
|
import { ComposeChildrenProps } from '../../../../../Helpers/common.types';
|
|
3
|
-
declare const Compose: ({ children, placement, contentWidth, ...restProps }: SelectContentComposeProps & RestSelectContentComposeProps & ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const Compose: ({ children, placement, contentWidth, variant, onKeyDown, ...restProps }: SelectContentComposeProps & RestSelectContentComposeProps & ComposeChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default Compose;
|
|
@@ -4,11 +4,38 @@ import { Container } from "./Compose.style.js";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useRef } from "react";
|
|
6
6
|
//#region src/Select/components/Content/components/Compose/Compose.tsx
|
|
7
|
-
var Compose = ({ children, placement = "bottom", contentWidth, ...restProps }) => {
|
|
7
|
+
var Compose = ({ children, placement = "bottom", contentWidth, variant, onKeyDown, ...restProps }) => {
|
|
8
8
|
const ref = useRef(null);
|
|
9
9
|
const { options } = useSelectContext();
|
|
10
10
|
const hasOptions = options.length > 0;
|
|
11
|
+
const getFooterActionTarget = (key) => {
|
|
12
|
+
const container = ref.current;
|
|
13
|
+
const actions = Array.from(container?.querySelectorAll("[data-role=\"footer-action\"]:not(:disabled)") ?? []);
|
|
14
|
+
if (!container || !actions.length) return null;
|
|
15
|
+
const optionElements = container.querySelectorAll("[role=\"option\"]:not([data-hidden]):not([data-disabled])");
|
|
16
|
+
const lastOption = optionElements[optionElements.length - 1];
|
|
17
|
+
const active = document.activeElement;
|
|
18
|
+
const actionIndex = actions.indexOf(active);
|
|
19
|
+
if (actionIndex < 0) return key === "ArrowDown" && (!lastOption || active === lastOption) ? actions[0] : null;
|
|
20
|
+
if (key === "ArrowDown") return actions[actionIndex + 1] ?? actions[actionIndex];
|
|
21
|
+
return actions[actionIndex - 1] ?? lastOption ?? container.querySelector("input[data-role=\"search\"]");
|
|
22
|
+
};
|
|
11
23
|
const handleKeyDown = (e) => {
|
|
24
|
+
onKeyDown?.(e);
|
|
25
|
+
if (e.defaultPrevented) return;
|
|
26
|
+
const target = e.target;
|
|
27
|
+
const footerActionTarget = (e.key === "ArrowDown" || e.key === "ArrowUp") && getFooterActionTarget(e.key);
|
|
28
|
+
if (footerActionTarget) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
footerActionTarget.focus();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (target.dataset.role === "footer-action" && (e.key === " " || e.key === "Enter")) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
if (!e.repeat) target.click();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (onKeyDown) return;
|
|
12
39
|
const isModifierKey = e.ctrlKey || e.altKey || e.metaKey;
|
|
13
40
|
if (e.key.length === 1 && !isModifierKey) {
|
|
14
41
|
const searchInput = ref.current?.querySelector("input[data-role=\"search\"]");
|
|
@@ -25,6 +52,8 @@ var Compose = ({ children, placement = "bottom", contentWidth, ...restProps }) =
|
|
|
25
52
|
onKeyDown: handleKeyDown,
|
|
26
53
|
...restProps,
|
|
27
54
|
asChild: false,
|
|
55
|
+
"data-content-variant": variant,
|
|
56
|
+
$variant: variant,
|
|
28
57
|
$contentWidth: contentWidth,
|
|
29
58
|
$hasOptions: hasOptions,
|
|
30
59
|
children
|
|
@@ -7,12 +7,13 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
|
7
7
|
var Container = (0, styled_components.default)(require_index.Content2).withConfig({
|
|
8
8
|
displayName: "Composestyle__Container",
|
|
9
9
|
componentId: "RedisUI__sc-oidrmy-0"
|
|
10
|
-
})(["display:flex;flex-direction:column;", ";[data-radix-select-viewport]{@media (pointer:fine){scrollbar-width:inherit;::-webkit-scrollbar{display:initial;}}}"], ({ collisionPadding = 10, $contentWidth, $hasOptions }) => {
|
|
10
|
+
})(["display:flex;flex-direction:column;", ";[data-radix-select-viewport]{@media (pointer:fine){scrollbar-width:inherit;::-webkit-scrollbar{display:initial;}}}"], ({ collisionPadding = 10, $contentWidth, $hasOptions, $variant }) => {
|
|
11
11
|
const theme = (0, _redislabsdev_redis_ui_styles.useTheme)();
|
|
12
12
|
const style = theme.components.select.dropdown;
|
|
13
13
|
const sidePads = `${collisionPadding}px * 2`;
|
|
14
|
+
const compact = $variant === "compact" ? style.compact : void 0;
|
|
14
15
|
return styled_components.css`
|
|
15
|
-
padding: ${$hasOptions ? style.padding : "0"};
|
|
16
|
+
padding: ${$hasOptions && !compact ? style.padding : "0"};
|
|
16
17
|
background-color: ${style.bgColor};
|
|
17
18
|
box-shadow: ${style.shadow};
|
|
18
19
|
border-radius: ${style.borderRadius};
|
|
@@ -37,6 +38,15 @@ var Container = (0, styled_components.default)(require_index.Content2).withConfi
|
|
|
37
38
|
max-height: min(100vh, var(--radix-select-content-available-height));
|
|
38
39
|
margin-inline: ${style.triggerOffset};
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
${compact && styled_components.css`
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
border: 1px solid ${compact.borderColor};
|
|
45
|
+
|
|
46
|
+
[data-radix-select-viewport] {
|
|
47
|
+
padding: ${compact.listPadding};
|
|
48
|
+
}
|
|
49
|
+
`}
|
|
40
50
|
`;
|
|
41
51
|
});
|
|
42
52
|
//#endregion
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as RadixSelect from '@radix-ui/react-select';
|
|
2
|
+
import { SelectContentVariant } from './Compose.types';
|
|
2
3
|
type ContainerProps = {
|
|
3
4
|
$contentWidth?: string;
|
|
4
5
|
$hasOptions?: boolean;
|
|
6
|
+
$variant?: SelectContentVariant;
|
|
5
7
|
};
|
|
6
8
|
export declare const Container: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<RadixSelect.SelectContentProps & import("react").RefAttributes<HTMLDivElement>>, any, ContainerProps, never>;
|
|
7
9
|
export {};
|
|
@@ -5,12 +5,13 @@ import { useTheme } from "@redis-ui/styles";
|
|
|
5
5
|
var Container = _styled(Content2).withConfig({
|
|
6
6
|
displayName: "Composestyle__Container",
|
|
7
7
|
componentId: "RedisUI__sc-oidrmy-0"
|
|
8
|
-
})(["display:flex;flex-direction:column;", ";[data-radix-select-viewport]{@media (pointer:fine){scrollbar-width:inherit;::-webkit-scrollbar{display:initial;}}}"], ({ collisionPadding = 10, $contentWidth, $hasOptions }) => {
|
|
8
|
+
})(["display:flex;flex-direction:column;", ";[data-radix-select-viewport]{@media (pointer:fine){scrollbar-width:inherit;::-webkit-scrollbar{display:initial;}}}"], ({ collisionPadding = 10, $contentWidth, $hasOptions, $variant }) => {
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
const style = theme.components.select.dropdown;
|
|
11
11
|
const sidePads = `${collisionPadding}px * 2`;
|
|
12
|
+
const compact = $variant === "compact" ? style.compact : void 0;
|
|
12
13
|
return css`
|
|
13
|
-
padding: ${$hasOptions ? style.padding : "0"};
|
|
14
|
+
padding: ${$hasOptions && !compact ? style.padding : "0"};
|
|
14
15
|
background-color: ${style.bgColor};
|
|
15
16
|
box-shadow: ${style.shadow};
|
|
16
17
|
border-radius: ${style.borderRadius};
|
|
@@ -35,6 +36,15 @@ var Container = _styled(Content2).withConfig({
|
|
|
35
36
|
max-height: min(100vh, var(--radix-select-content-available-height));
|
|
36
37
|
margin-inline: ${style.triggerOffset};
|
|
37
38
|
}
|
|
39
|
+
|
|
40
|
+
${compact && css`
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
border: 1px solid ${compact.borderColor};
|
|
43
|
+
|
|
44
|
+
[data-radix-select-viewport] {
|
|
45
|
+
padding: ${compact.listPadding};
|
|
46
|
+
}
|
|
47
|
+
`}
|
|
38
48
|
`;
|
|
39
49
|
});
|
|
40
50
|
//#endregion
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as RadixSelect from '@radix-ui/react-select';
|
|
2
2
|
type SelectContentPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export type SelectContentVariant = 'default' | 'compact';
|
|
3
4
|
export type SelectContentComposeProps = {
|
|
4
5
|
placement?: SelectContentPlacement;
|
|
5
6
|
contentWidth?: string;
|
|
7
|
+
/** `compact` draws a bordered menu with smaller, inset option rows. */
|
|
8
|
+
variant?: SelectContentVariant;
|
|
6
9
|
};
|
|
7
10
|
export type RestSelectContentComposeProps = Omit<RadixSelect.SelectContentProps, 'position' | 'side' | 'children' | 'asChild'>;
|
|
8
11
|
export {};
|
|
@@ -11,7 +11,7 @@ var ContentFooter = styled_components.default.div.withConfig({
|
|
|
11
11
|
";padding-inline:",
|
|
12
12
|
";border-top:",
|
|
13
13
|
" solid ",
|
|
14
|
-
";"
|
|
14
|
+
";&:has(> [data-role='footer-action']){align-items:stretch;padding:0;}"
|
|
15
15
|
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.select.dropdown.footer.blockPadding, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.select.dropdown.footer.inlinePadding, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.select.dropdown.footer.separator.size, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.select.dropdown.footer.separator.color);
|
|
16
16
|
//#endregion
|
|
17
17
|
exports.ContentFooter = ContentFooter;
|
|
@@ -9,7 +9,7 @@ var ContentFooter = _styled.div.withConfig({
|
|
|
9
9
|
";padding-inline:",
|
|
10
10
|
";border-top:",
|
|
11
11
|
" solid ",
|
|
12
|
-
";"
|
|
12
|
+
";&:has(> [data-role='footer-action']){align-items:stretch;padding:0;}"
|
|
13
13
|
], () => useTheme().components.select.dropdown.footer.blockPadding, () => useTheme().components.select.dropdown.footer.inlinePadding, () => useTheme().components.select.dropdown.footer.separator.size, () => useTheme().components.select.dropdown.footer.separator.color);
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ContentFooter };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_FooterAction_style = require("./FooterAction.style.cjs");
|
|
2
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
+
//#region src/Select/components/Content/components/FooterAction/FooterAction.tsx
|
|
4
|
+
var FooterAction = (0, require("react").forwardRef)(({ icon: Icon, children, ...restProps }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_FooterAction_style.FooterAction, {
|
|
5
|
+
ref,
|
|
6
|
+
type: "button",
|
|
7
|
+
"data-role": "footer-action",
|
|
8
|
+
...restProps,
|
|
9
|
+
children: [Icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { "aria-hidden": true }), children]
|
|
10
|
+
}));
|
|
11
|
+
FooterAction.displayName = "Select.Content.FooterAction";
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.default = FooterAction;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RestSelectFooterActionProps, SelectFooterActionProps } from './FooterAction.types';
|
|
2
|
+
declare const FooterAction: import("react").ForwardRefExoticComponent<SelectFooterActionProps & RestSelectFooterActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
3
|
+
export default FooterAction;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FooterAction as FooterAction$1 } from "./FooterAction.style.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
//#region src/Select/components/Content/components/FooterAction/FooterAction.tsx
|
|
5
|
+
var FooterAction = forwardRef(({ icon: Icon, children, ...restProps }, ref) => /* @__PURE__ */ jsxs(FooterAction$1, {
|
|
6
|
+
ref,
|
|
7
|
+
type: "button",
|
|
8
|
+
"data-role": "footer-action",
|
|
9
|
+
...restProps,
|
|
10
|
+
children: [Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }), children]
|
|
11
|
+
}));
|
|
12
|
+
FooterAction.displayName = "Select.Content.FooterAction";
|
|
13
|
+
//#endregion
|
|
14
|
+
export { FooterAction as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let styled_components = require("styled-components");
|
|
3
|
+
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
4
|
+
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
5
|
+
//#region src/Select/components/Content/components/FooterAction/FooterAction.style.ts
|
|
6
|
+
var FooterAction = styled_components.default.button.withConfig({
|
|
7
|
+
displayName: "FooterActionstyle__FooterAction",
|
|
8
|
+
componentId: "RedisUI__sc-1ua72bq-0"
|
|
9
|
+
})([
|
|
10
|
+
"",
|
|
11
|
+
" ",
|
|
12
|
+
""
|
|
13
|
+
], () => {
|
|
14
|
+
const theme = (0, _redislabsdev_redis_ui_styles.useTheme)();
|
|
15
|
+
const { footer, option } = theme.components.select.dropdown;
|
|
16
|
+
const { action, separator } = footer;
|
|
17
|
+
if (!action) return null;
|
|
18
|
+
return styled_components.css`
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: ${action.gap};
|
|
22
|
+
width: 100%;
|
|
23
|
+
padding: ${action.padding};
|
|
24
|
+
border: 0;
|
|
25
|
+
background-color: transparent;
|
|
26
|
+
color: ${action.textColor};
|
|
27
|
+
font-family: ${theme.components.typography.body.fontFamily};
|
|
28
|
+
font-size: ${action.fontSize};
|
|
29
|
+
text-align: start;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
|
|
32
|
+
svg {
|
|
33
|
+
flex: none;
|
|
34
|
+
width: ${action.iconSize};
|
|
35
|
+
height: ${action.iconSize};
|
|
36
|
+
color: ${action.iconColor};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:hover,
|
|
40
|
+
&:focus-visible {
|
|
41
|
+
background-color: ${action.hoverBgColor};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:disabled {
|
|
45
|
+
&,
|
|
46
|
+
svg {
|
|
47
|
+
color: ${option.states.disabled.textColor};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
background-color: transparent;
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
& + & {
|
|
55
|
+
border-top: ${separator.size} solid ${separator.color};
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
}, (0, _redislabsdev_redis_ui_styles.getFocusStyle)("-2px"));
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.FooterAction = FooterAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FooterAction: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _styled, { css } from "styled-components";
|
|
2
|
+
import { getFocusStyle, useTheme } from "@redis-ui/styles";
|
|
3
|
+
//#region src/Select/components/Content/components/FooterAction/FooterAction.style.ts
|
|
4
|
+
var FooterAction = _styled.button.withConfig({
|
|
5
|
+
displayName: "FooterActionstyle__FooterAction",
|
|
6
|
+
componentId: "RedisUI__sc-1ua72bq-0"
|
|
7
|
+
})([
|
|
8
|
+
"",
|
|
9
|
+
" ",
|
|
10
|
+
""
|
|
11
|
+
], () => {
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const { footer, option } = theme.components.select.dropdown;
|
|
14
|
+
const { action, separator } = footer;
|
|
15
|
+
if (!action) return null;
|
|
16
|
+
return css`
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: ${action.gap};
|
|
20
|
+
width: 100%;
|
|
21
|
+
padding: ${action.padding};
|
|
22
|
+
border: 0;
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
color: ${action.textColor};
|
|
25
|
+
font-family: ${theme.components.typography.body.fontFamily};
|
|
26
|
+
font-size: ${action.fontSize};
|
|
27
|
+
text-align: start;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
|
|
30
|
+
svg {
|
|
31
|
+
flex: none;
|
|
32
|
+
width: ${action.iconSize};
|
|
33
|
+
height: ${action.iconSize};
|
|
34
|
+
color: ${action.iconColor};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:hover,
|
|
38
|
+
&:focus-visible {
|
|
39
|
+
background-color: ${action.hoverBgColor};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:disabled {
|
|
43
|
+
&,
|
|
44
|
+
svg {
|
|
45
|
+
color: ${option.states.disabled.textColor};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
background-color: transparent;
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
& + & {
|
|
53
|
+
border-top: ${separator.size} solid ${separator.color};
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
}, getFocusStyle("-2px"));
|
|
57
|
+
//#endregion
|
|
58
|
+
export { FooterAction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../../../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_css_utils = require("../../../../../../../Helpers/css.utils.cjs");
|
|
3
3
|
const require_index = require("../../../../../../../node_modules/@radix-ui/react-select/dist/index.cjs");
|
|
4
|
+
const require_OptionSelectionIndicator_style = require("../OptionSelectionIndicator/OptionSelectionIndicator.style.cjs");
|
|
4
5
|
let styled_components = require("styled-components");
|
|
5
6
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
6
7
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -11,7 +12,7 @@ var SelectOptionContainer = (0, styled_components.default)(require_index.Item).w
|
|
|
11
12
|
displayName: "Composestyle__SelectOptionContainer",
|
|
12
13
|
componentId: "RedisUI__sc-evvx4-0"
|
|
13
14
|
})(["display:flex;align-items:center;justify-content:start;cursor:pointer;", ""], ({ $hidden }) => {
|
|
14
|
-
const theme = (0, _redislabsdev_redis_ui_styles.useTheme)().components.select.dropdown
|
|
15
|
+
const { option: theme, compact } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.select.dropdown;
|
|
15
16
|
return $hidden ? styled_components.css`
|
|
16
17
|
display: none;
|
|
17
18
|
` : styled_components.css`
|
|
@@ -20,6 +21,21 @@ var SelectOptionContainer = (0, styled_components.default)(require_index.Item).w
|
|
|
20
21
|
padding: ${theme.padding};
|
|
21
22
|
gap: ${theme.gap};
|
|
22
23
|
|
|
24
|
+
${compact && styled_components.css`
|
|
25
|
+
[data-content-variant='compact'] & {
|
|
26
|
+
height: ${compact.option.height};
|
|
27
|
+
font-size: ${compact.option.fontSize};
|
|
28
|
+
padding: ${compact.option.padding};
|
|
29
|
+
gap: ${compact.option.gap};
|
|
30
|
+
border-radius: ${compact.option.borderRadius};
|
|
31
|
+
|
|
32
|
+
${require_OptionSelectionIndicator_style.OptionSelectionIndicator} svg {
|
|
33
|
+
width: ${compact.option.indicatorSize};
|
|
34
|
+
height: ${compact.option.indicatorSize};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`}
|
|
38
|
+
|
|
23
39
|
& {
|
|
24
40
|
${require_css_utils.styleFromTokens({
|
|
25
41
|
tokenMaps: maps,
|
package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { styleFromTokens, tokenMaps } from "../../../../../../../Helpers/css.utils.js";
|
|
2
2
|
import { Item } from "../../../../../../../node_modules/@radix-ui/react-select/dist/index.js";
|
|
3
|
+
import { OptionSelectionIndicator } from "../OptionSelectionIndicator/OptionSelectionIndicator.style.js";
|
|
3
4
|
import _styled, { css } from "styled-components";
|
|
4
5
|
import { useTheme } from "@redis-ui/styles";
|
|
5
6
|
//#region src/Select/components/Content/components/Option/components/Compose/Compose.style.ts
|
|
@@ -9,7 +10,7 @@ var SelectOptionContainer = _styled(Item).withConfig({
|
|
|
9
10
|
displayName: "Composestyle__SelectOptionContainer",
|
|
10
11
|
componentId: "RedisUI__sc-evvx4-0"
|
|
11
12
|
})(["display:flex;align-items:center;justify-content:start;cursor:pointer;", ""], ({ $hidden }) => {
|
|
12
|
-
const theme = useTheme().components.select.dropdown
|
|
13
|
+
const { option: theme, compact } = useTheme().components.select.dropdown;
|
|
13
14
|
return $hidden ? css`
|
|
14
15
|
display: none;
|
|
15
16
|
` : css`
|
|
@@ -18,6 +19,21 @@ var SelectOptionContainer = _styled(Item).withConfig({
|
|
|
18
19
|
padding: ${theme.padding};
|
|
19
20
|
gap: ${theme.gap};
|
|
20
21
|
|
|
22
|
+
${compact && css`
|
|
23
|
+
[data-content-variant='compact'] & {
|
|
24
|
+
height: ${compact.option.height};
|
|
25
|
+
font-size: ${compact.option.fontSize};
|
|
26
|
+
padding: ${compact.option.padding};
|
|
27
|
+
gap: ${compact.option.gap};
|
|
28
|
+
border-radius: ${compact.option.borderRadius};
|
|
29
|
+
|
|
30
|
+
${OptionSelectionIndicator} svg {
|
|
31
|
+
width: ${compact.option.indicatorSize};
|
|
32
|
+
height: ${compact.option.indicatorSize};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`}
|
|
36
|
+
|
|
21
37
|
& {
|
|
22
38
|
${styleFromTokens({
|
|
23
39
|
tokenMaps: maps,
|
|
@@ -6,10 +6,13 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_runtime.__toESM(react, 1);
|
|
8
8
|
//#region src/Select/components/Content/components/Search/SelectSearchInput.tsx
|
|
9
|
-
var SelectSearchInput = react.default.forwardRef(({ onChange, ...restProps }, ref) => {
|
|
9
|
+
var SelectSearchInput = react.default.forwardRef(({ onChange, variant, ...restProps }, ref) => {
|
|
10
10
|
const context = require_Context.useSelectContext();
|
|
11
|
+
const isInline = variant === "inline";
|
|
11
12
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormField.default.Nested, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SelectSearchInput_style.SelectSearchInput, {
|
|
12
13
|
ref,
|
|
14
|
+
variant: isInline ? void 0 : variant,
|
|
15
|
+
$inline: isInline,
|
|
13
16
|
"data-role": "search",
|
|
14
17
|
onChange: (newSearchValue) => {
|
|
15
18
|
context.setSearchValue(newSearchValue);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const SelectSearchInput: React.ForwardRefExoticComponent<Omit<import("
|
|
2
|
+
declare const SelectSearchInput: React.ForwardRefExoticComponent<Omit<import("../../../../..").SearchInputProps, "variant"> & {
|
|
3
|
+
variant?: import("./SelectSearchInput.types").SelectSearchVariant;
|
|
4
|
+
} & import("../../../../..").RestInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
3
5
|
export default SelectSearchInput;
|
|
@@ -4,10 +4,13 @@ import { SelectSearchInput as SelectSearchInput$1 } from "./SelectSearchInput.st
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import React from "react";
|
|
6
6
|
//#region src/Select/components/Content/components/Search/SelectSearchInput.tsx
|
|
7
|
-
var SelectSearchInput = React.forwardRef(({ onChange, ...restProps }, ref) => {
|
|
7
|
+
var SelectSearchInput = React.forwardRef(({ onChange, variant, ...restProps }, ref) => {
|
|
8
8
|
const context = useSelectContext();
|
|
9
|
+
const isInline = variant === "inline";
|
|
9
10
|
return /* @__PURE__ */ jsx(FormField.Nested, { children: /* @__PURE__ */ jsx(SelectSearchInput$1, {
|
|
10
11
|
ref,
|
|
12
|
+
variant: isInline ? void 0 : variant,
|
|
13
|
+
$inline: isInline,
|
|
11
14
|
"data-role": "search",
|
|
12
15
|
onChange: (newSearchValue) => {
|
|
13
16
|
context.setSearchValue(newSearchValue);
|
|
@@ -7,6 +7,38 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
|
7
7
|
var SelectSearchInput = (0, styled_components.default)(require_SearchInput.default).withConfig({
|
|
8
8
|
displayName: "SelectSearchInputstyle__SelectSearchInput",
|
|
9
9
|
componentId: "RedisUI__sc-aw21tv-0"
|
|
10
|
-
})([
|
|
10
|
+
})([
|
|
11
|
+
"margin:",
|
|
12
|
+
";flex-shrink:0;",
|
|
13
|
+
""
|
|
14
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.select.dropdown.search.margin, ({ $inline }) => {
|
|
15
|
+
const theme = (0, _redislabsdev_redis_ui_styles.useTheme)();
|
|
16
|
+
const { search, footer } = theme.components.select.dropdown;
|
|
17
|
+
if (!$inline || !search.inline) return null;
|
|
18
|
+
return styled_components.css`
|
|
19
|
+
/* Outranks the input's state and variant rules, which stack up to three classes. */
|
|
20
|
+
&&&& {
|
|
21
|
+
height: auto;
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: ${search.inline.padding};
|
|
24
|
+
gap: ${search.inline.gap};
|
|
25
|
+
font-size: ${search.inline.fontSize};
|
|
26
|
+
background-color: transparent;
|
|
27
|
+
border: 0;
|
|
28
|
+
border-bottom: ${footer.separator.size} solid ${footer.separator.color};
|
|
29
|
+
border-radius: 0;
|
|
30
|
+
box-shadow: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&&&&:focus-within {
|
|
34
|
+
border-bottom-color: ${theme.components.input.states.focused.borderColor};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
> svg {
|
|
38
|
+
width: ${search.inline.iconSize};
|
|
39
|
+
height: ${search.inline.iconSize};
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
});
|
|
11
43
|
//#endregion
|
|
12
44
|
exports.SelectSearchInput = SelectSearchInput;
|
|
@@ -5,4 +5,6 @@ export declare const SelectSearchInput: import("styled-components").StyledCompon
|
|
|
5
5
|
StatusIndicator: ({ className, style, size, ...restProps }: import("@redis-ui/icons").MonochromeIconProps & Pick<import("react").HTMLAttributes<unknown>, "className" | "style">) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
LoadingIndicator: ({ loading, ...restProps }: import("../../../../../Inputs/components/LoadingIndicator/LoadingIndicator.types").LoadingIndicatorProps & import("../../../../../Inputs/components/LoadingIndicator/LoadingIndicator.types").RestLoadingIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
7
|
SearchIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
}, any, {
|
|
8
|
+
}, any, {
|
|
9
|
+
$inline?: boolean;
|
|
10
|
+
}, never>;
|
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
import SearchInput from "../../../../../Inputs/SearchInput/SearchInput.js";
|
|
2
|
-
import _styled from "styled-components";
|
|
2
|
+
import _styled, { css } from "styled-components";
|
|
3
3
|
import { useTheme } from "@redis-ui/styles";
|
|
4
4
|
//#region src/Select/components/Content/components/Search/SelectSearchInput.style.ts
|
|
5
5
|
var SelectSearchInput = _styled(SearchInput).withConfig({
|
|
6
6
|
displayName: "SelectSearchInputstyle__SelectSearchInput",
|
|
7
7
|
componentId: "RedisUI__sc-aw21tv-0"
|
|
8
|
-
})([
|
|
8
|
+
})([
|
|
9
|
+
"margin:",
|
|
10
|
+
";flex-shrink:0;",
|
|
11
|
+
""
|
|
12
|
+
], () => useTheme().components.select.dropdown.search.margin, ({ $inline }) => {
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const { search, footer } = theme.components.select.dropdown;
|
|
15
|
+
if (!$inline || !search.inline) return null;
|
|
16
|
+
return css`
|
|
17
|
+
/* Outranks the input's state and variant rules, which stack up to three classes. */
|
|
18
|
+
&&&& {
|
|
19
|
+
height: auto;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: ${search.inline.padding};
|
|
22
|
+
gap: ${search.inline.gap};
|
|
23
|
+
font-size: ${search.inline.fontSize};
|
|
24
|
+
background-color: transparent;
|
|
25
|
+
border: 0;
|
|
26
|
+
border-bottom: ${footer.separator.size} solid ${footer.separator.color};
|
|
27
|
+
border-radius: 0;
|
|
28
|
+
box-shadow: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&&&&:focus-within {
|
|
32
|
+
border-bottom-color: ${theme.components.input.states.focused.borderColor};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
> svg {
|
|
36
|
+
width: ${search.inline.iconSize};
|
|
37
|
+
height: ${search.inline.iconSize};
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
});
|
|
9
41
|
//#endregion
|
|
10
42
|
export { SelectSearchInput };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { RestSearchInputProps, SearchInputProps } from '../../../../../Inputs';
|
|
2
|
-
export type
|
|
2
|
+
export type SelectSearchVariant = NonNullable<SearchInputProps['variant']> | 'inline';
|
|
3
|
+
export type SelectSearchInputProps = Omit<SearchInputProps, 'variant'> & {
|
|
4
|
+
/** `inline` blends the search into the menu, with a divider below it. */
|
|
5
|
+
variant?: SelectSearchVariant;
|
|
6
|
+
};
|
|
3
7
|
export type RestSelectSearchInputProps = RestSearchInputProps;
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -2,3 +2,6 @@ export { default as Select } from './Select';
|
|
|
2
2
|
export { useSelectContext } from './components/Context/Context';
|
|
3
3
|
export * from './Select.types';
|
|
4
4
|
export * from './components/Content/components/Option/Option.types';
|
|
5
|
+
export type { SelectContentVariant } from './components/Content/components/Compose/Compose.types';
|
|
6
|
+
export type { SelectSearchVariant } from './components/Content/components/Search/SelectSearchInput.types';
|
|
7
|
+
export type { SelectFooterActionProps, RestSelectFooterActionProps } from './components/Content/components/FooterAction/FooterAction.types';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redis-ui/components",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "51.
|
|
4
|
+
"version": "51.8.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"repository": "git@github.com:redislabsdev/redis-ui.git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@redis-ui/icons": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
33
|
-
"@redis-ui/styles": "^21.
|
|
33
|
+
"@redis-ui/styles": "^21.14.0",
|
|
34
34
|
"react": "^18.0.0 || ^19.0.0",
|
|
35
35
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
36
36
|
"styled-components": "^5.0.0"
|
|
@@ -212,3 +212,4 @@ function CompositionWithSelectExample() {
|
|
|
212
212
|
- Basic breadcrumbs use a default `/` separator, but the separator can be customized with any React node.
|
|
213
213
|
- The composition pattern is the right choice when you need full control over rendering, including nested components such as `Select`.
|
|
214
214
|
- `BreadcrumbItem` entries are `{ label, href?, onClick? }` objects; the root component renders the last entry as `Breadcrumbs.Current`.
|
|
215
|
+
- Crumb text size comes from the optional `breadcrumbs.fontSize` theme token, which the Next themes set to 13px. Themes that leave it unset fall back to the body `M` size (14px).
|
|
@@ -59,9 +59,9 @@ The component also extends Radix UI `SelectTriggerProps` through `RestSelectTrig
|
|
|
59
59
|
- `MultiSelect.Trigger.LoadingIndicator` - Shows the loading indicator.
|
|
60
60
|
- `MultiSelect.Trigger.Arrow` - Dropdown arrow indicator.
|
|
61
61
|
- `MultiSelect.Trigger.ErrorIcon` - Deprecated alias for `MultiSelect.Trigger.StatusIndicator`.
|
|
62
|
-
- `MultiSelect.Content` - Default dropdown content with optional search, option list, custom `optionValueRender` / `optionComponent`, and select-all footer.
|
|
63
|
-
- `MultiSelect.Content.Compose` - Composable content wrapper for custom dropdown layouts and static elements.
|
|
64
|
-
- `MultiSelect.Content.Search` - Search input for filtering options.
|
|
62
|
+
- `MultiSelect.Content` - Default dropdown content with optional search, option list, custom `optionValueRender` / `optionComponent`, and select-all footer. Accepts `variant` (`'default' | 'compact'`); `compact` draws a bordered menu with smaller, inset option rows.
|
|
63
|
+
- `MultiSelect.Content.Compose` - Composable content wrapper for custom dropdown layouts and static elements. Accepts the same `variant` as `MultiSelect.Content`.
|
|
64
|
+
- `MultiSelect.Content.Search` - Search input for filtering options. Accepts `variant` (`'outline' | 'underline' | 'inline'`); `inline` blends the search into the menu with a divider below it.
|
|
65
65
|
- `MultiSelect.Content.OptionList` - Renders the list of options.
|
|
66
66
|
- `MultiSelect.Content.Footer` - Footer container used for select-all and custom footer content.
|
|
67
67
|
- `MultiSelect.Content.SelectAll` - Toggle button that selects or unselects all options. Accepts `selectAllTitle` and `unselectAllTitle`.
|
|
@@ -54,10 +54,11 @@ The component also extends Radix UI `SelectTriggerProps` (excluding `children`,
|
|
|
54
54
|
- **`Select.Trigger.StatusIndicator`** - Shows valid/error status indicator.
|
|
55
55
|
- **`Select.Trigger.LoadingIndicator`** - Shows loading spinner. Accepts `loading` prop.
|
|
56
56
|
- **`Select.Content`** - Default dropdown content with options list and optional search.
|
|
57
|
-
- **`Select.Content.Compose`** - Composable content wrapper for custom content layouts.
|
|
58
|
-
- **`Select.Content.Search`** - Search input for filtering options.
|
|
57
|
+
- **`Select.Content.Compose`** - Composable content wrapper for custom content layouts. Accepts `variant` (`'default' | 'compact'`); `compact` draws a bordered menu with smaller, inset option rows.
|
|
58
|
+
- **`Select.Content.Search`** - Search input for filtering options. Accepts `variant` (`'outline' | 'underline' | 'inline'`); `inline` blends the search into the menu with a divider below it.
|
|
59
59
|
- **`Select.Content.OptionList`** - Renders the list of options. Accepts `style` for custom sizing.
|
|
60
60
|
- **`Select.Content.Footer`** - Footer area inside the dropdown content.
|
|
61
|
+
- **`Select.Content.FooterAction`** - Full-width action row for the footer, with an optional `icon`. Consecutive actions are separated by a divider, and a footer holding actions drops its own padding. ArrowDown from the last option moves focus onto the actions, and ArrowUp moves back.
|
|
61
62
|
- **`Select.Option`** - Default option component.
|
|
62
63
|
- **`Select.Option.Compose`** - Composable option wrapper (must be root element in custom option components).
|
|
63
64
|
- **`Select.Option.Indicator`** - Selection check indicator. Accepts children to customize the icon.
|
|
@@ -73,6 +74,7 @@ The component also extends Radix UI `SelectTriggerProps` (excluding `children`,
|
|
|
73
74
|
| virtualized | `boolean` | - | Enables virtualized rendering |
|
|
74
75
|
| placement | `'top' \| 'bottom' \| 'left' \| 'right'` | - | Dropdown placement |
|
|
75
76
|
| contentWidth | `string` | - | Custom dropdown width |
|
|
77
|
+
| variant | `'default' \| 'compact'` | - | Dropdown style; `compact` is bordered with smaller, inset option rows. Unset keeps the default menu |
|
|
76
78
|
|
|
77
79
|
### Select.Trigger Props
|
|
78
80
|
| Prop | Type | Default | Description |
|
|
@@ -89,6 +91,14 @@ The component also extends Radix UI `SelectTriggerProps` (excluding `children`,
|
|
|
89
91
|
| customContainer | `boolean` | - | When true, allows using a custom container element instead of the default combobox button |
|
|
90
92
|
| id | `string` | - | Custom id |
|
|
91
93
|
|
|
94
|
+
### Select.Content.FooterAction Props
|
|
95
|
+
| Prop | Type | Default | Description |
|
|
96
|
+
|------|------|---------|-------------|
|
|
97
|
+
| icon | `IconType` | - | Icon rendered before the label |
|
|
98
|
+
| children | `ReactNode` | - | Action label |
|
|
99
|
+
| disabled | `boolean` | - | Disables the action and skips it in keyboard navigation |
|
|
100
|
+
| button props | `ButtonHTMLAttributes<HTMLButtonElement>` | - | Other native button props, such as `onClick` |
|
|
101
|
+
|
|
92
102
|
## Examples
|
|
93
103
|
|
|
94
104
|
### Playground
|
|
@@ -515,3 +525,27 @@ import { Select } from '@redis-ui/components';
|
|
|
515
525
|
- Custom option components must use `Select.Option.Compose` as the root element.
|
|
516
526
|
- Custom trigger containers may have name conflicts with attributes added by `Select.Trigger`; wrap in a `span` or `div` to avoid this.
|
|
517
527
|
- `useSelectContext` hook is exported and can be used inside custom option components to access select state.
|
|
528
|
+
|
|
529
|
+
### CompactMenu
|
|
530
|
+
> `variant="compact"` draws a bordered menu with smaller, inset option rows.
|
|
531
|
+
> Pair it with the `inline` search and `Select.Content.FooterAction` rows.
|
|
532
|
+
```tsx
|
|
533
|
+
import { Select } from '@redis-ui/components';
|
|
534
|
+
import { FolderIcon, PlusIcon } from '@redis-ui/icons';
|
|
535
|
+
|
|
536
|
+
<Select.Compose options={options} onChange={(value) => console.log(value)}>
|
|
537
|
+
<Select.Trigger />
|
|
538
|
+
<Select.Content.Compose variant="compact" contentWidth="30rem">
|
|
539
|
+
<Select.Content.Search variant="inline" placeholder="Find option…" />
|
|
540
|
+
<Select.Content.OptionList style={{ maxHeight: 200 }} />
|
|
541
|
+
<Select.Content.Footer>
|
|
542
|
+
<Select.Content.FooterAction icon={PlusIcon} onClick={() => {}}>
|
|
543
|
+
New option
|
|
544
|
+
</Select.Content.FooterAction>
|
|
545
|
+
<Select.Content.FooterAction icon={FolderIcon} onClick={() => {}}>
|
|
546
|
+
View all options
|
|
547
|
+
</Select.Content.FooterAction>
|
|
548
|
+
</Select.Content.Footer>
|
|
549
|
+
</Select.Content.Compose>
|
|
550
|
+
</Select.Compose>
|
|
551
|
+
```
|
|
@@ -8,7 +8,13 @@ Popup component triggered by pointer hover, with customizable content, controlle
|
|
|
8
8
|
import { Tooltip, TooltipProvider } from '@redis-ui/components';
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
>
|
|
11
|
+
> **`TooltipProvider` is required.** Every `Tooltip` (including tooltips rendered inside other components) must have a `TooltipProvider` ancestor, or it throws at render time. Mount one once near the app root, inside the theme provider. It also sets the shared hover delay (`openDelayDuration`, default `0`). The examples below assume it is already mounted.
|
|
12
|
+
>
|
|
13
|
+
> ```tsx
|
|
14
|
+
> <TooltipProvider>
|
|
15
|
+
> <App />
|
|
16
|
+
> </TooltipProvider>
|
|
17
|
+
> ```
|
|
12
18
|
|
|
13
19
|
> Examples that use `InfoIcon` also import it from `@redis-ui/icons`.
|
|
14
20
|
|
|
@@ -626,7 +632,7 @@ function Render() {
|
|
|
626
632
|
|
|
627
633
|
## Notes
|
|
628
634
|
|
|
629
|
-
- `TooltipProvider` defaults `openDelayDuration` to `0`.
|
|
635
|
+
- `TooltipProvider` is required: without an ancestor provider, `Tooltip` throws (it is built on Radix Tooltip). It defaults `openDelayDuration` to `0`.
|
|
630
636
|
- `Tooltip.Content` hides itself when `content` is falsy.
|
|
631
637
|
- `Tooltip.Trigger` can wrap plain text, SVG, or multi-element triggers by setting `withButton`.
|
|
632
638
|
- `Tooltip.Compose` supports controlled and uncontrolled open state.
|