@raystack/apsara 0.21.0 → 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.js CHANGED
@@ -10408,6 +10408,20 @@ const $cb5cc270b50c6fcd$var$PopoverContentNonModal = /*#__PURE__*/ forwardRef((p
10408
10408
  }
10409
10409
  }))));
10410
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
+ });
10411
10425
  /* -----------------------------------------------------------------------------------------------*/ function $cb5cc270b50c6fcd$var$getState(open) {
10412
10426
  return open ? 'open' : 'closed';
10413
10427
  }
@@ -10415,6 +10429,7 @@ const $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9 = $cb5cc270b50c6fcd$export$5b6b1
10415
10429
  const $cb5cc270b50c6fcd$export$41fb9f06171c75f4 = $cb5cc270b50c6fcd$export$7dacb05d26466c3;
10416
10430
  const $cb5cc270b50c6fcd$export$602eac185826482c = $cb5cc270b50c6fcd$export$dd679ffb4362d2d4;
10417
10431
  const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f420b25549ff;
10432
+ const $cb5cc270b50c6fcd$export$f39c2d165cd861fe = $cb5cc270b50c6fcd$export$d6ac43ebaa40d53e;
10418
10433
 
10419
10434
  var styles$i = {"popover":"popover-module_popover__Jh8Hg"};
10420
10435
 
@@ -10423,6 +10438,7 @@ const PopoverContent = React__default.forwardRef(({ className, align = "center",
10423
10438
  PopoverContent.displayName = $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2.displayName;
10424
10439
  const Popover = Object.assign($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, {
10425
10440
  Trigger: $cb5cc270b50c6fcd$export$41fb9f06171c75f4,
10441
+ Close: $cb5cc270b50c6fcd$export$f39c2d165cd861fe,
10426
10442
  Content: PopoverContent,
10427
10443
  });
10428
10444
 
@@ -28040,6 +28056,97 @@ function DayPicker(props) {
28040
28056
 
28041
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"};
28042
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
+
28043
28150
  const root$1 = cva(styles$6.calendarRoot);
28044
28151
  function DropDown({ options = [], value, onChange, onDropdownOpen, }) {
28045
28152
  const [open, setOpen] = useState(false);
@@ -28054,19 +28161,25 @@ function DropDown({ options = [], value, onChange, onDropdownOpen, }) {
28054
28161
  }
28055
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: {
28056
28163
  className: styles$6.dropdown_icon,
28057
- }, 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: {
28058
28165
  className: styles$6.dropdown_item_text,
28059
- }, 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, {}) }) })] })] }));
28060
28167
  }
