@dxos/react-ui-searchlist 0.8.4-main.b97322e → 0.8.4-main.dedc0f3
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/lib/browser/index.mjs +15 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +15 -11
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/SearchList.d.ts.map +1 -1
- package/dist/types/src/components/SearchList.stories.d.ts +10 -8
- package/dist/types/src/components/SearchList.stories.d.ts.map +1 -1
- package/dist/types/src/composites/PopoverCombobox.d.ts +3 -3
- package/dist/types/src/composites/PopoverCombobox.d.ts.map +1 -1
- package/dist/types/src/composites/PopoverCombobox.stories.d.ts +6 -21
- package/dist/types/src/composites/PopoverCombobox.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -8
- package/src/components/SearchList.stories.tsx +16 -6
- package/src/components/SearchList.tsx +5 -2
- package/src/composites/PopoverCombobox.stories.tsx +9 -4
- package/src/composites/PopoverCombobox.tsx +15 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-searchlist",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.dedc0f3",
|
|
4
4
|
"description": "A themed ⌘K-style combobox component, triggered by a button (or keyboard shortcut), where values are queried only within the invoked modal.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
@@ -34,17 +35,17 @@
|
|
|
34
35
|
"@types/react-dom": "~18.2.0",
|
|
35
36
|
"react": "~18.2.0",
|
|
36
37
|
"react-dom": "~18.2.0",
|
|
37
|
-
"vite": "
|
|
38
|
-
"@dxos/random": "0.8.4-main.
|
|
39
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
40
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
41
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
38
|
+
"vite": "7.1.1",
|
|
39
|
+
"@dxos/random": "0.8.4-main.dedc0f3",
|
|
40
|
+
"@dxos/react-ui": "0.8.4-main.dedc0f3",
|
|
41
|
+
"@dxos/storybook-utils": "0.8.4-main.dedc0f3",
|
|
42
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
45
|
"react": "~18.2.0",
|
|
45
46
|
"react-dom": "~18.2.0",
|
|
46
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
47
|
-
"@dxos/react-ui
|
|
47
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
|
|
48
|
+
"@dxos/react-ui": "0.8.4-main.dedc0f3"
|
|
48
49
|
},
|
|
49
50
|
"publishConfig": {
|
|
50
51
|
"access": "public"
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
+
import React from 'react';
|
|
8
9
|
|
|
9
10
|
import { faker } from '@dxos/random';
|
|
10
11
|
import { withTheme } from '@dxos/storybook-utils';
|
|
@@ -21,7 +22,11 @@ const defaultItems: StoryItems = faker.helpers
|
|
|
21
22
|
return acc;
|
|
22
23
|
}, {});
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
type StoryProps = {
|
|
26
|
+
items: StoryItems;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const DefaultStory = ({ items = defaultItems }: StoryProps) => {
|
|
25
30
|
return (
|
|
26
31
|
<SearchList.Root filter={(value, search) => (items[value].includes(search) ? 1 : 0)}>
|
|
27
32
|
<SearchList.Input placeholder='Search...' />
|
|
@@ -36,12 +41,17 @@ const SearchListStory: FC<{ items: StoryItems }> = ({ items = defaultItems }) =>
|
|
|
36
41
|
);
|
|
37
42
|
};
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
const meta = {
|
|
40
45
|
title: 'ui/react-ui-searchlist/SearchList',
|
|
41
|
-
component:
|
|
46
|
+
component: SearchList.Root as any,
|
|
47
|
+
render: DefaultStory,
|
|
42
48
|
decorators: [withTheme],
|
|
43
|
-
}
|
|
49
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<typeof meta>;
|
|
44
54
|
|
|
45
|
-
export const Default = {
|
|
55
|
+
export const Default: Story = {
|
|
46
56
|
args: {},
|
|
47
57
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
6
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
7
7
|
import { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from 'cmdk';
|
|
8
|
-
import React, { type ComponentPropsWithRef,
|
|
8
|
+
import React, { type ComponentPropsWithRef, type PropsWithChildren, forwardRef, useCallback } from 'react';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
Button,
|
|
@@ -136,7 +136,10 @@ const SearchListItem = forwardRef<HTMLDivElement, SearchListItemProps>(
|
|
|
136
136
|
<CommandItem
|
|
137
137
|
{...props}
|
|
138
138
|
onSelect={handleSelect}
|
|
139
|
-
className={mx(
|
|
139
|
+
className={mx(
|
|
140
|
+
'p-1 pis-2 pie-2 rounded-sm select-none cursor-pointer data-[selected]:bg-hoverOverlay',
|
|
141
|
+
classNames,
|
|
142
|
+
)}
|
|
140
143
|
ref={forwardedRef}
|
|
141
144
|
>
|
|
142
145
|
{children}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
10
|
import { faker } from '@dxos/random';
|
|
@@ -32,13 +33,17 @@ const DefaultStory = () => {
|
|
|
32
33
|
);
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
const meta = {
|
|
36
37
|
title: 'ui/react-ui-searchlist/PopoverCombobox',
|
|
37
|
-
component: PopoverCombobox,
|
|
38
|
+
component: PopoverCombobox.Root as any,
|
|
38
39
|
render: DefaultStory,
|
|
39
40
|
decorators: [withTheme],
|
|
40
|
-
}
|
|
41
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
41
46
|
|
|
42
|
-
export const Default = {
|
|
47
|
+
export const Default: Story = {
|
|
43
48
|
args: {},
|
|
44
49
|
};
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
Popover,
|
|
10
10
|
type PopoverArrowProps,
|
|
11
11
|
type PopoverContentProps,
|
|
12
|
-
type PopoverViewportProps,
|
|
13
12
|
type PopoverVirtualTriggerProps,
|
|
14
13
|
} from '@dxos/react-ui';
|
|
15
14
|
|
|
@@ -100,16 +99,17 @@ const PopoverComboboxContent = forwardRef<HTMLDivElement, PopoverComboboxContent
|
|
|
100
99
|
onFocusOutside,
|
|
101
100
|
onInteractOutside,
|
|
102
101
|
forceMount,
|
|
103
|
-
classNames,
|
|
104
102
|
}}
|
|
103
|
+
classNames={[
|
|
104
|
+
'is-[--radix-popover-trigger-width] max-bs-[--radix-popover-content-available-height] grid grid-rows-[min-content_1fr] overflow-hidden',
|
|
105
|
+
classNames,
|
|
106
|
+
]}
|
|
105
107
|
id={modalId}
|
|
106
108
|
ref={forwardedRef}
|
|
107
109
|
>
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</SearchList.Root>
|
|
112
|
-
</Popover.Viewport>
|
|
110
|
+
<SearchList.Root {...props} classNames='contents density-fine' role='none'>
|
|
111
|
+
{children}
|
|
112
|
+
</SearchList.Root>
|
|
113
113
|
</Popover.Content>
|
|
114
114
|
);
|
|
115
115
|
},
|
|
@@ -139,7 +139,7 @@ const PopoverComboboxInput = forwardRef<HTMLInputElement, PopoverComboboxInputPr
|
|
|
139
139
|
<SearchList.Input
|
|
140
140
|
{...props}
|
|
141
141
|
classNames={[
|
|
142
|
-
'mli-cardSpacingChrome mbs-cardSpacingChrome is-[calc(100%-2*var(--dx-cardSpacingChrome))]',
|
|
142
|
+
'mli-cardSpacingChrome mbs-cardSpacingChrome mbe-0 is-[calc(100%-2*var(--dx-cardSpacingChrome))]',
|
|
143
143
|
classNames,
|
|
144
144
|
]}
|
|
145
145
|
ref={forwardedRef}
|
|
@@ -148,15 +148,16 @@ const PopoverComboboxInput = forwardRef<HTMLInputElement, PopoverComboboxInputPr
|
|
|
148
148
|
},
|
|
149
149
|
);
|
|
150
150
|
|
|
151
|
-
type PopoverComboboxListProps = SearchListContentProps
|
|
152
|
-
Pick<PopoverViewportProps, 'constrainBlock' | 'constrainInline'>;
|
|
151
|
+
type PopoverComboboxListProps = SearchListContentProps;
|
|
153
152
|
|
|
154
153
|
const PopoverComboboxList = forwardRef<HTMLDivElement, PopoverComboboxListProps>(
|
|
155
|
-
({
|
|
154
|
+
({ classNames, ...props }, forwardedRef) => {
|
|
156
155
|
return (
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
<SearchList.Content
|
|
157
|
+
{...props}
|
|
158
|
+
classNames={['min-bs-0 overflow-y-auto plb-cardSpacingChrome', classNames]}
|
|
159
|
+
ref={forwardedRef}
|
|
160
|
+
/>
|
|
160
161
|
);
|
|
161
162
|
},
|
|
162
163
|
);
|