@raystack/apsara 0.12.0 → 0.14.0
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/calendar/calendar.d.ts.map +1 -1
- package/dist/calendar/date-picker.d.ts +13 -0
- package/dist/calendar/date-picker.d.ts.map +1 -0
- package/dist/calendar/index.d.ts +2 -0
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/range-picker.d.ts +15 -0
- package/dist/calendar/range-picker.d.ts.map +1 -0
- package/dist/errorstate/errorstate.d.ts +2 -1
- package/dist/errorstate/errorstate.d.ts.map +1 -1
- package/dist/index.cjs +485 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +40 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +484 -64
- package/dist/index.js.map +1 -1
- package/dist/popover/popover.d.ts.map +1 -1
- package/dist/sidebar/sidebar.d.ts +2 -0
- package/dist/sidebar/sidebar.d.ts.map +1 -1
- package/dist/table/DataTableFilterChips.d.ts.map +1 -1
- package/dist/table/FilteredChip.d.ts +3 -1
- package/dist/table/FilteredChip.d.ts.map +1 -1
- package/dist/table/TableContext.d.ts +3 -0
- package/dist/table/TableContext.d.ts.map +1 -1
- package/dist/table/datatable.d.ts +4 -3
- package/dist/table/datatable.d.ts.map +1 -1
- package/dist/table/datatables.types.d.ts +29 -6
- package/dist/table/datatables.types.d.ts.map +1 -1
- package/dist/table/filterFns.d.ts +11 -0
- package/dist/table/filterFns.d.ts.map +1 -0
- package/dist/table/hooks/useTable.d.ts +2 -0
- package/dist/table/hooks/useTable.d.ts.map +1 -1
- package/dist/textfield/textfield.d.ts +15 -2
- package/dist/textfield/textfield.d.ts.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import React__default, { createContext, useMemo, createElement, useContext, useC
|
|
|
3
3
|
import * as $7SXl2$reactdom from 'react-dom';
|
|
4
4
|
import $7SXl2$reactdom__default, { flushSync, createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7
|
+
|
|
6
8
|
function getDefaultExportFromCjs (x) {
|
|
7
9
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
8
10
|
}
|
|
@@ -2426,6 +2428,28 @@ var ArrowUpIcon = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
2426
2428
|
}));
|
|
2427
2429
|
});
|
|
2428
2430
|
|
|
2431
|
+
var _excluded$I = ["color"];
|
|
2432
|
+
var CalendarIcon = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
2433
|
+
var _ref$color = _ref.color,
|
|
2434
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
2435
|
+
props = _objectWithoutPropertiesLoose$1(_ref, _excluded$I);
|
|
2436
|
+
|
|
2437
|
+
return createElement("svg", Object.assign({
|
|
2438
|
+
width: "15",
|
|
2439
|
+
height: "15",
|
|
2440
|
+
viewBox: "0 0 15 15",
|
|
2441
|
+
fill: "none",
|
|
2442
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2443
|
+
}, props, {
|
|
2444
|
+
ref: forwardedRef
|
|
2445
|
+
}), createElement("path", {
|
|
2446
|
+
d: "M4.5 1C4.77614 1 5 1.22386 5 1.5V2H10V1.5C10 1.22386 10.2239 1 10.5 1C10.7761 1 11 1.22386 11 1.5V2H12.5C13.3284 2 14 2.67157 14 3.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V3.5C1 2.67157 1.67157 2 2.5 2H4V1.5C4 1.22386 4.22386 1 4.5 1ZM10 3V3.5C10 3.77614 10.2239 4 10.5 4C10.7761 4 11 3.77614 11 3.5V3H12.5C12.7761 3 13 3.22386 13 3.5V5H2V3.5C2 3.22386 2.22386 3 2.5 3H4V3.5C4 3.77614 4.22386 4 4.5 4C4.77614 4 5 3.77614 5 3.5V3H10ZM2 6V12.5C2 12.7761 2.22386 13 2.5 13H12.5C12.7761 13 13 12.7761 13 12.5V6H2ZM7 7.5C7 7.22386 7.22386 7 7.5 7C7.77614 7 8 7.22386 8 7.5C8 7.77614 7.77614 8 7.5 8C7.22386 8 7 7.77614 7 7.5ZM9.5 7C9.22386 7 9 7.22386 9 7.5C9 7.77614 9.22386 8 9.5 8C9.77614 8 10 7.77614 10 7.5C10 7.22386 9.77614 7 9.5 7ZM11 7.5C11 7.22386 11.2239 7 11.5 7C11.7761 7 12 7.22386 12 7.5C12 7.77614 11.7761 8 11.5 8C11.2239 8 11 7.77614 11 7.5ZM11.5 9C11.2239 9 11 9.22386 11 9.5C11 9.77614 11.2239 10 11.5 10C11.7761 10 12 9.77614 12 9.5C12 9.22386 11.7761 9 11.5 9ZM9 9.5C9 9.22386 9.22386 9 9.5 9C9.77614 9 10 9.22386 10 9.5C10 9.77614 9.77614 10 9.5 10C9.22386 10 9 9.77614 9 9.5ZM7.5 9C7.22386 9 7 9.22386 7 9.5C7 9.77614 7.22386 10 7.5 10C7.77614 10 8 9.77614 8 9.5C8 9.22386 7.77614 9 7.5 9ZM5 9.5C5 9.22386 5.22386 9 5.5 9C5.77614 9 6 9.22386 6 9.5C6 9.77614 5.77614 10 5.5 10C5.22386 10 5 9.77614 5 9.5ZM3.5 9C3.22386 9 3 9.22386 3 9.5C3 9.77614 3.22386 10 3.5 10C3.77614 10 4 9.77614 4 9.5C4 9.22386 3.77614 9 3.5 9ZM3 11.5C3 11.2239 3.22386 11 3.5 11C3.77614 11 4 11.2239 4 11.5C4 11.7761 3.77614 12 3.5 12C3.22386 12 3 11.7761 3 11.5ZM5.5 11C5.22386 11 5 11.2239 5 11.5C5 11.7761 5.22386 12 5.5 12C5.77614 12 6 11.7761 6 11.5C6 11.2239 5.77614 11 5.5 11ZM7 11.5C7 11.2239 7.22386 11 7.5 11C7.77614 11 8 11.2239 8 11.5C8 11.7761 7.77614 12 7.5 12C7.22386 12 7 11.7761 7 11.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12C9.77614 12 10 11.7761 10 11.5C10 11.2239 9.77614 11 9.5 11Z",
|
|
2447
|
+
fill: color,
|
|
2448
|
+
fillRule: "evenodd",
|
|
2449
|
+
clipRule: "evenodd"
|
|
2450
|
+
}));
|
|
2451
|
+
});
|
|
2452
|
+
|
|
2429
2453
|
var _excluded$T = ["color"];
|
|
2430
2454
|
var CheckIcon = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
2431
2455
|
var _ref$color = _ref.color,
|
|
@@ -9699,8 +9723,8 @@ const getHeadline = (status = "Something gone wrong") => {
|
|
|
9699
9723
|
}
|
|
9700
9724
|
};
|
|
9701
9725
|
const errorstate = cva(styles$n.errorstate);
|
|
9702
|
-
function ErrorState({ children, className, status, icon, ...props }) {
|
|
9703
|
-
return (jsxRuntimeExports$1.jsx(Flex, { justify: "center", style: { width: "100%", height: "100%" }, children: jsxRuntimeExports$1.jsxs(Flex, { direction: "column", gap: "large", align: "center", justify: "center", className: errorstate({ className }), style: { textAlign: "center", maxWidth: "400px" }, ...props, children: [icon ? icon : getIcon(status), jsxRuntimeExports$1.jsxs(Flex, { direction: "column", gap: "medium", children: [jsxRuntimeExports$1.jsx(Headline, { size: "large", children: getHeadline(status) }), jsxRuntimeExports$1.jsx(Body, { size: "large", children: getMessage(status) })] })] }) }));
|
|
9726
|
+
function ErrorState({ children, className, status, icon, message, ...props }) {
|
|
9727
|
+
return (jsxRuntimeExports$1.jsx(Flex, { justify: "center", style: { width: "100%", height: "100%" }, children: jsxRuntimeExports$1.jsxs(Flex, { direction: "column", gap: "large", align: "center", justify: "center", className: errorstate({ className }), style: { textAlign: "center", maxWidth: "400px" }, ...props, children: [icon ? icon : getIcon(status), jsxRuntimeExports$1.jsxs(Flex, { direction: "column", gap: "medium", children: [jsxRuntimeExports$1.jsx(Headline, { size: "large", children: getHeadline(status) }), jsxRuntimeExports$1.jsx(Body, { size: "large", children: message ? message : getMessage(status) })] })] }) }));
|
|
9704
9728
|
}
|
|
9705
9729
|
|
|
9706
9730
|
var styles$m = {"grid":"grid-module_grid__UQeew","align-start":"grid-module_align-start__Z7pvl","align-center":"grid-module_align-center__Rwlbt","align-end":"grid-module_align-end__nuXn1","align-stretch":"grid-module_align-stretch__6SP1w","align-baseline":"grid-module_align-baseline__ajEPv","justify-start":"grid-module_justify-start__hRYMn","justify-center":"grid-module_justify-center__zQ7Ym","justify-end":"grid-module_justify-end__92x6b","justify-between":"grid-module_justify-between__vQXi3","flow-row":"grid-module_flow-row__bI9DV","flow-column":"grid-module_flow-column__lsmAV","flow-dense":"grid-module_flow-dense__rAnOn","flow-rowDense":"grid-module_flow-rowDense__vvLwD","flow-columnDense":"grid-module_flow-columnDense__HnI7j","columns-1":"grid-module_columns-1__ISyE5","columns-2":"grid-module_columns-2__nAJXX","columns-3":"grid-module_columns-3__jSanv","columns-4":"grid-module_columns-4__TPrmV","gap-xs":"grid-module_gap-xs__jJXAg","gap-sm":"grid-module_gap-sm__lSOTF","gap-md":"grid-module_gap-md__d44tx","gap-lg":"grid-module_gap-lg__QxI9L","gap-xl":"grid-module_gap-xl__0VXE9","gapX-xs":"grid-module_gapX-xs__vCzot","gapX-sm":"grid-module_gapX-sm__3p68N","gapX-md":"grid-module_gapX-md__JPO3S","gapX-lg":"grid-module_gapX-lg__qFCBX","gapX-xl":"grid-module_gapX-xl__J141F","gapY-xs":"grid-module_gapY-xs__yx6Mm","gapY-sm":"grid-module_gapY-sm__uopNl","gapY-md":"grid-module_gapY-md__4XBeo","gapY-lg":"grid-module_gapY-lg__QrF6Z","gapY-xl":"grid-module_gapY-xl__Y6SHF"};
|
|
@@ -10015,7 +10039,8 @@ const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f
|
|
|
10015
10039
|
|
|
10016
10040
|
var styles$i = {"popover":"popover-module_popover__Jh8Hg"};
|
|
10017
10041
|
|
|
10018
|
-
const
|
|
10042
|
+
const popoverContent = cva(styles$i.popover);
|
|
10043
|
+
const PopoverContent = React__default.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (jsxRuntimeExports$1.jsx($cb5cc270b50c6fcd$export$602eac185826482c, { children: jsxRuntimeExports$1.jsx($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { ref: ref, align: align, sideOffset: sideOffset, className: popoverContent({ className }), ...props }) })));
|
|
10019
10044
|
PopoverContent.displayName = $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2.displayName;
|
|
10020
10045
|
const Popover = Object.assign($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, {
|
|
10021
10046
|
Trigger: $cb5cc270b50c6fcd$export$41fb9f06171c75f4,
|
|
@@ -28101,7 +28126,7 @@ function DayPicker(props) {
|
|
|
28101
28126
|
return (jsxRuntimeExports.jsx(RootProvider, __assign({}, props, { children: jsxRuntimeExports.jsx(Root, { initialProps: props }) })));
|
|
28102
28127
|
}
|
|
28103
28128
|
|
|
28104
|
-
var styles$6 = {"calendarRoot":"calendar-module_calendarRoot__KnBz-","caption":"calendar-module_caption__KH06I","caption_label":"calendar-module_caption_label__C5Ys7","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","head":"calendar-module_head__EIxyS","head_cell":"calendar-module_head_cell__z8NlN","cell":"calendar-module_cell__TTpcD","day_today":"calendar-module_day_today__P35-i","day_range_middle":"calendar-module_day_range_middle__3yKS1","day_range_start":"calendar-module_day_range_start__Qyhit","day_range_end":"calendar-module_day_range_end__YF0ad","row":"calendar-module_row__cjS3G","day":"calendar-module_day__rQFGK","day_outside":"calendar-module_day_outside__WN68B"};
|
|
28129
|
+
var styles$6 = {"calendarRoot":"calendar-module_calendarRoot__KnBz-","caption":"calendar-module_caption__KH06I","caption_label":"calendar-module_caption_label__C5Ys7","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","head":"calendar-module_head__EIxyS","head_cell":"calendar-module_head_cell__z8NlN","cell":"calendar-module_cell__TTpcD","day_today":"calendar-module_day_today__P35-i","day_range_middle":"calendar-module_day_range_middle__3yKS1","day_range_start":"calendar-module_day_range_start__Qyhit","day_range_end":"calendar-module_day_range_end__YF0ad","row":"calendar-module_row__cjS3G","day":"calendar-module_day__rQFGK","day_outside":"calendar-module_day_outside__WN68B","months":"calendar-module_months__IN75k","calendarPopover":"calendar-module_calendarPopover__PY4sa","datePickerInput":"calendar-module_datePickerInput__aOnRQ"};
|
|
28105
28130
|
|
|
28106
28131
|
const root$1 = cva(styles$6.calendarRoot);
|
|
28107
28132
|
const Calendar = function ({ className, classNames, showOutsideDays = true, ...props }) {
|
|
@@ -28125,10 +28150,100 @@ const Calendar = function ({ className, classNames, showOutsideDays = true, ...p
|
|
|
28125
28150
|
day_range_middle: styles$6.day_range_middle,
|
|
28126
28151
|
day_range_end: styles$6.day_range_end,
|
|
28127
28152
|
day_range_start: styles$6.day_range_start,
|
|
28153
|
+
months: styles$6.months,
|
|
28128
28154
|
...classNames,
|
|
28129
28155
|
}, className: root$1({ className }), ...props }));
|
|
28130
28156
|
};
|
|
28131
28157
|
|
|
28158
|
+
var styles$5 = {"textfield":"textfield-module_textfield__u4AGg","textfield-sm":"textfield-module_textfield-sm__OKPic","textfield-md":"textfield-module_textfield-md__e2ayW","textfield-invlid":"textfield-module_textfield-invlid__zo9MF","textfield-valid":"textfield-module_textfield-valid__6rMM9","textfield-leading":"textfield-module_textfield-leading__AE-ld","textfield-trailing":"textfield-module_textfield-trailing__Hj2jX"};
|
|
28159
|
+
|
|
28160
|
+
const textfield = cva(styles$5.textfield, {
|
|
28161
|
+
variants: {
|
|
28162
|
+
size: {
|
|
28163
|
+
small: styles$5["textfield-sm"],
|
|
28164
|
+
medium: styles$5["textfield-md"],
|
|
28165
|
+
},
|
|
28166
|
+
state: {
|
|
28167
|
+
invalid: styles$5["textfield-invalid"],
|
|
28168
|
+
valid: styles$5["textfield-valid"],
|
|
28169
|
+
},
|
|
28170
|
+
hasLeadingElement: {
|
|
28171
|
+
true: styles$5["textfield-leading"],
|
|
28172
|
+
},
|
|
28173
|
+
hasTrailingElement: {
|
|
28174
|
+
true: styles$5["textfield-trailing"],
|
|
28175
|
+
},
|
|
28176
|
+
},
|
|
28177
|
+
defaultVariants: {
|
|
28178
|
+
size: "small",
|
|
28179
|
+
},
|
|
28180
|
+
});
|
|
28181
|
+
const TextField = forwardRef(({ leading, trailing, className, src, size, state, style, ...props }, ref) => {
|
|
28182
|
+
const hasLeadingElement = Boolean(leading);
|
|
28183
|
+
const hasTrailingElement = Boolean(trailing);
|
|
28184
|
+
return (jsxRuntimeExports$1.jsxs(Flex, { align: "center", style: { position: "relative", width: "100%" }, children: [hasLeadingElement ? (jsxRuntimeExports$1.jsx(Flex, { style: { position: "absolute", left: "8px" }, children: leading })) : null, jsxRuntimeExports$1.jsx("input", { className: cx(textfield({
|
|
28185
|
+
size,
|
|
28186
|
+
state,
|
|
28187
|
+
className,
|
|
28188
|
+
hasLeadingElement,
|
|
28189
|
+
hasTrailingElement,
|
|
28190
|
+
})), ...props, ref: ref }), hasTrailingElement ? (jsxRuntimeExports$1.jsx(Flex, { style: { position: "absolute", right: "8px" }, children: trailing })) : null] }));
|
|
28191
|
+
});
|
|
28192
|
+
TextField.displayName = "TextField";
|
|
28193
|
+
|
|
28194
|
+
var dayjs_min = {exports: {}};
|
|
28195
|
+
|
|
28196
|
+
(function (module, exports) {
|
|
28197
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
28198
|
+
} (dayjs_min));
|
|
28199
|
+
|
|
28200
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
28201
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
28202
|
+
|
|
28203
|
+
function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, value = new Date(), onSelect = () => { }, }) {
|
|
28204
|
+
const [showCalendar, setShowCalendar] = useState(false);
|
|
28205
|
+
const dateValue = dayjs(value).format(dateFormat);
|
|
28206
|
+
const handleSelect = (day, selectedDay) => {
|
|
28207
|
+
const selected = day || selectedDay;
|
|
28208
|
+
onSelect(selected);
|
|
28209
|
+
setShowCalendar(false);
|
|
28210
|
+
};
|
|
28211
|
+
function onOpenChange(open) {
|
|
28212
|
+
setShowCalendar(Boolean(open));
|
|
28213
|
+
}
|
|
28214
|
+
return (jsxRuntimeExports$1.jsxs(Popover, { open: showCalendar, onOpenChange: onOpenChange, children: [jsxRuntimeExports$1.jsx(Popover.Trigger, { asChild: true, children: jsxRuntimeExports$1.jsx(TextField, { value: dateValue, trailing: jsxRuntimeExports$1.jsx(CalendarIcon, {}), className: styles$6.datePickerInput, readOnly: true, ...textFieldProps }) }), jsxRuntimeExports$1.jsx(Popover.Content, { side: side, className: styles$6.calendarPopover, children: jsxRuntimeExports$1.jsx(Calendar, { ...calendarProps, mode: "single", selected: value, defaultMonth: value, onSelect: handleSelect }) })] }));
|
|
28215
|
+
}
|
|
28216
|
+
|
|
28217
|
+
function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, onSelect = () => { }, value = {
|
|
28218
|
+
to: new Date(),
|
|
28219
|
+
from: new Date(),
|
|
28220
|
+
}, pickerGroupClassName, }) {
|
|
28221
|
+
const [showCalendar, setShowCalendar] = useState(false);
|
|
28222
|
+
const [currentRangeField, setCurrentRangeField] = useState("from");
|
|
28223
|
+
const startDate = dayjs(value.from).format(dateFormat);
|
|
28224
|
+
const endDate = dayjs(value.to).format(dateFormat);
|
|
28225
|
+
// 1st click will select the start date.
|
|
28226
|
+
// 2nd click will select the end date.
|
|
28227
|
+
// 3rd click will select the start date again.
|
|
28228
|
+
const handleSelect = (range, selectedDay) => {
|
|
28229
|
+
const from = value?.from || range?.from;
|
|
28230
|
+
if (currentRangeField === "to" && dayjs(selectedDay).isAfter(dayjs(from))) {
|
|
28231
|
+
// update the end date
|
|
28232
|
+
onSelect({ from, to: selectedDay });
|
|
28233
|
+
setCurrentRangeField("from");
|
|
28234
|
+
}
|
|
28235
|
+
else {
|
|
28236
|
+
// reset the range and select start day
|
|
28237
|
+
onSelect({ from: selectedDay });
|
|
28238
|
+
setCurrentRangeField("to");
|
|
28239
|
+
}
|
|
28240
|
+
};
|
|
28241
|
+
function onOpenChange(open) {
|
|
28242
|
+
setShowCalendar(Boolean(open));
|
|
28243
|
+
}
|
|
28244
|
+
return (jsxRuntimeExports$1.jsxs(Popover, { open: showCalendar, onOpenChange: onOpenChange, children: [jsxRuntimeExports$1.jsx(Popover.Trigger, { asChild: true, children: jsxRuntimeExports$1.jsxs(Flex, { gap: "medium", className: pickerGroupClassName, children: [jsxRuntimeExports$1.jsx(TextField, { value: startDate, trailing: jsxRuntimeExports$1.jsx(CalendarIcon, {}), className: styles$6.datePickerInput, readOnly: true, ...textFieldProps }), jsxRuntimeExports$1.jsx(TextField, { value: endDate, trailing: jsxRuntimeExports$1.jsx(CalendarIcon, {}), className: styles$6.datePickerInput, readOnly: true, ...textFieldProps })] }) }), jsxRuntimeExports$1.jsx(Popover.Content, { side: side, className: styles$6.calendarPopover, children: jsxRuntimeExports$1.jsx(Calendar, { showOutsideDays: false, numberOfMonths: 2, defaultMonth: value.from, ...calendarProps, mode: "range", selected: value, onSelect: handleSelect }) })] }));
|
|
28245
|
+
}
|
|
28246
|
+
|
|
28132
28247
|
/**
|
|
28133
28248
|
* table-core
|
|
28134
28249
|
*
|
|
@@ -31607,74 +31722,271 @@ function DataTableFilterOptions({ children, ...props }) {
|
|
|
31607
31722
|
})] })) : null] }));
|
|
31608
31723
|
}
|
|
31609
31724
|
|
|
31610
|
-
var styles$
|
|
31725
|
+
var styles$4 = {"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","chipWrapper":"datatable-module_chipWrapper__iz69x","filterOperator":"datatable-module_filterOperator__qtDsH","filterText":"datatable-module_filterText__w00L8","flex1":"datatable-module_flex1__fA-kQ"};
|
|
31611
31726
|
|
|
31612
|
-
const
|
|
31613
|
-
|
|
31614
|
-
|
|
31615
|
-
|
|
31616
|
-
|
|
31727
|
+
const columnTypesMap = {
|
|
31728
|
+
select: "select",
|
|
31729
|
+
number: "number",
|
|
31730
|
+
text: "text",
|
|
31731
|
+
date: "date",
|
|
31732
|
+
};
|
|
31733
|
+
const filterValueTypeMap = {
|
|
31734
|
+
select: "select",
|
|
31735
|
+
text: "text",
|
|
31736
|
+
datePicker: "datePicker",
|
|
31737
|
+
rangePicker: "rangePicker",
|
|
31738
|
+
};
|
|
31739
|
+
|
|
31740
|
+
var isSameOrAfter$1 = {exports: {}};
|
|
31741
|
+
|
|
31742
|
+
(function (module, exports) {
|
|
31743
|
+
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
31744
|
+
} (isSameOrAfter$1));
|
|
31745
|
+
|
|
31746
|
+
var isSameOrAfterExports = isSameOrAfter$1.exports;
|
|
31747
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
31748
|
+
|
|
31749
|
+
var isSameOrBefore$1 = {exports: {}};
|
|
31750
|
+
|
|
31751
|
+
(function (module, exports) {
|
|
31752
|
+
!function(e,i){module.exports=i();}(commonjsGlobal,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
31753
|
+
} (isSameOrBefore$1));
|
|
31754
|
+
|
|
31755
|
+
var isSameOrBeforeExports = isSameOrBefore$1.exports;
|
|
31756
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
31757
|
+
|
|
31758
|
+
dayjs.extend(isSameOrAfter);
|
|
31759
|
+
dayjs.extend(isSameOrBefore);
|
|
31760
|
+
const operationsOptions = {
|
|
31761
|
+
[columnTypesMap.select]: [
|
|
31762
|
+
{
|
|
31763
|
+
label: "is",
|
|
31764
|
+
value: "is",
|
|
31765
|
+
fn: (row, columnId, filterValue) => {
|
|
31766
|
+
return row.getValue(columnId) === filterValue.value;
|
|
31767
|
+
},
|
|
31617
31768
|
},
|
|
31618
|
-
|
|
31619
|
-
|
|
31620
|
-
|
|
31769
|
+
{
|
|
31770
|
+
label: "is not",
|
|
31771
|
+
value: "is not",
|
|
31772
|
+
fn: (row, columnId, filterValue) => {
|
|
31773
|
+
return row.getValue(columnId) !== filterValue.value;
|
|
31774
|
+
},
|
|
31621
31775
|
},
|
|
31622
|
-
|
|
31623
|
-
|
|
31776
|
+
],
|
|
31777
|
+
[columnTypesMap.number]: [
|
|
31778
|
+
{
|
|
31779
|
+
label: "=",
|
|
31780
|
+
value: "=",
|
|
31781
|
+
fn: (row, columnId, filterValue) => {
|
|
31782
|
+
return Number(row.getValue(columnId)) === Number(filterValue.value);
|
|
31783
|
+
},
|
|
31624
31784
|
},
|
|
31625
|
-
|
|
31626
|
-
|
|
31627
|
-
|
|
31628
|
-
|
|
31629
|
-
|
|
31630
|
-
|
|
31631
|
-
|
|
31632
|
-
|
|
31633
|
-
|
|
31634
|
-
|
|
31635
|
-
|
|
31785
|
+
{
|
|
31786
|
+
label: "!=",
|
|
31787
|
+
value: "!=",
|
|
31788
|
+
fn: (row, columnId, filterValue) => {
|
|
31789
|
+
return Number(row.getValue(columnId)) !== Number(filterValue.value);
|
|
31790
|
+
},
|
|
31791
|
+
},
|
|
31792
|
+
{
|
|
31793
|
+
label: ">",
|
|
31794
|
+
value: ">",
|
|
31795
|
+
fn: (row, columnId, filterValue) => {
|
|
31796
|
+
return Number(row.getValue(columnId)) > Number(filterValue.value);
|
|
31797
|
+
},
|
|
31798
|
+
},
|
|
31799
|
+
{
|
|
31800
|
+
label: ">=",
|
|
31801
|
+
value: ">=",
|
|
31802
|
+
fn: (row, columnId, filterValue) => {
|
|
31803
|
+
return Number(row.getValue(columnId)) >= Number(filterValue.value);
|
|
31804
|
+
},
|
|
31805
|
+
},
|
|
31806
|
+
{
|
|
31807
|
+
label: "<",
|
|
31808
|
+
value: "<",
|
|
31809
|
+
fn: (row, columnId, filterValue) => {
|
|
31810
|
+
return Number(row.getValue(columnId)) < Number(filterValue.value);
|
|
31811
|
+
},
|
|
31812
|
+
},
|
|
31813
|
+
{
|
|
31814
|
+
label: "<=",
|
|
31815
|
+
value: "<=",
|
|
31816
|
+
fn: (row, columnId, filterValue) => {
|
|
31817
|
+
return Number(row.getValue(columnId)) <= Number(filterValue.value);
|
|
31818
|
+
},
|
|
31819
|
+
},
|
|
31820
|
+
],
|
|
31821
|
+
[columnTypesMap.text]: [
|
|
31822
|
+
{
|
|
31823
|
+
label: "contains",
|
|
31824
|
+
value: "contains",
|
|
31825
|
+
fn: (row, columnId, filterValue) => {
|
|
31826
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31827
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31828
|
+
return columnValue.includes(filterStr);
|
|
31829
|
+
},
|
|
31830
|
+
},
|
|
31831
|
+
{
|
|
31832
|
+
label: "does not contains",
|
|
31833
|
+
value: "does not contains",
|
|
31834
|
+
fn: (row, columnId, filterValue) => {
|
|
31835
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31836
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31837
|
+
return !columnValue.includes(filterStr);
|
|
31838
|
+
},
|
|
31839
|
+
},
|
|
31840
|
+
{
|
|
31841
|
+
label: "starts with",
|
|
31842
|
+
value: "starts with",
|
|
31843
|
+
fn: (row, columnId, filterValue) => {
|
|
31844
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31845
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31846
|
+
return columnValue.startsWith(filterStr);
|
|
31847
|
+
},
|
|
31848
|
+
},
|
|
31849
|
+
{
|
|
31850
|
+
label: "ends with",
|
|
31851
|
+
value: "ends with",
|
|
31852
|
+
fn: (row, columnId, filterValue) => {
|
|
31853
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31854
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31855
|
+
return columnValue.endsWith(filterStr);
|
|
31856
|
+
},
|
|
31857
|
+
},
|
|
31858
|
+
{
|
|
31859
|
+
label: "is empty",
|
|
31860
|
+
value: "is empty",
|
|
31861
|
+
fn: (row, columnId, filterValue) => {
|
|
31862
|
+
return row.getValue(columnId).length === 0;
|
|
31863
|
+
},
|
|
31864
|
+
hideValueField: true,
|
|
31865
|
+
},
|
|
31866
|
+
{
|
|
31867
|
+
label: "is not empty",
|
|
31868
|
+
value: "is not empty",
|
|
31869
|
+
fn: (row, columnId, filterValue) => {
|
|
31870
|
+
return row.getValue(columnId).length > 0;
|
|
31871
|
+
},
|
|
31872
|
+
hideValueField: true,
|
|
31873
|
+
},
|
|
31874
|
+
],
|
|
31875
|
+
[columnTypesMap.date]: [
|
|
31876
|
+
{
|
|
31877
|
+
label: "is",
|
|
31878
|
+
value: "is",
|
|
31879
|
+
fn: (row, columnId, filterValue) => {
|
|
31880
|
+
return dayjs(row.getValue(columnId)).isSame(dayjs(filterValue.date), "day");
|
|
31881
|
+
},
|
|
31882
|
+
},
|
|
31883
|
+
{
|
|
31884
|
+
label: "is before",
|
|
31885
|
+
value: "is before",
|
|
31886
|
+
fn: (row, columnId, filterValue) => {
|
|
31887
|
+
return dayjs(row.getValue(columnId)).isBefore(dayjs(filterValue.date), "day");
|
|
31888
|
+
},
|
|
31889
|
+
},
|
|
31890
|
+
{
|
|
31891
|
+
label: "is after",
|
|
31892
|
+
value: "is after",
|
|
31893
|
+
fn: (row, columnId, filterValue) => {
|
|
31894
|
+
return dayjs(row.getValue(columnId)).isAfter(dayjs(filterValue.date), "day");
|
|
31895
|
+
},
|
|
31896
|
+
},
|
|
31897
|
+
{
|
|
31898
|
+
label: "is between",
|
|
31899
|
+
value: "is between",
|
|
31900
|
+
fn: (row, columnId, filterValue) => {
|
|
31901
|
+
return (dayjs(row.getValue(columnId)).isSameOrAfter(dayjs(filterValue.dateRange?.from), "day") &&
|
|
31902
|
+
dayjs(row.getValue(columnId)).isSameOrBefore(dayjs(filterValue.dateRange?.to), "day"));
|
|
31903
|
+
},
|
|
31904
|
+
component: "rangePicker",
|
|
31905
|
+
},
|
|
31906
|
+
],
|
|
31907
|
+
};
|
|
31636
31908
|
|
|
31637
|
-
const
|
|
31909
|
+
const getFilterValueType = ({ filterOperation, columnType, }) => {
|
|
31910
|
+
if (filterOperation?.component) {
|
|
31911
|
+
return filterOperation?.component;
|
|
31912
|
+
}
|
|
31913
|
+
else if (columnType === columnTypesMap.date) {
|
|
31914
|
+
return filterValueTypeMap.datePicker;
|
|
31915
|
+
}
|
|
31916
|
+
else if (columnType === columnTypesMap.select) {
|
|
31917
|
+
return filterValueTypeMap.select;
|
|
31918
|
+
}
|
|
31919
|
+
else {
|
|
31920
|
+
return filterValueTypeMap.text;
|
|
31921
|
+
}
|
|
31922
|
+
};
|
|
31923
|
+
const FilterValues = ({ columnType = filterValueTypeMap.text, options = [], onValueChange, filterOperation, ...props }) => {
|
|
31924
|
+
const [value, setValue] = useState({
|
|
31925
|
+
value: "",
|
|
31926
|
+
date: new Date(),
|
|
31927
|
+
dateRange: {
|
|
31928
|
+
to: new Date(),
|
|
31929
|
+
from: new Date(),
|
|
31930
|
+
},
|
|
31931
|
+
});
|
|
31932
|
+
const valueType = getFilterValueType({ filterOperation, columnType });
|
|
31933
|
+
useEffect(() => {
|
|
31934
|
+
if (onValueChange) {
|
|
31935
|
+
onValueChange(value);
|
|
31936
|
+
}
|
|
31937
|
+
}, [value]);
|
|
31938
|
+
switch (valueType) {
|
|
31939
|
+
case filterValueTypeMap.select:
|
|
31940
|
+
return (jsxRuntimeExports$1.jsxs(Select, { value: value.value, onValueChange: (value) => setValue({ value }), children: [jsxRuntimeExports$1.jsx(Select.Trigger, { children: jsxRuntimeExports$1.jsx(Select.Value, { placeholder: "Select value" }) }), jsxRuntimeExports$1.jsx(Select.Content, { children: options.map((opt) => {
|
|
31941
|
+
return (jsxRuntimeExports$1.jsx(Select.Item, { value: opt.value, children: opt.label || opt.value }, opt.key));
|
|
31942
|
+
}) })] }));
|
|
31943
|
+
case filterValueTypeMap.datePicker:
|
|
31944
|
+
return (jsxRuntimeExports$1.jsx(DatePicker, { onSelect: (date) => setValue({ date }), value: value.date }));
|
|
31945
|
+
case filterValueTypeMap.rangePicker:
|
|
31946
|
+
return (jsxRuntimeExports$1.jsx(RangePicker, { onSelect: (dateRange) => setValue({ dateRange }), value: value.dateRange }));
|
|
31947
|
+
default:
|
|
31948
|
+
return (jsxRuntimeExports$1.jsx(TextField, { value: value.value, onChange: (e) => setValue({ value: e.target.value }) }));
|
|
31949
|
+
}
|
|
31950
|
+
};
|
|
31951
|
+
const Operation = ({ columnType = columnTypesMap.text, onOperationSelect, }) => {
|
|
31952
|
+
const options = operationsOptions[columnType] || [];
|
|
31953
|
+
const [value, setValue] = useState(options?.[0]?.value);
|
|
31954
|
+
useEffect(() => {
|
|
31955
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
31956
|
+
if (selectedOption) {
|
|
31957
|
+
onOperationSelect(selectedOption);
|
|
31958
|
+
}
|
|
31959
|
+
}, [value]);
|
|
31960
|
+
return (jsxRuntimeExports$1.jsxs(Select, { defaultValue: value, onValueChange: setValue, children: [jsxRuntimeExports$1.jsx(Select.Trigger, { className: styles$4.filterOperator, children: jsxRuntimeExports$1.jsx(Select.Value, { placeholder: "Select operation" }) }), jsxRuntimeExports$1.jsx(Select.Content, { children: options.map((opt) => {
|
|
31961
|
+
return (jsxRuntimeExports$1.jsx(Select.Item, { value: opt.label, children: opt.label }, opt.label));
|
|
31962
|
+
}) })] }));
|
|
31963
|
+
};
|
|
31964
|
+
const FilteredChip = ({ column, updateColumnCustomFilter, }) => {
|
|
31965
|
+
const [filterOperation, setFilterOperation] = useState();
|
|
31966
|
+
const [filterValue, setFilterValue] = useState();
|
|
31638
31967
|
const { table, removeFilterColumn } = useTable();
|
|
31639
31968
|
const { filterVariant } = column?.columnDef;
|
|
31640
31969
|
const options = column?.columnDef?.meta?.data || [];
|
|
31641
|
-
|
|
31642
|
-
const
|
|
31643
|
-
|
|
31644
|
-
|
|
31645
|
-
|
|
31646
|
-
|
|
31647
|
-
|
|
31648
|
-
new Set(column?.getFilterValue());
|
|
31649
|
-
return (jsxRuntimeExports$1.jsxs(Select, { children: [jsxRuntimeExports$1.jsx(Select.Trigger, { children: jsxRuntimeExports$1.jsx(Select.Value, { placeholder: "Select a value" }) }), jsxRuntimeExports$1.jsx(Select.Content, { children: jsxRuntimeExports$1.jsx(Select.Group, { children: options.map((option) => (jsxRuntimeExports$1.jsx(Select.Item, { value: option.value, children: option?.label || option?.value }, option.value))) }) })] }));
|
|
31650
|
-
}
|
|
31651
|
-
default: {
|
|
31652
|
-
const selectedValues = new Set(column?.getFilterValue());
|
|
31653
|
-
return (jsxRuntimeExports$1.jsxs(Popover, { children: [jsxRuntimeExports$1.jsx(Popover.Trigger, { asChild: true, children: jsxRuntimeExports$1.jsxs(Button$1, { children: [selectedValues.size, " selected"] }) }), jsxRuntimeExports$1.jsx(Popover.Content, { align: "start", style: { padding: 0 }, children: jsxRuntimeExports$1.jsxs(Command, { children: [jsxRuntimeExports$1.jsx(Command.Input, {}), jsxRuntimeExports$1.jsxs(Command.List, { children: [jsxRuntimeExports$1.jsx(Command.Empty, { children: "No results found." }), jsxRuntimeExports$1.jsx(Command.Group, { children: options.map((option) => {
|
|
31654
|
-
const isSelected = selectedValues.has(option.value);
|
|
31655
|
-
return (jsxRuntimeExports$1.jsx(Command.Item, { onSelect: () => {
|
|
31656
|
-
if (isSelected) {
|
|
31657
|
-
selectedValues.delete(option.value);
|
|
31658
|
-
}
|
|
31659
|
-
else {
|
|
31660
|
-
selectedValues.add(option.value);
|
|
31661
|
-
}
|
|
31662
|
-
const filterValues = Array.from(selectedValues);
|
|
31663
|
-
console.log(selectedValues, filterValues);
|
|
31664
|
-
column?.setFilterValue(filterValues.length ? filterValues : undefined);
|
|
31665
|
-
}, children: jsxRuntimeExports$1.jsxs(Flex, { justify: "between", gap: "small", children: [jsxRuntimeExports$1.jsxs(Flex, { align: "center", gap: "small", children: [jsxRuntimeExports$1.jsx(Checkbox, { checked: isSelected }), option.icon && (jsxRuntimeExports$1.jsx(option.icon, { className: "mr-2 h-4 w-4 text-muted-foreground" })), jsxRuntimeExports$1.jsx("span", { children: option.label })] }), facets?.get(option.value) && (jsxRuntimeExports$1.jsx("span", { children: facets.get(option.value) }))] }) }, option.value));
|
|
31666
|
-
}) }), selectedValues.size > 0 && (jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsx(Command.Separator, {}), jsxRuntimeExports$1.jsx(Command.Group, { children: jsxRuntimeExports$1.jsx(Command.Item, { onSelect: () => column?.setFilterValue(undefined), className: "justify-center text-center", children: "Clear filters" }) })] }))] })] }) })] }));
|
|
31667
|
-
}
|
|
31970
|
+
column?.getFacetedUniqueValues();
|
|
31971
|
+
const columnHeader = column?.columnDef?.header;
|
|
31972
|
+
const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
|
|
31973
|
+
useEffect(() => {
|
|
31974
|
+
if (filterOperation?.fn && filterValue) {
|
|
31975
|
+
updateColumnCustomFilter(column.id, filterOperation?.fn);
|
|
31976
|
+
column.setFilterValue(filterValue);
|
|
31668
31977
|
}
|
|
31669
|
-
};
|
|
31670
|
-
|
|
31671
|
-
|
|
31672
|
-
|
|
31673
|
-
|
|
31978
|
+
}, [filterOperation, filterValue]);
|
|
31979
|
+
function removeFilter() {
|
|
31980
|
+
column.setFilterValue(undefined);
|
|
31981
|
+
removeFilterColumn(column.id);
|
|
31982
|
+
setFilterOperation(undefined);
|
|
31983
|
+
setFilterValue({});
|
|
31984
|
+
}
|
|
31985
|
+
return (jsxRuntimeExports$1.jsxs(Box, { className: styles$4.chip, children: [jsxRuntimeExports$1.jsx(Text, { className: styles$4.filterText, children: columnName }), jsxRuntimeExports$1.jsx(Operation, { columnType: filterVariant, onOperationSelect: setFilterOperation }), filterOperation?.hideValueField ? null : (jsxRuntimeExports$1.jsx(FilterValues, { columnType: filterVariant, options: options, onValueChange: setFilterValue, filterOperation: filterOperation })), jsxRuntimeExports$1.jsx(Flex, { children: jsxRuntimeExports$1.jsx(Cross1Icon, { height: "12", width: "12", onClick: removeFilter }) })] }));
|
|
31674
31986
|
};
|
|
31675
31987
|
|
|
31676
31988
|
function DataTableFilterChips(props) {
|
|
31677
|
-
const { filteredColumns, table } = useTable();
|
|
31989
|
+
const { filteredColumns, table, updateColumnCustomFilter } = useTable();
|
|
31678
31990
|
const tableColumns = table
|
|
31679
31991
|
.getAllColumns()
|
|
31680
31992
|
.filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide());
|
|
@@ -31682,7 +31994,7 @@ function DataTableFilterChips(props) {
|
|
|
31682
31994
|
return null;
|
|
31683
31995
|
return (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", className: styles$4.chipWrapper, ...props, children: [filteredColumns.map((filter, index) => {
|
|
31684
31996
|
const filteredColumn = table.getColumn(filter);
|
|
31685
|
-
return jsxRuntimeExports$1.jsx(FilteredChip, { column: filteredColumn }, index);
|
|
31997
|
+
return (jsxRuntimeExports$1.jsx(FilteredChip, { column: filteredColumn, updateColumnCustomFilter: updateColumnCustomFilter }, index));
|
|
31686
31998
|
}), filteredColumns.length < tableColumns.length && (jsxRuntimeExports$1.jsx(DataTableFilterOptions, { variant: "ghost", style: { border: "none", background: "none" }, children: jsxRuntimeExports$1.jsx(PlusIcon, { width: 16, height: 16 }) }))] }));
|
|
31687
31999
|
}
|
|
31688
32000
|
|
|
@@ -31776,7 +32088,99 @@ const Table = Object.assign(TableRoot, {
|
|
|
31776
32088
|
Caption: TableCaption,
|
|
31777
32089
|
});
|
|
31778
32090
|
|
|
31779
|
-
|
|
32091
|
+
/**
|
|
32092
|
+
* @internal
|
|
32093
|
+
*/
|
|
32094
|
+
const SkeletonThemeContext = React__default.createContext({});
|
|
32095
|
+
|
|
32096
|
+
/* eslint-disable react/no-array-index-key */
|
|
32097
|
+
const defaultEnableAnimation = true;
|
|
32098
|
+
// For performance & cleanliness, don't add any inline styles unless we have to
|
|
32099
|
+
function styleOptionsToCssProperties({ baseColor, highlightColor, width, height, borderRadius, circle, direction, duration, enableAnimation = defaultEnableAnimation, }) {
|
|
32100
|
+
const style = {};
|
|
32101
|
+
if (direction === 'rtl')
|
|
32102
|
+
style['--animation-direction'] = 'reverse';
|
|
32103
|
+
if (typeof duration === 'number')
|
|
32104
|
+
style['--animation-duration'] = `${duration}s`;
|
|
32105
|
+
if (!enableAnimation)
|
|
32106
|
+
style['--pseudo-element-display'] = 'none';
|
|
32107
|
+
if (typeof width === 'string' || typeof width === 'number')
|
|
32108
|
+
style.width = width;
|
|
32109
|
+
if (typeof height === 'string' || typeof height === 'number')
|
|
32110
|
+
style.height = height;
|
|
32111
|
+
if (typeof borderRadius === 'string' || typeof borderRadius === 'number')
|
|
32112
|
+
style.borderRadius = borderRadius;
|
|
32113
|
+
if (circle)
|
|
32114
|
+
style.borderRadius = '50%';
|
|
32115
|
+
if (typeof baseColor !== 'undefined')
|
|
32116
|
+
style['--base-color'] = baseColor;
|
|
32117
|
+
if (typeof highlightColor !== 'undefined')
|
|
32118
|
+
style['--highlight-color'] = highlightColor;
|
|
32119
|
+
return style;
|
|
32120
|
+
}
|
|
32121
|
+
function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp, ...originalPropsStyleOptions }) {
|
|
32122
|
+
var _a, _b, _c;
|
|
32123
|
+
const contextStyleOptions = React__default.useContext(SkeletonThemeContext);
|
|
32124
|
+
const propsStyleOptions = { ...originalPropsStyleOptions };
|
|
32125
|
+
// DO NOT overwrite style options from the context if `propsStyleOptions`
|
|
32126
|
+
// has properties explicity set to undefined
|
|
32127
|
+
for (const [key, value] of Object.entries(originalPropsStyleOptions)) {
|
|
32128
|
+
if (typeof value === 'undefined') {
|
|
32129
|
+
delete propsStyleOptions[key];
|
|
32130
|
+
}
|
|
32131
|
+
}
|
|
32132
|
+
// Props take priority over context
|
|
32133
|
+
const styleOptions = {
|
|
32134
|
+
...contextStyleOptions,
|
|
32135
|
+
...propsStyleOptions,
|
|
32136
|
+
circle,
|
|
32137
|
+
};
|
|
32138
|
+
// `styleProp` has the least priority out of everything
|
|
32139
|
+
const style = {
|
|
32140
|
+
...styleProp,
|
|
32141
|
+
...styleOptionsToCssProperties(styleOptions),
|
|
32142
|
+
};
|
|
32143
|
+
let className = 'react-loading-skeleton';
|
|
32144
|
+
if (customClassName)
|
|
32145
|
+
className += ` ${customClassName}`;
|
|
32146
|
+
const inline = (_a = styleOptions.inline) !== null && _a !== void 0 ? _a : false;
|
|
32147
|
+
const elements = [];
|
|
32148
|
+
const countCeil = Math.ceil(count);
|
|
32149
|
+
for (let i = 0; i < countCeil; i++) {
|
|
32150
|
+
let thisStyle = style;
|
|
32151
|
+
if (countCeil > count && i === countCeil - 1) {
|
|
32152
|
+
// count is not an integer and we've reached the last iteration of
|
|
32153
|
+
// the loop, so add a "fractional" skeleton.
|
|
32154
|
+
//
|
|
32155
|
+
// For example, if count is 3.5, we've already added 3 full
|
|
32156
|
+
// skeletons, so now we add one more skeleton that is 0.5 times the
|
|
32157
|
+
// original width.
|
|
32158
|
+
const width = (_b = thisStyle.width) !== null && _b !== void 0 ? _b : '100%'; // 100% is the default since that's what's in the CSS
|
|
32159
|
+
const fractionalPart = count % 1;
|
|
32160
|
+
const fractionalWidth = typeof width === 'number'
|
|
32161
|
+
? width * fractionalPart
|
|
32162
|
+
: `calc(${width} * ${fractionalPart})`;
|
|
32163
|
+
thisStyle = { ...thisStyle, width: fractionalWidth };
|
|
32164
|
+
}
|
|
32165
|
+
const skeletonSpan = (React__default.createElement("span", { className: className, style: thisStyle, key: i }, "\u200C"));
|
|
32166
|
+
if (inline) {
|
|
32167
|
+
elements.push(skeletonSpan);
|
|
32168
|
+
}
|
|
32169
|
+
else {
|
|
32170
|
+
// Without the <br />, the skeleton lines will all run together if
|
|
32171
|
+
// `width` is specified
|
|
32172
|
+
elements.push(React__default.createElement(React__default.Fragment, { key: i },
|
|
32173
|
+
skeletonSpan,
|
|
32174
|
+
React__default.createElement("br", null)));
|
|
32175
|
+
}
|
|
32176
|
+
}
|
|
32177
|
+
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
|
|
32178
|
+
? elements.map((el, i) => React__default.createElement(Wrapper, { key: i }, el))
|
|
32179
|
+
: elements));
|
|
32180
|
+
}
|
|
32181
|
+
|
|
32182
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, ...props }) {
|
|
32183
|
+
const [tableCustomFilter, setTableCustomFilter] = React__default.useState({});
|
|
31780
32184
|
const convertedChildren = Children.toArray(children);
|
|
31781
32185
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
|
|
31782
32186
|
const footer = convertedChildren.find((child) => child.type === DataTableFooter) || null;
|
|
@@ -31788,9 +32192,23 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, Shoul
|
|
|
31788
32192
|
const [rowSelection, setRowSelection] = React__default.useState({});
|
|
31789
32193
|
const [globalFilter, setGlobalFilter] = React__default.useState("");
|
|
31790
32194
|
const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
|
|
32195
|
+
const columnWithCustomFilter = columns.map((col) => {
|
|
32196
|
+
// @ts-ignore;
|
|
32197
|
+
const colId = col.id || col?.accessorKey;
|
|
32198
|
+
if (colId && tableCustomFilter.hasOwnProperty(colId)) {
|
|
32199
|
+
col.filterFn = tableCustomFilter[colId];
|
|
32200
|
+
}
|
|
32201
|
+
col.cell = isLoading
|
|
32202
|
+
? () => (jsxRuntimeExports$1.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }))
|
|
32203
|
+
: col.cell;
|
|
32204
|
+
return col;
|
|
32205
|
+
});
|
|
32206
|
+
const updateColumnCustomFilter = (id, filterFn) => {
|
|
32207
|
+
setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
|
|
32208
|
+
};
|
|
31791
32209
|
const table = useReactTable({
|
|
31792
32210
|
data,
|
|
31793
|
-
columns,
|
|
32211
|
+
columns: columnWithCustomFilter,
|
|
31794
32212
|
globalFilterFn: "auto",
|
|
31795
32213
|
enableRowSelection: true,
|
|
31796
32214
|
manualPagination: true,
|
|
@@ -31826,6 +32244,8 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, Shoul
|
|
|
31826
32244
|
resetColumns,
|
|
31827
32245
|
onGlobalFilterChange: setGlobalFilter,
|
|
31828
32246
|
onChange: () => ({}),
|
|
32247
|
+
tableCustomFilter,
|
|
32248
|
+
updateColumnCustomFilter,
|
|
31829
32249
|
}, children: [jsxRuntimeExports$1.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports$1.jsxs(Flex, { className: styles$4.tableContainer, style: parentStyle, children: [jsxRuntimeExports$1.jsxs(Table, { ...props, style: tableStyle, children: [jsxRuntimeExports$1.jsx(Table.Header, { children: ShouldShowHeader
|
|
31830
32250
|
? table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports$1.jsx(Table.Row, { children: headerGroup.headers.map((header, index) => {
|
|
31831
32251
|
return (jsxRuntimeExports$1.jsx(Table.Head, { style: {
|
|
@@ -32303,5 +32723,5 @@ function Title({ children, className, size, ...props }) {
|
|
|
32303
32723
|
return (jsxRuntimeExports$1.jsx("span", { className: title({ size, className }), ...props, children: children }));
|
|
32304
32724
|
}
|
|
32305
32725
|
|
|
32306
|
-
export { Accordion, Avatar, badge$1 as Badge, Body, Box, Button$1 as Button, Calendar, Checkbox, Command, Container, DataTable, Dialog, Display, DropdownMenu, EmptyState, ErrorState, Flex, Grid, Headline, Image, InputField, Label, Link, Popover, RSelect, Radio, ScrollArea, Select, Separator, Sheet, Sidebar, Switch, Table, Tabs, Text, TextField, Textarea, ThemeProvider, ThemeSwitcher, Title, ToggleGroup, Tooltip, useTable, useTheme };
|
|
32726
|
+
export { Accordion, Avatar, badge$1 as Badge, Body, Box, Button$1 as Button, Calendar, Checkbox, Command, Container, DataTable, DatePicker, Dialog, Display, DropdownMenu, EmptyState, ErrorState, Flex, Grid, Headline, Image, InputField, Label, Link, Popover, RSelect, Radio, RangePicker, ScrollArea, Select, Separator, Sheet, Sidebar, Switch, Table, Tabs, Text, TextField, Textarea, ThemeProvider, ThemeSwitcher, Title, ToggleGroup, Tooltip, useTable, useTheme };
|
|
32307
32727
|
//# sourceMappingURL=index.js.map
|