@noxickon/onyx 4.0.7 → 4.1.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/AI-README.md +119 -0
- package/dist/chunks/{hooks-CNgb50x1.js → hooks-BHARFCd8.js} +8 -8
- package/dist/chunks/{hooks-6tQOArBm.js → hooks-HgSTVeVG.js} +172 -163
- package/dist/chunks/{ui-92MxpFAB.js → ui-CrovNVis.js} +5294 -4931
- package/dist/chunks/ui-DMqTyCSX.js +9 -0
- package/dist/contexts/contexts.cjs.js +1 -1
- package/dist/contexts/contexts.es.js +30 -30
- package/dist/forms/Combobox/Combobox.stories.d.ts +9 -0
- package/dist/forms/Combobox/index.d.ts +10 -0
- package/dist/forms/Combobox/src/Combobox.d.ts +2 -0
- package/dist/forms/Combobox/src/Combobox.types.d.ts +56 -0
- package/dist/forms/Combobox/src/ComboboxContent.d.ts +2 -0
- package/dist/forms/Combobox/src/ComboboxEmpty.d.ts +2 -0
- package/dist/forms/Combobox/src/ComboboxLoading.d.ts +2 -0
- package/dist/forms/Combobox/src/ComboboxOption.d.ts +2 -0
- package/dist/forms/Combobox/src/ComboboxOptions.d.ts +2 -0
- package/dist/forms/Combobox/src/ComboboxSearch.d.ts +2 -0
- package/dist/forms/Combobox/src/ComboboxTrigger.d.ts +2 -0
- package/dist/forms/Combobox/src/context/ComboboxContext.d.ts +2 -0
- package/dist/forms/Combobox/src/context/useComboboxContext.d.ts +1 -0
- package/dist/forms/index.d.ts +1 -0
- package/dist/hooks/hooks.cjs.js +1 -1
- package/dist/hooks/hooks.es.js +10 -9
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useDebounce/index.d.ts +1 -0
- package/dist/hooks/useDebounce/src/useDebounce.d.ts +1 -0
- package/dist/layouts/Sidebar/src/Sidebar.types.d.ts +1 -0
- package/dist/layouts/layouts.cjs.js +1 -1
- package/dist/layouts/layouts.es.js +188 -187
- package/dist/legacy/legacy.cjs.js +1 -1
- package/dist/legacy/legacy.es.js +4 -4
- package/dist/onyx.cjs.js +1 -1
- package/dist/onyx.es.js +53 -52
- package/dist/pages/pages.cjs.js +1 -1
- package/dist/pages/pages.es.js +5 -5
- package/dist/routes/routes.cjs.js +1 -1
- package/dist/routes/routes.es.js +1 -1
- package/dist/styles.css +10 -0
- package/dist/ui.css +1 -1
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ui-DeVnzHls.js +0 -9
package/AI-README.md
CHANGED
|
@@ -2229,6 +2229,125 @@ interface OxCheckboxGroupItemProps extends Omit<
|
|
|
2229
2229
|
|
|
2230
2230
|
---
|
|
2231
2231
|
|
|
2232
|
+
## OxCombobox
|
|
2233
|
+
|
|
2234
|
+
Searchable select component with async support.
|
|
2235
|
+
|
|
2236
|
+
**Pattern**: Compound Component
|
|
2237
|
+
**Sub-components**: `Trigger`, `Content`, `Search`, `Options`, `Option`, `Empty`, `Loading`
|
|
2238
|
+
|
|
2239
|
+
### Props
|
|
2240
|
+
|
|
2241
|
+
```tsx
|
|
2242
|
+
interface OxComboboxProps<T = unknown> {
|
|
2243
|
+
children: ReactNode;
|
|
2244
|
+
className?: string;
|
|
2245
|
+
defaultValue?: T | null; // Uncontrolled default value
|
|
2246
|
+
disabled?: boolean;
|
|
2247
|
+
error?: boolean; // Error state styling
|
|
2248
|
+
onChange?: (value: T | null) => void; // Called when selection changes
|
|
2249
|
+
required?: boolean;
|
|
2250
|
+
value?: T | null; // Controlled value (generic type)
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
interface OxComboboxTriggerProps extends ComponentPropsWithoutRef<'button'> {
|
|
2254
|
+
placeholder?: string; // Shown when no value selected
|
|
2255
|
+
renderValue?: (value: unknown) => ReactNode; // Custom render for selected value
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
interface OxComboboxContentProps extends ComponentPropsWithoutRef<'div'> {
|
|
2259
|
+
children: ReactNode; // Search, Options, Empty, Loading components
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
interface OxComboboxSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'onChange'> {
|
|
2263
|
+
debounce?: number; // Debounce delay in ms (default: 300)
|
|
2264
|
+
onChange?: (value: string) => void; // Called with debounced search query
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
interface OxComboboxOptionsProps extends ComponentPropsWithoutRef<'ul'> {
|
|
2268
|
+
children: ReactNode; // OxCombobox.Option elements
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
interface OxComboboxOptionProps<T = unknown> extends Omit<ComponentPropsWithoutRef<'li'>, 'value'> {
|
|
2272
|
+
children: ReactNode; // Option content (text, icons, etc.)
|
|
2273
|
+
value: T; // Required - passed to onChange on select
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
interface OxComboboxEmptyProps extends ComponentPropsWithoutRef<'div'> {
|
|
2277
|
+
children: ReactNode; // Empty state message
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
interface OxComboboxLoadingProps extends ComponentPropsWithoutRef<'div'> {
|
|
2281
|
+
rows?: number; // Number of skeleton rows (default: 4)
|
|
2282
|
+
}
|
|
2283
|
+
```
|
|
2284
|
+
|
|
2285
|
+
### Example
|
|
2286
|
+
|
|
2287
|
+
```tsx
|
|
2288
|
+
{
|
|
2289
|
+
/* Basic with local filtering */
|
|
2290
|
+
}
|
|
2291
|
+
const [selected, setSelected] = useState<Item | null>(null);
|
|
2292
|
+
const [query, setQuery] = useState('');
|
|
2293
|
+
|
|
2294
|
+
const items = query
|
|
2295
|
+
? mockItems.filter((item) => item.name.toLowerCase().includes(query.toLowerCase()))
|
|
2296
|
+
: mockItems;
|
|
2297
|
+
|
|
2298
|
+
<OxCombobox value={selected} onChange={setSelected}>
|
|
2299
|
+
<OxCombobox.Trigger placeholder="Select item..." renderValue={(v) => (v as Item).name} />
|
|
2300
|
+
<OxCombobox.Content>
|
|
2301
|
+
<OxCombobox.Search placeholder="Search..." onChange={setQuery} />
|
|
2302
|
+
{items.length === 0 ? (
|
|
2303
|
+
<OxCombobox.Empty>No results found</OxCombobox.Empty>
|
|
2304
|
+
) : (
|
|
2305
|
+
<OxCombobox.Options>
|
|
2306
|
+
{items.map((item) => (
|
|
2307
|
+
<OxCombobox.Option key={item.id} value={item}>
|
|
2308
|
+
{item.name}
|
|
2309
|
+
</OxCombobox.Option>
|
|
2310
|
+
))}
|
|
2311
|
+
</OxCombobox.Options>
|
|
2312
|
+
)}
|
|
2313
|
+
</OxCombobox.Content>
|
|
2314
|
+
</OxCombobox>;
|
|
2315
|
+
|
|
2316
|
+
{
|
|
2317
|
+
/* Async with loading state */
|
|
2318
|
+
}
|
|
2319
|
+
const [loading, setLoading] = useState(false);
|
|
2320
|
+
|
|
2321
|
+
const handleSearch = (query: string) => {
|
|
2322
|
+
setLoading(true);
|
|
2323
|
+
fetchItems(query)
|
|
2324
|
+
.then(setItems)
|
|
2325
|
+
.finally(() => setLoading(false));
|
|
2326
|
+
};
|
|
2327
|
+
|
|
2328
|
+
<OxCombobox value={selected} onChange={setSelected}>
|
|
2329
|
+
<OxCombobox.Trigger placeholder="Search..." renderValue={(v) => (v as Item).name} />
|
|
2330
|
+
<OxCombobox.Content>
|
|
2331
|
+
<OxCombobox.Search debounce={300} onChange={handleSearch} />
|
|
2332
|
+
{loading ? (
|
|
2333
|
+
<OxCombobox.Loading rows={4} />
|
|
2334
|
+
) : items.length === 0 ? (
|
|
2335
|
+
<OxCombobox.Empty>No results</OxCombobox.Empty>
|
|
2336
|
+
) : (
|
|
2337
|
+
<OxCombobox.Options>
|
|
2338
|
+
{items.map((item) => (
|
|
2339
|
+
<OxCombobox.Option key={item.id} value={item}>
|
|
2340
|
+
{item.name}
|
|
2341
|
+
</OxCombobox.Option>
|
|
2342
|
+
))}
|
|
2343
|
+
</OxCombobox.Options>
|
|
2344
|
+
)}
|
|
2345
|
+
</OxCombobox.Content>
|
|
2346
|
+
</OxCombobox>;
|
|
2347
|
+
```
|
|
2348
|
+
|
|
2349
|
+
---
|
|
2350
|
+
|
|
2232
2351
|
## OxFileUpload (experimental)
|
|
2233
2352
|
|
|
2234
2353
|
File upload component with drag-and-drop.
|