@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.css
CHANGED
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
border: none;
|
|
96
96
|
border-radius: var(--br-round);
|
|
97
97
|
background: var(--background-inset);
|
|
98
|
+
border: 1px solid transparent;
|
|
98
99
|
width: 32px;
|
|
99
100
|
height: 32px;
|
|
100
101
|
}
|
|
@@ -1173,6 +1174,11 @@
|
|
|
1173
1174
|
border: 1px solid var(--border-accent-inverted)
|
|
1174
1175
|
}
|
|
1175
1176
|
|
|
1177
|
+
.select-module_trigger__1tSaG:disabled {
|
|
1178
|
+
opacity: 0.6;
|
|
1179
|
+
pointer-events: none;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1176
1182
|
.select-module_trigger__1tSaG::placeholder {
|
|
1177
1183
|
color: var(--foreground-subtle);
|
|
1178
1184
|
font-size: 12px;
|
package/dist/index.js
CHANGED
|
@@ -11223,6 +11223,59 @@ const $cc7e05a45900e73f$var$SelectPopperPosition = /*#__PURE__*/ forwardRef((pro
|
|
|
11223
11223
|
/* -------------------------------------------------------------------------------------------------
|
|
11224
11224
|
* SelectViewport
|
|
11225
11225
|
* -----------------------------------------------------------------------------------------------*/ const [$cc7e05a45900e73f$var$SelectViewportProvider, $cc7e05a45900e73f$var$useSelectViewportContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, {});
|
|
11226
|
+
const $cc7e05a45900e73f$var$VIEWPORT_NAME = 'SelectViewport';
|
|
11227
|
+
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
11228
|
+
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
11229
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
11230
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
11231
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentContext.onViewportChange);
|
|
11232
|
+
const prevScrollTopRef = useRef(0);
|
|
11233
|
+
return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement("style", {
|
|
11234
|
+
dangerouslySetInnerHTML: {
|
|
11235
|
+
__html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`
|
|
11236
|
+
}
|
|
11237
|
+
}), /*#__PURE__*/ createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
11238
|
+
scope: __scopeSelect
|
|
11239
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends({
|
|
11240
|
+
"data-radix-select-viewport": "",
|
|
11241
|
+
role: "presentation"
|
|
11242
|
+
}, viewportProps, {
|
|
11243
|
+
ref: composedRefs,
|
|
11244
|
+
style: {
|
|
11245
|
+
// we use position: 'relative' here on the `viewport` so that when we call
|
|
11246
|
+
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
11247
|
+
// (independent of the scrollUpButton).
|
|
11248
|
+
position: 'relative',
|
|
11249
|
+
flex: 1,
|
|
11250
|
+
overflow: 'auto',
|
|
11251
|
+
...viewportProps.style
|
|
11252
|
+
},
|
|
11253
|
+
onScroll: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(viewportProps.onScroll, (event)=>{
|
|
11254
|
+
const viewport = event.currentTarget;
|
|
11255
|
+
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = viewportContext;
|
|
11256
|
+
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
11257
|
+
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
11258
|
+
if (scrolledBy > 0) {
|
|
11259
|
+
const availableHeight = window.innerHeight - $cc7e05a45900e73f$var$CONTENT_MARGIN * 2;
|
|
11260
|
+
const cssMinHeight = parseFloat(contentWrapper.style.minHeight);
|
|
11261
|
+
const cssHeight = parseFloat(contentWrapper.style.height);
|
|
11262
|
+
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
11263
|
+
if (prevHeight < availableHeight) {
|
|
11264
|
+
const nextHeight = prevHeight + scrolledBy;
|
|
11265
|
+
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
11266
|
+
const heightDiff = nextHeight - clampedNextHeight;
|
|
11267
|
+
contentWrapper.style.height = clampedNextHeight + 'px';
|
|
11268
|
+
if (contentWrapper.style.bottom === '0px') {
|
|
11269
|
+
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0; // ensure the content stays pinned to the bottom
|
|
11270
|
+
contentWrapper.style.justifyContent = 'flex-end';
|
|
11271
|
+
}
|
|
11272
|
+
}
|
|
11273
|
+
}
|
|
11274
|
+
}
|
|
11275
|
+
prevScrollTopRef.current = viewport.scrollTop;
|
|
11276
|
+
})
|
|
11277
|
+
}))));
|
|
11278
|
+
});
|
|
11226
11279
|
/* -------------------------------------------------------------------------------------------------
|
|
11227
11280
|
* SelectGroup
|
|
11228
11281
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$GROUP_NAME = 'SelectGroup';
|
|
@@ -11388,6 +11441,91 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ forwardRef((prop
|
|
|
11388
11441
|
ref: forwardedRef
|
|
11389
11442
|
})) : null;
|
|
11390
11443
|
});
|
|
11444
|
+
/* -------------------------------------------------------------------------------------------------
|
|
11445
|
+
* SelectScrollDownButton
|
|
11446
|
+
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';
|
|
11447
|
+
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
11448
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
11449
|
+
const viewportContext = $cc7e05a45900e73f$var$useSelectViewportContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
11450
|
+
const [canScrollDown1, setCanScrollDown] = useState(false);
|
|
11451
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, viewportContext.onScrollButtonChange);
|
|
11452
|
+
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
11453
|
+
if (contentContext.viewport && contentContext.isPositioned) {
|
|
11454
|
+
const viewport = contentContext.viewport;
|
|
11455
|
+
function handleScroll() {
|
|
11456
|
+
const maxScroll = viewport.scrollHeight - viewport.clientHeight; // we use Math.ceil here because if the UI is zoomed-in
|
|
11457
|
+
// `scrollTop` is not always reported as an integer
|
|
11458
|
+
const canScrollDown = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
11459
|
+
setCanScrollDown(canScrollDown);
|
|
11460
|
+
}
|
|
11461
|
+
handleScroll();
|
|
11462
|
+
viewport.addEventListener('scroll', handleScroll);
|
|
11463
|
+
return ()=>viewport.removeEventListener('scroll', handleScroll)
|
|
11464
|
+
;
|
|
11465
|
+
}
|
|
11466
|
+
}, [
|
|
11467
|
+
contentContext.viewport,
|
|
11468
|
+
contentContext.isPositioned
|
|
11469
|
+
]);
|
|
11470
|
+
return canScrollDown1 ? /*#__PURE__*/ createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, _extends({}, props, {
|
|
11471
|
+
ref: composedRefs,
|
|
11472
|
+
onAutoScroll: ()=>{
|
|
11473
|
+
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
11474
|
+
if (viewport && selectedItem) viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
11475
|
+
}
|
|
11476
|
+
})) : null;
|
|
11477
|
+
});
|
|
11478
|
+
const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
11479
|
+
const { __scopeSelect: __scopeSelect , onAutoScroll: onAutoScroll , ...scrollIndicatorProps } = props;
|
|
11480
|
+
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext('SelectScrollButton', __scopeSelect);
|
|
11481
|
+
const autoScrollTimerRef = useRef(null);
|
|
11482
|
+
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
11483
|
+
const clearAutoScrollTimer = useCallback(()=>{
|
|
11484
|
+
if (autoScrollTimerRef.current !== null) {
|
|
11485
|
+
window.clearInterval(autoScrollTimerRef.current);
|
|
11486
|
+
autoScrollTimerRef.current = null;
|
|
11487
|
+
}
|
|
11488
|
+
}, []);
|
|
11489
|
+
useEffect(()=>{
|
|
11490
|
+
return ()=>clearAutoScrollTimer()
|
|
11491
|
+
;
|
|
11492
|
+
}, [
|
|
11493
|
+
clearAutoScrollTimer
|
|
11494
|
+
]); // When the viewport becomes scrollable on either side, the relevant scroll button will mount.
|
|
11495
|
+
// Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)
|
|
11496
|
+
// the viewport, potentially causing the active item to now be partially out of view.
|
|
11497
|
+
// We re-run the `scrollIntoView` logic to make sure it stays within the viewport.
|
|
11498
|
+
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
11499
|
+
var _activeItem$ref$curre;
|
|
11500
|
+
const activeItem = getItems().find((item)=>item.ref.current === document.activeElement
|
|
11501
|
+
);
|
|
11502
|
+
activeItem === null || activeItem === void 0 || (_activeItem$ref$curre = activeItem.ref.current) === null || _activeItem$ref$curre === void 0 || _activeItem$ref$curre.scrollIntoView({
|
|
11503
|
+
block: 'nearest'
|
|
11504
|
+
});
|
|
11505
|
+
}, [
|
|
11506
|
+
getItems
|
|
11507
|
+
]);
|
|
11508
|
+
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends({
|
|
11509
|
+
"aria-hidden": true
|
|
11510
|
+
}, scrollIndicatorProps, {
|
|
11511
|
+
ref: forwardedRef,
|
|
11512
|
+
style: {
|
|
11513
|
+
flexShrink: 0,
|
|
11514
|
+
...scrollIndicatorProps.style
|
|
11515
|
+
},
|
|
11516
|
+
onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(scrollIndicatorProps.onPointerDown, ()=>{
|
|
11517
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
11518
|
+
}),
|
|
11519
|
+
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(scrollIndicatorProps.onPointerMove, ()=>{
|
|
11520
|
+
var _contentContext$onIte3;
|
|
11521
|
+
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
11522
|
+
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
11523
|
+
}),
|
|
11524
|
+
onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(scrollIndicatorProps.onPointerLeave, ()=>{
|
|
11525
|
+
clearAutoScrollTimer();
|
|
11526
|
+
})
|
|
11527
|
+
}));
|
|
11528
|
+
});
|
|
11391
11529
|
const $cc7e05a45900e73f$export$eba4b1df07cb1d3 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
11392
11530
|
const { __scopeSelect: __scopeSelect , ...separatorProps } = props;
|
|
11393
11531
|
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.div, _extends({
|
|
@@ -11508,11 +11646,13 @@ const $cc7e05a45900e73f$export$4c8d1a57a761ef94 = $cc7e05a45900e73f$export$e2887
|
|
|
11508
11646
|
const $cc7e05a45900e73f$export$f04a61298a47a40f = $cc7e05a45900e73f$export$99b400cabb58c515;
|
|
11509
11647
|
const $cc7e05a45900e73f$export$602eac185826482c = $cc7e05a45900e73f$export$b2af6c9944296213;
|
|
11510
11648
|
const $cc7e05a45900e73f$export$7c6e2c02157bb7d2 = $cc7e05a45900e73f$export$c973a4b3cb86a03d;
|
|
11649
|
+
const $cc7e05a45900e73f$export$d5c6c08dc2d3ca7 = $cc7e05a45900e73f$export$9ed6e7b40248d36d;
|
|
11511
11650
|
const $cc7e05a45900e73f$export$eb2fcfdbd7ba97d4 = $cc7e05a45900e73f$export$ee25a334c55de1f4;
|
|
11512
11651
|
const $cc7e05a45900e73f$export$b04be29aa201d4f5 = $cc7e05a45900e73f$export$f67338d29bd972f8;
|
|
11513
11652
|
const $cc7e05a45900e73f$export$6d08773d2e66f8f2 = $cc7e05a45900e73f$export$13ef48a934230896;
|
|
11514
11653
|
const $cc7e05a45900e73f$export$d6e5bf9c43ea9319 = $cc7e05a45900e73f$export$3572fb0fb821ff49;
|
|
11515
11654
|
const $cc7e05a45900e73f$export$c3468e2714d175fa = $cc7e05a45900e73f$export$6b9198de19accfe6;
|
|
11655
|
+
const $cc7e05a45900e73f$export$bf1aedc3039c8d63 = $cc7e05a45900e73f$export$ff951e476c12189;
|
|
11516
11656
|
const $cc7e05a45900e73f$export$1ff3c3f08ae963c0 = $cc7e05a45900e73f$export$eba4b1df07cb1d3;
|
|
11517
11657
|
|
|
11518
11658
|
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"};
|
|
@@ -11535,6 +11675,9 @@ SelectSeparator.displayName = $cc7e05a45900e73f$export$1ff3c3f08ae963c0.displayN
|
|
|
11535
11675
|
const Select = Object.assign($cc7e05a45900e73f$export$be92b6f5f03c0fe9, {
|
|
11536
11676
|
Group: $cc7e05a45900e73f$export$eb2fcfdbd7ba97d4,
|
|
11537
11677
|
Value: $cc7e05a45900e73f$export$4c8d1a57a761ef94,
|
|
11678
|
+
ScrollUpButton: $cc7e05a45900e73f$export$bf1aedc3039c8d63,
|
|
11679
|
+
ScrollDownButton: $cc7e05a45900e73f$export$bf1aedc3039c8d63,
|
|
11680
|
+
Viewport: $cc7e05a45900e73f$export$d5c6c08dc2d3ca7,
|
|
11538
11681
|
Trigger: SelectTrigger,
|
|
11539
11682
|
Content: SelectContent,
|
|
11540
11683
|
Label: SelectLabel,
|
|
@@ -15321,9 +15464,9 @@ const textfield = cva(styles$4.textfield, {
|
|
|
15321
15464
|
size: "small",
|
|
15322
15465
|
},
|
|
15323
15466
|
});
|
|
15324
|
-
const TextField = ({ leading, className, src, size, state, style, ...props }) => {
|
|
15325
|
-
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 })] }));
|
|
15326
|
-
};
|
|
15467
|
+
const TextField = forwardRef(({ leading, className, src, size, state, style, ...props }, ref) => {
|
|
15468
|
+
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 })] }));
|
|
15469
|
+
});
|
|
15327
15470
|
TextField.displayName = "TextField";
|
|
15328
15471
|
|
|
15329
15472
|
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"};
|