@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.cjs
CHANGED
|
@@ -23,6 +23,8 @@ function _interopNamespaceDefault(e) {
|
|
|
23
23
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
24
24
|
var $7SXl2$reactdom__namespace = /*#__PURE__*/_interopNamespaceDefault($7SXl2$reactdom);
|
|
25
25
|
|
|
26
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
27
|
+
|
|
26
28
|
function getDefaultExportFromCjs (x) {
|
|
27
29
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
28
30
|
}
|
|
@@ -2446,6 +2448,28 @@ var ArrowUpIcon = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
2446
2448
|
}));
|
|
2447
2449
|
});
|
|
2448
2450
|
|
|
2451
|
+
var _excluded$I = ["color"];
|
|
2452
|
+
var CalendarIcon = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
2453
|
+
var _ref$color = _ref.color,
|
|
2454
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
2455
|
+
props = _objectWithoutPropertiesLoose$1(_ref, _excluded$I);
|
|
2456
|
+
|
|
2457
|
+
return React.createElement("svg", Object.assign({
|
|
2458
|
+
width: "15",
|
|
2459
|
+
height: "15",
|
|
2460
|
+
viewBox: "0 0 15 15",
|
|
2461
|
+
fill: "none",
|
|
2462
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2463
|
+
}, props, {
|
|
2464
|
+
ref: forwardedRef
|
|
2465
|
+
}), React.createElement("path", {
|
|
2466
|
+
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",
|
|
2467
|
+
fill: color,
|
|
2468
|
+
fillRule: "evenodd",
|
|
2469
|
+
clipRule: "evenodd"
|
|
2470
|
+
}));
|
|
2471
|
+
});
|
|
2472
|
+
|
|
2449
2473
|
var _excluded$T = ["color"];
|
|
2450
2474
|
var CheckIcon = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
2451
2475
|
var _ref$color = _ref.color,
|
|
@@ -9719,8 +9743,8 @@ const getHeadline = (status = "Something gone wrong") => {
|
|
|
9719
9743
|
}
|
|
9720
9744
|
};
|
|
9721
9745
|
const errorstate = cva(styles$n.errorstate);
|
|
9722
|
-
function ErrorState({ children, className, status, icon, ...props }) {
|
|
9723
|
-
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) })] })] }) }));
|
|
9746
|
+
function ErrorState({ children, className, status, icon, message, ...props }) {
|
|
9747
|
+
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) })] })] }) }));
|
|
9724
9748
|
}
|
|
9725
9749
|
|
|
9726
9750
|
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"};
|
|
@@ -10035,7 +10059,8 @@ const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f
|
|
|
10035
10059
|
|
|
10036
10060
|
var styles$i = {"popover":"popover-module_popover__Jh8Hg"};
|
|
10037
10061
|
|
|
10038
|
-
const
|
|
10062
|
+
const popoverContent = cva(styles$i.popover);
|
|
10063
|
+
const PopoverContent = React.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 }) })));
|
|
10039
10064
|
PopoverContent.displayName = $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2.displayName;
|
|
10040
10065
|
const Popover = Object.assign($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, {
|
|
10041
10066
|
Trigger: $cb5cc270b50c6fcd$export$41fb9f06171c75f4,
|
|
@@ -28121,7 +28146,7 @@ function DayPicker(props) {
|
|
|
28121
28146
|
return (jsxRuntimeExports.jsx(RootProvider, __assign({}, props, { children: jsxRuntimeExports.jsx(Root, { initialProps: props }) })));
|
|
28122
28147
|
}
|
|
28123
28148
|
|
|
28124
|
-
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"};
|
|
28149
|
+
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"};
|
|
28125
28150
|
|
|
28126
28151
|
const root$1 = cva(styles$6.calendarRoot);
|
|
28127
28152
|
const Calendar = function ({ className, classNames, showOutsideDays = true, ...props }) {
|
|
@@ -28145,10 +28170,100 @@ const Calendar = function ({ className, classNames, showOutsideDays = true, ...p
|
|
|
28145
28170
|
day_range_middle: styles$6.day_range_middle,
|
|
28146
28171
|
day_range_end: styles$6.day_range_end,
|
|
28147
28172
|
day_range_start: styles$6.day_range_start,
|
|
28173
|
+
months: styles$6.months,
|
|
28148
28174
|
...classNames,
|
|
28149
28175
|
}, className: root$1({ className }), ...props }));
|
|
28150
28176
|
};
|
|
28151
28177
|
|
|
28178
|
+
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"};
|
|
28179
|
+
|
|
28180
|
+
const textfield = cva(styles$5.textfield, {
|
|
28181
|
+
variants: {
|
|
28182
|
+
size: {
|
|
28183
|
+
small: styles$5["textfield-sm"],
|
|
28184
|
+
medium: styles$5["textfield-md"],
|
|
28185
|
+
},
|
|
28186
|
+
state: {
|
|
28187
|
+
invalid: styles$5["textfield-invalid"],
|
|
28188
|
+
valid: styles$5["textfield-valid"],
|
|
28189
|
+
},
|
|
28190
|
+
hasLeadingElement: {
|
|
28191
|
+
true: styles$5["textfield-leading"],
|
|
28192
|
+
},
|
|
28193
|
+
hasTrailingElement: {
|
|
28194
|
+
true: styles$5["textfield-trailing"],
|
|
28195
|
+
},
|
|
28196
|
+
},
|
|
28197
|
+
defaultVariants: {
|
|
28198
|
+
size: "small",
|
|
28199
|
+
},
|
|
28200
|
+
});
|
|
28201
|
+
const TextField = React.forwardRef(({ leading, trailing, className, src, size, state, style, ...props }, ref) => {
|
|
28202
|
+
const hasLeadingElement = Boolean(leading);
|
|
28203
|
+
const hasTrailingElement = Boolean(trailing);
|
|
28204
|
+
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({
|
|
28205
|
+
size,
|
|
28206
|
+
state,
|
|
28207
|
+
className,
|
|
28208
|
+
hasLeadingElement,
|
|
28209
|
+
hasTrailingElement,
|
|
28210
|
+
})), ...props, ref: ref }), hasTrailingElement ? (jsxRuntimeExports$1.jsx(Flex, { style: { position: "absolute", right: "8px" }, children: trailing })) : null] }));
|
|
28211
|
+
});
|
|
28212
|
+
TextField.displayName = "TextField";
|
|
28213
|
+
|
|
28214
|
+
var dayjs_min = {exports: {}};
|
|
28215
|
+
|
|
28216
|
+
(function (module, exports) {
|
|
28217
|
+
!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}));
|
|
28218
|
+
} (dayjs_min));
|
|
28219
|
+
|
|
28220
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
28221
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
28222
|
+
|
|
28223
|
+
function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, value = new Date(), onSelect = () => { }, }) {
|
|
28224
|
+
const [showCalendar, setShowCalendar] = React.useState(false);
|
|
28225
|
+
const dateValue = dayjs(value).format(dateFormat);
|
|
28226
|
+
const handleSelect = (day, selectedDay) => {
|
|
28227
|
+
const selected = day || selectedDay;
|
|
28228
|
+
onSelect(selected);
|
|
28229
|
+
setShowCalendar(false);
|
|
28230
|
+
};
|
|
28231
|
+
function onOpenChange(open) {
|
|
28232
|
+
setShowCalendar(Boolean(open));
|
|
28233
|
+
}
|
|
28234
|
+
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 }) })] }));
|
|
28235
|
+
}
|
|
28236
|
+
|
|
28237
|
+
function RangePicker({ side = "top", dateFormat = "DD/MM/YYYY", textFieldProps, calendarProps, onSelect = () => { }, value = {
|
|
28238
|
+
to: new Date(),
|
|
28239
|
+
from: new Date(),
|
|
28240
|
+
}, pickerGroupClassName, }) {
|
|
28241
|
+
const [showCalendar, setShowCalendar] = React.useState(false);
|
|
28242
|
+
const [currentRangeField, setCurrentRangeField] = React.useState("from");
|
|
28243
|
+
const startDate = dayjs(value.from).format(dateFormat);
|
|
28244
|
+
const endDate = dayjs(value.to).format(dateFormat);
|
|
28245
|
+
// 1st click will select the start date.
|
|
28246
|
+
// 2nd click will select the end date.
|
|
28247
|
+
// 3rd click will select the start date again.
|
|
28248
|
+
const handleSelect = (range, selectedDay) => {
|
|
28249
|
+
const from = value?.from || range?.from;
|
|
28250
|
+
if (currentRangeField === "to" && dayjs(selectedDay).isAfter(dayjs(from))) {
|
|
28251
|
+
// update the end date
|
|
28252
|
+
onSelect({ from, to: selectedDay });
|
|
28253
|
+
setCurrentRangeField("from");
|
|
28254
|
+
}
|
|
28255
|
+
else {
|
|
28256
|
+
// reset the range and select start day
|
|
28257
|
+
onSelect({ from: selectedDay });
|
|
28258
|
+
setCurrentRangeField("to");
|
|
28259
|
+
}
|
|
28260
|
+
};
|
|
28261
|
+
function onOpenChange(open) {
|
|
28262
|
+
setShowCalendar(Boolean(open));
|
|
28263
|
+
}
|
|
28264
|
+
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 }) })] }));
|
|
28265
|
+
}
|
|
28266
|
+
|
|
28152
28267
|
/**
|
|
28153
28268
|
* table-core
|
|
28154
28269
|
*
|
|
@@ -31627,74 +31742,271 @@ function DataTableFilterOptions({ children, ...props }) {
|
|
|
31627
31742
|
})] })) : null] }));
|
|
31628
31743
|
}
|
|
31629
31744
|
|
|
31630
|
-
var styles$
|
|
31745
|
+
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"};
|
|
31631
31746
|
|
|
31632
|
-
const
|
|
31633
|
-
|
|
31634
|
-
|
|
31635
|
-
|
|
31636
|
-
|
|
31747
|
+
const columnTypesMap = {
|
|
31748
|
+
select: "select",
|
|
31749
|
+
number: "number",
|
|
31750
|
+
text: "text",
|
|
31751
|
+
date: "date",
|
|
31752
|
+
};
|
|
31753
|
+
const filterValueTypeMap = {
|
|
31754
|
+
select: "select",
|
|
31755
|
+
text: "text",
|
|
31756
|
+
datePicker: "datePicker",
|
|
31757
|
+
rangePicker: "rangePicker",
|
|
31758
|
+
};
|
|
31759
|
+
|
|
31760
|
+
var isSameOrAfter$1 = {exports: {}};
|
|
31761
|
+
|
|
31762
|
+
(function (module, exports) {
|
|
31763
|
+
!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)};}}));
|
|
31764
|
+
} (isSameOrAfter$1));
|
|
31765
|
+
|
|
31766
|
+
var isSameOrAfterExports = isSameOrAfter$1.exports;
|
|
31767
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
31768
|
+
|
|
31769
|
+
var isSameOrBefore$1 = {exports: {}};
|
|
31770
|
+
|
|
31771
|
+
(function (module, exports) {
|
|
31772
|
+
!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)};}}));
|
|
31773
|
+
} (isSameOrBefore$1));
|
|
31774
|
+
|
|
31775
|
+
var isSameOrBeforeExports = isSameOrBefore$1.exports;
|
|
31776
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
31777
|
+
|
|
31778
|
+
dayjs.extend(isSameOrAfter);
|
|
31779
|
+
dayjs.extend(isSameOrBefore);
|
|
31780
|
+
const operationsOptions = {
|
|
31781
|
+
[columnTypesMap.select]: [
|
|
31782
|
+
{
|
|
31783
|
+
label: "is",
|
|
31784
|
+
value: "is",
|
|
31785
|
+
fn: (row, columnId, filterValue) => {
|
|
31786
|
+
return row.getValue(columnId) === filterValue.value;
|
|
31787
|
+
},
|
|
31637
31788
|
},
|
|
31638
|
-
|
|
31639
|
-
|
|
31640
|
-
|
|
31789
|
+
{
|
|
31790
|
+
label: "is not",
|
|
31791
|
+
value: "is not",
|
|
31792
|
+
fn: (row, columnId, filterValue) => {
|
|
31793
|
+
return row.getValue(columnId) !== filterValue.value;
|
|
31794
|
+
},
|
|
31641
31795
|
},
|
|
31642
|
-
|
|
31643
|
-
|
|
31796
|
+
],
|
|
31797
|
+
[columnTypesMap.number]: [
|
|
31798
|
+
{
|
|
31799
|
+
label: "=",
|
|
31800
|
+
value: "=",
|
|
31801
|
+
fn: (row, columnId, filterValue) => {
|
|
31802
|
+
return Number(row.getValue(columnId)) === Number(filterValue.value);
|
|
31803
|
+
},
|
|
31644
31804
|
},
|
|
31645
|
-
|
|
31646
|
-
|
|
31647
|
-
|
|
31648
|
-
|
|
31649
|
-
|
|
31650
|
-
|
|
31651
|
-
|
|
31652
|
-
|
|
31653
|
-
|
|
31654
|
-
|
|
31655
|
-
|
|
31805
|
+
{
|
|
31806
|
+
label: "!=",
|
|
31807
|
+
value: "!=",
|
|
31808
|
+
fn: (row, columnId, filterValue) => {
|
|
31809
|
+
return Number(row.getValue(columnId)) !== Number(filterValue.value);
|
|
31810
|
+
},
|
|
31811
|
+
},
|
|
31812
|
+
{
|
|
31813
|
+
label: ">",
|
|
31814
|
+
value: ">",
|
|
31815
|
+
fn: (row, columnId, filterValue) => {
|
|
31816
|
+
return Number(row.getValue(columnId)) > Number(filterValue.value);
|
|
31817
|
+
},
|
|
31818
|
+
},
|
|
31819
|
+
{
|
|
31820
|
+
label: ">=",
|
|
31821
|
+
value: ">=",
|
|
31822
|
+
fn: (row, columnId, filterValue) => {
|
|
31823
|
+
return Number(row.getValue(columnId)) >= Number(filterValue.value);
|
|
31824
|
+
},
|
|
31825
|
+
},
|
|
31826
|
+
{
|
|
31827
|
+
label: "<",
|
|
31828
|
+
value: "<",
|
|
31829
|
+
fn: (row, columnId, filterValue) => {
|
|
31830
|
+
return Number(row.getValue(columnId)) < Number(filterValue.value);
|
|
31831
|
+
},
|
|
31832
|
+
},
|
|
31833
|
+
{
|
|
31834
|
+
label: "<=",
|
|
31835
|
+
value: "<=",
|
|
31836
|
+
fn: (row, columnId, filterValue) => {
|
|
31837
|
+
return Number(row.getValue(columnId)) <= Number(filterValue.value);
|
|
31838
|
+
},
|
|
31839
|
+
},
|
|
31840
|
+
],
|
|
31841
|
+
[columnTypesMap.text]: [
|
|
31842
|
+
{
|
|
31843
|
+
label: "contains",
|
|
31844
|
+
value: "contains",
|
|
31845
|
+
fn: (row, columnId, filterValue) => {
|
|
31846
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31847
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31848
|
+
return columnValue.includes(filterStr);
|
|
31849
|
+
},
|
|
31850
|
+
},
|
|
31851
|
+
{
|
|
31852
|
+
label: "does not contains",
|
|
31853
|
+
value: "does not contains",
|
|
31854
|
+
fn: (row, columnId, filterValue) => {
|
|
31855
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31856
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31857
|
+
return !columnValue.includes(filterStr);
|
|
31858
|
+
},
|
|
31859
|
+
},
|
|
31860
|
+
{
|
|
31861
|
+
label: "starts with",
|
|
31862
|
+
value: "starts with",
|
|
31863
|
+
fn: (row, columnId, filterValue) => {
|
|
31864
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31865
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31866
|
+
return columnValue.startsWith(filterStr);
|
|
31867
|
+
},
|
|
31868
|
+
},
|
|
31869
|
+
{
|
|
31870
|
+
label: "ends with",
|
|
31871
|
+
value: "ends with",
|
|
31872
|
+
fn: (row, columnId, filterValue) => {
|
|
31873
|
+
const columnValue = row.getValue(columnId).toLowerCase();
|
|
31874
|
+
const filterStr = filterValue.value.toLowerCase();
|
|
31875
|
+
return columnValue.endsWith(filterStr);
|
|
31876
|
+
},
|
|
31877
|
+
},
|
|
31878
|
+
{
|
|
31879
|
+
label: "is empty",
|
|
31880
|
+
value: "is empty",
|
|
31881
|
+
fn: (row, columnId, filterValue) => {
|
|
31882
|
+
return row.getValue(columnId).length === 0;
|
|
31883
|
+
},
|
|
31884
|
+
hideValueField: true,
|
|
31885
|
+
},
|
|
31886
|
+
{
|
|
31887
|
+
label: "is not empty",
|
|
31888
|
+
value: "is not empty",
|
|
31889
|
+
fn: (row, columnId, filterValue) => {
|
|
31890
|
+
return row.getValue(columnId).length > 0;
|
|
31891
|
+
},
|
|
31892
|
+
hideValueField: true,
|
|
31893
|
+
},
|
|
31894
|
+
],
|
|
31895
|
+
[columnTypesMap.date]: [
|
|
31896
|
+
{
|
|
31897
|
+
label: "is",
|
|
31898
|
+
value: "is",
|
|
31899
|
+
fn: (row, columnId, filterValue) => {
|
|
31900
|
+
return dayjs(row.getValue(columnId)).isSame(dayjs(filterValue.date), "day");
|
|
31901
|
+
},
|
|
31902
|
+
},
|
|
31903
|
+
{
|
|
31904
|
+
label: "is before",
|
|
31905
|
+
value: "is before",
|
|
31906
|
+
fn: (row, columnId, filterValue) => {
|
|
31907
|
+
return dayjs(row.getValue(columnId)).isBefore(dayjs(filterValue.date), "day");
|
|
31908
|
+
},
|
|
31909
|
+
},
|
|
31910
|
+
{
|
|
31911
|
+
label: "is after",
|
|
31912
|
+
value: "is after",
|
|
31913
|
+
fn: (row, columnId, filterValue) => {
|
|
31914
|
+
return dayjs(row.getValue(columnId)).isAfter(dayjs(filterValue.date), "day");
|
|
31915
|
+
},
|
|
31916
|
+
},
|
|
31917
|
+
{
|
|
31918
|
+
label: "is between",
|
|
31919
|
+
value: "is between",
|
|
31920
|
+
fn: (row, columnId, filterValue) => {
|
|
31921
|
+
return (dayjs(row.getValue(columnId)).isSameOrAfter(dayjs(filterValue.dateRange?.from), "day") &&
|
|
31922
|
+
dayjs(row.getValue(columnId)).isSameOrBefore(dayjs(filterValue.dateRange?.to), "day"));
|
|
31923
|
+
},
|
|
31924
|
+
component: "rangePicker",
|
|
31925
|
+
},
|
|
31926
|
+
],
|
|
31927
|
+
};
|
|
31656
31928
|
|
|
31657
|
-
const
|
|
31929
|
+
const getFilterValueType = ({ filterOperation, columnType, }) => {
|
|
31930
|
+
if (filterOperation?.component) {
|
|
31931
|
+
return filterOperation?.component;
|
|
31932
|
+
}
|
|
31933
|
+
else if (columnType === columnTypesMap.date) {
|
|
31934
|
+
return filterValueTypeMap.datePicker;
|
|
31935
|
+
}
|
|
31936
|
+
else if (columnType === columnTypesMap.select) {
|
|
31937
|
+
return filterValueTypeMap.select;
|
|
31938
|
+
}
|
|
31939
|
+
else {
|
|
31940
|
+
return filterValueTypeMap.text;
|
|
31941
|
+
}
|
|
31942
|
+
};
|
|
31943
|
+
const FilterValues = ({ columnType = filterValueTypeMap.text, options = [], onValueChange, filterOperation, ...props }) => {
|
|
31944
|
+
const [value, setValue] = React.useState({
|
|
31945
|
+
value: "",
|
|
31946
|
+
date: new Date(),
|
|
31947
|
+
dateRange: {
|
|
31948
|
+
to: new Date(),
|
|
31949
|
+
from: new Date(),
|
|
31950
|
+
},
|
|
31951
|
+
});
|
|
31952
|
+
const valueType = getFilterValueType({ filterOperation, columnType });
|
|
31953
|
+
React.useEffect(() => {
|
|
31954
|
+
if (onValueChange) {
|
|
31955
|
+
onValueChange(value);
|
|
31956
|
+
}
|
|
31957
|
+
}, [value]);
|
|
31958
|
+
switch (valueType) {
|
|
31959
|
+
case filterValueTypeMap.select:
|
|
31960
|
+
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) => {
|
|
31961
|
+
return (jsxRuntimeExports$1.jsx(Select.Item, { value: opt.value, children: opt.label || opt.value }, opt.key));
|
|
31962
|
+
}) })] }));
|
|
31963
|
+
case filterValueTypeMap.datePicker:
|
|
31964
|
+
return (jsxRuntimeExports$1.jsx(DatePicker, { onSelect: (date) => setValue({ date }), value: value.date }));
|
|
31965
|
+
case filterValueTypeMap.rangePicker:
|
|
31966
|
+
return (jsxRuntimeExports$1.jsx(RangePicker, { onSelect: (dateRange) => setValue({ dateRange }), value: value.dateRange }));
|
|
31967
|
+
default:
|
|
31968
|
+
return (jsxRuntimeExports$1.jsx(TextField, { value: value.value, onChange: (e) => setValue({ value: e.target.value }) }));
|
|
31969
|
+
}
|
|
31970
|
+
};
|
|
31971
|
+
const Operation = ({ columnType = columnTypesMap.text, onOperationSelect, }) => {
|
|
31972
|
+
const options = operationsOptions[columnType] || [];
|
|
31973
|
+
const [value, setValue] = React.useState(options?.[0]?.value);
|
|
31974
|
+
React.useEffect(() => {
|
|
31975
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
31976
|
+
if (selectedOption) {
|
|
31977
|
+
onOperationSelect(selectedOption);
|
|
31978
|
+
}
|
|
31979
|
+
}, [value]);
|
|
31980
|
+
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) => {
|
|
31981
|
+
return (jsxRuntimeExports$1.jsx(Select.Item, { value: opt.label, children: opt.label }, opt.label));
|
|
31982
|
+
}) })] }));
|
|
31983
|
+
};
|
|
31984
|
+
const FilteredChip = ({ column, updateColumnCustomFilter, }) => {
|
|
31985
|
+
const [filterOperation, setFilterOperation] = React.useState();
|
|
31986
|
+
const [filterValue, setFilterValue] = React.useState();
|
|
31658
31987
|
const { table, removeFilterColumn } = useTable();
|
|
31659
31988
|
const { filterVariant } = column?.columnDef;
|
|
31660
31989
|
const options = column?.columnDef?.meta?.data || [];
|
|
31661
|
-
|
|
31662
|
-
const
|
|
31663
|
-
|
|
31664
|
-
|
|
31665
|
-
|
|
31666
|
-
|
|
31667
|
-
|
|
31668
|
-
new Set(column?.getFilterValue());
|
|
31669
|
-
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))) }) })] }));
|
|
31670
|
-
}
|
|
31671
|
-
default: {
|
|
31672
|
-
const selectedValues = new Set(column?.getFilterValue());
|
|
31673
|
-
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) => {
|
|
31674
|
-
const isSelected = selectedValues.has(option.value);
|
|
31675
|
-
return (jsxRuntimeExports$1.jsx(Command.Item, { onSelect: () => {
|
|
31676
|
-
if (isSelected) {
|
|
31677
|
-
selectedValues.delete(option.value);
|
|
31678
|
-
}
|
|
31679
|
-
else {
|
|
31680
|
-
selectedValues.add(option.value);
|
|
31681
|
-
}
|
|
31682
|
-
const filterValues = Array.from(selectedValues);
|
|
31683
|
-
console.log(selectedValues, filterValues);
|
|
31684
|
-
column?.setFilterValue(filterValues.length ? filterValues : undefined);
|
|
31685
|
-
}, 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));
|
|
31686
|
-
}) }), 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" }) })] }))] })] }) })] }));
|
|
31687
|
-
}
|
|
31990
|
+
column?.getFacetedUniqueValues();
|
|
31991
|
+
const columnHeader = column?.columnDef?.header;
|
|
31992
|
+
const columnName = (typeof columnHeader === "string" && columnHeader) || column.id;
|
|
31993
|
+
React.useEffect(() => {
|
|
31994
|
+
if (filterOperation?.fn && filterValue) {
|
|
31995
|
+
updateColumnCustomFilter(column.id, filterOperation?.fn);
|
|
31996
|
+
column.setFilterValue(filterValue);
|
|
31688
31997
|
}
|
|
31689
|
-
};
|
|
31690
|
-
|
|
31691
|
-
|
|
31692
|
-
|
|
31693
|
-
|
|
31998
|
+
}, [filterOperation, filterValue]);
|
|
31999
|
+
function removeFilter() {
|
|
32000
|
+
column.setFilterValue(undefined);
|
|
32001
|
+
removeFilterColumn(column.id);
|
|
32002
|
+
setFilterOperation(undefined);
|
|
32003
|
+
setFilterValue({});
|
|
32004
|
+
}
|
|
32005
|
+
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 }) })] }));
|
|
31694
32006
|
};
|
|
31695
32007
|
|
|
31696
32008
|
function DataTableFilterChips(props) {
|
|
31697
|
-
const { filteredColumns, table } = useTable();
|
|
32009
|
+
const { filteredColumns, table, updateColumnCustomFilter } = useTable();
|
|
31698
32010
|
const tableColumns = table
|
|
31699
32011
|
.getAllColumns()
|
|
31700
32012
|
.filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide());
|
|
@@ -31702,7 +32014,7 @@ function DataTableFilterChips(props) {
|
|
|
31702
32014
|
return null;
|
|
31703
32015
|
return (jsxRuntimeExports$1.jsxs(Flex, { gap: "small", align: "center", className: styles$4.chipWrapper, ...props, children: [filteredColumns.map((filter, index) => {
|
|
31704
32016
|
const filteredColumn = table.getColumn(filter);
|
|
31705
|
-
return jsxRuntimeExports$1.jsx(FilteredChip, { column: filteredColumn }, index);
|
|
32017
|
+
return (jsxRuntimeExports$1.jsx(FilteredChip, { column: filteredColumn, updateColumnCustomFilter: updateColumnCustomFilter }, index));
|
|
31706
32018
|
}), filteredColumns.length < tableColumns.length && (jsxRuntimeExports$1.jsx(DataTableFilterOptions, { variant: "ghost", style: { border: "none", background: "none" }, children: jsxRuntimeExports$1.jsx(PlusIcon, { width: 16, height: 16 }) }))] }));
|
|
31707
32019
|
}
|
|
31708
32020
|
|
|
@@ -31796,7 +32108,99 @@ const Table = Object.assign(TableRoot, {
|
|
|
31796
32108
|
Caption: TableCaption,
|
|
31797
32109
|
});
|
|
31798
32110
|
|
|
31799
|
-
|
|
32111
|
+
/**
|
|
32112
|
+
* @internal
|
|
32113
|
+
*/
|
|
32114
|
+
const SkeletonThemeContext = React.createContext({});
|
|
32115
|
+
|
|
32116
|
+
/* eslint-disable react/no-array-index-key */
|
|
32117
|
+
const defaultEnableAnimation = true;
|
|
32118
|
+
// For performance & cleanliness, don't add any inline styles unless we have to
|
|
32119
|
+
function styleOptionsToCssProperties({ baseColor, highlightColor, width, height, borderRadius, circle, direction, duration, enableAnimation = defaultEnableAnimation, }) {
|
|
32120
|
+
const style = {};
|
|
32121
|
+
if (direction === 'rtl')
|
|
32122
|
+
style['--animation-direction'] = 'reverse';
|
|
32123
|
+
if (typeof duration === 'number')
|
|
32124
|
+
style['--animation-duration'] = `${duration}s`;
|
|
32125
|
+
if (!enableAnimation)
|
|
32126
|
+
style['--pseudo-element-display'] = 'none';
|
|
32127
|
+
if (typeof width === 'string' || typeof width === 'number')
|
|
32128
|
+
style.width = width;
|
|
32129
|
+
if (typeof height === 'string' || typeof height === 'number')
|
|
32130
|
+
style.height = height;
|
|
32131
|
+
if (typeof borderRadius === 'string' || typeof borderRadius === 'number')
|
|
32132
|
+
style.borderRadius = borderRadius;
|
|
32133
|
+
if (circle)
|
|
32134
|
+
style.borderRadius = '50%';
|
|
32135
|
+
if (typeof baseColor !== 'undefined')
|
|
32136
|
+
style['--base-color'] = baseColor;
|
|
32137
|
+
if (typeof highlightColor !== 'undefined')
|
|
32138
|
+
style['--highlight-color'] = highlightColor;
|
|
32139
|
+
return style;
|
|
32140
|
+
}
|
|
32141
|
+
function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp, ...originalPropsStyleOptions }) {
|
|
32142
|
+
var _a, _b, _c;
|
|
32143
|
+
const contextStyleOptions = React.useContext(SkeletonThemeContext);
|
|
32144
|
+
const propsStyleOptions = { ...originalPropsStyleOptions };
|
|
32145
|
+
// DO NOT overwrite style options from the context if `propsStyleOptions`
|
|
32146
|
+
// has properties explicity set to undefined
|
|
32147
|
+
for (const [key, value] of Object.entries(originalPropsStyleOptions)) {
|
|
32148
|
+
if (typeof value === 'undefined') {
|
|
32149
|
+
delete propsStyleOptions[key];
|
|
32150
|
+
}
|
|
32151
|
+
}
|
|
32152
|
+
// Props take priority over context
|
|
32153
|
+
const styleOptions = {
|
|
32154
|
+
...contextStyleOptions,
|
|
32155
|
+
...propsStyleOptions,
|
|
32156
|
+
circle,
|
|
32157
|
+
};
|
|
32158
|
+
// `styleProp` has the least priority out of everything
|
|
32159
|
+
const style = {
|
|
32160
|
+
...styleProp,
|
|
32161
|
+
...styleOptionsToCssProperties(styleOptions),
|
|
32162
|
+
};
|
|
32163
|
+
let className = 'react-loading-skeleton';
|
|
32164
|
+
if (customClassName)
|
|
32165
|
+
className += ` ${customClassName}`;
|
|
32166
|
+
const inline = (_a = styleOptions.inline) !== null && _a !== void 0 ? _a : false;
|
|
32167
|
+
const elements = [];
|
|
32168
|
+
const countCeil = Math.ceil(count);
|
|
32169
|
+
for (let i = 0; i < countCeil; i++) {
|
|
32170
|
+
let thisStyle = style;
|
|
32171
|
+
if (countCeil > count && i === countCeil - 1) {
|
|
32172
|
+
// count is not an integer and we've reached the last iteration of
|
|
32173
|
+
// the loop, so add a "fractional" skeleton.
|
|
32174
|
+
//
|
|
32175
|
+
// For example, if count is 3.5, we've already added 3 full
|
|
32176
|
+
// skeletons, so now we add one more skeleton that is 0.5 times the
|
|
32177
|
+
// original width.
|
|
32178
|
+
const width = (_b = thisStyle.width) !== null && _b !== void 0 ? _b : '100%'; // 100% is the default since that's what's in the CSS
|
|
32179
|
+
const fractionalPart = count % 1;
|
|
32180
|
+
const fractionalWidth = typeof width === 'number'
|
|
32181
|
+
? width * fractionalPart
|
|
32182
|
+
: `calc(${width} * ${fractionalPart})`;
|
|
32183
|
+
thisStyle = { ...thisStyle, width: fractionalWidth };
|
|
32184
|
+
}
|
|
32185
|
+
const skeletonSpan = (React.createElement("span", { className: className, style: thisStyle, key: i }, "\u200C"));
|
|
32186
|
+
if (inline) {
|
|
32187
|
+
elements.push(skeletonSpan);
|
|
32188
|
+
}
|
|
32189
|
+
else {
|
|
32190
|
+
// Without the <br />, the skeleton lines will all run together if
|
|
32191
|
+
// `width` is specified
|
|
32192
|
+
elements.push(React.createElement(React.Fragment, { key: i },
|
|
32193
|
+
skeletonSpan,
|
|
32194
|
+
React.createElement("br", null)));
|
|
32195
|
+
}
|
|
32196
|
+
}
|
|
32197
|
+
return (React.createElement("span", { className: containerClassName, "data-testid": containerTestId, "aria-live": "polite", "aria-busy": (_c = styleOptions.enableAnimation) !== null && _c !== void 0 ? _c : defaultEnableAnimation }, Wrapper
|
|
32198
|
+
? elements.map((el, i) => React.createElement(Wrapper, { key: i }, el))
|
|
32199
|
+
: elements));
|
|
32200
|
+
}
|
|
32201
|
+
|
|
32202
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, isLoading = false, ShouldShowHeader = true, ...props }) {
|
|
32203
|
+
const [tableCustomFilter, setTableCustomFilter] = React.useState({});
|
|
31800
32204
|
const convertedChildren = React.Children.toArray(children);
|
|
31801
32205
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || null;
|
|
31802
32206
|
const footer = convertedChildren.find((child) => child.type === DataTableFooter) || null;
|
|
@@ -31808,9 +32212,23 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, Shoul
|
|
|
31808
32212
|
const [rowSelection, setRowSelection] = React.useState({});
|
|
31809
32213
|
const [globalFilter, setGlobalFilter] = React.useState("");
|
|
31810
32214
|
const { filteredColumns, addFilterColumn, removeFilterColumn, resetColumns } = useTableColumn();
|
|
32215
|
+
const columnWithCustomFilter = columns.map((col) => {
|
|
32216
|
+
// @ts-ignore;
|
|
32217
|
+
const colId = col.id || col?.accessorKey;
|
|
32218
|
+
if (colId && tableCustomFilter.hasOwnProperty(colId)) {
|
|
32219
|
+
col.filterFn = tableCustomFilter[colId];
|
|
32220
|
+
}
|
|
32221
|
+
col.cell = isLoading
|
|
32222
|
+
? () => (jsxRuntimeExports$1.jsx(Skeleton, { containerClassName: styles$4.flex1, highlightColor: "var(--background-base)", baseColor: "var(--background-base-hover)" }))
|
|
32223
|
+
: col.cell;
|
|
32224
|
+
return col;
|
|
32225
|
+
});
|
|
32226
|
+
const updateColumnCustomFilter = (id, filterFn) => {
|
|
32227
|
+
setTableCustomFilter((old) => ({ ...old, [id]: filterFn }));
|
|
32228
|
+
};
|
|
31811
32229
|
const table = useReactTable({
|
|
31812
32230
|
data,
|
|
31813
|
-
columns,
|
|
32231
|
+
columns: columnWithCustomFilter,
|
|
31814
32232
|
globalFilterFn: "auto",
|
|
31815
32233
|
enableRowSelection: true,
|
|
31816
32234
|
manualPagination: true,
|
|
@@ -31846,6 +32264,8 @@ function DataTableRoot({ columns, data, emptyState, children, parentStyle, Shoul
|
|
|
31846
32264
|
resetColumns,
|
|
31847
32265
|
onGlobalFilterChange: setGlobalFilter,
|
|
31848
32266
|
onChange: () => ({}),
|
|
32267
|
+
tableCustomFilter,
|
|
32268
|
+
updateColumnCustomFilter,
|
|
31849
32269
|
}, 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
|
|
31850
32270
|
? table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports$1.jsx(Table.Row, { children: headerGroup.headers.map((header, index) => {
|
|
31851
32271
|
return (jsxRuntimeExports$1.jsx(Table.Head, { style: {
|
|
@@ -32334,6 +32754,7 @@ exports.Checkbox = Checkbox;
|
|
|
32334
32754
|
exports.Command = Command;
|
|
32335
32755
|
exports.Container = Container;
|
|
32336
32756
|
exports.DataTable = DataTable;
|
|
32757
|
+
exports.DatePicker = DatePicker;
|
|
32337
32758
|
exports.Dialog = Dialog;
|
|
32338
32759
|
exports.Display = Display;
|
|
32339
32760
|
exports.DropdownMenu = DropdownMenu;
|
|
@@ -32349,6 +32770,7 @@ exports.Link = Link;
|
|
|
32349
32770
|
exports.Popover = Popover;
|
|
32350
32771
|
exports.RSelect = RSelect;
|
|
32351
32772
|
exports.Radio = Radio;
|
|
32773
|
+
exports.RangePicker = RangePicker;
|
|
32352
32774
|
exports.ScrollArea = ScrollArea;
|
|
32353
32775
|
exports.Select = Select;
|
|
32354
32776
|
exports.Separator = Separator;
|