@raystack/apsara 0.20.4 → 0.21.1

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.css CHANGED
@@ -742,6 +742,10 @@ html[data-theme="dark"] {
742
742
  border: 1px solid var(--border-subtle);
743
743
  }
744
744
 
745
+ .dialog-module_overlayBlur__-RCHk {
746
+ backdrop-filter: blur(2px);
747
+ }
748
+
745
749
  .dialog-module_dialogContent__bljTL:focus {
746
750
  outline: none;
747
751
  }
package/dist/index.js CHANGED
@@ -6656,14 +6656,20 @@ const $5d3850c4d0b4e6c7$export$f99233281efd08a0 = $5d3850c4d0b4e6c7$export$16f76
6656
6656
  const $5d3850c4d0b4e6c7$export$393edc798c47379d = $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5;
6657
6657
  const $5d3850c4d0b4e6c7$export$f39c2d165cd861fe = $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac;
6658
6658
 
6659
- var styles$t = {"dialogContent":"dialog-module_dialogContent__bljTL","overlay":"dialog-module_overlay__t-jUE","close":"dialog-module_close__n9JNt"};
6659
+ var styles$t = {"dialogContent":"dialog-module_dialogContent__bljTL","overlayBlur":"dialog-module_overlayBlur__-RCHk","overlay":"dialog-module_overlay__t-jUE","close":"dialog-module_close__n9JNt"};
6660
6660
 
6661
6661
  const dialogContent = cva(styles$t.dialogContent);
6662
- const DialogContent = forwardRef(({ className, children, close, overlayStyle, overlayClassname, ...props }, forwardedRef) => {
6663
- return (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$602eac185826482c, { children: jsxRuntimeExports.jsx(Overlay$1, { className: overlayClassname, style: overlayStyle, children: jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ...props, ref: forwardedRef, className: dialogContent({ className }), children: [children, close && (jsxRuntimeExports.jsx(CloseButton$1, { children: jsxRuntimeExports.jsx(Cross1Icon, {}) }))] }) }) }));
6662
+ const DialogContent = forwardRef(({ className, children, close, overlayStyle, overlayClassname, overlayBlur, ...props }, forwardedRef) => {
6663
+ return (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$602eac185826482c, { children: jsxRuntimeExports.jsx(Overlay$1, { className: overlayClassname, style: overlayStyle, blur: overlayBlur, children: jsxRuntimeExports.jsxs($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, { ...props, ref: forwardedRef, className: dialogContent({ className }), children: [children, close && (jsxRuntimeExports.jsx(CloseButton$1, { children: jsxRuntimeExports.jsx(Cross1Icon, {}) }))] }) }) }));
6664
6664
  });
6665
- const overlay$1 = cva(styles$t.overlay);
6666
- const Overlay$1 = forwardRef(({ className, ...props }, ref) => (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, { ref: ref, className: overlay$1({ className }), ...props })));
6665
+ const overlay$1 = cva(styles$t.overlay, {
6666
+ variants: {
6667
+ blur: {
6668
+ true: styles$t.overlayBlur,
6669
+ },
6670
+ },
6671
+ });
6672
+ const Overlay$1 = forwardRef(({ className, blur, ...props }, ref) => (jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, { ref: ref, className: overlay$1({ className, blur }), ...props })));
6667
6673
  Overlay$1.displayName = $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff.displayName;
6668
6674
  const close$1 = cva(styles$t.close);
6669
6675
  function CloseButton$1({ children, className, ...props }) {
@@ -10402,6 +10408,20 @@ const $cb5cc270b50c6fcd$var$PopoverContentNonModal = /*#__PURE__*/ forwardRef((p
10402
10408
  }
10403
10409
  }))));
10404
10410
  });
10411
+ /* -------------------------------------------------------------------------------------------------
10412
+ * PopoverClose
10413
+ * -----------------------------------------------------------------------------------------------*/ const $cb5cc270b50c6fcd$var$CLOSE_NAME = 'PopoverClose';
10414
+ const $cb5cc270b50c6fcd$export$d6ac43ebaa40d53e = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
10415
+ const { __scopePopover: __scopePopover , ...closeProps } = props;
10416
+ const context = $cb5cc270b50c6fcd$var$usePopoverContext($cb5cc270b50c6fcd$var$CLOSE_NAME, __scopePopover);
10417
+ return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034$1.button, _extends({
10418
+ type: "button"
10419
+ }, closeProps, {
10420
+ ref: forwardedRef,
10421
+ onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10$1(props.onClick, ()=>context.onOpenChange(false)
10422
+ )
10423
+ }));
10424
+ });
10405
10425
  /* -----------------------------------------------------------------------------------------------*/ function $cb5cc270b50c6fcd$var$getState(open) {
10406
10426
  return open ? 'open' : 'closed';
10407
10427
  }