28061
- const Calendar = function ({ className, classNames, showOutsideDays = true, onDropdownOpen, ...props }) {
28168
+ const Calendar = function ({ className, classNames, showOutsideDays = true, onDropdownOpen, showTooltip = false, tooltipMessages = {}, loadingData = false, ...props }) {
28062
28169
  return (jsxRuntimeExports.jsx(DayPicker, { showOutsideDays: showOutsideDays, components: {
28063
28170
  Chevron: (props) => {
28064
- if (props.orientation === "left") {
28171
+ if (props.orientation === 'left') {
28065
28172
  return jsxRuntimeExports.jsx(ChevronLeftIcon, { ...props });
28066
28173
  }
28067
28174
  return jsxRuntimeExports.jsx(ChevronRightIcon, { ...props });
28068
28175
  },
28069
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 })),
28070
28183
  }, classNames: {
28071
28184
  caption_label: styles$6.caption_label,
28072
28185
  button_previous: `${styles$6.nav_button} ${styles$6.nav_button_previous}`,
@@ -32124,97 +32237,6 @@ const Table = Object.assign(TableRoot, {
32124
32237
  Caption: TableCaption,
32125
32238
  });
32126
32239
 
32127
- /**
32128
- * @internal
32129
- */
32130
- const SkeletonThemeContext = React__default.createContext({});
32131
-
32132
- /* eslint-disable react/no-array-index-key */
32133
- const defaultEnableAnimation = true;
32134
- // For performance & cleanliness, don't add any inline styles unless we have to
32135
- function styleOptionsToCssProperties({ baseColor, highlightColor, width, height, borderRadius, circle, direction, duration, enableAnimation = defaultEnableAnimation, }) {
32136
- const style = {};
32137
- if (direction === 'rtl')
32138
- style['--animation-direction'] = 'reverse';
32139
- if (typeof duration === 'number')
32140
- style['--animation-duration'] = `${duration}s`;
32141
- if (!enableAnimation)
32142
- style['--pseudo-element-display'] = 'none';
32143
- if (typeof width === 'string' || typeof width === 'number')
32144
- style.width = width;
32145
- if (typeof height === 'string' || typeof height === 'number')
32146
- style.height = height;
32147
- if (typeof borderRadius === 'string' || typeof borderRadius === 'number')
32148
- style.borderRadius = borderRadius;
32149
- if (circle)
32150
- style.borderRadius = '50%';
32151
- if (typeof baseColor !== 'undefined')
32152
- style['--base-color'] = baseColor;
32153
- if (typeof highlightColor !== 'undefined')
32154
- style['--highlight-color'] = highlightColor;
32155
- return style;
32156
- }
32157
- function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp, ...originalPropsStyleOptions }) {
32158
- var _a, _b, _c;
32159
- const contextStyleOptions = React__default.useContext(SkeletonThemeContext);
32160
- const propsStyleOptions = { ...originalPropsStyleOptions };
32161
- // DO NOT overwrite style options from the context if `propsStyleOptions`
32162
- // has properties explicity set to undefined
32163
- for (const [key, value] of Object.entries(originalPropsStyleOptions)) {
32164
- if (typeof value === 'undefined') {
32165
- delete propsStyleOptions[key];
32166
- }
32167
- }
32168
- // Props take priority over context
32169
- const styleOptions = {
32170
- ...contextStyleOptions,
32171
- ...propsStyleOptions,
32172
- circle,
32173
- };
32174
- // `styleProp` has the least priority out of everything
32175
- const style = {
32176
- ...styleProp,
32177
- ...styleOptionsToCssProperties(styleOptions),
32178
- };
32179
- let className = 'react-loading-skeleton';
32180
- if (customClassName)
32181
- className += ` ${customClassName}`;
32182
- const inline = (_a = styleOptions.inline) !== null && _a !== void 0 ? _a : false;
32183
- const elements = [];
32184
- const countCeil = Math.ceil(count);
32185
- for (let i = 0; i < countCeil; i++) {
32186
- let thisStyle = style;
32187
- if (countCeil > count && i === countCeil - 1) {
32188
- // count is not an integer and we've reached the last iteration of
32189
- // the loop, so add a "fractional" skeleton.
32190
- //
32191
- // For example, if count is 3.5, we've already added 3 full
32192
- // skeletons, so now we add one more skeleton that is 0.5 times the
32193
- // original width.
32194
- const width = (_b = thisStyle.width) !== null && _b !== void 0 ? _b : '100%'; // 100% is the default since that's what's in the CSS
32195
- const fractionalPart = count % 1;
32196
- const fractionalWidth = typeof width === 'number'
32197
- ? width * fractionalPart
32198
- : `calc(${width} * ${fractionalPart})`;
32199
- thisStyle = { ...thisStyle, width: fractionalWidth };
32200
- }
32201
- const skeletonSpan = (React__default.createElement("span", { className: className, style: thisStyle, key: i }, "\u200C"));
32202
- if (inline) {
32203
- elements.push(skeletonSpan);
32204
- }
32205
- else {
32206
- // Without the <br />, the skeleton lines will all run together if
32207
- // `width` is specified
32208
- elements.push(React__default.createElement(React__default.Fragment, { key: i },
32209
- skeletonSpan,
32210
- React__default.createElement("br", null)));
32211
- }
32212
- }
32213
- 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
32214
- ? elements.map((el, i) => React__default.createElement(Wrapper, { key: i }, el))
32215
- : elements));
32216
- }
32217
-
32218
32240
  function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, initialState, loaderRow = 2, onRowClick, onStateChange = () => { }, onLoadMore, ...props }) {
32219
32241
  const [tableCustomFilter, setTableCustomFilter] = useState({});
32220
32242
  const convertedChildren = Children.toArray(children);