@raystack/apsara 0.11.2 → 0.11.4
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/index.cjs +146 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6 -0
- package/dist/index.js +146 -3
- package/dist/index.js.map +1 -1
- package/dist/select/select.d.ts +3 -0
- package/dist/select/select.d.ts.map +1 -1
- package/dist/textfield/textfield.d.ts +7 -11
- package/dist/textfield/textfield.d.ts.map +1 -1
- package/package.json +15 -11
package/dist/index.cjs
CHANGED
|
@@ -11243,6 +11243,59 @@ const $cc7e05a45900e73f$var$SelectPopperPosition = /*#__PURE__*/ React.forwardRe
|
|
|
11243
11243
|
/* -------------------------------------------------------------------------------------------------
|
|
11244
11244
|
* SelectViewport
|
|
11245
11245
|
* -----------------------------------------------------------------------------------------------*/ const [$cc7e05a45900e73f$var$SelectViewportProvider, $cc7e05a45900e73f$var$useSelectViewportContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, {});
|
|
11246
|
+
const $cc7e05a45900e73f$var$VIEWPORT_NAME = 'SelectViewport';
|
|
11247
|
+
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
11248
|
+
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
11249
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
11250
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
11251
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onViewportChange);
|
|
11252
|
+
const prevScrollTopRef = React.useRef(0);
|
|
11253
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("style", {
|
|
11254
|
+
dangerouslySetInnerHTML: {
|
|
11255
|
+
__html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`
|
|
11256
|
+
}
|
|
11257
|
+
}), /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
11258
|
+
scope: __scopeSelect
|
|
11259
|
+
}, /*#__PURE__*/ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends({
|
|
11260
|
+
"data-radix-select-viewport": "",
|
|
11261
|
+
role: "presentation"
|
|
11262
|
+
}, viewportProps, {
|
|
11263
|
+
ref: composedRefs,
|
|
11264
|
+
style: {
|
|
11265
|
+
// we use position: 'relative' here on the `viewport` so that when we call
|
|
11266
|
+
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
11267
|
+
// (independent of the scrollUpButton).
|
|
11268
|
+
position: 'relative',
|
|
11269
|
+
flex: 1,
|
|
11270
|
+
overflow: 'auto',
|
|
11271
|
+
...viewportProps.style
|
|
11272
|
+
},
|
|
11273
|
+
onScroll: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(viewportProps.onScroll, (event)=>{
|
|
11274
|
+
const viewport = event.currentTarget;
|
|
11275
|
+
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = viewportContext;
|
|
11276
|
+
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
11277
|
+
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
11278
|
+
if (scrolledBy > 0) {
|
|
11279
|
+
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
11280
|
+
const cssMinHeight = parseFloat(contentWrapper.style.minHeight);
|
|
11281
|
+
const cssHeight = parseFloat(contentWrapper.style.height);
|
|
11282
|
+
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
11283
|
+
if (prevHeight < availableHeight) {
|
|
11284
|
+
const nextHeight = prevHeight + scrolledBy;
|
|
11285
|
+
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
11286
|
+
const heightDiff = nextHeight - clampedNextHeight;
|
|
11287
|
+
contentWrapper.style.height = clampedNextHeight + 'px';
|
|
11288
|
+
if (contentWrapper.style.bottom === '0px') {
|
|
11289
|
+
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0; // ensure the content stays pinned to the bottom
|
|
11290
|
+
contentWrapper.style.justifyContent = 'flex-end';
|
|
11291
|
+
}
|
|
11292
|
+
}
|
|
11293
|
+
}
|
|
11294
|
+
}
|
|
11295
|
+
prevScrollTopRef.current = viewport.scrollTop;
|
|
11296
|
+
})
|
|
11297
|
+
}))));
|
|
11298
|
+
});
|
|
11246
11299
|
/* -------------------------------------------------------------------------------------------------
|
|
11247
11300
|
* SelectGroup
|
|
11248
11301
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$GROUP_NAME = 'SelectGroup';
|
|
@@ -11408,6 +11461,91 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React.forwardRef
|
|
|
11408
11461
|
ref: forwardedRef
|
|
11409
11462
|
})) : null;
|
|
11410
11463
|
});
|
|
11464
|
+
/* -------------------------------------------------------------------------------------------------
|
|
11465
|
+
* SelectScrollDownButton
|
|
11466
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';
|
|
11467
|
+
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
11468
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
11469
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
11470
|
+
const [canScrollDown1, setCanScrollDown] = React.useState(false);
|
|
11471
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, viewportContext.onScrollButtonChange);
|
|
11472
|
+
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
11473
|
+
if (contentContext.viewport && contentContext.isPositioned) {
|
|
11474
|
+
const viewport = contentContext.viewport;
|
|
11475
|
+
function handleScroll() {
|
|
11476
|
+
const maxScroll = viewport.scrollHeight - viewport.clientHeight; // we use Math.ceil here because if the UI is zoomed-in
|
|
11477
|
+
// `scrollTop` is not always reported as an integer
|
|
11478
|
+
const canScrollDown = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
11479
|
+
setCanScrollDown(canScrollDown);
|
|
11480
|
+
}
|
|
11481
|
+
handleScroll();
|
|
11482
|
+
viewport.addEventListener('scroll', handleScroll);
|
|
11483
|
+
return ()=>viewport.removeEventListener('scroll', handleScroll)
|
|
11484
|
+
;
|
|
11485
|
+
}
|
|
11486
|
+
}, [
|
|
11487
|
+
contentContext.viewport,
|
|
11488
|
+
contentContext.isPositioned
|
|
11489
|
+
]);
|
|
11490
|
+
return canScrollDown1 ? /*#__PURE__*/ React.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, _extends({}, props, {
|
|
11491
|
+
ref: composedRefs,
|
|
11492
|
+
onAutoScroll: ()=>{
|
|
11493
|
+
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
11494
|
+
if (viewport && selectedItem) viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
11495
|
+
}
|
|
11496
|
+
})) : null;
|
|
11497
|
+
});
|
|
11498
|
+
const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
11499
|
+
const { __scopeSelect: __scopeSelect , onAutoScroll: onAutoScroll , ...scrollIndicatorProps } = props;
|
|
11500
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext('SelectScrollButton', __scopeSelect);
|
|
11501
|
+
const autoScrollTimerRef = React.useRef(null);
|
|
11502
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
11503
|
+
const clearAutoScrollTimer = React.useCallback(()=>{
|
|
11504
|
+
if (autoScrollTimerRef.current !== null) {
|
|
11505
|
+
window.clearInterval(autoScrollTimerRef.current);
|
|
11506
|
+
autoScrollTimerRef.current = null;
|
|
11507
|
+
}
|
|
11508
|
+
}, []);
|
|
11509
|
+
React.useEffect(()=>{
|
|
11510
|
+
return ()=>clearAutoScrollTimer()
|
|
11511
|
+
;
|
|
11512
|
+
}, [
|
|
11513
|
+
clearAutoScrollTimer
|
|
11514
|
+
]); // When the viewport becomes scrollable on either side, the relevant scroll button will mount.
|
|
11515
|
+
// Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)
|
|
11516
|
+
// the viewport, potentially causing the active item to now be partially out of view.
|
|
11517
|
+
// We re-run the `scrollIntoView` logic to make sure it stays within the viewport.
|
|
11518
|
+
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
11519
|
+
var _activeItem$ref$curre;
|
|
11520
|
+
const activeItem = getItems().find((item)=>item.ref.current === document.activeElement
|
|
11521
|
+
);
|
|
11522
|
+
activeItem === null || activeItem === void 0 || (_activeItem$ref$curre = activeItem.ref.current) === null || _activeItem$ref$curre === void 0 || _activeItem$ref$curre.scrollIntoView({
|
|
11523
|
+
block: 'nearest'
|
|
11524
|
+
});
|
|
11525
|
+
}, [
|
|
11526
|
+
getItems
|
|
11527
|
+
]);
|
|
11528
|
+
return /*#__PURE__*/ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends({
|
|
11529
|
+
"aria-hidden": true
|
|
11530
|
+
}, scrollIndicatorProps, {
|
|
11531
|
+
ref: forwardedRef,
|
|
11532
|
+
style: {
|
|
11533
|
+
flexShrink: 0,
|
|
11534
|
+
...scrollIndicatorProps.style
|
|
11535
|
+
},
|
|
11536
|
+
onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(scrollIndicatorProps.onPointerDown, ()=>{
|
|
11537
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
11538
|
+
}),
|
|
11539
|
+
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(scrollIndicatorProps.onPointerMove, ()=>{
|
|
11540
|
+
var _contentContext$onIte3;
|
|
11541
|
+
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
11542
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
11543
|
+
}),
|
|
11544
|
+
onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(scrollIndicatorProps.onPointerLeave, ()=>{
|
|
11545
|
+
clearAutoScrollTimer();
|
|
11546
|
+
})
|
|
11547
|
+
}));
|
|
11548
|
+
});
|
|
11411
11549
|
const $cc7e05a45900e73f$export$eba4b1df07cb1d3 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
11412
11550
|
const { __scopeSelect: __scopeSelect , ...separatorProps } = props;
|
|
11413
11551
|
return /*#__PURE__*/ React.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends({
|
|
@@ -11528,11 +11666,13 @@ const $cc7e05a45900e73f$export$4c8d1a57a761ef94 = $cc7e05a45900e73f$export$e2887
|
|
|
11528
11666
|
const $cc7e05a45900e73f$export$f04a61298a47a40f = $cc7e05a45900e73f$export$99b400cabb58c515;
|
|
11529
11667
|
const $cc7e05a45900e73f$export$602eac185826482c = $cc7e05a45900e73f$export$b2af6c9944296213;
|
|
11530
11668
|
const $cc7e05a45900e73f$export$7c6e2c02157bb7d2 = $cc7e05a45900e73f$export$c973a4b3cb86a03d;
|
|
11669
|
+
const $cc7e05a45900e73f$export$d5c6c08dc2d3ca7 = $cc7e05a45900e73f$export$9ed6e7b40248d36d;
|
|
11531
11670
|
const $cc7e05a45900e73f$export$eb2fcfdbd7ba97d4 = $cc7e05a45900e73f$export$ee25a334c55de1f4;
|
|
11532
11671
|
const $cc7e05a45900e73f$export$b04be29aa201d4f5 = $cc7e05a45900e73f$export$f67338d29bd972f8;
|
|
11533
11672
|
const $cc7e05a45900e73f$export$6d08773d2e66f8f2 = $cc7e05a45900e73f$export$13ef48a934230896;
|
|
11534
11673
|
const $cc7e05a45900e73f$export$d6e5bf9c43ea9319 = $cc7e05a45900e73f$export$3572fb0fb821ff49;
|
|
11535
11674
|
const $cc7e05a45900e73f$export$c3468e2714d175fa = $cc7e05a45900e73f$export$6b9198de19accfe6;
|
|
11675
|
+
const $cc7e05a45900e73f$export$bf1aedc3039c8d63 = $cc7e05a45900e73f$export$ff951e476c12189;
|
|
11536
11676
|
const $cc7e05a45900e73f$export$1ff3c3f08ae963c0 = $cc7e05a45900e73f$export$eba4b1df07cb1d3;
|
|
11537
11677
|
|
|
11538
11678
|
var styles$a = {"content":"select-module_content__X0QJ-","menuitem":"select-module_menuitem__DfVEU","menuitemIndicatorWapper":"select-module_menuitemIndicatorWapper__TZDvz","label":"select-module_label__4I1Se","separator":"select-module_separator__2UBNd","menugroup":"select-module_menugroup__zJbzr","trigger":"select-module_trigger__1tSaG","triggerIcon":"select-module_triggerIcon__iaoZ3"};
|
|
@@ -11555,6 +11695,9 @@ SelectSeparator.displayName = $cc7e05a45900e73f$export$1ff3c3f08ae963c0.displayN
|
|
|
11555
11695
|
const Select = Object.assign($cc7e05a45900e73f$export$be92b6f5f03c0fe9, {
|
|
11556
11696
|
Group: $cc7e05a45900e73f$export$eb2fcfdbd7ba97d4,
|
|
11557
11697
|
Value: $cc7e05a45900e73f$export$4c8d1a57a761ef94,
|
|
11698
|
+
ScrollUpButton: $cc7e05a45900e73f$export$bf1aedc3039c8d63,
|
|
11699
|
+
ScrollDownButton: $cc7e05a45900e73f$export$bf1aedc3039c8d63,
|
|
11700
|
+
Viewport: $cc7e05a45900e73f$export$d5c6c08dc2d3ca7,
|
|
11558
11701
|
Trigger: SelectTrigger,
|
|
11559
11702
|
Content: SelectContent,
|
|
11560
11703
|
Label: SelectLabel,
|
|
@@ -15341,9 +15484,9 @@ const textfield = cva(styles$4.textfield, {
|
|
|
15341
15484
|
size: "small",
|
|
15342
15485
|
},
|
|
15343
15486
|
});
|
|
15344
|
-
const TextField = ({ leading, className, src, size, state, style, ...props }) => {
|
|
15345
|
-
return (jsxRuntimeExports.jsxs(Flex, { align: "center", style: { position: "relative", width: "100%" }, children: [leading ? (jsxRuntimeExports.jsx(Flex, { style: { position: "absolute", left: "8px" }, children: leading })) : null, jsxRuntimeExports.jsx("input", { className: cx(textfield({ size, state, className, leading })), style: leading ? { paddingLeft: "32px" } : {}, ...props })] }));
|
|
15346
|
-
};
|
|
15487
|
+
const TextField = React.forwardRef(({ leading, className, src, size, state, style, ...props }, ref) => {
|
|
15488
|
+
return (jsxRuntimeExports.jsxs(Flex, { align: "center", style: { position: "relative", width: "100%" }, children: [leading ? (jsxRuntimeExports.jsx(Flex, { style: { position: "absolute", left: "8px" }, children: leading })) : null, jsxRuntimeExports.jsx("input", { className: cx(textfield({ size, state, className, leading })), style: leading ? { paddingLeft: "32px" } : {}, ...props, ref: ref })] }));
|
|
15489
|
+
});
|
|
15347
15490
|
TextField.displayName = "TextField";
|
|
15348
15491
|
|
|
15349
15492
|
var styles$3 = {"wrapper":"datatable-module_wrapper__Sxg2d","datatable":"datatable-module_datatable__z-Th2","table":"datatable-module_table__x2IkY","head":"datatable-module_head__zCfCW","toolbar":"datatable-module_toolbar__lO-aI","chip":"datatable-module_chip__IiwTD"};
|