@@ -10409,6 +10429,7 @@ const $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9 = $cb5cc270b50c6fcd$export$5b6b1
10409
10429
  const $cb5cc270b50c6fcd$export$41fb9f06171c75f4 = $cb5cc270b50c6fcd$export$7dacb05d26466c3;
10410
10430
  const $cb5cc270b50c6fcd$export$602eac185826482c = $cb5cc270b50c6fcd$export$dd679ffb4362d2d4;
10411
10431
  const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f420b25549ff;
10432
+ const $cb5cc270b50c6fcd$export$f39c2d165cd861fe = $cb5cc270b50c6fcd$export$d6ac43ebaa40d53e;
10412
10433
 
10413
10434
  var styles$i = {"popover":"popover-module_popover__Jh8Hg"};
10414
10435
 
@@ -10417,6 +10438,7 @@ const PopoverContent = React__default.forwardRef(({ className, align = "center",
10417
10438
  PopoverContent.displayName = $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2.displayName;
10418
10439
  const Popover = Object.assign($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, {
10419
10440
  Trigger: $cb5cc270b50c6fcd$export$41fb9f06171c75f4,
10441
+ Close: $cb5cc270b50c6fcd$export$f39c2d165cd861fe,
10420
10442
  Content: PopoverContent,
10421
10443
  });
10422
10444
 
@@ -28034,6 +28056,97 @@ function DayPicker(props) {
28034
28056
 
28035
28057
  var styles$6 = {"calendarRoot":"calendar-module_calendarRoot__KnBz-","caption_label":"calendar-module_caption_label__C5Ys7","dropdowns":"calendar-module_dropdowns__Wn53e","dropdown_trigger":"calendar-module_dropdown_trigger__dsyaq","dropdown_item_text":"calendar-module_dropdown_item_text__Tudqv","nav_button":"calendar-module_nav_button__8W5py","nav_button_previous":"calendar-module_nav_button_previous__lWJYm","nav_button_next":"calendar-module_nav_button_next__1MzRT","months":"calendar-module_months__IN75k","nav":"calendar-module_nav__aGeze","month_caption":"calendar-module_month_caption__Ws6Hx","day":"calendar-module_day__rQFGK","disabled":"calendar-module_disabled__jqgRB","outside":"calendar-module_outside__nq5XC","selected":"calendar-module_selected__kiiAZ","range_middle":"calendar-module_range_middle__PmzFi","range_start":"calendar-module_range_start__ZUooG","range_end":"calendar-module_range_end__PKrm7","week":"calendar-module_week__kCvKJ","day_button":"calendar-module_day_button__vCKP1","today":"calendar-module_today__iXQIQ","weekday":"calendar-module_weekday__xzf6F","hidden":"calendar-module_hidden__wqJVo","calendarPopover":"calendar-module_calendarPopover__PY4sa","dropdown_icon":"calendar-module_dropdown_icon__rDTbz","dropdown_content":"calendar-module_dropdown_content__ajJ5V"};
28036
28058
 
28059
+ /**
28060
+ * @internal
28061
+ */
28062
+ const SkeletonThemeContext = React__default.createContext({});
28063
+
28064
+ /* eslint-disable react/no-array-index-key */
28065
+ const defaultEnableAnimation = true;
28066
+ // For performance & cleanliness, don't add any inline styles unless we have to
28067
+ function styleOptionsToCssProperties({ baseColor, highlightColor, width, height, borderRadius, circle, direction, duration, enableAnimation = defaultEnableAnimation, }) {
28068
+ const style = {};
28069
+ if (direction === 'rtl')
28070
+ style['--animation-direction'] = 'reverse';
28071
+ if (typeof duration === 'number')
28072
+ style['--animation-duration'] = `${duration}s`;
28073
+ if (!enableAnimation)
28074
+ style['--pseudo-element-display'] = 'none';
28075
+ if (typeof width === 'string' || typeof width === 'number')
28076
+ style.width = width;
28077
+ if (typeof height === 'string' || typeof height === 'number')
28078
+ style.height = height;
28079
+ if (typeof borderRadius === 'string' || typeof borderRadius === 'number')
28080
+ style.borderRadius = borderRadius;
28081
+ if (circle)
28082
+ style.borderRadius = '50%';
28083
+ if (typeof baseColor !== 'undefined')
28084
+ style['--base-color'] = baseColor;
28085
+ if (typeof highlightColor !== 'undefined')
28086
+ style['--highlight-color'] = highlightColor;
28087
+ return style;
28088
+ }
28089
+ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp, ...originalPropsStyleOptions }) {
28090
+ var _a, _b, _c;
28091
+ const contextStyleOptions = React__default.useContext(SkeletonThemeContext);
28092
+ const propsStyleOptions = { ...originalPropsStyleOptions };
28093
+ // DO NOT overwrite style options from the context if `propsStyleOptions`
28094
+ // has properties explicity set to undefined
28095
+ for (const [key, value] of Object.entries(originalPropsStyleOptions)) {
28096
+ if (typeof value === 'undefined') {
28097
+ delete propsStyleOptions[key];
28098
+ }
28099
+ }
28100
+ // Props take priority over context
28101
+ const styleOptions = {
28102
+ ...contextStyleOptions,
28103
+ ...propsStyleOptions,
28104
+ circle,
28105
+ };
28106
+ // `styleProp` has the least priority out of everything
28107
+ const style = {
28108
+ ...styleProp,
28109
+ ...styleOptionsToCssProperties(styleOptions),
28110
+ };
28111
+ let className = 'react-loading-skeleton';
28112
+ if (customClassName)
28113
+ className += ` ${customClassName}`;
28114
+ const inline = (_a = styleOptions.inline) !== null && _a !== void 0 ? _a : false;
28115
+ const elements = [];
28116
+ const countCeil = Math.ceil(count);
28117
+ for (let i = 0; i < countCeil; i++) {
28118
+ let thisStyle = style;
28119
+ if (countCeil > count && i === countCeil - 1) {
28120
+ // count is not an integer and we've reached the last iteration of
28121
+ // the loop, so add a "fractional" skeleton.
28122
+ //
28123
+ // For example, if count is 3.5, we've already added 3 full
28124
+ // skeletons, so now we add one more skeleton that is 0.5 times the
28125
+ // original width.
28126
+ const width = (_b = thisStyle.width) !== null && _b !== void 0 ? _b : '100%'; // 100% is the default since that's what's in the CSS
28127
+ const fractionalPart = count % 1;
28128
+ const fractionalWidth = typeof width === 'number'
28129
+ ? width * fractionalPart
28130
+ : `calc(${width} * ${fractionalPart})`;
28131
+ thisStyle = { ...thisStyle, width: fractionalWidth };
28132
+ }
28133
+ const skeletonSpan = (React__default.createElement("span", { className: className, style: thisStyle, key: i }, "\u200C"));
28134
+ if (inline) {
28135
+ elements.push(skeletonSpan);
28136
+ }
28137
+ else {
28138
+ // Without the <br />, the skeleton lines will all run together if
28139
+ // `width` is specified
28140
+ elements.push(React__default.createElement(React__default.Fragment, { key: i },
28141
+ skeletonSpan,
28142
+ React__default.createElement("br", null)));
28143
+ }
28144
+ }
28145
+ return (React__default.createElement("span", { className: containerClassName, "data-testid": containerTestId, "aria-live": "polite", "aria-busy": (_c = styleOptions.enableAnimation) !== null && _c !== void 0 ? _c : defaultEnableAnimation }, Wrapper
28146
+ ? elements.map((el, i) => React__default.createElement(Wrapper, { key: i }, el))
28147
+ : elements));
28148
+ }
28149
+
28037
28150
  const root$1 = cva(styles$6.calendarRoot);
28038
28151
  function DropDown({ options = [], value, onChange, onDropdownOpen, }) {
28039
28152
  const [open, setOpen] = useState(false);
@@ -28048,19 +28161,25 @@ function DropDown({ options = [], value, onChange, onDropdownOpen, }) {
28048
28161
  }
28049
28162
  return (jsxRuntimeExports.jsxs(Select$1, { value: value?.toString(), onValueChange: handleChange, open: open, onOpenChange: setOpen, children: [jsxRuntimeExports.jsx(Select$1.Trigger, { className: styles$6.dropdown_trigger, iconProps: {
28050
28163
  className: styles$6.dropdown_icon,
28051
- }, children: jsxRuntimeExports.jsx(Select$1.Value, {}) }), jsxRuntimeExports.jsxs(Select$1.Content, { className: styles$6.dropdown_content, children: [jsxRuntimeExports.jsx(Select$1.ScrollUpButton, { asChild: true, children: jsxRuntimeExports.jsx(Flex, { justify: "center", children: jsxRuntimeExports.jsx(ChevronUpIcon, {}) }) }), jsxRuntimeExports.jsx(Select$1.Viewport, { children: options.map((opt) => (jsxRuntimeExports.jsx(Select$1.Item, { value: opt.value.toString(), disabled: opt.disabled, textProps: {
28164
+ }, children: jsxRuntimeExports.jsx(Select$1.Value, {}) }), jsxRuntimeExports.jsxs(Select$1.Content, { className: styles$6.dropdown_content, children: [jsxRuntimeExports.jsx(Select$1.ScrollUpButton, { asChild: true, children: jsxRuntimeExports.jsx(Flex, { justify: 'center', children: jsxRuntimeExports.jsx(ChevronUpIcon, {}) }) }), jsxRuntimeExports.jsx(Select$1.Viewport, { children: options.map((opt) => (jsxRuntimeExports.jsx(Select$1.Item, { value: opt.value.toString(), disabled: opt.disabled, textProps: {
28052
28165
  className: styles$6.dropdown_item_text,
28053
- }, children: opt.label }, opt.value))) }), jsxRuntimeExports.jsx(Select$1.ScrollDownButton, { asChild: true, children: jsxRuntimeExports.jsx(Flex, { justify: "center", children: jsxRuntimeExports.jsx(ChevronDownIcon, {}) }) })] })] }));
28166
+ }, children: opt.label }, opt.value))) }), jsxRuntimeExports.jsx(Select$1.ScrollDownButton, { asChild: true, children: jsxRuntimeExports.jsx(Flex, { justify: 'center', children: jsxRuntimeExports.jsx(ChevronDownIcon, {}) }) })] })] }));
28054
28167
  }
