@adamosuiteservices/ui 1.4.6 → 1.6.6
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/colors.css +1 -1
- package/dist/combobox.cjs +2 -2
- package/dist/combobox.js +319 -282
- package/dist/components/ui/combobox/combobox.d.ts +197 -1
- package/dist/components/ui/combobox/combobox.stories.d.ts +8 -0
- package/dist/components/ui/scroll-area/index.d.ts +1 -0
- package/dist/components/ui/scroll-area/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area/scroll-area.stories.d.ts +11 -0
- package/dist/custom-layered-styles.css +1 -1
- package/dist/custom-scroll-bar.css +1 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +3 -3
- package/dist/{index-DMLQL2aG.js → index-DniCthJA.js} +2 -2
- package/dist/{sheet-UZWAbdXr.js → sheet-B-9YHdR5.js} +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.cjs +1 -1
- package/dist/sidebar.js +6 -6
- package/dist/styles.css +1 -1
- package/dist/themes.css +1 -1
- package/docs/components/ui/combobox.md +293 -16
- package/docs/components/ui/scroll-area.md +357 -0
- package/package.json +4 -2
|
@@ -1,35 +1,231 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a single option in the combobox.
|
|
4
|
+
*/
|
|
1
5
|
type ComboboxOption = {
|
|
6
|
+
/** Unique value identifier for the option */
|
|
2
7
|
value: string;
|
|
8
|
+
/** Display text for the option */
|
|
3
9
|
label: string;
|
|
10
|
+
/** Whether the option is disabled and cannot be selected */
|
|
4
11
|
disabled?: boolean;
|
|
5
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Customizable text labels used throughout the combobox.
|
|
15
|
+
*/
|
|
6
16
|
type ComboboxLabels = {
|
|
17
|
+
/** Text shown when no option is selected */
|
|
7
18
|
placeholder?: string;
|
|
19
|
+
/** Placeholder text for the search input */
|
|
8
20
|
searchPlaceholder?: string;
|
|
21
|
+
/** Message displayed when no options match the search */
|
|
9
22
|
noItemsFound?: string;
|
|
23
|
+
/** Function to generate text when multiple items are selected. Receives the count of selected items. */
|
|
10
24
|
multipleSelected?: (count: number) => string;
|
|
11
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* CSS class names for customizing component styling.
|
|
28
|
+
*/
|
|
12
29
|
type ComboboxClassNames = {
|
|
30
|
+
/** Class name for the trigger button */
|
|
13
31
|
trigger?: string;
|
|
32
|
+
/** Class name for the popover container */
|
|
14
33
|
popover?: string;
|
|
34
|
+
/** Class name for the command component */
|
|
15
35
|
command?: string;
|
|
36
|
+
/** Class name for the search input */
|
|
16
37
|
input?: string;
|
|
38
|
+
/** Class name for the options list */
|
|
17
39
|
list?: string;
|
|
40
|
+
/** Class name for the empty state message */
|
|
18
41
|
empty?: string;
|
|
42
|
+
/** Class name for the option group */
|
|
19
43
|
group?: string;
|
|
44
|
+
/** Class name for individual option items */
|
|
20
45
|
item?: string;
|
|
46
|
+
/** Class name for checkbox elements */
|
|
21
47
|
checkbox?: string;
|
|
48
|
+
/** Class name for check icon elements */
|
|
22
49
|
check?: string;
|
|
23
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Render prop functions for customizing component rendering.
|
|
53
|
+
* Each render prop receives relevant data and allows complete control over that part of the UI.
|
|
54
|
+
*/
|
|
55
|
+
type ComboboxRenderProps = {
|
|
56
|
+
/**
|
|
57
|
+
* Custom renderer for the entire trigger button.
|
|
58
|
+
* @param props.open - Whether the popover is open
|
|
59
|
+
* @param props.value - Current selected value(s)
|
|
60
|
+
* @param props.displayText - Formatted display text for selected value(s)
|
|
61
|
+
* @param props.placeholder - Placeholder text
|
|
62
|
+
* @param props.hasValue - Whether any value is selected
|
|
63
|
+
* @param props.icon - Optional icon component
|
|
64
|
+
* @param props.showIcon - Whether to show the icon
|
|
65
|
+
*/
|
|
66
|
+
trigger?: (props: {
|
|
67
|
+
open: boolean;
|
|
68
|
+
value: string | string[];
|
|
69
|
+
displayText: string | null;
|
|
70
|
+
placeholder: string;
|
|
71
|
+
hasValue: boolean;
|
|
72
|
+
icon?: ComponentType<{
|
|
73
|
+
className?: string;
|
|
74
|
+
}>;
|
|
75
|
+
showIcon?: boolean;
|
|
76
|
+
}) => ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* Custom renderer for the trigger dropdown icon.
|
|
79
|
+
* @param props.open - Whether the popover is open
|
|
80
|
+
*/
|
|
81
|
+
triggerIcon?: (props: {
|
|
82
|
+
open: boolean;
|
|
83
|
+
}) => ReactNode;
|
|
84
|
+
/**
|
|
85
|
+
* Custom renderer for the placeholder text.
|
|
86
|
+
* @param props.text - The placeholder text
|
|
87
|
+
* @param props.hasValue - Whether any value is selected
|
|
88
|
+
*/
|
|
89
|
+
placeholder?: (props: {
|
|
90
|
+
text: string;
|
|
91
|
+
hasValue: boolean;
|
|
92
|
+
}) => ReactNode;
|
|
93
|
+
/**
|
|
94
|
+
* Custom renderer for displaying selected value(s).
|
|
95
|
+
* @param props.text - Formatted display text
|
|
96
|
+
* @param props.value - Current selected value(s)
|
|
97
|
+
*/
|
|
98
|
+
displayValue?: (props: {
|
|
99
|
+
text: string | null;
|
|
100
|
+
value: string | string[];
|
|
101
|
+
}) => ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* Custom renderer for an entire option item.
|
|
104
|
+
* @param props.option - The option data
|
|
105
|
+
* @param props.isSelected - Whether this option is currently selected
|
|
106
|
+
* @param props.selectedFeedback - Type of selection feedback ("checkbox" or "check")
|
|
107
|
+
*/
|
|
108
|
+
option?: (props: {
|
|
109
|
+
option: ComboboxOption;
|
|
110
|
+
isSelected: boolean;
|
|
111
|
+
selectedFeedback: "checkbox" | "check";
|
|
112
|
+
}) => ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Custom renderer for just the option label text.
|
|
115
|
+
* @param props.option - The option data
|
|
116
|
+
*/
|
|
117
|
+
optionLabel?: (props: {
|
|
118
|
+
option: ComboboxOption;
|
|
119
|
+
}) => ReactNode;
|
|
120
|
+
/**
|
|
121
|
+
* Custom renderer for the selection feedback indicator (checkbox or check).
|
|
122
|
+
* @param props.option - The option data
|
|
123
|
+
* @param props.isSelected - Whether this option is currently selected
|
|
124
|
+
* @param props.type - Type of feedback indicator
|
|
125
|
+
*/
|
|
126
|
+
selectedFeedback?: (props: {
|
|
127
|
+
option: ComboboxOption;
|
|
128
|
+
isSelected: boolean;
|
|
129
|
+
type: "checkbox" | "check";
|
|
130
|
+
}) => ReactNode;
|
|
131
|
+
/**
|
|
132
|
+
* Custom renderer for the empty state when no options match.
|
|
133
|
+
* @param props.text - The "no items found" message
|
|
134
|
+
*/
|
|
135
|
+
empty?: (props: {
|
|
136
|
+
text: string;
|
|
137
|
+
}) => ReactNode;
|
|
138
|
+
/**
|
|
139
|
+
* Custom renderer for the search input field.
|
|
140
|
+
* @param props.placeholder - Placeholder text for the search input
|
|
141
|
+
*/
|
|
142
|
+
searchInput?: (props: {
|
|
143
|
+
placeholder: string;
|
|
144
|
+
}) => ReactNode;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Props for the Combobox component.
|
|
148
|
+
*/
|
|
24
149
|
type ComboboxProps = Readonly<{
|
|
150
|
+
/** Enable search/filter functionality within the combobox */
|
|
25
151
|
searchable?: boolean;
|
|
152
|
+
/** Allow multiple options to be selected simultaneously */
|
|
26
153
|
multiple?: boolean;
|
|
154
|
+
/** Optional icon component to display in the trigger */
|
|
155
|
+
icon?: ComponentType<{
|
|
156
|
+
className?: string;
|
|
157
|
+
}>;
|
|
158
|
+
/** Whether to show the icon in the trigger */
|
|
159
|
+
showIcon?: boolean;
|
|
160
|
+
/** Controlled value for the combobox. Can be a single value or array of values for multiple selection. */
|
|
27
161
|
value?: string | string[];
|
|
162
|
+
/** Callback fired when the selected value changes */
|
|
28
163
|
onValueChange?: (value: string | string[]) => void;
|
|
164
|
+
/** Customizable text labels for various UI elements */
|
|
29
165
|
labels?: ComboboxLabels;
|
|
166
|
+
/** Array of options to display in the combobox */
|
|
30
167
|
options: ComboboxOption[];
|
|
168
|
+
/** CSS class names for styling various parts of the component */
|
|
31
169
|
classNames?: ComboboxClassNames;
|
|
170
|
+
/** Type of selection feedback indicator to show ("checkbox" or "check") */
|
|
32
171
|
selectedFeedback?: "checkbox" | "check";
|
|
172
|
+
/** Always show the placeholder text even when a value is selected. When enabled, both placeholder and value are displayed. */
|
|
173
|
+
alwaysShowPlaceholder?: boolean;
|
|
174
|
+
/** Render prop functions for customizing component rendering */
|
|
175
|
+
renders?: ComboboxRenderProps;
|
|
33
176
|
}>;
|
|
34
|
-
|
|
177
|
+
/**
|
|
178
|
+
* A flexible combobox component with support for single/multiple selection, search, and extensive customization.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```tsx
|
|
182
|
+
* // Basic single select
|
|
183
|
+
* <Combobox
|
|
184
|
+
* options={[
|
|
185
|
+
* { value: "1", label: "Option 1" },
|
|
186
|
+
* { value: "2", label: "Option 2" },
|
|
187
|
+
* ]}
|
|
188
|
+
* value={value}
|
|
189
|
+
* onValueChange={setValue}
|
|
190
|
+
* />
|
|
191
|
+
*
|
|
192
|
+
* // Multiple select with search
|
|
193
|
+
* <Combobox
|
|
194
|
+
* multiple
|
|
195
|
+
* searchable
|
|
196
|
+
* options={options}
|
|
197
|
+
* value={selectedValues}
|
|
198
|
+
* onValueChange={setSelectedValues}
|
|
199
|
+
* labels={{
|
|
200
|
+
* placeholder: "Select items...",
|
|
201
|
+
* searchPlaceholder: "Search...",
|
|
202
|
+
* }}
|
|
203
|
+
* />
|
|
204
|
+
*
|
|
205
|
+
* // With custom rendering
|
|
206
|
+
* <Combobox
|
|
207
|
+
* options={options}
|
|
208
|
+
* value={value}
|
|
209
|
+
* onValueChange={setValue}
|
|
210
|
+
* renders={{
|
|
211
|
+
* optionLabel: ({ option }) => (
|
|
212
|
+
* <div className="flex items-center gap-2">
|
|
213
|
+
* <Avatar src={option.avatar} />
|
|
214
|
+
* <span>{option.label}</span>
|
|
215
|
+
* </div>
|
|
216
|
+
* ),
|
|
217
|
+
* }}
|
|
218
|
+
* />
|
|
219
|
+
*
|
|
220
|
+
* // Always show placeholder with value
|
|
221
|
+
* <Combobox
|
|
222
|
+
* alwaysShowPlaceholder
|
|
223
|
+
* options={options}
|
|
224
|
+
* value={value}
|
|
225
|
+
* onValueChange={setValue}
|
|
226
|
+
* labels={{ placeholder: "Country" }}
|
|
227
|
+
* />
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
declare function Combobox({ searchable, multiple, icon: Icon, showIcon, value: controlledValue, onValueChange, labels, options, classNames, selectedFeedback, alwaysShowPlaceholder, renders, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
35
231
|
export { Combobox };
|
|
@@ -25,3 +25,11 @@ export declare const ControlledMultiple: Story;
|
|
|
25
25
|
export declare const CustomLabels: Story;
|
|
26
26
|
export declare const CustomStyling: Story;
|
|
27
27
|
export declare const InForm: Story;
|
|
28
|
+
export declare const WithIcon: Story;
|
|
29
|
+
export declare const AlwaysShowPlaceholder: Story;
|
|
30
|
+
export declare const AlwaysShowPlaceholderMultiple: Story;
|
|
31
|
+
export declare const CustomRendering: Story;
|
|
32
|
+
export declare const CustomTrigger: Story;
|
|
33
|
+
export declare const CustomEmptyState: Story;
|
|
34
|
+
export declare const CustomSelectedFeedback: Story;
|
|
35
|
+
export declare const WithIconAndPlaceholder: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './scroll-area';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
3
|
+
declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ScrollArea } from '.';
|
|
3
|
+
declare const meta: Meta<typeof ScrollArea>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Horizontal: Story;
|
|
8
|
+
export declare const WithBothScrollbars: Story;
|
|
9
|
+
export declare const LongText: Story;
|
|
10
|
+
export declare const WithBadges: Story;
|
|
11
|
+
export declare const CustomHeight: Story;
|