@noxickon/onyx 4.1.2 → 4.1.3
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 +22 -12
- package/dist/chunks/{hooks-HgSTVeVG.js → hooks-BMXCuU2h.js} +2153 -2155
- package/dist/chunks/hooks-H39lCrRt.js +31 -0
- package/dist/chunks/{ui-uWNvgve1.js → ui-DCn7Mox4.js} +1492 -1472
- package/dist/chunks/{ui-CY9lV5En.js → ui-DZn73MJL.js} +4 -4
- package/dist/contexts/contexts.cjs.js +1 -1
- package/dist/contexts/contexts.es.js +2 -2
- package/dist/forms/Select/src/context/SelectContext.types.d.ts +2 -0
- package/dist/hooks/hooks.cjs.js +1 -1
- package/dist/hooks/hooks.es.js +1 -1
- package/dist/hooks/useOverflowDetection/src/useOverflowDetection.d.ts +1 -1
- package/dist/hooks/useOverflowDetection/src/useOverflowDetection.types.d.ts +3 -1
- package/dist/layouts/layouts.cjs.js +1 -1
- package/dist/layouts/layouts.es.js +2 -2
- package/dist/legacy/legacy.cjs.js +1 -1
- package/dist/legacy/legacy.es.js +2 -2
- package/dist/onyx.cjs.js +1 -1
- package/dist/onyx.es.js +2 -2
- package/dist/pages/pages.cjs.js +1 -1
- package/dist/pages/pages.es.js +2 -2
- package/dist/routes/routes.cjs.js +1 -1
- package/dist/routes/routes.es.js +1 -1
- package/dist/ui/Popper/src/hooks/usePopperState.types.d.ts +1 -0
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/hooks-BHARFCd8.js +0 -31
package/AI-README.md
CHANGED
|
@@ -4123,16 +4123,18 @@ function SearchBox() {
|
|
|
4123
4123
|
|
|
4124
4124
|
## useOverflowDetection
|
|
4125
4125
|
|
|
4126
|
-
|
|
4126
|
+
Calculates how many items fit in a container and returns visible/overflow counts (MUI-style approach).
|
|
4127
4127
|
|
|
4128
4128
|
### Signature
|
|
4129
4129
|
|
|
4130
4130
|
```tsx
|
|
4131
|
-
function useOverflowDetection(options
|
|
4131
|
+
function useOverflowDetection(options: {
|
|
4132
|
+
totalItems: number; // Total number of items (required)
|
|
4132
4133
|
selector?: string; // Default: '[data-ox-state="selected"]'
|
|
4134
|
+
minVisible?: number; // Minimum items to always show (default: 1)
|
|
4133
4135
|
}): {
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
+
visibleCount: number; // Number of items that fit
|
|
4137
|
+
overflowAmount: number; // Number of hidden items (totalItems - visibleCount)
|
|
4136
4138
|
handleResize: (node: HTMLDivElement | null) => () => void; // Ref callback with cleanup
|
|
4137
4139
|
};
|
|
4138
4140
|
```
|
|
@@ -4141,16 +4143,23 @@ function useOverflowDetection(options?: {
|
|
|
4141
4143
|
|
|
4142
4144
|
```tsx
|
|
4143
4145
|
function TagList({ tags }) {
|
|
4144
|
-
const { overflowAmount, handleResize } = useOverflowDetection(
|
|
4146
|
+
const { visibleCount, overflowAmount, handleResize } = useOverflowDetection({
|
|
4147
|
+
totalItems: tags.length,
|
|
4148
|
+
selector: '[data-tag]',
|
|
4149
|
+
});
|
|
4150
|
+
|
|
4151
|
+
const visibleTags = tags.slice(0, visibleCount);
|
|
4145
4152
|
|
|
4146
4153
|
return (
|
|
4147
|
-
<div ref={handleResize}>
|
|
4148
|
-
{
|
|
4149
|
-
<span key={tag} data-
|
|
4154
|
+
<div className="flex gap-2" ref={handleResize}>
|
|
4155
|
+
{visibleTags.map((tag) => (
|
|
4156
|
+
<span key={tag} data-tag>
|
|
4150
4157
|
{tag}
|
|
4151
4158
|
</span>
|
|
4152
4159
|
))}
|
|
4153
|
-
{overflowAmount > 0 &&
|
|
4160
|
+
{overflowAmount > 0 && (
|
|
4161
|
+
<span data-ox-overflow-indicator>+{overflowAmount} more</span>
|
|
4162
|
+
)}
|
|
4154
4163
|
</div>
|
|
4155
4164
|
);
|
|
4156
4165
|
}
|
|
@@ -4158,9 +4167,10 @@ function TagList({ tags }) {
|
|
|
4158
4167
|
|
|
4159
4168
|
**Notes**:
|
|
4160
4169
|
|
|
4161
|
-
- ResizeObserver integration
|
|
4162
|
-
-
|
|
4163
|
-
-
|
|
4170
|
+
- ResizeObserver integration for automatic recalculation on resize
|
|
4171
|
+
- Consumer controls rendering - only render `visibleCount` items (no display:none)
|
|
4172
|
+
- Measures items via selector and calculates how many fit in container width
|
|
4173
|
+
- Accounts for gap and overflow indicator width in calculation
|
|
4164
4174
|
|
|
4165
4175
|
---
|
|
4166
4176
|
|