28055
- const Calendar = function ({ className, classNames, showOutsideDays = true, onDropdownOpen, ...props }) {
28168
+ const Calendar = function ({ className, classNames, showOutsideDays = true, onDropdownOpen, showTooltip = false, tooltipMessages = {}, loadingData = false, ...props }) {
28056
28169
  return (jsxRuntimeExports.jsx(DayPicker, { showOutsideDays: showOutsideDays, components: {
28057
28170
  Chevron: (props) => {
28058
- if (props.orientation === "left") {
28171
+ if (props.orientation === 'left') {
28059
28172
  return jsxRuntimeExports.jsx(ChevronLeftIcon, { ...props });
28060
28173
  }
28061
28174
  return jsxRuntimeExports.jsx(ChevronRightIcon, { ...props });
28062
28175
  },
28063
28176
  Dropdown: (props) => (jsxRuntimeExports.jsx(DropDown, { ...props, onDropdownOpen: onDropdownOpen })),
28177
+ DayButton: (props) => {
28178
+ const { day, ...buttonProps } = props;
28179
+ const message = tooltipMessages[dateLib.format(day.date, 'dd-MM-yyyy')];
28180
+ return (jsxRuntimeExports.jsx(Tooltip, { side: "top", disabled: loadingData || !showTooltip || !message, message: message, children: jsxRuntimeExports.jsx("button", { ...buttonProps }) }));
28181
+ },
28182
+ MonthGrid: (props) => loadingData ? (jsxRuntimeExports.jsx(Skeleton, { count: 6, height: '12px', width: '252px', style: { marginBottom: 'var(--space-5)' }, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" })) : (jsxRuntimeExports.jsx("table", { ...props })),
28064
28183
  }, classNames: {
28065
28184
  caption_label: styles$6.caption_label,
28066
28185
  button_previous: `${styles$6.nav_button} ${styles$6.nav_button_previous}`,
@@ -32118,97 +32237,6 @@ const Table = Object.assign(TableRoot, {
32118
32237
  Caption: TableCaption,
32119
32238
  });
32120
32239
 
32121
- /**
32122
- * @internal
32123
- */
32124
- const SkeletonThemeContext = React__default.createContext({});
32125
-
32126
- /* eslint-disable react/no-array-index-key */
32127
- const defaultEnableAnimation = true;
32128
- // For performance & cleanliness, don't add any inline styles unless we have to
32129
- function styleOptionsToCssProperties({ baseColor, highlightColor, width, height, borderRadius, circle, direction, duration, enableAnimation = defaultEnableAnimation, }) {
32130
- const style = {};
32131
- if (direction === 'rtl')
32132
- style['--animation-direction'] = 'reverse';
32133
- if (typeof duration === 'number')
32134
- style['--animation-duration'] = `${duration}s`;
32135
- if (!enableAnimation)
32136
- style['--pseudo-element-display'] = 'none';
32137
- if (typeof width === 'string' || typeof width === 'number')
32138
- style.width = width;
32139
- if (typeof height === 'string' || typeof height === 'number')
32140
- style.height = height;
32141
- if (typeof borderRadius === 'string' || typeof borderRadius === 'number')
32142
- style.borderRadius = borderRadius;
32143
- if (circle)
32144
- style.borderRadius = '50%';
32145
- if (typeof baseColor !== 'undefined')
32146
- style['--base-color'] = baseColor;
32147
- if (typeof highlightColor !== 'undefined')
32148
- style['--highlight-color'] = highlightColor;
32149
- return style;
32150
- }
32151
- function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp, ...originalPropsStyleOptions }) {
32152
- var _a, _b, _c;
32153
- const contextStyleOptions = React__default.useContext(SkeletonThemeContext);
32154
- const propsStyleOptions = { ...originalPropsStyleOptions };
32155
- // DO NOT overwrite style options from the context if `propsStyleOptions`
32156
- // has properties explicity set to undefined
32157
- for (const [key, value] of Object.entries(originalPropsStyleOptions)) {
32158
- if (typeof value === 'undefined') {
32159
- delete propsStyleOptions[key];
32160
- }
32161
- }
32162
- // Props take priority over context
32163
- const styleOptions = {
32164
- ...contextStyleOptions,
32165
- ...propsStyleOptions,
32166
- circle,
32167
- };
32168
- // `styleProp` has the least priority out of everything
32169
- const style = {
32170
- ...styleProp,
32171
- ...styleOptionsToCssProperties(styleOptions),
32172
- };
32173
- let className = 'react-loading-skeleton';
32174
- if (customClassName)
32175
- className += ` ${customClassName}`;
32176
- const inline = (_a = styleOptions.inline) !== null && _a !== void 0 ? _a : false;
32177
- const elements = [];
32178
- const countCeil = Math.ceil(count);
32179
- for (let i = 0; i < countCeil; i++) {
32180
- let thisStyle = style;
32181
- if (countCeil > count && i === countCeil - 1) {
32182
- // count is not an integer and we've reached the last iteration of
32183
- // the loop, so add a "fractional" skeleton.
32184
- //
32185
- // For example, if count is 3.5, we've already added 3 full
32186
- // skeletons, so now we add one more skeleton that is 0.5 times the
32187
- // original width.
32188
- const width = (_b = thisStyle.width) !== null && _b !== void 0 ? _b : '100%'; // 100% is the default since that's what's in the CSS
32189
- const fractionalPart = count % 1;
32190
- const fractionalWidth = typeof width === 'number'
32191
- ? width * fractionalPart
32192
- : `calc(${width} * ${fractionalPart})`;
32193
- thisStyle = { ...thisStyle, width: fractionalWidth };
32194
- }
32195
- const skeletonSpan = (React__default.createElement("span", { className: className, style: thisStyle, key: i }, "\u200C"));
32196
- if (inline) {
32197
- elements.push(skeletonSpan);
32198
- }
32199
- else {
32200
- // Without the <br />, the skeleton lines will all run together if
32201
- // `width` is specified
32202
- elements.push(React__default.createElement(React__default.Fragment, { key: i },
32203
- skeletonSpan,
32204
- React__default.createElement("br", null)));
32205
- }
32206
- }
32207
- return (React__default.createElement("span", { className: containerClassName, "data-testid": containerTestId, "aria-live": "polite", "aria-busy": (_c = styleOptions.enableAnimation) !== null && _c !== void 0 ? _c : defaultEnableAnimation }, Wrapper
32208
- ? elements.map((el, i) => React__default.createElement(Wrapper, { key: i }, el))
32209
- : elements));
32210
- }
32211
-
32212
32240
  function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 2, onRowClick, onStateChange = () => { }, onLoadMore, ...props }) {
32213
32241
  const [tableCustomFilter, setTableCustomFilter] = useState({});
32214
32242
  const convertedChildren = Children.toArray(children);