@galaxy-io/dls 1.0.8 → 1.1.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/README.md +1 -1
- package/dist/avatar/Avatar.d.ts +1 -2
- package/dist/avatar/Avatar.js +2 -27
- package/dist/avatar/AvatarEmpty.d.ts +2 -31
- package/dist/avatar/AvatarEmpty.js +86 -30
- package/dist/buttons/Button.js +9 -9
- package/dist/dropdown/DropdownButton.js +11 -11
- package/dist/editor/CodeEditor.d.ts +1 -1
- package/dist/editor/CodeEditor.js +5 -5
- package/dist/icons/GalaxyLogomark.js +3 -3
- package/dist/icons/GalaxyWordmark.js +3 -3
- package/dist/icons/TextIcon.js +3 -3
- package/dist/icons/WebScrapeIcon.js +3 -3
- package/dist/icons/WebhookIcon.js +3 -3
- package/dist/icons/sources/ClickhouseLogomark.js +3 -3
- package/dist/icons/sources/SnowflakeLogomark.js +3 -3
- package/dist/styles.css +3 -4
- package/dist/theme/GalaxyTheme.d.ts +1 -1
- package/dist/theme/GalaxyTheme.js +1 -1
- package/package.json +1 -1
- package/dist/avatar/GalaxyAvatar.d.ts +0 -6
- package/dist/avatar/GalaxyAvatar.js +0 -36
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Access theme state in components:
|
|
|
63
63
|
import { useGalaxyTheme } from "@galaxy-io/dls/theme/GalaxyTheme";
|
|
64
64
|
|
|
65
65
|
function ThemeSwitcher() {
|
|
66
|
-
const {
|
|
66
|
+
const { activeTheme, selectedTheme, setTheme } = useGalaxyTheme();
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
package/dist/avatar/Avatar.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export interface AvatarProps {
|
|
|
3
3
|
isLoading?: boolean;
|
|
4
4
|
size?: number;
|
|
5
5
|
hex?: string;
|
|
6
|
-
shouldShowLogo?: boolean;
|
|
7
6
|
}
|
|
8
|
-
declare const Avatar: ({ img, isLoading, size, hex
|
|
7
|
+
declare const Avatar: ({ img, isLoading, size, hex }: AvatarProps) => import("react").JSX.Element;
|
|
9
8
|
export default Avatar;
|
package/dist/avatar/Avatar.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
1
|
import AvatarShimmer from "./AvatarShimmer.js";
|
|
3
|
-
import GalaxyLogomark from "../icons/GalaxyLogomark.js";
|
|
4
2
|
import AvatarEmpty from "./AvatarEmpty.js";
|
|
5
3
|
/* empty css */
|
|
6
4
|
import { styled } from "@linaria/react";
|
|
@@ -13,31 +11,8 @@ var StyledAvatar = /*#__PURE__*/ styled("img")({
|
|
|
13
11
|
propsAsIs: false,
|
|
14
12
|
vars: { "sve5wdp-0": [_exp2(), "px"] }
|
|
15
13
|
});
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _exp5 = () => ({ $size }) => {
|
|
19
|
-
if ($size <= 16) return "2px";
|
|
20
|
-
if ($size <= 24) return "3px";
|
|
21
|
-
return "4px";
|
|
22
|
-
};
|
|
23
|
-
var _exp7 = () => ({ $size }) => $size;
|
|
24
|
-
var StyledLogoAvatar = withTheme(/*#__PURE__*/ styled("div")({
|
|
25
|
-
name: "StyledLogoAvatar",
|
|
26
|
-
class: "s3r0r1h",
|
|
27
|
-
propsAsIs: false,
|
|
28
|
-
vars: {
|
|
29
|
-
"s3r0r1h-0": [_exp3()],
|
|
30
|
-
"s3r0r1h-1": [_exp4()],
|
|
31
|
-
"s3r0r1h-2": [_exp5()],
|
|
32
|
-
"s3r0r1h-3": [_exp7(), "px"]
|
|
33
|
-
}
|
|
34
|
-
}));
|
|
35
|
-
var Avatar = ({ img, isLoading, size = 16, hex, shouldShowLogo }) => {
|
|
36
|
-
if (isLoading) return isLoading ? /* @__PURE__ */ jsx(AvatarShimmer, { size }) : null;
|
|
37
|
-
if (shouldShowLogo) return /* @__PURE__ */ jsx(StyledLogoAvatar, {
|
|
38
|
-
$size: size,
|
|
39
|
-
children: /* @__PURE__ */ jsx(GalaxyLogomark, { height: Math.max(8, size - (size <= 16 ? 2 : size <= 24 ? 3 : 4) * 2 - 2) })
|
|
40
|
-
});
|
|
14
|
+
var Avatar = ({ img, isLoading, size = 16, hex }) => {
|
|
15
|
+
if (isLoading) return /* @__PURE__ */ jsx(AvatarShimmer, { size });
|
|
41
16
|
if (!img) return /* @__PURE__ */ jsx(AvatarEmpty, {
|
|
42
17
|
size,
|
|
43
18
|
hex
|
|
@@ -1,36 +1,7 @@
|
|
|
1
|
-
import { GalaxyTheme } from "../theme/constants";
|
|
2
1
|
export interface AvatarEmptyProps {
|
|
3
2
|
size: number;
|
|
4
3
|
hex?: string;
|
|
4
|
+
seed?: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
theme: import("../theme").Theme;
|
|
8
|
-
} & {
|
|
9
|
-
$size: number;
|
|
10
|
-
$hex?: string;
|
|
11
|
-
$galaxyTheme: Exclude<GalaxyTheme, GalaxyTheme.SYSTEM>;
|
|
12
|
-
} & {
|
|
13
|
-
as?: React.ElementType;
|
|
14
|
-
}, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement> | "as" | "$size" | "$hex" | "$galaxyTheme"> & {
|
|
15
|
-
theme?: import("@callstack/react-theme-provider").$DeepPartial<import("../theme").Theme> | undefined;
|
|
16
|
-
}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<import("react").ComponentType<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
17
|
-
theme: import("../theme").Theme;
|
|
18
|
-
} & {
|
|
19
|
-
$size: number;
|
|
20
|
-
$hex?: string;
|
|
21
|
-
$galaxyTheme: Exclude<GalaxyTheme, GalaxyTheme.SYSTEM>;
|
|
22
|
-
} & {
|
|
23
|
-
as?: React.ElementType;
|
|
24
|
-
}> & {
|
|
25
|
-
__wyw_meta: unknown;
|
|
26
|
-
} & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
27
|
-
theme: import("../theme").Theme;
|
|
28
|
-
} & {
|
|
29
|
-
$size: number;
|
|
30
|
-
$hex?: string;
|
|
31
|
-
$galaxyTheme: Exclude<GalaxyTheme, GalaxyTheme.SYSTEM>;
|
|
32
|
-
} & {
|
|
33
|
-
as?: React.ElementType;
|
|
34
|
-
}>, {}>;
|
|
35
|
-
declare const AvatarEmpty: ({ size, hex }: AvatarEmptyProps) => import("react").JSX.Element;
|
|
6
|
+
declare const AvatarEmpty: ({ size, hex, seed }: AvatarEmptyProps) => import("react").JSX.Element;
|
|
36
7
|
export default AvatarEmpty;
|
|
@@ -1,43 +1,99 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useGalaxyTheme, withTheme } from "../theme/GalaxyTheme.js";
|
|
1
|
+
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
3
2
|
import { getDarkerHexColor, getLighterHexColor, getOpaqueHexColor } from "../utils/colors.js";
|
|
4
3
|
/* empty css */
|
|
5
4
|
import { styled } from "@linaria/react";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/avatar/AvatarEmpty.tsx
|
|
8
|
-
var _exp2 = () => ({ $size }) =>
|
|
9
|
-
var _exp3 = () => ({ theme
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const galaxy = theme.color.background.galaxy;
|
|
14
|
-
const galaxyRing = getOpaqueHexColor(galaxy, .22);
|
|
15
|
-
const galaxyRingSoft = getOpaqueHexColor(galaxy, .08);
|
|
16
|
-
return `
|
|
17
|
-
radial-gradient(circle at 50% 50%, transparent 28%, ${galaxyRingSoft} 45%, ${galaxyRing} 62%, ${galaxyRing} 85%, ${galaxyRingSoft} 96%, transparent 100%),
|
|
18
|
-
radial-gradient(ellipse 90% 40% at 30% 25%, ${accent} 0%, transparent 55%),
|
|
19
|
-
radial-gradient(ellipse 85% 35% at 75% 65%, ${accent} 0%, transparent 50%),
|
|
20
|
-
radial-gradient(ellipse 70% 50% at 55% 80%, ${base} 0%, transparent 45%),
|
|
21
|
-
radial-gradient(ellipse 80% 45% at 20% 70%, ${base} 0%, transparent 50%),
|
|
22
|
-
radial-gradient(ellipse 100% 60% at 50% 50%, ${base} 10%, ${accent} 100%)
|
|
23
|
-
`;
|
|
24
|
-
};
|
|
25
|
-
var StyledAvatarEmpty = withTheme(/*#__PURE__*/ styled("div")({
|
|
26
|
-
name: "StyledAvatarEmpty",
|
|
27
|
-
class: "s3y5dk3",
|
|
8
|
+
var _exp2 = () => ({ $size }) => $size;
|
|
9
|
+
var _exp3 = () => ({ theme }) => theme.color.background.secondary;
|
|
10
|
+
var Container = withTheme(/*#__PURE__*/ styled("div")({
|
|
11
|
+
name: "Container",
|
|
12
|
+
class: "c3y5dk3",
|
|
28
13
|
propsAsIs: false,
|
|
29
14
|
vars: {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
15
|
+
"c3y5dk3-0": [_exp2(), "px"],
|
|
16
|
+
"c3y5dk3-1": [_exp3()]
|
|
32
17
|
}
|
|
33
18
|
}));
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
var _exp5 = () => ({ $dotSize }) => $dotSize;
|
|
20
|
+
var _exp6 = () => ({ $color }) => $color;
|
|
21
|
+
var _exp7 = () => ({ $x }) => $x;
|
|
22
|
+
var _exp8 = () => ({ $y }) => $y;
|
|
23
|
+
var Dot = /*#__PURE__*/ styled("div")({
|
|
24
|
+
name: "Dot",
|
|
25
|
+
class: "d1vohupz",
|
|
26
|
+
propsAsIs: false,
|
|
27
|
+
vars: {
|
|
28
|
+
"d1vohupz-0": [_exp5(), "px"],
|
|
29
|
+
"d1vohupz-1": [_exp6()],
|
|
30
|
+
"d1vohupz-2": [_exp7(), "px"],
|
|
31
|
+
"d1vohupz-3": [_exp8(), "px"]
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var seededRandom = (seed) => {
|
|
35
|
+
let hash = 0;
|
|
36
|
+
for (let i = 0; i < seed.length; i++) {
|
|
37
|
+
const char = seed.charCodeAt(i);
|
|
38
|
+
hash = (hash << 5) - hash + char;
|
|
39
|
+
hash = hash & hash;
|
|
40
|
+
}
|
|
41
|
+
return () => {
|
|
42
|
+
hash = hash * 1103515245 + 12345 & 2147483647;
|
|
43
|
+
return hash / 2147483647;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
var DEFAULT_HEX = "#6B7280";
|
|
47
|
+
var AvatarEmpty = ({ size = 16, hex, seed }) => {
|
|
48
|
+
const dots = useMemo(() => {
|
|
49
|
+
const baseHex = hex ?? DEFAULT_HEX;
|
|
50
|
+
const colors = [
|
|
51
|
+
baseHex,
|
|
52
|
+
getLighterHexColor(baseHex, 30),
|
|
53
|
+
getDarkerHexColor(baseHex, 25),
|
|
54
|
+
getOpaqueHexColor(baseHex, .3),
|
|
55
|
+
getOpaqueHexColor(baseHex, .15)
|
|
56
|
+
];
|
|
57
|
+
const gridSize = size <= 24 ? 5 : size <= 48 ? 7 : 9;
|
|
58
|
+
const step = size / gridSize;
|
|
59
|
+
const dotSize = Math.round(step * .6);
|
|
60
|
+
const random = seededRandom(seed ?? hex ?? "default");
|
|
61
|
+
const halfCols = Math.ceil(gridSize / 2);
|
|
62
|
+
const pattern = [];
|
|
63
|
+
for (let row = 0; row < gridSize; row++) {
|
|
64
|
+
pattern[row] = [];
|
|
65
|
+
for (let col = 0; col < halfCols; col++) pattern[row][col] = { colorIndex: Math.floor(random() * colors.length) };
|
|
66
|
+
for (let col = halfCols; col < gridSize; col++) pattern[row][col] = pattern[row][gridSize - 1 - col];
|
|
67
|
+
}
|
|
68
|
+
const dotPositions = [];
|
|
69
|
+
for (let row = 0; row < gridSize; row++) for (let col = 0; col < gridSize; col++) {
|
|
70
|
+
const x = col * step + (step - dotSize) / 2;
|
|
71
|
+
const y = row * step + (step - dotSize) / 2;
|
|
72
|
+
dotPositions.push({
|
|
73
|
+
x,
|
|
74
|
+
y,
|
|
75
|
+
color: colors[pattern[row][col].colorIndex],
|
|
76
|
+
key: `${row}-${col}`
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
dotSize,
|
|
81
|
+
dotPositions
|
|
82
|
+
};
|
|
83
|
+
}, [
|
|
84
|
+
size,
|
|
85
|
+
hex,
|
|
86
|
+
seed
|
|
87
|
+
]);
|
|
88
|
+
return /* @__PURE__ */ jsx(Container, {
|
|
37
89
|
$size: size,
|
|
38
|
-
|
|
39
|
-
|
|
90
|
+
children: dots.dotPositions.map(({ x, y, color, key }) => /* @__PURE__ */ jsx(Dot, {
|
|
91
|
+
$dotSize: dots.dotSize,
|
|
92
|
+
$x: x,
|
|
93
|
+
$y: y,
|
|
94
|
+
$color: color
|
|
95
|
+
}, key))
|
|
40
96
|
});
|
|
41
97
|
};
|
|
42
98
|
//#endregion
|
|
43
|
-
export {
|
|
99
|
+
export { AvatarEmpty as default };
|
package/dist/buttons/Button.js
CHANGED
|
@@ -81,11 +81,11 @@ var LabelWrapper = /*#__PURE__*/ styled("span")({
|
|
|
81
81
|
"l9yox33-1": [_exp12()]
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
function getTextVariant(variant,
|
|
85
|
-
return match(variant).with("PRIMARY", () =>
|
|
84
|
+
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_ALT).with("ERROR", () => TextVariant.PRIMARY_ALT).exhaustive();
|
|
86
86
|
}
|
|
87
|
-
function getIconVariant(variant,
|
|
88
|
-
return match(variant).with("PRIMARY", () =>
|
|
87
|
+
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_ALT).with("ERROR", () => IconVariant.PRIMARY_ALT).exhaustive();
|
|
89
89
|
}
|
|
90
90
|
var BUTTON_SIZE_TO_TEXT_SIZE_MAP = {
|
|
91
91
|
["SMALL"]: TextSize.BODY_SM,
|
|
@@ -98,7 +98,7 @@ var BUTTON_SIZE_TO_ICON_SIZE_MAP = {
|
|
|
98
98
|
["LARGE"]: 16
|
|
99
99
|
};
|
|
100
100
|
var Button = ({ label, icon, variant = "PRIMARY", size = "MEDIUM", onClick, onMouseEnter, onMouseLeave, fillWidth, isLoading, isDisabled, isIconTrailing, isEllipsis, cursor }) => {
|
|
101
|
-
const {
|
|
101
|
+
const { activeTheme } = useGalaxyTheme();
|
|
102
102
|
const handleClick = useCallback((e) => {
|
|
103
103
|
if (isDisabled || isLoading) return;
|
|
104
104
|
onClick(e);
|
|
@@ -109,7 +109,7 @@ var Button = ({ label, icon, variant = "PRIMARY", size = "MEDIUM", onClick, onMo
|
|
|
109
109
|
]);
|
|
110
110
|
const renderIcon = useCallback(() => {
|
|
111
111
|
if (!icon) return null;
|
|
112
|
-
let iconVariant = getIconVariant(variant,
|
|
112
|
+
let iconVariant = getIconVariant(variant, activeTheme);
|
|
113
113
|
if (isDisabled) iconVariant = IconVariant.TERTIARY;
|
|
114
114
|
return /* @__PURE__ */ jsx(FlexItem, {
|
|
115
115
|
shrink: 0,
|
|
@@ -125,11 +125,11 @@ var Button = ({ label, icon, variant = "PRIMARY", size = "MEDIUM", onClick, onMo
|
|
|
125
125
|
variant,
|
|
126
126
|
size,
|
|
127
127
|
isDisabled,
|
|
128
|
-
|
|
128
|
+
activeTheme
|
|
129
129
|
]);
|
|
130
130
|
const renderLabel = useCallback(() => {
|
|
131
131
|
if (!label) return null;
|
|
132
|
-
let textVariant = getTextVariant(variant,
|
|
132
|
+
let textVariant = getTextVariant(variant, activeTheme);
|
|
133
133
|
if (isDisabled) textVariant = TextVariant.TERTIARY_ALT;
|
|
134
134
|
return /* @__PURE__ */ jsx(LabelWrapper, {
|
|
135
135
|
$isEllipsis: isEllipsis,
|
|
@@ -149,7 +149,7 @@ var Button = ({ label, icon, variant = "PRIMARY", size = "MEDIUM", onClick, onMo
|
|
|
149
149
|
isDisabled,
|
|
150
150
|
isEllipsis,
|
|
151
151
|
cursor,
|
|
152
|
-
|
|
152
|
+
activeTheme
|
|
153
153
|
]);
|
|
154
154
|
return /* @__PURE__ */ jsxs(StyledButton, {
|
|
155
155
|
$variant: variant,
|
|
@@ -71,11 +71,11 @@ var LabelWrapper = /*#__PURE__*/ styled("span")({
|
|
|
71
71
|
"l147oxln-1": [_exp12()]
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
function getTextVariant(variant,
|
|
75
|
-
return match(variant).with(ButtonVariant.PRIMARY, () =>
|
|
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
76
|
}
|
|
77
|
-
function getIconVariant(variant,
|
|
78
|
-
return match(variant).with(ButtonVariant.PRIMARY, () =>
|
|
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
79
|
}
|
|
80
80
|
var BUTTON_SIZE_TO_TEXT_SIZE_MAP = {
|
|
81
81
|
[ButtonSize.SMALL]: TextSize.BODY_SM,
|
|
@@ -88,7 +88,7 @@ var BUTTON_SIZE_TO_ICON_SIZE_MAP = {
|
|
|
88
88
|
[ButtonSize.LARGE]: 16
|
|
89
89
|
};
|
|
90
90
|
var DropdownButton = ({ label, icon, variant = ButtonVariant.PRIMARY, size = ButtonSize.MEDIUM, onClick, isOpen, fillWidth, isLoading, isDisabled, isEllipsis, cursor }) => {
|
|
91
|
-
const {
|
|
91
|
+
const { activeTheme } = useGalaxyTheme();
|
|
92
92
|
const handleClick = useCallback((e) => {
|
|
93
93
|
if (isDisabled || isLoading) return;
|
|
94
94
|
onClick(e);
|
|
@@ -99,7 +99,7 @@ var DropdownButton = ({ label, icon, variant = ButtonVariant.PRIMARY, size = But
|
|
|
99
99
|
]);
|
|
100
100
|
const renderIcon = useCallback(() => {
|
|
101
101
|
if (!icon) return null;
|
|
102
|
-
let iconVariant = getIconVariant(variant,
|
|
102
|
+
let iconVariant = getIconVariant(variant, activeTheme);
|
|
103
103
|
if (isDisabled) iconVariant = IconVariant.TERTIARY;
|
|
104
104
|
return /* @__PURE__ */ jsx(FlexItem, {
|
|
105
105
|
shrink: 0,
|
|
@@ -115,10 +115,10 @@ var DropdownButton = ({ label, icon, variant = ButtonVariant.PRIMARY, size = But
|
|
|
115
115
|
variant,
|
|
116
116
|
size,
|
|
117
117
|
isDisabled,
|
|
118
|
-
|
|
118
|
+
activeTheme
|
|
119
119
|
]);
|
|
120
120
|
const renderLabel = useCallback(() => {
|
|
121
|
-
let textVariant = getTextVariant(variant,
|
|
121
|
+
let textVariant = getTextVariant(variant, activeTheme);
|
|
122
122
|
if (isDisabled) textVariant = TextVariant.TERTIARY_ALT;
|
|
123
123
|
return /* @__PURE__ */ jsx(LabelWrapper, {
|
|
124
124
|
$isEllipsis: isEllipsis,
|
|
@@ -138,10 +138,10 @@ var DropdownButton = ({ label, icon, variant = ButtonVariant.PRIMARY, size = But
|
|
|
138
138
|
isDisabled,
|
|
139
139
|
isEllipsis,
|
|
140
140
|
cursor,
|
|
141
|
-
|
|
141
|
+
activeTheme
|
|
142
142
|
]);
|
|
143
143
|
const renderCaret = useCallback(() => {
|
|
144
|
-
let iconVariant = getIconVariant(variant,
|
|
144
|
+
let iconVariant = getIconVariant(variant, activeTheme);
|
|
145
145
|
if (isDisabled) iconVariant = IconVariant.TERTIARY;
|
|
146
146
|
return /* @__PURE__ */ jsx(RotateWithTransition, {
|
|
147
147
|
isRotated: isOpen,
|
|
@@ -157,7 +157,7 @@ var DropdownButton = ({ label, icon, variant = ButtonVariant.PRIMARY, size = But
|
|
|
157
157
|
size,
|
|
158
158
|
isDisabled,
|
|
159
159
|
isOpen,
|
|
160
|
-
|
|
160
|
+
activeTheme
|
|
161
161
|
]);
|
|
162
162
|
return /* @__PURE__ */ jsxs(StyledDropdownButton, {
|
|
163
163
|
$variant: variant,
|
|
@@ -63,6 +63,6 @@ type CodeEditorProps = {
|
|
|
63
63
|
variant?: CodeEditorVariant;
|
|
64
64
|
};
|
|
65
65
|
export declare function createSearchPanelThemeExtension(theme: Theme): Extension;
|
|
66
|
-
export declare function createCodeMirrorThemeExtension(theme: Theme,
|
|
66
|
+
export declare function createCodeMirrorThemeExtension(theme: Theme, activeTheme: Exclude<GalaxyTheme, GalaxyTheme.SYSTEM>, variant: CodeEditorVariant, isReadOnly?: boolean): Extension;
|
|
67
67
|
declare const CodeEditor: ({ content, placeholder, lang, customExtensions, onChange, onExecute, borderRadius, noBorder, isReadOnly, noLineNumbers, padding, variant, }: CodeEditorProps) => import("react").JSX.Element;
|
|
68
68
|
export default CodeEditor;
|
|
@@ -109,8 +109,8 @@ function createSearchPanelThemeExtension(theme) {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
function createCodeMirrorThemeExtension(theme,
|
|
113
|
-
const codeMirrorTheme = match(
|
|
112
|
+
function createCodeMirrorThemeExtension(theme, activeTheme, variant, isReadOnly) {
|
|
113
|
+
const codeMirrorTheme = match(activeTheme).returnType().with(GalaxyTheme.DARK, () => "dark").with(GalaxyTheme.LIGHT, () => "light").exhaustive();
|
|
114
114
|
const settingsBackgroundColor = getBackgroundColorFromVariant(theme, variant);
|
|
115
115
|
const settingsSelectionColor = isReadOnly ? theme.color.opacity.bw0 : theme.color.opacity.bw16Alt;
|
|
116
116
|
const settingsSelectionMatchColor = getBackgroundColorFromVariant(theme, variant);
|
|
@@ -366,10 +366,10 @@ function createCodeMirrorThemeExtension(theme, galaxyTheme, variant, isReadOnly)
|
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
var CodeEditor = ({ content, placeholder, lang, customExtensions = [], onChange, onExecute, borderRadius, noBorder, isReadOnly, noLineNumbers, padding, variant = "PRIMARY" }) => {
|
|
369
|
-
const { theme,
|
|
370
|
-
const codeMirrorTheme = useMemo(() => createCodeMirrorThemeExtension(theme,
|
|
369
|
+
const { theme, activeTheme } = useGalaxyTheme();
|
|
370
|
+
const codeMirrorTheme = useMemo(() => createCodeMirrorThemeExtension(theme, activeTheme, variant, isReadOnly), [
|
|
371
371
|
theme,
|
|
372
|
-
|
|
372
|
+
activeTheme,
|
|
373
373
|
variant,
|
|
374
374
|
isReadOnly
|
|
375
375
|
]);
|
|
@@ -7,14 +7,14 @@ import { useMemo } from "react";
|
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/icons/GalaxyLogomark.tsx
|
|
9
9
|
var GalaxyLogomark = ({ height, isDark }) => {
|
|
10
|
-
const {
|
|
10
|
+
const { activeTheme } = useGalaxyTheme();
|
|
11
11
|
return useMemo(() => {
|
|
12
12
|
if (isDark) return /* @__PURE__ */ jsx(SvgGalaxyLogomarkDark, { height });
|
|
13
|
-
return match(
|
|
13
|
+
return match(activeTheme).with(GalaxyTheme.DARK, () => /* @__PURE__ */ jsx(SvgGalaxyLogomarkLight, { height })).with(GalaxyTheme.LIGHT, () => /* @__PURE__ */ jsx(SvgGalaxyLogomarkDark, { height })).exhaustive();
|
|
14
14
|
}, [
|
|
15
15
|
height,
|
|
16
16
|
isDark,
|
|
17
|
-
|
|
17
|
+
activeTheme
|
|
18
18
|
]);
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
@@ -7,14 +7,14 @@ import { useMemo } from "react";
|
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/icons/GalaxyWordmark.tsx
|
|
9
9
|
var GalaxyWordmark = ({ height, isDark }) => {
|
|
10
|
-
const {
|
|
10
|
+
const { activeTheme } = useGalaxyTheme();
|
|
11
11
|
return useMemo(() => {
|
|
12
12
|
if (isDark) return /* @__PURE__ */ jsx(SvgGalaxyWordmarkLight, { height });
|
|
13
|
-
return match(
|
|
13
|
+
return match(activeTheme).with(GalaxyTheme.DARK, () => /* @__PURE__ */ jsx(SvgGalaxyWordmarkLight, { height })).with(GalaxyTheme.LIGHT, () => /* @__PURE__ */ jsx(SvgGalaxyWordmarkDark, { height })).exhaustive();
|
|
14
14
|
}, [
|
|
15
15
|
height,
|
|
16
16
|
isDark,
|
|
17
|
-
|
|
17
|
+
activeTheme
|
|
18
18
|
]);
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
package/dist/icons/TextIcon.js
CHANGED
|
@@ -7,10 +7,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import { TextTIcon } from "@phosphor-icons/react";
|
|
8
8
|
//#region src/icons/TextIcon.tsx
|
|
9
9
|
var TextIcon = ({ size = 16 }) => {
|
|
10
|
-
const {
|
|
10
|
+
const { activeTheme } = useGalaxyTheme();
|
|
11
11
|
const variant = useMemo(() => {
|
|
12
|
-
return match(
|
|
13
|
-
}, [
|
|
12
|
+
return match(activeTheme).with(GalaxyTheme.DARK, () => IconVariant.PRIMARY_ALT).with(GalaxyTheme.LIGHT, () => IconVariant.PRIMARY).exhaustive();
|
|
13
|
+
}, [activeTheme]);
|
|
14
14
|
return /* @__PURE__ */ jsx(Icon, {
|
|
15
15
|
component: TextTIcon,
|
|
16
16
|
weight: IconWeight.FILL,
|
|
@@ -7,10 +7,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import { GlobeIcon } from "@phosphor-icons/react";
|
|
8
8
|
//#region src/icons/WebScrapeIcon.tsx
|
|
9
9
|
var WebScrapeIcon = ({ size = 16 }) => {
|
|
10
|
-
const {
|
|
10
|
+
const { activeTheme } = useGalaxyTheme();
|
|
11
11
|
const variant = useMemo(() => {
|
|
12
|
-
return match(
|
|
13
|
-
}, [
|
|
12
|
+
return match(activeTheme).with(GalaxyTheme.DARK, () => IconVariant.PRIMARY_ALT).with(GalaxyTheme.LIGHT, () => IconVariant.PRIMARY).exhaustive();
|
|
13
|
+
}, [activeTheme]);
|
|
14
14
|
return /* @__PURE__ */ jsx(Icon, {
|
|
15
15
|
component: GlobeIcon,
|
|
16
16
|
weight: IconWeight.FILL,
|
|
@@ -7,10 +7,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import { WebhooksLogoIcon } from "@phosphor-icons/react";
|
|
8
8
|
//#region src/icons/WebhookIcon.tsx
|
|
9
9
|
var WebhookIcon = ({ size = 16 }) => {
|
|
10
|
-
const {
|
|
10
|
+
const { activeTheme } = useGalaxyTheme();
|
|
11
11
|
const variant = useMemo(() => {
|
|
12
|
-
return match(
|
|
13
|
-
}, [
|
|
12
|
+
return match(activeTheme).with(GalaxyTheme.DARK, () => IconVariant.PRIMARY_ALT).with(GalaxyTheme.LIGHT, () => IconVariant.PRIMARY).exhaustive();
|
|
13
|
+
}, [activeTheme]);
|
|
14
14
|
return /* @__PURE__ */ jsx(Icon, {
|
|
15
15
|
component: WebhooksLogoIcon,
|
|
16
16
|
weight: IconWeight.FILL,
|
|
@@ -7,10 +7,10 @@ import { useMemo } from "react";
|
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/icons/sources/ClickhouseLogomark.tsx
|
|
9
9
|
var ClickhouseLogomark = ({ height }) => {
|
|
10
|
-
const {
|
|
10
|
+
const { activeTheme } = useGalaxyTheme();
|
|
11
11
|
return useMemo(() => {
|
|
12
|
-
return match(
|
|
13
|
-
}, [
|
|
12
|
+
return match(activeTheme).with(GalaxyTheme.DARK, () => /* @__PURE__ */ jsx(SvgClickhouseLogoSourceIconLight, { height })).with(GalaxyTheme.LIGHT, () => /* @__PURE__ */ jsx(SvgClickhouseLogoSourceIconDark, { height })).exhaustive();
|
|
13
|
+
}, [activeTheme, height]);
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ClickhouseLogomark as default };
|
|
@@ -7,10 +7,10 @@ import { useMemo } from "react";
|
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/icons/sources/SnowflakeLogomark.tsx
|
|
9
9
|
var SnowflakeLogomark = ({ height }) => {
|
|
10
|
-
const {
|
|
10
|
+
const { activeTheme } = useGalaxyTheme();
|
|
11
11
|
return useMemo(() => {
|
|
12
|
-
return match(
|
|
13
|
-
}, [
|
|
12
|
+
return match(activeTheme).with(GalaxyTheme.DARK, () => /* @__PURE__ */ jsx(SvgSnowflakeLogoSourceIconLight, { height })).with(GalaxyTheme.LIGHT, () => /* @__PURE__ */ jsx(SvgSnowflakeLogoSourceIconDark, { height })).exhaustive();
|
|
13
|
+
}, [activeTheme, height]);
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
16
|
export { SnowflakeLogomark as default };
|
package/dist/styles.css
CHANGED
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
.s1eqyn2i{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-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;-webkit-animation:spin-s1eqyn2i var(--s1eqyn2i-0) linear infinite;animation:spin-s1eqyn2i var(--s1eqyn2i-0) linear infinite;transform-origin:50% 50%;}@-webkit-keyframes spin-s1eqyn2i{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}@keyframes spin-s1eqyn2i{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}
|
|
12
12
|
.s1eibpeh{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;}.s1eibpeh >*{-webkit-animation:spinVertical-s1eibpeh var(--s1eibpeh-0) linear infinite;animation:spinVertical-s1eibpeh var(--s1eibpeh-0) linear infinite;}@-webkit-keyframes spinVertical-s1eibpeh{from{-webkit-transform:rotateY(0deg);-moz-transform:rotateY(0deg);-ms-transform:rotateY(0deg);transform:rotateY(0deg);}to{-webkit-transform:rotateY(360deg);-moz-transform:rotateY(360deg);-ms-transform:rotateY(360deg);transform:rotateY(360deg);}}@keyframes spinVertical-s1eibpeh{from{-webkit-transform:rotateY(0deg);-moz-transform:rotateY(0deg);-ms-transform:rotateY(0deg);transform:rotateY(0deg);}to{-webkit-transform:rotateY(360deg);-moz-transform:rotateY(360deg);-ms-transform:rotateY(360deg);transform:rotateY(360deg);}}
|
|
13
13
|
.sve5wdp{border-radius:200px;height:var(--sve5wdp-0);width:var(--sve5wdp-0);}
|
|
14
|
-
.
|
|
15
|
-
.
|
|
16
|
-
.s1o6ak6r{background:var(--s1o6ak6r-0);-webkit-background-size:200% 100%;background-size:200% 100%;-webkit-animation:shimmer-s1o6ak6r 2.5s infinite,pulse-s1o6ak6r 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;animation:shimmer-s1o6ak6r 2.5s infinite,pulse-s1o6ak6r 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;height:var(--s1o6ak6r-1);width:var(--s1o6ak6r-1);border-radius:
|
|
17
|
-
.s1iz4plp{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;border-radius:4px;background-color:var(--s1iz4plp-0);border:0.5px solid var(--s1iz4plp-1);padding:var(--s1iz4plp-2);height:var(--s1iz4plp-3);width:var(--s1iz4plp-3);}
|
|
14
|
+
.c3y5dk3{width:var(--c3y5dk3-0);height:var(--c3y5dk3-0);border-radius:50%;background:var(--c3y5dk3-1);position:relative;overflow:hidden;}
|
|
15
|
+
.d1vohupz{position:absolute;width:var(--d1vohupz-0);height:var(--d1vohupz-0);border-radius:50%;background:var(--d1vohupz-1);left:var(--d1vohupz-2);top:var(--d1vohupz-3);}
|
|
16
|
+
.s1o6ak6r{background:var(--s1o6ak6r-0);-webkit-background-size:200% 100%;background-size:200% 100%;-webkit-animation:shimmer-s1o6ak6r 2.5s infinite,pulse-s1o6ak6r 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;animation:shimmer-s1o6ak6r 2.5s infinite,pulse-s1o6ak6r 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;height:var(--s1o6ak6r-1);width:var(--s1o6ak6r-1);border-radius:50%;}@-webkit-keyframes shimmer-s1o6ak6r{0%{-webkit-background-position:-250% 0;background-position:-250% 0;}100%{-webkit-background-position:150% 0;background-position:150% 0;}}@keyframes shimmer-s1o6ak6r{0%{-webkit-background-position:-250% 0;background-position:-250% 0;}100%{-webkit-background-position:150% 0;background-position:150% 0;}}@-webkit-keyframes pulse-s1o6ak6r{0%,100%{opacity:0.75;}50%{opacity:0.25;}}@keyframes pulse-s1o6ak6r{0%,100%{opacity:0.75;}50%{opacity:0.25;}}
|
|
18
17
|
.s3lwr7s{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:var(--s3lwr7s-0);height:var(--s3lwr7s-0);background-color:var(--s3lwr7s-1);background-image:var(--s3lwr7s-2);-webkit-background-size:var(--s3lwr7s-3);background-size:var(--s3lwr7s-3);}
|
|
19
18
|
.siq7g1q{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:var(--siq7g1q-0);height:var(--siq7g1q-0);background-color:var(--siq7g1q-1);background-image:var(--siq7g1q-2);-webkit-background-size:var(--siq7g1q-3);background-size:var(--siq7g1q-3);border-radius:var(--siq7g1q-4);}
|
|
20
19
|
.saa8iad{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:var(--saa8iad-0);height:var(--saa8iad-0);background-color:var(--saa8iad-1);background-image:var(--saa8iad-2);-webkit-background-size:var(--saa8iad-3);background-size:var(--saa8iad-3);border-radius:var(--saa8iad-4);}
|
|
@@ -16,7 +16,7 @@ export interface ThemeDetector {
|
|
|
16
16
|
export declare const BrowserThemeDetector: ThemeDetector;
|
|
17
17
|
interface GalaxyThemeContextValue {
|
|
18
18
|
theme: Theme;
|
|
19
|
-
|
|
19
|
+
activeTheme: Exclude<GalaxyTheme, GalaxyTheme.SYSTEM>;
|
|
20
20
|
selectedTheme: GalaxyTheme;
|
|
21
21
|
systemTheme: GalaxyTheme.DARK | GalaxyTheme.LIGHT;
|
|
22
22
|
isSystemThemeSupported: boolean;
|
|
@@ -77,7 +77,7 @@ var GalaxyThemeProvider = ({ children, initialTheme, storageKey = GALAXY_THEME_S
|
|
|
77
77
|
const actualTheme = GALAXY_THEME_MAP[resolvedTheme] || GALAXY_THEME_MAP[GalaxyTheme.DARK];
|
|
78
78
|
const value = useMemo(() => ({
|
|
79
79
|
theme: actualTheme,
|
|
80
|
-
|
|
80
|
+
activeTheme: resolvedTheme,
|
|
81
81
|
selectedTheme,
|
|
82
82
|
systemTheme,
|
|
83
83
|
isSystemThemeSupported,
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { withTheme } from "../theme/GalaxyTheme.js";
|
|
2
|
-
import AvatarShimmer from "./AvatarShimmer.js";
|
|
3
|
-
import GalaxyLogomark from "../icons/GalaxyLogomark.js";
|
|
4
|
-
/* empty css */
|
|
5
|
-
import { styled } from "@linaria/react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
//#region src/avatar/GalaxyAvatar.tsx
|
|
8
|
-
var _exp = () => ({ theme }) => theme.color.background.tertiary;
|
|
9
|
-
var _exp2 = () => ({ theme }) => theme.color.border.primary;
|
|
10
|
-
var _exp3 = () => ({ $size }) => {
|
|
11
|
-
if ($size <= 16) return "2px";
|
|
12
|
-
if ($size <= 24) return "3px";
|
|
13
|
-
return "4px";
|
|
14
|
-
};
|
|
15
|
-
var _exp5 = () => ({ $size }) => $size;
|
|
16
|
-
var StyledGalaxyAvatar = withTheme(/*#__PURE__*/ styled("div")({
|
|
17
|
-
name: "StyledGalaxyAvatar",
|
|
18
|
-
class: "s1iz4plp",
|
|
19
|
-
propsAsIs: false,
|
|
20
|
-
vars: {
|
|
21
|
-
"s1iz4plp-0": [_exp()],
|
|
22
|
-
"s1iz4plp-1": [_exp2()],
|
|
23
|
-
"s1iz4plp-2": [_exp3()],
|
|
24
|
-
"s1iz4plp-3": [_exp5(), "px"]
|
|
25
|
-
}
|
|
26
|
-
}));
|
|
27
|
-
var GalaxyAvatar = ({ isLoading, size = 16 }) => {
|
|
28
|
-
if (isLoading) return isLoading ? /* @__PURE__ */ jsx(AvatarShimmer, { size }) : null;
|
|
29
|
-
const availableInnerSize = size - (size <= 16 ? 2 : size <= 24 ? 3 : 4) * 2;
|
|
30
|
-
return /* @__PURE__ */ jsx(StyledGalaxyAvatar, {
|
|
31
|
-
$size: size,
|
|
32
|
-
children: /* @__PURE__ */ jsx(GalaxyLogomark, { height: Math.max(8, Math.round(availableInnerSize * .75)) })
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
export { GalaxyAvatar as default };
|