@galaxy-io/dls 1.2.1 → 1.2.3
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/buttons/Button.d.ts +1 -0
- package/dist/buttons/Button.js +8 -7
- package/dist/spreadsheet/SpreadsheetHeaderCell.d.ts +5 -0
- package/dist/spreadsheet/SpreadsheetHeaderCell.js +20 -4
- package/dist/spreadsheet/SpreadsheetRowActionCell.d.ts +5 -0
- package/dist/spreadsheet/SpreadsheetRowActionCell.js +25 -7
- package/dist/styles.css +8 -12
- package/dist/table/InfiniteTable.js +118 -201
- package/package.json +1 -1
- package/dist/dropdown/DropdownButton.d.ts +0 -18
- package/dist/dropdown/DropdownButton.js +0 -179
- package/dist/dropdown/DropdownFooter.d.ts +0 -10
- package/dist/dropdown/DropdownFooter.js +0 -35
- package/dist/dropdown/DropdownItem.d.ts +0 -10
- package/dist/dropdown/DropdownItem.js +0 -38
package/dist/buttons/Button.d.ts
CHANGED
package/dist/buttons/Button.js
CHANGED
|
@@ -11,6 +11,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
//#region src/buttons/Button.tsx
|
|
12
12
|
var ButtonVariant = /* @__PURE__ */ function(ButtonVariant) {
|
|
13
13
|
ButtonVariant["PRIMARY"] = "PRIMARY";
|
|
14
|
+
ButtonVariant["PRIMARY_ALT"] = "PRIMARY_ALT";
|
|
14
15
|
ButtonVariant["SECONDARY"] = "SECONDARY";
|
|
15
16
|
ButtonVariant["TERTIARY"] = "TERTIARY";
|
|
16
17
|
ButtonVariant["SUCCESS"] = "SUCCESS";
|
|
@@ -36,20 +37,20 @@ var _exp6 = () => ({ $size }) => {
|
|
|
36
37
|
return match($size).with("SMALL", () => "24px").with("MEDIUM", () => "28px").with("LARGE", () => "32px").exhaustive();
|
|
37
38
|
};
|
|
38
39
|
var _exp7 = () => ({ theme, $variant }) => {
|
|
39
|
-
return match($variant).with("PRIMARY", () => theme.color.background.galaxy).with("SECONDARY", () => theme.color.background.primary).with("TERTIARY", () => "transparent").with("SUCCESS", () => theme.color.icon.success).with("ERROR", () => theme.color.icon.error).exhaustive();
|
|
40
|
+
return match($variant).with("PRIMARY", () => theme.color.background.galaxy).with("PRIMARY_ALT", () => theme.color.background.primaryAlt).with("SECONDARY", () => theme.color.background.primary).with("TERTIARY", () => "transparent").with("SUCCESS", () => theme.color.icon.success).with("ERROR", () => theme.color.icon.error).exhaustive();
|
|
40
41
|
};
|
|
41
42
|
var _exp8 = () => ({ theme, $variant }) => {
|
|
42
|
-
return match($variant).with("PRIMARY", () => "0.5px solid transparent").with("SECONDARY", () => `0.5px solid ${theme.color.border.primary}`).with("TERTIARY", () => "0.5px solid transparent").with("SUCCESS", () => "0.5px solid transparent").with("ERROR", () => "0.5px solid transparent").exhaustive();
|
|
43
|
+
return match($variant).with("PRIMARY", () => "0.5px solid transparent").with("PRIMARY_ALT", () => `0.5px solid transparent`).with("SECONDARY", () => `0.5px solid ${theme.color.border.primary}`).with("TERTIARY", () => "0.5px solid transparent").with("SUCCESS", () => "0.5px solid transparent").with("ERROR", () => "0.5px solid transparent").exhaustive();
|
|
43
44
|
};
|
|
44
45
|
var _exp9 = () => ({ $cursor }) => $cursor ?? "pointer";
|
|
45
46
|
var _exp0 = () => ({ theme, $variant }) => {
|
|
46
|
-
return match($variant).with("PRIMARY", () => theme.color.background.galaxyAlt).with("SECONDARY", () => theme.color.background.tertiary).with("TERTIARY", () => theme.color.background.secondary).with("SUCCESS", () => theme.color.background.successAlt).with("ERROR", () => theme.color.background.errorAlt).exhaustive();
|
|
47
|
+
return match($variant).with("PRIMARY", () => theme.color.background.galaxyAlt).with("PRIMARY_ALT", () => theme.color.background.secondaryAlt).with("SECONDARY", () => theme.color.background.tertiary).with("TERTIARY", () => theme.color.background.secondary).with("SUCCESS", () => theme.color.background.successAlt).with("ERROR", () => theme.color.background.errorAlt).exhaustive();
|
|
47
48
|
};
|
|
48
49
|
var _exp1 = () => ({ theme, $variant }) => {
|
|
49
|
-
return match($variant).with("PRIMARY", () => theme.color.border.primary).with("SECONDARY", () => theme.color.border.primary).with("TERTIARY", () => theme.color.border.primary).with("SUCCESS", () =>
|
|
50
|
+
return match($variant).with("PRIMARY", () => theme.color.border.primary).with("PRIMARY_ALT", () => theme.color.border.primary).with("SECONDARY", () => theme.color.border.primary).with("TERTIARY", () => theme.color.border.primary).with("SUCCESS", () => theme.color.border.primary).with("ERROR", () => theme.color.border.primary).exhaustive();
|
|
50
51
|
};
|
|
51
52
|
var _exp10 = () => ({ theme, $variant }) => {
|
|
52
|
-
return match($variant).with("PRIMARY", () => theme.color.background.disabled).with("SECONDARY", () => theme.color.background.disabled).with("TERTIARY", () => "transparent").with("SUCCESS", () => theme.color.background.successAlt).with("ERROR", () => theme.color.background.errorAlt).exhaustive();
|
|
53
|
+
return match($variant).with("PRIMARY", () => theme.color.background.disabled).with("PRIMARY_ALT", () => theme.color.background.disabled).with("SECONDARY", () => theme.color.background.disabled).with("TERTIARY", () => "transparent").with("SUCCESS", () => theme.color.background.successAlt).with("ERROR", () => theme.color.background.errorAlt).exhaustive();
|
|
53
54
|
};
|
|
54
55
|
var StyledButton = withTheme(/*#__PURE__*/ styled("button")({
|
|
55
56
|
name: "StyledButton",
|
|
@@ -82,10 +83,10 @@ var LabelWrapper = /*#__PURE__*/ styled("span")({
|
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
function getTextVariant(variant, activeTheme) {
|
|
85
|
-
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? TextVariant.PRIMARY : TextVariant.PRIMARY_ALT).with("SECONDARY", () => TextVariant.PRIMARY).with("TERTIARY", () => TextVariant.PRIMARY).with("SUCCESS", () => TextVariant.PRIMARY).with("ERROR", () => TextVariant.PRIMARY).exhaustive();
|
|
86
|
+
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? TextVariant.PRIMARY : TextVariant.PRIMARY_ALT).with("PRIMARY_ALT", () => TextVariant.PRIMARY_ALT).with("SECONDARY", () => TextVariant.PRIMARY).with("TERTIARY", () => TextVariant.PRIMARY).with("SUCCESS", () => TextVariant.PRIMARY).with("ERROR", () => TextVariant.PRIMARY).exhaustive();
|
|
86
87
|
}
|
|
87
88
|
function getIconVariant(variant, activeTheme) {
|
|
88
|
-
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? IconVariant.PRIMARY : IconVariant.PRIMARY_ALT).with("SECONDARY", () => IconVariant.PRIMARY).with("TERTIARY", () => IconVariant.PRIMARY).with("SUCCESS", () => IconVariant.PRIMARY).with("ERROR", () => IconVariant.PRIMARY).exhaustive();
|
|
89
|
+
return match(variant).with("PRIMARY", () => activeTheme === GalaxyTheme.DARK ? IconVariant.PRIMARY : IconVariant.PRIMARY_ALT).with("PRIMARY_ALT", () => IconVariant.PRIMARY_ALT).with("SECONDARY", () => IconVariant.PRIMARY).with("TERTIARY", () => IconVariant.PRIMARY).with("SUCCESS", () => IconVariant.PRIMARY).with("ERROR", () => IconVariant.PRIMARY).exhaustive();
|
|
89
90
|
}
|
|
90
91
|
var BUTTON_SIZE_TO_TEXT_SIZE_MAP = {
|
|
91
92
|
["SMALL"]: TextSize.BODY_SM,
|
|
@@ -8,6 +8,11 @@ export interface SpreadsheetHeaderCellProps<TData> {
|
|
|
8
8
|
onResizeStart: (columnId: string, clientX: number) => void;
|
|
9
9
|
getAllRows?: () => TData[];
|
|
10
10
|
}
|
|
11
|
+
export interface HeaderCellDropdownItemProps {
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
label: string;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
}
|
|
11
16
|
declare function SpreadsheetHeaderCellInner<TData>({ column, width, pin, pinnedOffset, onResizeStart, getAllRows, }: SpreadsheetHeaderCellProps<TData>): React.JSX.Element;
|
|
12
17
|
declare const SpreadsheetHeaderCell: typeof SpreadsheetHeaderCellInner;
|
|
13
18
|
export default SpreadsheetHeaderCell;
|
|
@@ -4,7 +4,6 @@ import Button, { ButtonSize, ButtonVariant } from "../buttons/Button.js";
|
|
|
4
4
|
import FlexWrapper, { FlexDirection } from "../containers/FlexWrapper.js";
|
|
5
5
|
import { ColumnAlign, ColumnPin } from "../table/InfiniteTable.js";
|
|
6
6
|
import Dropdown, { DropdownPosition } from "../dropdown/Dropdown.js";
|
|
7
|
-
import DropdownItem from "../dropdown/DropdownItem.js";
|
|
8
7
|
/* empty css */
|
|
9
8
|
import { styled } from "@linaria/react";
|
|
10
9
|
import { match } from "ts-pattern";
|
|
@@ -54,6 +53,23 @@ var ResizeHandle = withTheme(/*#__PURE__*/ styled("div")({
|
|
|
54
53
|
propsAsIs: false,
|
|
55
54
|
vars: { "r10tums3-0": [_exp0()] }
|
|
56
55
|
}));
|
|
56
|
+
var _exp1 = () => ({ theme }) => theme.color.background.secondary;
|
|
57
|
+
var HeaderCellDropdownItemWrapper = withTheme(/*#__PURE__*/ styled("button")({
|
|
58
|
+
name: "HeaderCellDropdownItemWrapper",
|
|
59
|
+
class: "hz0qata",
|
|
60
|
+
propsAsIs: false,
|
|
61
|
+
vars: { "hz0qata-0": [_exp1()] }
|
|
62
|
+
}));
|
|
63
|
+
var HeaderCellDropdownItem = ({ icon, label, onClick }) => {
|
|
64
|
+
return /* @__PURE__ */ jsxs(HeaderCellDropdownItemWrapper, {
|
|
65
|
+
onClick,
|
|
66
|
+
children: [icon, /* @__PURE__ */ jsx(Text, {
|
|
67
|
+
size: TextSize.BODY_SM,
|
|
68
|
+
weight: TextWeight.MEDIUM,
|
|
69
|
+
children: label
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
57
73
|
function SpreadsheetHeaderCellInner({ column, width, pin, pinnedOffset, onResizeStart, getAllRows }) {
|
|
58
74
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
59
75
|
const handleResizeMouseDown = useCallback((e) => {
|
|
@@ -83,7 +99,7 @@ function SpreadsheetHeaderCellInner({ column, width, pin, pinnedOffset, onResize
|
|
|
83
99
|
body: /* @__PURE__ */ jsxs(FlexWrapper, {
|
|
84
100
|
direction: FlexDirection.COLUMN,
|
|
85
101
|
gap: 2,
|
|
86
|
-
children: [enrichmentActions.map((action) => /* @__PURE__ */ jsx(
|
|
102
|
+
children: [enrichmentActions.map((action) => /* @__PURE__ */ jsx(HeaderCellDropdownItem, {
|
|
87
103
|
icon: action.icon,
|
|
88
104
|
label: action.label,
|
|
89
105
|
onClick: () => {
|
|
@@ -91,10 +107,9 @@ function SpreadsheetHeaderCellInner({ column, width, pin, pinnedOffset, onResize
|
|
|
91
107
|
action.onAction(column.id, rows);
|
|
92
108
|
setIsMenuOpen(false);
|
|
93
109
|
}
|
|
94
|
-
}, `enrich-${action.id}`)), headerActions.map((action) => /* @__PURE__ */ jsx(
|
|
110
|
+
}, `enrich-${action.id}`)), headerActions.map((action) => /* @__PURE__ */ jsx(HeaderCellDropdownItem, {
|
|
95
111
|
icon: action.icon,
|
|
96
112
|
label: action.label,
|
|
97
|
-
variant: action.variant,
|
|
98
113
|
onClick: () => {
|
|
99
114
|
action.onAction(column.id);
|
|
100
115
|
setIsMenuOpen(false);
|
|
@@ -102,6 +117,7 @@ function SpreadsheetHeaderCellInner({ column, width, pin, pinnedOffset, onResize
|
|
|
102
117
|
}, `action-${action.id}`))]
|
|
103
118
|
}),
|
|
104
119
|
position: DropdownPosition.BOTTOM_END,
|
|
120
|
+
offset: [0, 4],
|
|
105
121
|
isOpen: isMenuOpen,
|
|
106
122
|
onClose: () => setIsMenuOpen(false),
|
|
107
123
|
minWidth: 160,
|
|
@@ -6,6 +6,11 @@ export interface SpreadsheetRowActionCellProps<TData> {
|
|
|
6
6
|
actions: SpreadsheetRowAction<TData>[];
|
|
7
7
|
pinnedOffset?: number;
|
|
8
8
|
}
|
|
9
|
+
export interface ActionCellDropdownItemProps {
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
}
|
|
9
14
|
declare function SpreadsheetRowActionCellInner<TData>({ row, rowIndex, actions, pinnedOffset, }: SpreadsheetRowActionCellProps<TData>): React.JSX.Element;
|
|
10
15
|
declare const SpreadsheetRowActionCell: typeof SpreadsheetRowActionCellInner;
|
|
11
16
|
export default SpreadsheetRowActionCell;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
|
+
import Text, { TextSize, TextWeight } from "../text/Text.js";
|
|
2
3
|
import Button, { ButtonSize, ButtonVariant } from "../buttons/Button.js";
|
|
3
4
|
import FlexWrapper, { FlexDirection } from "../containers/FlexWrapper.js";
|
|
4
5
|
import Dropdown, { DropdownPosition } from "../dropdown/Dropdown.js";
|
|
5
|
-
import DropdownItem from "../dropdown/DropdownItem.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { styled } from "@linaria/react";
|
|
8
8
|
import React, { useState } from "react";
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { DotsThreeVerticalIcon } from "@phosphor-icons/react";
|
|
11
11
|
//#region src/spreadsheet/SpreadsheetRowActionCell.tsx
|
|
12
12
|
var _exp = () => ({ $pinnedOffset }) => $pinnedOffset !== void 0 ? `${$pinnedOffset}px` : "0";
|
|
@@ -22,15 +22,36 @@ var ActionCellContainer = withTheme(/*#__PURE__*/ styled("td")({
|
|
|
22
22
|
"a1b1bj84-2": [_exp3()]
|
|
23
23
|
}
|
|
24
24
|
}));
|
|
25
|
+
var _exp4 = () => ({ theme }) => theme.color.background.secondary;
|
|
26
|
+
var ActionCellDropdownItemWrapper = withTheme(/*#__PURE__*/ styled("button")({
|
|
27
|
+
name: "ActionCellDropdownItemWrapper",
|
|
28
|
+
class: "a1mvarzo",
|
|
29
|
+
propsAsIs: false,
|
|
30
|
+
vars: { "a1mvarzo-0": [_exp4()] }
|
|
31
|
+
}));
|
|
32
|
+
var ActionCellDropdownItem = ({ icon, label, onClick }) => {
|
|
33
|
+
return /* @__PURE__ */ jsxs(ActionCellDropdownItemWrapper, {
|
|
34
|
+
onClick,
|
|
35
|
+
children: [icon, /* @__PURE__ */ jsx(Text, {
|
|
36
|
+
size: TextSize.BODY_SM,
|
|
37
|
+
weight: TextWeight.MEDIUM,
|
|
38
|
+
children: label
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
25
42
|
function SpreadsheetRowActionCellInner({ row, rowIndex, actions, pinnedOffset }) {
|
|
26
43
|
const [isOpen, setIsOpen] = useState(false);
|
|
44
|
+
const handleActionClick = (e) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
setIsOpen(!isOpen);
|
|
47
|
+
};
|
|
27
48
|
return /* @__PURE__ */ jsx(ActionCellContainer, {
|
|
28
49
|
$pinnedOffset: pinnedOffset,
|
|
29
50
|
children: /* @__PURE__ */ jsx(Dropdown, {
|
|
30
51
|
body: /* @__PURE__ */ jsx(FlexWrapper, {
|
|
31
52
|
direction: FlexDirection.COLUMN,
|
|
32
53
|
gap: 2,
|
|
33
|
-
children: actions.map((action) => /* @__PURE__ */ jsx(
|
|
54
|
+
children: actions.map((action) => /* @__PURE__ */ jsx(ActionCellDropdownItem, {
|
|
34
55
|
icon: action.icon,
|
|
35
56
|
label: action.label,
|
|
36
57
|
onClick: () => {
|
|
@@ -47,10 +68,7 @@ function SpreadsheetRowActionCellInner({ row, rowIndex, actions, pinnedOffset })
|
|
|
47
68
|
icon: DotsThreeVerticalIcon,
|
|
48
69
|
variant: ButtonVariant.TERTIARY,
|
|
49
70
|
size: ButtonSize.SMALL,
|
|
50
|
-
onClick:
|
|
51
|
-
e.stopPropagation();
|
|
52
|
-
setIsOpen(!isOpen);
|
|
53
|
-
}
|
|
71
|
+
onClick: handleActionClick
|
|
54
72
|
})
|
|
55
73
|
})
|
|
56
74
|
});
|
package/dist/styles.css
CHANGED
|
@@ -47,11 +47,6 @@
|
|
|
47
47
|
.s1hpu3t7{position:fixed;inset:0;background-color:var(--s1hpu3t7-0);-webkit-backdrop-filter:var(--s1hpu3t7-1);backdrop-filter:var(--s1hpu3t7-1);opacity:var(--s1hpu3t7-2);visibility:var(--s1hpu3t7-3);-webkit-transition:var(--s1hpu3t7-4);transition:var(--s1hpu3t7-4);z-index:var(--s1hpu3t7-5);pointer-events:var(--s1hpu3t7-6);}
|
|
48
48
|
.d1bgy4cf{display:inline-block;position:relative;width:var(--d1bgy4cf-0);min-width:var(--d1bgy4cf-1);max-width:var(--d1bgy4cf-2);overflow:var(--d1bgy4cf-3);padding:var(--d1bgy4cf-4);background-color:var(--d1bgy4cf-5);border:var(--d1bgy4cf-6);border-radius:5px;}
|
|
49
49
|
.dfdzgmt{position:relative;z-index:var(--dfdzgmt-0);display:var(--dfdzgmt-1);width:var(--dfdzgmt-2);}
|
|
50
|
-
.sobaxfi{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;width:var(--sobaxfi-0);min-width:var(--sobaxfi-1);overflow:var(--sobaxfi-2);gap:var(--sobaxfi-3);padding:var(--sobaxfi-4);height:var(--sobaxfi-5);background-color:var(--sobaxfi-6);border:var(--sobaxfi-7);border-radius:5px;cursor:var(--sobaxfi-8);-webkit-transition:background-color 0.075s ease-in-out,border 0.075s ease-in-out;transition:background-color 0.075s ease-in-out,border 0.075s ease-in-out;}.sobaxfi:hover:not(:disabled){background-color:var(--sobaxfi-9);border-color:var(--sobaxfi-10);}.sobaxfi:disabled{background-color:var(--sobaxfi-11);cursor:not-allowed;opacity:0.5;}
|
|
51
|
-
.l147oxln{-webkit-flex:var(--l147oxln-0);-ms-flex:var(--l147oxln-0);flex:var(--l147oxln-0);min-width:var(--l147oxln-1);overflow:hidden;}
|
|
52
|
-
.d1egzp74{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:var(--d1egzp74-0);-webkit-box-align:var(--d1egzp74-0);-ms-flex-align:var(--d1egzp74-0);align-items:var(--d1egzp74-0);-webkit-box-pack:var(--d1egzp74-1);-ms-flex-pack:var(--d1egzp74-1);-webkit-justify-content:var(--d1egzp74-1);justify-content:var(--d1egzp74-1);gap:var(--d1egzp74-2);width:var(--d1egzp74-3);padding:var(--d1egzp74-4);}
|
|
53
|
-
.syosvbj{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:24px;width:100%;border-radius:4px;cursor:pointer;}.syosvbj:disabled{opacity:0.5;cursor:not-allowed;}.syosvbj:disabled:hover{background-color:transparent;}
|
|
54
|
-
.d189jx24{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;padding:4px;width:100%;height:100%;border:0.5px solid transparent;border-radius:4px;}.syosvbj:hover .d189jx24{background-color:var(--d189jx24-0);}.d189jx24:hover{border:0.5px solid var(--d189jx24-1);}
|
|
55
50
|
.cwfaerb{-webkit-flex:1;-ms-flex:1;flex:1;min-height:0;min-width:0;width:100%;max-width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow:hidden;border:var(--cwfaerb-0);border-radius:var(--cwfaerb-1);}.cwfaerb>div{-webkit-flex:1;-ms-flex:1;flex:1;min-height:0;}.cwfaerb .cm-editor{width:100%!important;max-width:100%!important;height:100%!important;}.cwfaerb .cm-scroller{overflow:auto!important;width:100%!important;max-width:100%!important;}.cwfaerb .cm-content{max-width:100%!important;}.cwfaerb .cm-content,.cwfaerb .cm-gutter{line-height:1.8;}
|
|
56
51
|
.h179mi29{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:2px;}
|
|
57
52
|
.h1gstj4e{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}
|
|
@@ -146,6 +141,7 @@
|
|
|
146
141
|
.h5b2q63{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:4px;-webkit-flex:1;-ms-flex:1;flex:1;min-width:0;overflow:hidden;}
|
|
147
142
|
.m1q357fu{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}
|
|
148
143
|
.r10tums3{position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;}.r10tums3:hover,.r10tums3:active{background-color:var(--r10tums3-0);}
|
|
144
|
+
.hz0qata{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;padding:4px;width:100%;height:100%;border:0.5px solid transparent;border-radius:4px;}.hz0qata:hover{background-color:var(--hz0qata-0);}
|
|
149
145
|
.t15fnb8v{width:var(--t15fnb8v-0);height:var(--t15fnb8v-1);position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;border-radius:5px;overflow:hidden;}
|
|
150
146
|
.t1xd4vnx{-webkit-flex:1;-ms-flex:1;flex:1;overflow:auto;position:relative;min-height:0;padding-bottom:var(--t1xd4vnx-0);}
|
|
151
147
|
.sk741d9{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;}
|
|
@@ -159,19 +155,19 @@
|
|
|
159
155
|
.s1we9pi1{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}
|
|
160
156
|
.ezfy353{position:absolute;top:0;left:0;right:0;bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;pointer-events:none;}.ezfy353>*{pointer-events:auto;}
|
|
161
157
|
.l1pcw3m6{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;height:var(--l1pcw3m6-0);}.l1pcw3m6>td{border-bottom:0.5px solid var(--l1pcw3m6-1);background-color:var(--l1pcw3m6-2);}
|
|
162
|
-
.eo1carc{display:block;width:100%;
|
|
163
|
-
.e8l9d05{display:block;width:100%;
|
|
164
|
-
.e12m9dma{position:
|
|
165
|
-
.e1birhg7{
|
|
166
|
-
.e2tyxoq{
|
|
167
|
-
.ew9y6zt{
|
|
168
|
-
.e2jf90d{width:100%;box-sizing:border-box;overscroll-behavior:auto;}
|
|
158
|
+
.eo1carc{display:block;width:100%;min-width:var(--eo1carc-0);}
|
|
159
|
+
.e8l9d05{display:block;width:100%;padding:0;box-sizing:border-box;background-color:var(--e8l9d05-0);border-bottom:var(--e8l9d05-1);}
|
|
160
|
+
.e12m9dma{position:-webkit-sticky;position:sticky;left:0;width:var(--e12m9dma-0);display:-ms-grid;display:grid;-ms-grid-columns:44px minmax(0, 1fr);grid-template-columns:44px minmax(0, 1fr);box-sizing:border-box;}
|
|
161
|
+
.e1birhg7{background-color:var(--e1birhg7-0);border-right:0.5px solid var(--e1birhg7-1);min-width:44px;}
|
|
162
|
+
.e2tyxoq{min-width:0;width:100%;border-top:0.5px solid var(--e2tyxoq-0);}
|
|
163
|
+
.ew9y6zt{width:100%;box-sizing:border-box;overscroll-behavior:auto;}
|
|
169
164
|
.c1bx58xl{position:var(--c1bx58xl-0);z-index:var(--c1bx58xl-1);left:var(--c1bx58xl-2);right:var(--c1bx58xl-3);-webkit-flex:var(--c1bx58xl-4);-ms-flex:var(--c1bx58xl-4);flex:var(--c1bx58xl-4);padding:0 12px;height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:var(--c1bx58xl-5);-ms-flex-pack:var(--c1bx58xl-5);-webkit-justify-content:var(--c1bx58xl-5);justify-content:var(--c1bx58xl-5);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:var(--c1bx58xl-6);background-color:var(--c1bx58xl-7);border-right:var(--c1bx58xl-8);border-left:var(--c1bx58xl-9);}.c1bx58xl:hover{background-color:var(--c1bx58xl-10);}
|
|
170
165
|
.sgqglvy{width:6px;height:6px;border-radius:50%;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;margin-right:6px;background-color:var(--sgqglvy-0);}
|
|
171
166
|
.ejxsxoj{position:absolute;inset:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 4px;z-index:1;background-color:var(--ejxsxoj-0);border:1.5px solid var(--ejxsxoj-1);border-radius:2px;}
|
|
172
167
|
.a1thqwpm{position:-webkit-sticky;position:sticky;right:0;z-index:5;-webkit-flex:0 0 48px;-ms-flex:0 0 48px;flex:0 0 48px;background-color:var(--a1thqwpm-0);border-left:0.5px solid var(--a1thqwpm-1);}
|
|
173
168
|
.r1frty7c{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:-webkit-max-content;width:-moz-max-content;width:max-content;min-width:100%;position:absolute;top:0;left:0;-webkit-transform:translateY(var(--r1frty7c-0));-moz-transform:translateY(var(--r1frty7c-0));-ms-transform:translateY(var(--r1frty7c-0));transform:translateY(var(--r1frty7c-0));height:var(--r1frty7c-1);}.r1frty7c>td{border-bottom:var(--r1frty7c-2);}.r1frty7c:hover>td{background-color:var(--r1frty7c-3);}
|
|
174
169
|
.a1b1bj84{position:-webkit-sticky;position:sticky;right:var(--a1b1bj84-0);z-index:5;-webkit-flex:0 0 48px;-ms-flex:0 0 48px;flex:0 0 48px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;background-color:var(--a1b1bj84-1);border-left:0.5px solid var(--a1b1bj84-2);}.a1b1bj84>*{opacity:1;}
|
|
170
|
+
.a1mvarzo{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;padding:4px;width:100%;height:100%;border:0.5px solid transparent;border-radius:4px;}.a1mvarzo:hover{background-color:var(--a1mvarzo-0);}
|
|
175
171
|
.a1tvwf2d{position:-webkit-sticky;position:sticky;top:0;z-index:20;-webkit-flex:0 0 120px;-ms-flex:0 0 120px;flex:0 0 120px;height:36px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;gap:4px;padding:0 12px;background-color:var(--a1tvwf2d-0);border-bottom:0.5px solid var(--a1tvwf2d-1);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:background-color 0.1s;transition:background-color 0.1s;}.a1tvwf2d:hover{background-color:var(--a1tvwf2d-2);}
|
|
176
172
|
.scx8lyz{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:var(--scx8lyz-0);border:0.5px solid var(--scx8lyz-1);border-radius:5px;padding:0 3px;height:28px;}
|
|
177
173
|
.s1law64s{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;padding:3px 8px;background:var(--s1law64s-0);cursor:pointer;border:0.5px solid var(--s1law64s-1);border-radius:4px;}
|
|
@@ -6,7 +6,7 @@ import Button, { ButtonSize, ButtonVariant } from "../buttons/Button.js";
|
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { styled } from "@linaria/react";
|
|
8
8
|
import { match } from "ts-pattern";
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { CaretDownIcon, CaretRightIcon, CaretUpDownIcon, SortAscendingIcon, SortDescendingIcon } from "@phosphor-icons/react";
|
|
12
12
|
import { flexRender, getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
@@ -293,72 +293,59 @@ var LoadingRowWrapper = withTheme(/*#__PURE__*/ styled("tr")({
|
|
|
293
293
|
"l1pcw3m6-2": [_exp37()]
|
|
294
294
|
}
|
|
295
295
|
}));
|
|
296
|
-
var _exp38 = () => ({ $
|
|
297
|
-
var
|
|
298
|
-
name: "
|
|
296
|
+
var _exp38 = () => ({ $minWidth }) => `${$minWidth}px`;
|
|
297
|
+
var ExpandedRow = /*#__PURE__*/ styled("tr")({
|
|
298
|
+
name: "ExpandedRow",
|
|
299
299
|
class: "eo1carc",
|
|
300
300
|
propsAsIs: false,
|
|
301
301
|
vars: { "eo1carc-0": [_exp38()] }
|
|
302
302
|
});
|
|
303
|
-
var
|
|
304
|
-
|
|
303
|
+
var _exp39 = () => ({ $variant, theme }) => getVariantBackgroundColor(theme, $variant);
|
|
304
|
+
var _exp40 = () => ({ $isLastRow, theme }) => $isLastRow ? "none" : `0.5px solid ${theme.color.border.primary}`;
|
|
305
|
+
var ExpandedRowCell = withTheme(/*#__PURE__*/ styled("td")({
|
|
306
|
+
name: "ExpandedRowCell",
|
|
305
307
|
class: "e8l9d05",
|
|
306
|
-
propsAsIs: false
|
|
307
|
-
}));
|
|
308
|
-
var ExpandedOverlayLayer = /*#__PURE__*/ styled("div")({
|
|
309
|
-
name: "ExpandedOverlayLayer",
|
|
310
|
-
class: "e12m9dma",
|
|
311
|
-
propsAsIs: false
|
|
312
|
-
});
|
|
313
|
-
var _exp39 = () => ({ $top }) => `${$top}px`;
|
|
314
|
-
var _exp40 = () => ({ $left }) => `${$left}px`;
|
|
315
|
-
var _exp41 = () => ({ $width }) => `${$width}px`;
|
|
316
|
-
var _exp43 = () => ({ $variant, theme }) => getVariantBackgroundColor(theme, $variant);
|
|
317
|
-
var _exp44 = () => ({ $isLastRow, theme }) => $isLastRow ? "none" : `0.5px solid ${theme.color.border.primary}`;
|
|
318
|
-
var ExpandedOverlay = withTheme(/*#__PURE__*/ styled("div")({
|
|
319
|
-
name: "ExpandedOverlay",
|
|
320
|
-
class: "e1birhg7",
|
|
321
308
|
propsAsIs: false,
|
|
322
309
|
vars: {
|
|
323
|
-
"
|
|
324
|
-
"
|
|
325
|
-
"e1birhg7-2": [_exp41()],
|
|
326
|
-
"e1birhg7-3": [_exp43()],
|
|
327
|
-
"e1birhg7-4": [_exp44()]
|
|
310
|
+
"e8l9d05-0": [_exp39()],
|
|
311
|
+
"e8l9d05-1": [_exp40()]
|
|
328
312
|
}
|
|
329
313
|
}));
|
|
330
|
-
var
|
|
331
|
-
var
|
|
314
|
+
var _exp41 = () => ({ $width }) => $width !== void 0 ? `${$width}px` : "100%";
|
|
315
|
+
var ExpandedViewport = /*#__PURE__*/ styled("div")({
|
|
316
|
+
name: "ExpandedViewport",
|
|
317
|
+
class: "e12m9dma",
|
|
318
|
+
propsAsIs: false,
|
|
319
|
+
vars: { "e12m9dma-0": [_exp41()] }
|
|
320
|
+
});
|
|
321
|
+
var _exp43 = () => ({ $variant, theme }) => getVariantBackgroundColor(theme, $variant);
|
|
322
|
+
var _exp44 = () => ({ theme }) => theme.color.border.primary;
|
|
332
323
|
var ExpandedGutter = withTheme(/*#__PURE__*/ styled("div")({
|
|
333
324
|
name: "ExpandedGutter",
|
|
334
|
-
class: "
|
|
325
|
+
class: "e1birhg7",
|
|
335
326
|
propsAsIs: false,
|
|
336
327
|
vars: {
|
|
337
|
-
"
|
|
338
|
-
"
|
|
328
|
+
"e1birhg7-0": [_exp43()],
|
|
329
|
+
"e1birhg7-1": [_exp44()]
|
|
339
330
|
}
|
|
340
331
|
}));
|
|
341
|
-
var
|
|
332
|
+
var _exp46 = () => ({ theme }) => theme.color.border.primary;
|
|
342
333
|
var ExpandedBody = withTheme(/*#__PURE__*/ styled("div")({
|
|
343
334
|
name: "ExpandedBody",
|
|
344
|
-
class: "
|
|
335
|
+
class: "e2tyxoq",
|
|
345
336
|
propsAsIs: false,
|
|
346
|
-
vars: { "
|
|
337
|
+
vars: { "e2tyxoq-0": [_exp46()] }
|
|
347
338
|
}));
|
|
348
339
|
var ExpandedContent = /*#__PURE__*/ styled("div")({
|
|
349
340
|
name: "ExpandedContent",
|
|
350
|
-
class: "
|
|
341
|
+
class: "ew9y6zt",
|
|
351
342
|
propsAsIs: false
|
|
352
343
|
});
|
|
353
344
|
function InfiniteTable(props) {
|
|
354
345
|
const { columns, data, getRowId, height, width, fillWidth, fillHeight, density = "MEDIUM", variant = "PRIMARY", hasNextPage, isFetchingNextPage, fetchNextPage, enableRowSelection, enableMultiRowSelection, rowSelection, onRowSelectionChange, enableSorting = false, enableMultiSort = false, sorting, onSortingChange, manualSorting = false, isLoading = false, isError = false, loadingRowCount = 5, contentWhenEmpty, contentWhenError, noHeader = false, noLastRowBorder = false, noLastRowPadding = false, onRowClick, onRowDoubleClick, onRowExpand, onTableReady } = props;
|
|
355
|
-
const outerContainerRef = useRef(null);
|
|
356
346
|
const scrollContainerRef = useRef(null);
|
|
357
|
-
const expandedOverlayRef = useRef(null);
|
|
358
|
-
const queueWheelScrollRef = useRef(null);
|
|
359
|
-
const syncExpandedOverlayLayoutRafRef = useRef(null);
|
|
360
347
|
const [expandedRowId, setExpandedRowId] = useState(null);
|
|
361
|
-
const [
|
|
348
|
+
const [scrollContainerClientWidth, setScrollContainerClientWidth] = useState(null);
|
|
362
349
|
const resolvedColumns = useMemo(() => {
|
|
363
350
|
if (!onRowExpand) return columns;
|
|
364
351
|
return [{
|
|
@@ -410,6 +397,7 @@ function InfiniteTable(props) {
|
|
|
410
397
|
});
|
|
411
398
|
return offsets;
|
|
412
399
|
}, [resolvedColumns]);
|
|
400
|
+
const totalColumnMinWidth = useMemo(() => resolvedColumns.reduce((sum, col) => sum + (col.size ?? col.minSize ?? 0), 0), [resolvedColumns]);
|
|
413
401
|
const table = useReactTable({
|
|
414
402
|
data,
|
|
415
403
|
columns: useMemo(() => resolvedColumns.map((col) => ({
|
|
@@ -473,8 +461,6 @@ function InfiniteTable(props) {
|
|
|
473
461
|
onTableReady?.(table);
|
|
474
462
|
}, [table, onTableReady]);
|
|
475
463
|
const { rows } = table.getRowModel();
|
|
476
|
-
const expandedRow = expandedRowId ? rows.find((row) => row.id === expandedRowId) : void 0;
|
|
477
|
-
const isExpandedRowLast = expandedRow ? rows[rows.length - 1]?.id === expandedRow.id : false;
|
|
478
464
|
useEffect(() => {
|
|
479
465
|
if (!onRowExpand && expandedRowId !== null) setExpandedRowId(null);
|
|
480
466
|
}, [expandedRowId, onRowExpand]);
|
|
@@ -482,74 +468,21 @@ function InfiniteTable(props) {
|
|
|
482
468
|
if (expandedRowId === null) return;
|
|
483
469
|
if (!rows.some((row) => row.id === expandedRowId)) setExpandedRowId(null);
|
|
484
470
|
}, [expandedRowId, rows]);
|
|
485
|
-
const syncExpandedOverlayLayout = useCallback(() => {
|
|
486
|
-
if (!expandedRow || !onRowExpand) {
|
|
487
|
-
setExpandedOverlayLayout(null);
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
const outerContainer = outerContainerRef.current;
|
|
491
|
-
const scrollContainer = scrollContainerRef.current;
|
|
492
|
-
const overlayElement = expandedOverlayRef.current;
|
|
493
|
-
if (!outerContainer || !scrollContainer || !overlayElement) return;
|
|
494
|
-
const expandedRowAnchor = scrollContainer.querySelector("[data-gx-expanded-row-anchor=\"true\"]");
|
|
495
|
-
if (!expandedRowAnchor) return;
|
|
496
|
-
const outerRect = outerContainer.getBoundingClientRect();
|
|
497
|
-
const scrollRect = scrollContainer.getBoundingClientRect();
|
|
498
|
-
const rowRect = expandedRowAnchor.getBoundingClientRect();
|
|
499
|
-
const overlayRect = overlayElement.getBoundingClientRect();
|
|
500
|
-
const nextLayout = {
|
|
501
|
-
top: rowRect.bottom - outerRect.top,
|
|
502
|
-
left: scrollRect.left - outerRect.left,
|
|
503
|
-
width: scrollContainer.clientWidth,
|
|
504
|
-
height: overlayRect.height
|
|
505
|
-
};
|
|
506
|
-
setExpandedOverlayLayout((currentLayout) => {
|
|
507
|
-
if (currentLayout && currentLayout.top === nextLayout.top && currentLayout.left === nextLayout.left && currentLayout.width === nextLayout.width && currentLayout.height === nextLayout.height) return currentLayout;
|
|
508
|
-
return nextLayout;
|
|
509
|
-
});
|
|
510
|
-
}, [expandedRow, onRowExpand]);
|
|
511
|
-
const scheduleSyncExpandedOverlayLayout = useCallback(() => {
|
|
512
|
-
if (syncExpandedOverlayLayoutRafRef.current !== null) return;
|
|
513
|
-
syncExpandedOverlayLayoutRafRef.current = requestAnimationFrame(() => {
|
|
514
|
-
syncExpandedOverlayLayoutRafRef.current = null;
|
|
515
|
-
syncExpandedOverlayLayout();
|
|
516
|
-
});
|
|
517
|
-
}, [syncExpandedOverlayLayout]);
|
|
518
471
|
useLayoutEffect(() => {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
syncExpandedOverlayLayoutRafRef.current = null;
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
}, [syncExpandedOverlayLayout]);
|
|
527
|
-
useEffect(() => {
|
|
528
|
-
if (!expandedRow || !onRowExpand) return;
|
|
529
|
-
const scrollContainer = scrollContainerRef.current;
|
|
530
|
-
const overlayElement = expandedOverlayRef.current;
|
|
531
|
-
if (!scrollContainer || !overlayElement) return;
|
|
532
|
-
scrollContainer.addEventListener("scroll", scheduleSyncExpandedOverlayLayout, { passive: true });
|
|
533
|
-
window.addEventListener("resize", scheduleSyncExpandedOverlayLayout);
|
|
534
|
-
if (typeof ResizeObserver === "undefined") return () => {
|
|
535
|
-
scrollContainer.removeEventListener("scroll", scheduleSyncExpandedOverlayLayout);
|
|
536
|
-
window.removeEventListener("resize", scheduleSyncExpandedOverlayLayout);
|
|
537
|
-
};
|
|
538
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
539
|
-
scheduleSyncExpandedOverlayLayout();
|
|
540
|
-
});
|
|
541
|
-
resizeObserver.observe(scrollContainer);
|
|
542
|
-
resizeObserver.observe(overlayElement);
|
|
543
|
-
return () => {
|
|
544
|
-
scrollContainer.removeEventListener("scroll", scheduleSyncExpandedOverlayLayout);
|
|
545
|
-
window.removeEventListener("resize", scheduleSyncExpandedOverlayLayout);
|
|
546
|
-
resizeObserver.disconnect();
|
|
472
|
+
const container = scrollContainerRef.current;
|
|
473
|
+
if (!container) return;
|
|
474
|
+
const measure = () => {
|
|
475
|
+
setScrollContainerClientWidth((currentWidth) => currentWidth === container.clientWidth ? currentWidth : container.clientWidth);
|
|
547
476
|
};
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
477
|
+
measure();
|
|
478
|
+
if (typeof ResizeObserver === "undefined") {
|
|
479
|
+
window.addEventListener("resize", measure);
|
|
480
|
+
return () => window.removeEventListener("resize", measure);
|
|
481
|
+
}
|
|
482
|
+
const resizeObserver = new ResizeObserver(measure);
|
|
483
|
+
resizeObserver.observe(container);
|
|
484
|
+
return () => resizeObserver.disconnect();
|
|
485
|
+
}, []);
|
|
553
486
|
useEffect(() => {
|
|
554
487
|
const container = scrollContainerRef.current;
|
|
555
488
|
if (!container || !fetchNextPage) return;
|
|
@@ -597,23 +530,15 @@ function InfiniteTable(props) {
|
|
|
597
530
|
}
|
|
598
531
|
return false;
|
|
599
532
|
};
|
|
600
|
-
queueWheelScrollRef.current = queueWheelScroll;
|
|
601
533
|
const onWheel = (e) => {
|
|
602
534
|
queueWheelScroll(e.deltaX, e.deltaY);
|
|
603
535
|
};
|
|
604
536
|
container.addEventListener("wheel", onWheel, { passive: true });
|
|
605
537
|
return () => {
|
|
606
|
-
queueWheelScrollRef.current = null;
|
|
607
538
|
container.removeEventListener("wheel", onWheel);
|
|
608
539
|
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
609
540
|
};
|
|
610
541
|
}, [isFetchingNextPage]);
|
|
611
|
-
const handleExpandedOverlayWheel = useCallback((event) => {
|
|
612
|
-
if (queueWheelScrollRef.current?.(event.deltaX, event.deltaY) ?? false) {
|
|
613
|
-
event.preventDefault();
|
|
614
|
-
event.stopPropagation();
|
|
615
|
-
}
|
|
616
|
-
}, []);
|
|
617
542
|
const renderLoadingRows = () => {
|
|
618
543
|
return Array.from({ length: loadingRowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx(LoadingRowWrapper, {
|
|
619
544
|
$density: density,
|
|
@@ -635,98 +560,90 @@ function InfiniteTable(props) {
|
|
|
635
560
|
const showLoading = isLoading && data.length === 0;
|
|
636
561
|
const showError = isError && data.length === 0;
|
|
637
562
|
return /* @__PURE__ */ jsxs(TableOuterContainer, {
|
|
638
|
-
ref: outerContainerRef,
|
|
639
563
|
$width: width,
|
|
640
564
|
$height: height,
|
|
641
565
|
$fillWidth: fillWidth,
|
|
642
566
|
$fillHeight: fillHeight,
|
|
643
|
-
children: [
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
567
|
+
children: [/* @__PURE__ */ jsx(TableScrollContainer, {
|
|
568
|
+
ref: scrollContainerRef,
|
|
569
|
+
$noLastRowPadding: noLastRowPadding,
|
|
570
|
+
children: /* @__PURE__ */ jsxs(StyledTable, { children: [!noHeader && /* @__PURE__ */ jsx(TableHead, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableHeaderRow, { children: headerGroup.headers.map((header) => {
|
|
571
|
+
const columnMeta = header.column.columnDef.meta;
|
|
572
|
+
const canSort = header.column.getCanSort();
|
|
573
|
+
return /* @__PURE__ */ jsx(TableHeaderCell, {
|
|
574
|
+
$width: header.column.columnDef.size,
|
|
575
|
+
$minWidth: header.column.columnDef.minSize,
|
|
576
|
+
$maxWidth: header.column.columnDef.maxSize,
|
|
577
|
+
$pin: columnMeta?.pin,
|
|
578
|
+
$pinnedOffset: pinnedOffsets.get(header.column.id),
|
|
579
|
+
$align: columnMeta?.align,
|
|
580
|
+
$isSortable: canSort,
|
|
581
|
+
$density: density,
|
|
582
|
+
$variant: variant,
|
|
583
|
+
$isExpandCell: header.column.id === EXPAND_COLUMN_ID,
|
|
584
|
+
onClick: canSort ? header.column.getToggleSortingHandler() : void 0,
|
|
585
|
+
children: /* @__PURE__ */ jsxs(HeaderContentWrapper, { children: [flexRender(header.column.columnDef.header, header.getContext()), canSort && /* @__PURE__ */ jsx(SortIconWrapper, { children: header.column.getIsSorted() === "asc" ? /* @__PURE__ */ jsx(Icon, {
|
|
586
|
+
component: SortAscendingIcon,
|
|
587
|
+
size: 12,
|
|
588
|
+
variant: IconVariant.TERTIARY
|
|
589
|
+
}) : header.column.getIsSorted() === "desc" ? /* @__PURE__ */ jsx(Icon, {
|
|
590
|
+
component: SortDescendingIcon,
|
|
591
|
+
size: 12,
|
|
592
|
+
variant: IconVariant.TERTIARY
|
|
593
|
+
}) : /* @__PURE__ */ jsx(Icon, {
|
|
594
|
+
component: CaretUpDownIcon,
|
|
595
|
+
size: 12,
|
|
596
|
+
variant: IconVariant.TERTIARY
|
|
597
|
+
}) })] })
|
|
598
|
+
}, header.id);
|
|
599
|
+
}) }, headerGroup.id)) }), /* @__PURE__ */ jsxs(TableBody, { children: [showLoading ? renderLoadingRows() : showError ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
600
|
+
colSpan: resolvedColumns.length,
|
|
601
|
+
children: typeof contentWhenError === "function" ? contentWhenError() : contentWhenError ?? /* @__PURE__ */ jsx(Text, {
|
|
602
|
+
variant: TextVariant.ERROR,
|
|
603
|
+
children: "Error loading data"
|
|
604
|
+
})
|
|
605
|
+
}) }) : rows.map((row, index) => {
|
|
606
|
+
const isSelected = row.getIsSelected();
|
|
607
|
+
const isExpanded = onRowExpand !== void 0 && row.id === expandedRowId;
|
|
608
|
+
const isLastRow = index === rows.length - 1;
|
|
609
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(TableRow, {
|
|
610
|
+
$isClickable: !!onRowClick,
|
|
611
|
+
$isSelected: isSelected,
|
|
612
|
+
$density: density,
|
|
613
|
+
$variant: variant,
|
|
614
|
+
$isExpanded: isExpanded,
|
|
615
|
+
$isLastRow: noLastRowBorder && isLastRow && !isExpanded,
|
|
616
|
+
onClick: onRowClick ? (e) => onRowClick(row, e) : void 0,
|
|
617
|
+
onDoubleClick: onRowDoubleClick ? (e) => onRowDoubleClick(row, e) : void 0,
|
|
618
|
+
children: row.getVisibleCells().map((cell) => {
|
|
619
|
+
const columnMeta = cell.column.columnDef.meta;
|
|
620
|
+
return /* @__PURE__ */ jsx(TableDataCell, {
|
|
621
|
+
$width: cell.column.columnDef.size,
|
|
622
|
+
$minWidth: cell.column.columnDef.minSize,
|
|
623
|
+
$maxWidth: cell.column.columnDef.maxSize,
|
|
624
|
+
$pin: columnMeta?.pin,
|
|
625
|
+
$pinnedOffset: pinnedOffsets.get(cell.column.id),
|
|
626
|
+
$align: columnMeta?.align,
|
|
627
|
+
$density: density,
|
|
628
|
+
$variant: variant,
|
|
629
|
+
$isExpandCell: cell.column.id === EXPAND_COLUMN_ID,
|
|
630
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
631
|
+
}, cell.id);
|
|
681
632
|
})
|
|
682
|
-
})
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(TableRow, {
|
|
687
|
-
"data-gx-expanded-row-anchor": isExpanded ? "true" : void 0,
|
|
688
|
-
$isClickable: !!onRowClick,
|
|
689
|
-
$isSelected: isSelected,
|
|
690
|
-
$density: density,
|
|
633
|
+
}), isExpanded && onRowExpand && /* @__PURE__ */ jsx(ExpandedRow, {
|
|
634
|
+
$minWidth: totalColumnMinWidth,
|
|
635
|
+
children: /* @__PURE__ */ jsx(ExpandedRowCell, {
|
|
636
|
+
colSpan: resolvedColumns.length,
|
|
691
637
|
$variant: variant,
|
|
692
|
-
$
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
children: row.getVisibleCells().map((cell) => {
|
|
697
|
-
const columnMeta = cell.column.columnDef.meta;
|
|
698
|
-
return /* @__PURE__ */ jsx(TableDataCell, {
|
|
699
|
-
$width: cell.column.columnDef.size,
|
|
700
|
-
$minWidth: cell.column.columnDef.minSize,
|
|
701
|
-
$maxWidth: cell.column.columnDef.maxSize,
|
|
702
|
-
$pin: columnMeta?.pin,
|
|
703
|
-
$pinnedOffset: pinnedOffsets.get(cell.column.id),
|
|
704
|
-
$align: columnMeta?.align,
|
|
705
|
-
$density: density,
|
|
706
|
-
$variant: variant,
|
|
707
|
-
$isExpandCell: cell.column.id === EXPAND_COLUMN_ID,
|
|
708
|
-
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
709
|
-
}, cell.id);
|
|
638
|
+
$isLastRow: noLastRowBorder && isLastRow,
|
|
639
|
+
children: /* @__PURE__ */ jsxs(ExpandedViewport, {
|
|
640
|
+
$width: scrollContainerClientWidth ?? void 0,
|
|
641
|
+
children: [/* @__PURE__ */ jsx(ExpandedGutter, { $variant: variant }), /* @__PURE__ */ jsx(ExpandedBody, { children: /* @__PURE__ */ jsx(ExpandedContent, { children: onRowExpand(row) }) })]
|
|
710
642
|
})
|
|
711
|
-
})
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}), isFetchingNextPage && renderLoadingRows()] })] })
|
|
716
|
-
}),
|
|
717
|
-
expandedRow && onRowExpand && /* @__PURE__ */ jsx(ExpandedOverlayLayer, { children: /* @__PURE__ */ jsxs(ExpandedOverlay, {
|
|
718
|
-
ref: expandedOverlayRef,
|
|
719
|
-
$isLastRow: noLastRowBorder && isExpandedRowLast,
|
|
720
|
-
$left: expandedOverlayLayout?.left ?? 0,
|
|
721
|
-
$top: expandedOverlayLayout?.top ?? 0,
|
|
722
|
-
$width: expandedOverlayLayout?.width ?? scrollContainerRef.current?.clientWidth ?? 0,
|
|
723
|
-
$variant: variant,
|
|
724
|
-
onWheel: handleExpandedOverlayWheel,
|
|
725
|
-
style: { visibility: expandedOverlayLayout ? "visible" : "hidden" },
|
|
726
|
-
children: [/* @__PURE__ */ jsx(ExpandedGutter, { $variant: variant }), /* @__PURE__ */ jsx(ExpandedBody, { children: /* @__PURE__ */ jsx(ExpandedContent, { children: onRowExpand(expandedRow) }) })]
|
|
727
|
-
}) }),
|
|
728
|
-
isEmpty && contentWhenEmpty && /* @__PURE__ */ jsx(EmptyContentWrapper, { children: contentWhenEmpty })
|
|
729
|
-
]
|
|
643
|
+
})
|
|
644
|
+
})] }, row.id);
|
|
645
|
+
}), isFetchingNextPage && renderLoadingRows()] })] })
|
|
646
|
+
}), isEmpty && contentWhenEmpty && /* @__PURE__ */ jsx(EmptyContentWrapper, { children: contentWhenEmpty })]
|
|
730
647
|
});
|
|
731
648
|
}
|
|
732
649
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Icon as PhosphorIcon } from "@phosphor-icons/react";
|
|
2
|
-
import { ButtonSize, ButtonVariant } from "../buttons/Button";
|
|
3
|
-
export { ButtonSize, ButtonVariant };
|
|
4
|
-
export interface DropdownButtonProps {
|
|
5
|
-
label: string;
|
|
6
|
-
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
icon?: PhosphorIcon;
|
|
9
|
-
variant?: ButtonVariant;
|
|
10
|
-
size?: ButtonSize;
|
|
11
|
-
isLoading?: boolean;
|
|
12
|
-
isDisabled?: boolean;
|
|
13
|
-
fillWidth?: boolean;
|
|
14
|
-
isEllipsis?: boolean;
|
|
15
|
-
cursor?: React.CSSProperties["cursor"];
|
|
16
|
-
}
|
|
17
|
-
declare const DropdownButton: ({ label, icon, variant, size, onClick, isOpen, fillWidth, isLoading, isDisabled, isEllipsis, cursor, }: DropdownButtonProps) => import("react").JSX.Element;
|
|
18
|
-
export default DropdownButton;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { GalaxyTheme } from "../theme/constants.js";
|
|
2
|
-
import { useGalaxyTheme, withTheme } from "../theme/GalaxyTheme.js";
|
|
3
|
-
import Text, { TextSize, TextVariant, TextWeight } from "../text/Text.js";
|
|
4
|
-
import FlexItem from "../containers/FlexItem.js";
|
|
5
|
-
import Icon, { IconVariant } from "../icons/Icon.js";
|
|
6
|
-
import { ButtonSize, ButtonVariant } from "../buttons/Button.js";
|
|
7
|
-
import RotateWithTransition from "../animations/RotateWithTransition.js";
|
|
8
|
-
/* empty css */
|
|
9
|
-
import { styled } from "@linaria/react";
|
|
10
|
-
import { match } from "ts-pattern";
|
|
11
|
-
import { useCallback } from "react";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { CaretDownIcon } from "@phosphor-icons/react";
|
|
14
|
-
//#region src/dropdown/DropdownButton.tsx
|
|
15
|
-
var _exp = () => ({ $fillWidth }) => $fillWidth ? "100%" : "auto";
|
|
16
|
-
var _exp2 = () => ({ $isEllipsis }) => $isEllipsis ? "0" : "auto";
|
|
17
|
-
var _exp3 = () => ({ $isEllipsis }) => $isEllipsis ? "hidden" : "visible";
|
|
18
|
-
var _exp4 = () => ({ $size }) => {
|
|
19
|
-
return match($size).with(ButtonSize.SMALL, () => "4px").with(ButtonSize.MEDIUM, () => "6px").with(ButtonSize.LARGE, () => "6px").exhaustive();
|
|
20
|
-
};
|
|
21
|
-
var _exp5 = () => ({ $size }) => {
|
|
22
|
-
return match($size).with(ButtonSize.SMALL, () => "0 6px").with(ButtonSize.MEDIUM, () => "0 8px").with(ButtonSize.LARGE, () => "0 12px").exhaustive();
|
|
23
|
-
};
|
|
24
|
-
var _exp6 = () => ({ $size }) => {
|
|
25
|
-
return match($size).with(ButtonSize.SMALL, () => "24px").with(ButtonSize.MEDIUM, () => "28px").with(ButtonSize.LARGE, () => "32px").exhaustive();
|
|
26
|
-
};
|
|
27
|
-
var _exp7 = () => ({ theme, $variant, $isOpen }) => {
|
|
28
|
-
if ($isOpen) return match($variant).with(ButtonVariant.PRIMARY, () => theme.color.background.galaxyAlt).with(ButtonVariant.SECONDARY, () => theme.color.background.tertiary).with(ButtonVariant.TERTIARY, () => theme.color.background.secondary).with(ButtonVariant.SUCCESS, () => theme.color.background.successAlt).with(ButtonVariant.ERROR, () => theme.color.background.errorAlt).exhaustive();
|
|
29
|
-
return match($variant).with(ButtonVariant.PRIMARY, () => theme.color.background.galaxy).with(ButtonVariant.SECONDARY, () => theme.color.background.primary).with(ButtonVariant.TERTIARY, () => "transparent").with(ButtonVariant.SUCCESS, () => theme.color.icon.success).with(ButtonVariant.ERROR, () => theme.color.icon.error).exhaustive();
|
|
30
|
-
};
|
|
31
|
-
var _exp8 = () => ({ theme, $variant, $isOpen }) => {
|
|
32
|
-
return `0.5px solid ${match($variant).with(ButtonVariant.PRIMARY, () => $isOpen ? theme.color.border.primary : "transparent").with(ButtonVariant.SECONDARY, () => theme.color.border.primary).with(ButtonVariant.TERTIARY, () => $isOpen ? theme.color.border.primary : "transparent").with(ButtonVariant.SUCCESS, () => "transparent").with(ButtonVariant.ERROR, () => "transparent").exhaustive()}`;
|
|
33
|
-
};
|
|
34
|
-
var _exp9 = () => ({ $cursor }) => $cursor ?? "pointer";
|
|
35
|
-
var _exp0 = () => ({ theme, $variant }) => {
|
|
36
|
-
return match($variant).with(ButtonVariant.PRIMARY, () => theme.color.background.galaxyAlt).with(ButtonVariant.SECONDARY, () => theme.color.background.tertiary).with(ButtonVariant.TERTIARY, () => theme.color.background.secondary).with(ButtonVariant.SUCCESS, () => theme.color.background.successAlt).with(ButtonVariant.ERROR, () => theme.color.background.errorAlt).exhaustive();
|
|
37
|
-
};
|
|
38
|
-
var _exp1 = () => ({ theme, $variant }) => {
|
|
39
|
-
return match($variant).with(ButtonVariant.PRIMARY, () => theme.color.border.primary).with(ButtonVariant.SECONDARY, () => theme.color.border.primary).with(ButtonVariant.TERTIARY, () => theme.color.border.primary).with(ButtonVariant.SUCCESS, () => "transparent").with(ButtonVariant.ERROR, () => "transparent").exhaustive();
|
|
40
|
-
};
|
|
41
|
-
var _exp10 = () => ({ theme, $variant }) => {
|
|
42
|
-
return match($variant).with(ButtonVariant.PRIMARY, () => theme.color.background.disabled).with(ButtonVariant.SECONDARY, () => theme.color.background.disabled).with(ButtonVariant.TERTIARY, () => "transparent").with(ButtonVariant.SUCCESS, () => theme.color.background.successAlt).with(ButtonVariant.ERROR, () => theme.color.background.errorAlt).exhaustive();
|
|
43
|
-
};
|
|
44
|
-
var StyledDropdownButton = withTheme(/*#__PURE__*/ styled("button")({
|
|
45
|
-
name: "StyledDropdownButton",
|
|
46
|
-
class: "sobaxfi",
|
|
47
|
-
propsAsIs: false,
|
|
48
|
-
vars: {
|
|
49
|
-
"sobaxfi-0": [_exp()],
|
|
50
|
-
"sobaxfi-1": [_exp2()],
|
|
51
|
-
"sobaxfi-2": [_exp3()],
|
|
52
|
-
"sobaxfi-3": [_exp4()],
|
|
53
|
-
"sobaxfi-4": [_exp5()],
|
|
54
|
-
"sobaxfi-5": [_exp6()],
|
|
55
|
-
"sobaxfi-6": [_exp7()],
|
|
56
|
-
"sobaxfi-7": [_exp8()],
|
|
57
|
-
"sobaxfi-8": [_exp9()],
|
|
58
|
-
"sobaxfi-9": [_exp0()],
|
|
59
|
-
"sobaxfi-10": [_exp1()],
|
|
60
|
-
"sobaxfi-11": [_exp10()]
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
var _exp11 = () => ({ $isEllipsis }) => $isEllipsis ? "1" : "0 1 auto";
|
|
64
|
-
var _exp12 = () => ({ $isEllipsis }) => $isEllipsis ? "0" : "auto";
|
|
65
|
-
var LabelWrapper = /*#__PURE__*/ styled("span")({
|
|
66
|
-
name: "LabelWrapper",
|
|
67
|
-
class: "l147oxln",
|
|
68
|
-
propsAsIs: false,
|
|
69
|
-
vars: {
|
|
70
|
-
"l147oxln-0": [_exp11()],
|
|
71
|
-
"l147oxln-1": [_exp12()]
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
function getTextVariant(variant, activeTheme) {
|
|
75
|
-
return match(variant).with(ButtonVariant.PRIMARY, () => activeTheme === GalaxyTheme.DARK ? TextVariant.PRIMARY : TextVariant.PRIMARY_ALT).with(ButtonVariant.SECONDARY, () => TextVariant.PRIMARY).with(ButtonVariant.TERTIARY, () => TextVariant.PRIMARY).with(ButtonVariant.SUCCESS, () => TextVariant.PRIMARY_ALT).with(ButtonVariant.ERROR, () => TextVariant.PRIMARY_ALT).exhaustive();
|
|
76
|
-
}
|
|
77
|
-
function getIconVariant(variant, activeTheme) {
|
|
78
|
-
return match(variant).with(ButtonVariant.PRIMARY, () => activeTheme === GalaxyTheme.DARK ? IconVariant.PRIMARY : IconVariant.PRIMARY_ALT).with(ButtonVariant.SECONDARY, () => IconVariant.PRIMARY).with(ButtonVariant.TERTIARY, () => IconVariant.PRIMARY).with(ButtonVariant.SUCCESS, () => IconVariant.PRIMARY_ALT).with(ButtonVariant.ERROR, () => IconVariant.PRIMARY_ALT).exhaustive();
|
|
79
|
-
}
|
|
80
|
-
var BUTTON_SIZE_TO_TEXT_SIZE_MAP = {
|
|
81
|
-
[ButtonSize.SMALL]: TextSize.BODY_SM,
|
|
82
|
-
[ButtonSize.MEDIUM]: TextSize.BODY_MD,
|
|
83
|
-
[ButtonSize.LARGE]: TextSize.BODY_LG
|
|
84
|
-
};
|
|
85
|
-
var BUTTON_SIZE_TO_ICON_SIZE_MAP = {
|
|
86
|
-
[ButtonSize.SMALL]: 12,
|
|
87
|
-
[ButtonSize.MEDIUM]: 14,
|
|
88
|
-
[ButtonSize.LARGE]: 16
|
|
89
|
-
};
|
|
90
|
-
var DropdownButton = ({ label, icon, variant = ButtonVariant.PRIMARY, size = ButtonSize.MEDIUM, onClick, isOpen, fillWidth, isLoading, isDisabled, isEllipsis, cursor }) => {
|
|
91
|
-
const { activeTheme } = useGalaxyTheme();
|
|
92
|
-
const handleClick = useCallback((e) => {
|
|
93
|
-
if (isDisabled || isLoading) return;
|
|
94
|
-
onClick(e);
|
|
95
|
-
}, [
|
|
96
|
-
isDisabled,
|
|
97
|
-
isLoading,
|
|
98
|
-
onClick
|
|
99
|
-
]);
|
|
100
|
-
const renderIcon = useCallback(() => {
|
|
101
|
-
if (!icon) return null;
|
|
102
|
-
let iconVariant = getIconVariant(variant, activeTheme);
|
|
103
|
-
if (isDisabled) iconVariant = IconVariant.TERTIARY;
|
|
104
|
-
return /* @__PURE__ */ jsx(FlexItem, {
|
|
105
|
-
shrink: 0,
|
|
106
|
-
grow: 0,
|
|
107
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
108
|
-
component: icon,
|
|
109
|
-
variant: iconVariant,
|
|
110
|
-
size: BUTTON_SIZE_TO_ICON_SIZE_MAP[size]
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
}, [
|
|
114
|
-
icon,
|
|
115
|
-
variant,
|
|
116
|
-
size,
|
|
117
|
-
isDisabled,
|
|
118
|
-
activeTheme
|
|
119
|
-
]);
|
|
120
|
-
const renderLabel = useCallback(() => {
|
|
121
|
-
let textVariant = getTextVariant(variant, activeTheme);
|
|
122
|
-
if (isDisabled) textVariant = TextVariant.TERTIARY_ALT;
|
|
123
|
-
return /* @__PURE__ */ jsx(LabelWrapper, {
|
|
124
|
-
$isEllipsis: isEllipsis,
|
|
125
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
126
|
-
variant: textVariant,
|
|
127
|
-
weight: TextWeight.MEDIUM,
|
|
128
|
-
size: BUTTON_SIZE_TO_TEXT_SIZE_MAP[size],
|
|
129
|
-
cursor: isDisabled ? "not-allowed" : cursor,
|
|
130
|
-
isEllipsis,
|
|
131
|
-
children: label
|
|
132
|
-
})
|
|
133
|
-
});
|
|
134
|
-
}, [
|
|
135
|
-
label,
|
|
136
|
-
variant,
|
|
137
|
-
size,
|
|
138
|
-
isDisabled,
|
|
139
|
-
isEllipsis,
|
|
140
|
-
cursor,
|
|
141
|
-
activeTheme
|
|
142
|
-
]);
|
|
143
|
-
const renderCaret = useCallback(() => {
|
|
144
|
-
let iconVariant = getIconVariant(variant, activeTheme);
|
|
145
|
-
if (isDisabled) iconVariant = IconVariant.TERTIARY;
|
|
146
|
-
return /* @__PURE__ */ jsx(RotateWithTransition, {
|
|
147
|
-
isRotated: isOpen,
|
|
148
|
-
deg: -180,
|
|
149
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
150
|
-
component: CaretDownIcon,
|
|
151
|
-
variant: iconVariant,
|
|
152
|
-
size: BUTTON_SIZE_TO_ICON_SIZE_MAP[size]
|
|
153
|
-
})
|
|
154
|
-
});
|
|
155
|
-
}, [
|
|
156
|
-
variant,
|
|
157
|
-
size,
|
|
158
|
-
isDisabled,
|
|
159
|
-
isOpen,
|
|
160
|
-
activeTheme
|
|
161
|
-
]);
|
|
162
|
-
return /* @__PURE__ */ jsxs(StyledDropdownButton, {
|
|
163
|
-
$variant: variant,
|
|
164
|
-
$size: size,
|
|
165
|
-
$isOpen: isOpen,
|
|
166
|
-
$fillWidth: fillWidth,
|
|
167
|
-
$isEllipsis: isEllipsis,
|
|
168
|
-
$cursor: cursor,
|
|
169
|
-
onClick: handleClick,
|
|
170
|
-
disabled: isDisabled || isLoading,
|
|
171
|
-
children: [
|
|
172
|
-
renderIcon(),
|
|
173
|
-
renderLabel(),
|
|
174
|
-
renderCaret()
|
|
175
|
-
]
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
//#endregion
|
|
179
|
-
export { ButtonSize, ButtonVariant, DropdownButton as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties, PropsWithChildren } from "react";
|
|
2
|
-
interface DropdownFooterProps {
|
|
3
|
-
gap?: number | string;
|
|
4
|
-
padding?: CSSProperties["padding"];
|
|
5
|
-
justifyContent?: CSSProperties["justifyContent"];
|
|
6
|
-
alignItems?: CSSProperties["alignItems"];
|
|
7
|
-
fillWidth?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const DropdownFooter: ({ children, gap, padding, justifyContent, alignItems, fillWidth, }: PropsWithChildren<DropdownFooterProps>) => import("react").JSX.Element;
|
|
10
|
-
export default DropdownFooter;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
|
-
import { getCssSizeValue } from "../utils/linaria.js";
|
|
3
|
-
/* empty css */
|
|
4
|
-
import { styled } from "@linaria/react";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
//#region src/dropdown/DropdownFooter.tsx
|
|
7
|
-
var _exp = () => ({ $alignItems }) => $alignItems ?? "center";
|
|
8
|
-
var _exp2 = () => ({ $justifyContent }) => $justifyContent ?? "flex-start";
|
|
9
|
-
var _exp3 = () => ({ $gap }) => getCssSizeValue($gap, "0");
|
|
10
|
-
var _exp4 = () => ({ $fillWidth }) => $fillWidth ? "100%" : "auto";
|
|
11
|
-
var _exp5 = () => ({ $padding }) => $padding ?? "0";
|
|
12
|
-
var DropdownFooterWrapper = withTheme(/*#__PURE__*/ styled("div")({
|
|
13
|
-
name: "DropdownFooterWrapper",
|
|
14
|
-
class: "d1egzp74",
|
|
15
|
-
propsAsIs: false,
|
|
16
|
-
vars: {
|
|
17
|
-
"d1egzp74-0": [_exp()],
|
|
18
|
-
"d1egzp74-1": [_exp2()],
|
|
19
|
-
"d1egzp74-2": [_exp3()],
|
|
20
|
-
"d1egzp74-3": [_exp4()],
|
|
21
|
-
"d1egzp74-4": [_exp5()]
|
|
22
|
-
}
|
|
23
|
-
}));
|
|
24
|
-
var DropdownFooter = ({ children, gap, padding, justifyContent, alignItems, fillWidth = false }) => {
|
|
25
|
-
return /* @__PURE__ */ jsx(DropdownFooterWrapper, {
|
|
26
|
-
$gap: gap,
|
|
27
|
-
$padding: padding,
|
|
28
|
-
$justifyContent: justifyContent,
|
|
29
|
-
$alignItems: alignItems,
|
|
30
|
-
$fillWidth: fillWidth,
|
|
31
|
-
children
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
35
|
-
export { DropdownFooter as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type TextVariant } from "../text/Text";
|
|
2
|
-
export interface DropdownItemButton {
|
|
3
|
-
icon?: React.ReactNode;
|
|
4
|
-
label: string;
|
|
5
|
-
variant?: TextVariant;
|
|
6
|
-
isDisabled?: boolean;
|
|
7
|
-
onClick: () => void;
|
|
8
|
-
}
|
|
9
|
-
declare const DropdownItem: ({ icon, label, variant, isDisabled, onClick }: DropdownItemButton) => import("react").JSX.Element;
|
|
10
|
-
export default DropdownItem;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
|
-
import Text from "../text/Text.js";
|
|
3
|
-
/* empty css */
|
|
4
|
-
import { styled } from "@linaria/react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
//#region src/dropdown/DropdownItem.tsx
|
|
7
|
-
var StyledDropdownItemButton = withTheme(/*#__PURE__*/ styled("button")({
|
|
8
|
-
name: "StyledDropdownItemButton",
|
|
9
|
-
class: "syosvbj",
|
|
10
|
-
propsAsIs: false
|
|
11
|
-
}));
|
|
12
|
-
var _exp2 = () => ({ theme }) => theme.color.background.tertiary;
|
|
13
|
-
var _exp3 = () => ({ theme }) => theme.color.border.primary;
|
|
14
|
-
var DropdownItemWrapper = withTheme(/*#__PURE__*/ styled("div")({
|
|
15
|
-
name: "DropdownItemWrapper",
|
|
16
|
-
class: "d189jx24",
|
|
17
|
-
propsAsIs: false,
|
|
18
|
-
vars: {
|
|
19
|
-
"d189jx24-0": [_exp2()],
|
|
20
|
-
"d189jx24-1": [_exp3()]
|
|
21
|
-
}
|
|
22
|
-
}));
|
|
23
|
-
var DropdownItem = ({ icon, label, variant, isDisabled, onClick }) => {
|
|
24
|
-
const handleClick = (e) => {
|
|
25
|
-
e.stopPropagation();
|
|
26
|
-
onClick();
|
|
27
|
-
};
|
|
28
|
-
return /* @__PURE__ */ jsx(StyledDropdownItemButton, {
|
|
29
|
-
onClick: handleClick,
|
|
30
|
-
disabled: isDisabled,
|
|
31
|
-
children: /* @__PURE__ */ jsxs(DropdownItemWrapper, { children: [icon, /* @__PURE__ */ jsx(Text, {
|
|
32
|
-
variant,
|
|
33
|
-
children: label
|
|
34
|
-
})] })
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
//#endregion
|
|
38
|
-
export { DropdownItem as default };
|