@datalayer/core 0.0.25 → 0.0.27

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.
Files changed (109) hide show
  1. package/README.md +11 -11
  2. package/lib/api/index.d.ts +1 -1
  3. package/lib/api/index.js +1 -1
  4. package/lib/api/spacer/agentSpaces.d.ts +193 -0
  5. package/lib/api/spacer/agentSpaces.js +127 -0
  6. package/lib/api/spacer/index.d.ts +2 -1
  7. package/lib/api/spacer/index.js +2 -1
  8. package/lib/api/utils/validation.d.ts +1 -1
  9. package/lib/api/utils/validation.js +1 -1
  10. package/lib/client/auth/AuthenticationManager.d.ts +2 -2
  11. package/lib/client/auth/AuthenticationManager.js +2 -2
  12. package/lib/client/auth/index.d.ts +1 -1
  13. package/lib/client/auth/index.js +1 -1
  14. package/lib/client/auth/types.d.ts +1 -1
  15. package/lib/client/auth/types.js +1 -1
  16. package/lib/client/base.d.ts +9 -9
  17. package/lib/client/base.js +3 -3
  18. package/lib/client/constants.d.ts +2 -2
  19. package/lib/client/constants.js +2 -2
  20. package/lib/client/index.d.ts +2 -2
  21. package/lib/client/mixins/IAMMixin.js +1 -1
  22. package/lib/client/utils/spacerUtils.d.ts +1 -1
  23. package/lib/client/utils/spacerUtils.js +1 -1
  24. package/lib/components/auth/Login.d.ts +4 -0
  25. package/lib/components/auth/Login.js +8 -2
  26. package/lib/components/auth/Login.stories.d.ts +1 -0
  27. package/lib/components/progress/ConsumptionBar.js +26 -8
  28. package/lib/components/progress/CreditsIndicator.d.ts +7 -1
  29. package/lib/components/progress/CreditsIndicator.js +4 -2
  30. package/lib/components/{screenshot/ScreenCapture.d.ts → screencapture/Screencapture.d.ts} +5 -5
  31. package/lib/components/{screenshot/ScreenCapture.js → screencapture/Screencapture.js} +2 -2
  32. package/lib/components/screencapture/ScreencaptureButton.d.ts +3 -0
  33. package/lib/components/{screenshot/ScreenCaptureButton.js → screencapture/ScreencaptureButton.js} +8 -8
  34. package/lib/components/screencapture/index.d.ts +2 -0
  35. package/lib/components/{screenshot → screencapture}/index.js +2 -2
  36. package/lib/hooks/index.d.ts +1 -1
  37. package/lib/hooks/index.js +1 -1
  38. package/lib/hooks/layouts/{LayoutScreenshot.css → LayoutScreencapture.css} +2 -2
  39. package/lib/hooks/layouts/LayoutScreencapture.d.ts +3 -0
  40. package/lib/hooks/layouts/{LayoutScreenshot.js → LayoutScreencapture.js} +14 -14
  41. package/lib/hooks/layouts/index.d.ts +1 -1
  42. package/lib/hooks/layouts/index.js +1 -1
  43. package/lib/hooks/useCache.d.ts +91 -1
  44. package/lib/hooks/useCache.js +523 -59
  45. package/lib/hooks/useCellOutputshot.js +2 -2
  46. package/lib/hooks/useScreencapture.d.ts +18 -0
  47. package/lib/hooks/useScreencapture.js +53 -0
  48. package/lib/index.d.ts +1 -1
  49. package/lib/models/CreditsDTO.js +1 -1
  50. package/lib/models/Datasource.d.ts +2 -2
  51. package/lib/models/Datasource.js +2 -2
  52. package/lib/models/EnvironmentDTO.d.ts +3 -3
  53. package/lib/models/EnvironmentDTO.js +2 -2
  54. package/lib/models/HealthCheck.d.ts +1 -1
  55. package/lib/models/HealthCheck.js +1 -1
  56. package/lib/models/IAMProviderUsers.d.ts +11 -0
  57. package/lib/models/IAMProvidersSpecs.d.ts +2 -1
  58. package/lib/models/IAMProvidersSpecs.js +14 -0
  59. package/lib/models/ItemDTO.d.ts +2 -2
  60. package/lib/models/ItemDTO.js +2 -2
  61. package/lib/models/LexicalDTO.d.ts +2 -2
  62. package/lib/models/LexicalDTO.js +2 -2
  63. package/lib/models/NotebookDTO.d.ts +2 -2
  64. package/lib/models/NotebookDTO.js +1 -1
  65. package/lib/models/Page.js +1 -1
  66. package/lib/models/PageTag.d.ts +1 -1
  67. package/lib/models/PageTag.js +21 -0
  68. package/lib/models/RuntimeDTO.d.ts +2 -2
  69. package/lib/models/RuntimeDTO.js +2 -2
  70. package/lib/models/RuntimeSnapshotDTO.d.ts +3 -3
  71. package/lib/models/RuntimeSnapshotDTO.js +1 -1
  72. package/lib/models/Secret.d.ts +3 -3
  73. package/lib/models/Secret.js +2 -2
  74. package/lib/models/SpaceDTO.d.ts +2 -2
  75. package/lib/models/SpaceDTO.js +3 -3
  76. package/lib/models/UserDTO.d.ts +2 -2
  77. package/lib/models/UserDTO.js +1 -1
  78. package/lib/models/index.d.ts +1 -1
  79. package/lib/models/index.js +1 -1
  80. package/lib/state/substates/CoreState.js +1 -1
  81. package/lib/state/substates/LayoutState.d.ts +5 -5
  82. package/lib/state/substates/LayoutState.js +3 -3
  83. package/lib/theme/DatalayerThemeProvider.d.ts +22 -2
  84. package/lib/theme/DatalayerThemeProvider.js +17 -9
  85. package/lib/theme/index.d.ts +1 -0
  86. package/lib/theme/index.js +1 -0
  87. package/lib/theme/useSystemColorMode.d.ts +9 -0
  88. package/lib/theme/useSystemColorMode.js +26 -0
  89. package/lib/utils/Screencapture.d.ts +1 -0
  90. package/lib/utils/{Screenshot.js → Screencapture.js} +1 -1
  91. package/lib/utils/index.js +1 -1
  92. package/lib/views/datasources/DatasourceNew.d.ts +7 -1
  93. package/lib/views/datasources/DatasourceNew.js +3 -3
  94. package/lib/views/datasources/Datasources.d.ts +7 -1
  95. package/lib/views/datasources/Datasources.js +6 -4
  96. package/lib/views/iam-tokens/IAMTokenNew.d.ts +5 -1
  97. package/lib/views/iam-tokens/IAMTokenNew.js +2 -2
  98. package/lib/views/iam-tokens/IAMTokens.d.ts +7 -1
  99. package/lib/views/iam-tokens/IAMTokens.js +6 -4
  100. package/package.json +1 -1
  101. package/style/screencapture/index.css +58 -0
  102. package/lib/components/screenshot/ScreenCaptureButton.d.ts +0 -3
  103. package/lib/components/screenshot/index.d.ts +0 -2
  104. package/lib/hooks/layouts/LayoutScreenshot.d.ts +0 -3
  105. package/lib/hooks/useCache0.d.ts +0 -312
  106. package/lib/hooks/useCache0.js +0 -3189
  107. package/lib/hooks/useScreenshot.d.ts +0 -18
  108. package/lib/hooks/useScreenshot.js +0 -53
  109. package/lib/utils/Screenshot.d.ts +0 -1
@@ -15,7 +15,7 @@ export type PortalDisplay = {
15
15
  portal: ReactPortal;
16
16
  pinned: boolean;
17
17
  };
18
- export type ScreenshotDisplay = {
18
+ export type ScreencaptureDisplay = {
19
19
  open: boolean;
20
20
  message?: string | void;
21
21
  };
@@ -30,13 +30,13 @@ export type ILayoutState = {
30
30
  organization?: IAnyOrganization;
31
31
  rightPortal?: PortalDisplay;
32
32
  screenCapture?: string;
33
- screenshot?: ScreenshotDisplay;
33
+ screenshot?: ScreencaptureDisplay;
34
34
  space?: IAnySpace;
35
35
  team?: IAnyTeam;
36
36
  };
37
37
  export type LayoutState = ILayoutState & {
38
38
  hideBackdrop: () => void;
39
- hideScreenshot: () => void;
39
+ hideScreencapture: () => void;
40
40
  reset: () => void;
41
41
  resetForcedLeftPortal: () => void;
42
42
  resetForcedRightPortal: () => void;
@@ -48,9 +48,9 @@ export type LayoutState = ILayoutState & {
48
48
  setLeftPortal: (leftPortal: PortalDisplay) => void;
49
49
  setLeftSidebarVariant: (leftSidebarVariant: LeftSidebarVariant) => void;
50
50
  setRightPortal: (rightPortal: PortalDisplay) => void;
51
- setScreenCapture: (screenCapture?: string) => void;
51
+ setScreencapture: (screenCapture?: string) => void;
52
52
  showBackdrop: (message?: string) => void;
53
- showScreenshot: (message?: string) => void;
53
+ showScreencapture: (message?: string) => void;
54
54
  triggerItemsRefresh: () => void;
55
55
  updateLayoutOrganization: (organization?: Partial<IAnyOrganization>) => void;
56
56
  updateLayoutSpace: (space?: Partial<IAnySpace>) => void;
@@ -20,12 +20,12 @@ export const layoutStore = createStore((set, get) => ({
20
20
  hideBackdrop: () => set((state) => ({
21
21
  backdrop: { open: false, message: undefined },
22
22
  })),
23
- hideScreenshot: () => set((state) => ({
23
+ hideScreencapture: () => set((state) => ({
24
24
  screenshot: { open: false, message: undefined },
25
25
  })),
26
26
  setBootstrapped: (bootstrapped) => set((state) => ({ bootstrapped })),
27
27
  showBackdrop: (message) => set((state) => ({ backdrop: { open: true, message } })),
28
- showScreenshot: (message) => set((state) => ({ screenshot: { open: true, message } })),
28
+ showScreencapture: (message) => set((state) => ({ screenshot: { open: true, message } })),
29
29
  setBanner: (bannerDisplay) => set((state) => ({
30
30
  banner: {
31
31
  timestamp: new Date(),
@@ -78,7 +78,7 @@ export const layoutStore = createStore((set, get) => ({
78
78
  triggerItemsRefresh: () => set((state) => ({
79
79
  itemsRefreshCount: state.itemsRefreshCount + 1,
80
80
  })),
81
- setScreenCapture: (screenCapture) => set((state) => ({ screenCapture })),
81
+ setScreencapture: (screenCapture) => set((state) => ({ screenCapture })),
82
82
  reset: () => set((state) => ({ bootstrapped: false })),
83
83
  }));
84
84
  export function useLayoutStore(selector) {
@@ -1,9 +1,29 @@
1
1
  import { type CSSProperties } from 'react';
2
2
  import { ThemeProviderProps } from '@primer/react';
3
- export interface IDatalayerThemeProviderProps extends Omit<ThemeProviderProps, 'theme'> {
3
+ export interface IDatalayerThemeProviderProps extends Omit<ThemeProviderProps, 'theme' | 'colorMode'> {
4
4
  /**
5
- * Base styles.
5
+ * Color mode to use.
6
+ * - `'light'` / `'dark'` — explicit override
7
+ * - `'auto'` — follow the operating system preference (prefers-color-scheme)
8
+ * - Primer's `'day'` / `'night'` are still accepted.
9
+ */
10
+ colorMode?: 'light' | 'dark' | 'auto' | 'day' | 'night';
11
+ /**
12
+ * Additional base styles merged on top of theme defaults.
6
13
  */
7
14
  baseStyles?: CSSProperties;
15
+ /**
16
+ * Optional Primer theme object. Defaults to the built-in datalayerTheme.
17
+ */
18
+ theme?: Record<string, any>;
19
+ /**
20
+ * Optional per-mode style overrides (base + button CSS vars).
21
+ * When provided, these replace the built-in datalayer styles entirely.
22
+ * The `baseStyles` prop is still merged on top.
23
+ */
24
+ themeStyles?: {
25
+ light: CSSProperties;
26
+ dark: CSSProperties;
27
+ };
8
28
  }
9
29
  export declare function DatalayerThemeProvider(props: React.PropsWithChildren<IDatalayerThemeProviderProps>): JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { BaseStyles, ThemeProvider } from '@primer/react';
3
3
  import { datalayerTheme, datalayerColors } from './DatalayerTheme';
4
+ import { useSystemColorMode } from './useSystemColorMode';
4
5
  const baseStyleLight = {
5
6
  backgroundColor: datalayerColors.white,
6
7
  color: datalayerColors.black,
@@ -32,15 +33,22 @@ const primaryButtonVarsDark = {
32
33
  '--color-btn-primary-hover-bg': datalayerColors.greenBright,
33
34
  };
34
35
  export function DatalayerThemeProvider(props) {
35
- const { children, colorMode, baseStyles, ...rest } = props;
36
- const isDark = colorMode === 'dark' || colorMode === 'night';
37
- const baseStyleDefaults = isDark ? baseStyleDark : baseStyleLight;
38
- const primaryButtonVars = isDark
39
- ? primaryButtonVarsDark
40
- : primaryButtonVarsLight;
41
- return (_jsx(ThemeProvider, { colorMode: colorMode, theme: datalayerTheme, ...rest, children: _jsx(BaseStyles, { style: {
42
- ...baseStyleDefaults,
43
- ...primaryButtonVars,
36
+ const { children, colorMode, baseStyles, theme, themeStyles, ...rest } = props;
37
+ // Resolve 'auto' actual system preference ('light' or 'dark').
38
+ const systemMode = useSystemColorMode();
39
+ const resolvedColorMode = colorMode === 'auto' ? systemMode : (colorMode ?? 'light');
40
+ const isDark = resolvedColorMode === 'dark' || resolvedColorMode === 'night';
41
+ const resolvedTheme = theme ?? datalayerTheme;
42
+ const defaultStyles = isDark
43
+ ? { ...baseStyleDark, ...primaryButtonVarsDark }
44
+ : { ...baseStyleLight, ...primaryButtonVarsLight };
45
+ const resolvedStyles = themeStyles
46
+ ? isDark
47
+ ? themeStyles.dark
48
+ : themeStyles.light
49
+ : defaultStyles;
50
+ return (_jsx(ThemeProvider, { colorMode: resolvedColorMode, theme: resolvedTheme, ...rest, children: _jsx(BaseStyles, { style: {
51
+ ...resolvedStyles,
44
52
  ...baseStyles,
45
53
  }, children: children }) }));
46
54
  }
@@ -1,3 +1,4 @@
1
1
  export * from './DatalayerTheme';
2
2
  export * from './DatalayerThemeProvider';
3
3
  export * from './Palette';
4
+ export * from './useSystemColorMode';
@@ -5,3 +5,4 @@
5
5
  export * from './DatalayerTheme';
6
6
  export * from './DatalayerThemeProvider';
7
7
  export * from './Palette';
8
+ export * from './useSystemColorMode';
@@ -0,0 +1,9 @@
1
+ type ResolvedColorMode = 'light' | 'dark';
2
+ /**
3
+ * React hook that tracks the operating system's preferred color scheme.
4
+ *
5
+ * Listens to `prefers-color-scheme` media query changes and returns
6
+ * either `'light'` or `'dark'`.
7
+ */
8
+ export declare function useSystemColorMode(): ResolvedColorMode;
9
+ export default useSystemColorMode;
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ import { useEffect, useState } from 'react';
6
+ /**
7
+ * React hook that tracks the operating system's preferred color scheme.
8
+ *
9
+ * Listens to `prefers-color-scheme` media query changes and returns
10
+ * either `'light'` or `'dark'`.
11
+ */
12
+ export function useSystemColorMode() {
13
+ const getMode = () => typeof window !== 'undefined' &&
14
+ window.matchMedia('(prefers-color-scheme: dark)').matches
15
+ ? 'dark'
16
+ : 'light';
17
+ const [mode, setMode] = useState(getMode);
18
+ useEffect(() => {
19
+ const media = window.matchMedia('(prefers-color-scheme: dark)');
20
+ const listener = (e) => setMode(e.matches ? 'dark' : 'light');
21
+ media.addEventListener('change', listener);
22
+ return () => media.removeEventListener('change', listener);
23
+ }, []);
24
+ return mode;
25
+ }
26
+ export default useSystemColorMode;
@@ -0,0 +1 @@
1
+ export declare const takeHTMLNodeScreencapture: (node: HTMLDivElement) => Promise<string>;
@@ -3,7 +3,7 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  import html2canvas from 'html2canvas';
6
- export const takeHTMLNodeScreenshot = async (node) => {
6
+ export const takeHTMLNodeScreencapture = async (node) => {
7
7
  const sc = html2canvas(node, {
8
8
  width: node.getBoundingClientRect().width,
9
9
  height: node.getBoundingClientRect().height,
@@ -23,7 +23,7 @@ export * from './Notebook';
23
23
  export * from './Number';
24
24
  export * from './Plots';
25
25
  export * from './Random';
26
- // export * from './Screenshot'; Do not export html2canvas for now.
26
+ // export * from './Screencapture'; Do not export html2canvas for now.
27
27
  export * from './Sleep';
28
28
  export * from './Snapshot';
29
29
  export * from './String';
@@ -1,2 +1,8 @@
1
- export declare const DatasourceNew: () => import("react/jsx-runtime").JSX.Element;
1
+ export type DatasourceNewProps = {
2
+ /** Route to navigate after creating a datasource. Defaults to '/settings/integrations/datasources'. */
3
+ datasourcesListRoute?: string;
4
+ /** Route to navigate to the secrets page. Defaults to '/settings/iam/secrets'. */
5
+ secretsRoute?: string;
6
+ };
7
+ export declare const DatasourceNew: ({ datasourcesListRoute, secretsRoute, }?: DatasourceNewProps) => import("react/jsx-runtime").JSX.Element;
2
8
  export default DatasourceNew;
@@ -8,7 +8,7 @@ import { PageHeader, FormControl, Button, TextInput, Text, Textarea, Select, Fla
8
8
  import { Box } from '@datalayer/primer-addons';
9
9
  import { useCache, useNavigate, useToast } from '../../hooks';
10
10
  import { useRunStore } from '../../state';
11
- export const DatasourceNew = () => {
11
+ export const DatasourceNew = ({ datasourcesListRoute = '/settings/integrations/datasources', secretsRoute = '/settings/iam/secrets', } = {}) => {
12
12
  const runStore = useRunStore();
13
13
  const { useCreateDatasource } = useCache();
14
14
  const createDatasourceMutation = useCreateDatasource();
@@ -99,7 +99,7 @@ export const DatasourceNew = () => {
99
99
  onSuccess: (resp) => {
100
100
  if (resp.success) {
101
101
  enqueueToast(resp.message, { variant: 'success' });
102
- navigate(`/settings/integrations/datasources`);
102
+ navigate(datasourcesListRoute);
103
103
  }
104
104
  },
105
105
  onSettled: () => {
@@ -107,7 +107,7 @@ export const DatasourceNew = () => {
107
107
  },
108
108
  });
109
109
  };
110
- return (_jsxs(Box, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New Datasource" }) }) }), _jsxs(Flash, { variant: "warning", children: [formValues.variant === 'athena' && (_jsxs(Text, { children: ["For ", _jsx(Link, { href: "https://aws.amazon.com/athena", children: "Amazon Athena" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/settings/iam/secrets', e), children: "Secrets" }), ' ', "are available:", ' ', _jsx(Text, { as: "code", children: "AWS_SECRET_ACCESS_KEY" }), ' ', _jsx(Text, { as: "code", children: "AWS_ACCESS_KEY_ID" }), ' ', _jsx(Text, { as: "code", children: "AWS_DEFAULT_REGION" })] })), formValues.variant === 'bigquery' && (_jsxs(Text, { children: ["For", ' ', _jsx(Link, { href: "https://cloud.google.com/bigquery", children: "Google Big Query" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/settings/iam/secrets', e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "GOOGLE_APPLICATION_CREDENTIALS" })] })), formValues.variant === 'mssentinel' && (_jsxs(Text, { children: ["For", ' ', _jsx(Link, { href: "https://learn.microsoft.com/en-us/azure/sentinel/overview?tabs=defender-portaly", children: "Microsoft Sentinel" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/settings/iam/secrets', e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "AZURE_TENANT_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_CLIENT_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_CLIENT_SECRET" }), ` `, _jsx(Text, { as: "code", children: "AZURE_SUBSCRIPTION_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_RESOURCE_GROUP" }), ` `, _jsx(Text, { as: "code", children: "MSSENTINEL_WORKSPACE_ID" }), ` `, _jsx(Text, { as: "code", children: "MSSENTINEL_WORKSPACE_NAME" })] })), formValues.variant === 'splunk' && (_jsxs(Text, { children: ["For ", _jsx(Link, { href: "https://www.splunk.com/", children: "Splunk" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate('/settings/iam/secrets', e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "SPLUNK_HOST" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_PORT" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_USERNAME" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_PASSWORD" })] }))] }), _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Datasource type" }), _jsxs(Select, { name: "type", value: formValues.variant, onChange: valueVariantChange, children: [_jsx(Select.Option, { value: "athena", children: "Amazon Athena" }), _jsx(Select.Option, { value: "bigquery", children: "Google BigQuery" }), _jsx(Select.Option, { value: "mssentinel", children: "Microsoft Sentinel" }), _jsx(Select.Option, { value: "splunk", children: "Splunk" })] }), _jsx(FormControl.Caption, { children: "Pick the most appropriate datasource type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: valueNameChange, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The datasource name is a short name that identifies in a unique way your datasource." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), formValues.variant === 'athena' && (_jsxs(_Fragment, { children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Database" }), _jsx(TextInput, { block: true, value: formValues.database, onChange: valueDatabaseChange }), validationResult.database === false && (_jsx(FormControl.Validation, { variant: "error", children: "Database must have more than 1." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Output Bucket" }), _jsx(TextInput, { block: true, value: formValues.outputBucket, onChange: valueOutputBucketChange }), validationResult.database === false && (_jsx(FormControl.Validation, { variant: "error", children: "Output bucket must have more than 1." }))] })] })), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: valueDescriptionChange }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.database ||
110
+ return (_jsxs(Box, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New Datasource" }) }) }), _jsxs(Flash, { variant: "warning", children: [formValues.variant === 'athena' && (_jsxs(Text, { children: ["For ", _jsx(Link, { href: "https://aws.amazon.com/athena", children: "Amazon Athena" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secrets" }), ' ', "are available:", ' ', _jsx(Text, { as: "code", children: "AWS_SECRET_ACCESS_KEY" }), ' ', _jsx(Text, { as: "code", children: "AWS_ACCESS_KEY_ID" }), ' ', _jsx(Text, { as: "code", children: "AWS_DEFAULT_REGION" })] })), formValues.variant === 'bigquery' && (_jsxs(Text, { children: ["For", ' ', _jsx(Link, { href: "https://cloud.google.com/bigquery", children: "Google Big Query" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "GOOGLE_APPLICATION_CREDENTIALS" })] })), formValues.variant === 'mssentinel' && (_jsxs(Text, { children: ["For", ' ', _jsx(Link, { href: "https://learn.microsoft.com/en-us/azure/sentinel/overview?tabs=defender-portaly", children: "Microsoft Sentinel" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "AZURE_TENANT_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_CLIENT_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_CLIENT_SECRET" }), ` `, _jsx(Text, { as: "code", children: "AZURE_SUBSCRIPTION_ID" }), ` `, _jsx(Text, { as: "code", children: "AZURE_RESOURCE_GROUP" }), ` `, _jsx(Text, { as: "code", children: "MSSENTINEL_WORKSPACE_ID" }), ` `, _jsx(Text, { as: "code", children: "MSSENTINEL_WORKSPACE_NAME" })] })), formValues.variant === 'splunk' && (_jsxs(Text, { children: ["For ", _jsx(Link, { href: "https://www.splunk.com/", children: "Splunk" }), ", ensure the following", ' ', _jsx(Link, { href: "javascript: return false;", onClick: e => navigate(secretsRoute, e), children: "Secret" }), ' ', "is available:", ' ', _jsx(Text, { as: "code", children: "SPLUNK_HOST" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_PORT" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_USERNAME" }), ` `, _jsx(Text, { as: "code", children: "SPLUNK_PASSWORD" })] }))] }), _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Datasource type" }), _jsxs(Select, { name: "type", value: formValues.variant, onChange: valueVariantChange, children: [_jsx(Select.Option, { value: "athena", children: "Amazon Athena" }), _jsx(Select.Option, { value: "bigquery", children: "Google BigQuery" }), _jsx(Select.Option, { value: "mssentinel", children: "Microsoft Sentinel" }), _jsx(Select.Option, { value: "splunk", children: "Splunk" })] }), _jsx(FormControl.Caption, { children: "Pick the most appropriate datasource type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: valueNameChange, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The datasource name is a short name that identifies in a unique way your datasource." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), formValues.variant === 'athena' && (_jsxs(_Fragment, { children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Database" }), _jsx(TextInput, { block: true, value: formValues.database, onChange: valueDatabaseChange }), validationResult.database === false && (_jsx(FormControl.Validation, { variant: "error", children: "Database must have more than 1." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Output Bucket" }), _jsx(TextInput, { block: true, value: formValues.outputBucket, onChange: valueOutputBucketChange }), validationResult.database === false && (_jsx(FormControl.Validation, { variant: "error", children: "Output bucket must have more than 1." }))] })] })), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: valueDescriptionChange }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.database ||
111
111
  !validationResult.outputBucket ||
112
112
  !validationResult.name ||
113
113
  !validationResult.description, sx: { marginTop: 2 }, onClick: e => {
@@ -1,2 +1,8 @@
1
- export declare const Datasources: () => import("react/jsx-runtime").JSX.Element;
1
+ export type DatasourcesProps = {
2
+ /** Route to navigate when clicking "New datasource" button. Defaults to '/new/datasource'. */
3
+ newDatasourceRoute?: string;
4
+ /** Base route for the datasources list (used for edit navigation). Defaults to current relative path. */
5
+ datasourcesListRoute?: string;
6
+ };
7
+ export declare const Datasources: ({ newDatasourceRoute, datasourcesListRoute, }?: DatasourcesProps) => import("react/jsx-runtime").JSX.Element;
2
8
  export default Datasources;
@@ -9,7 +9,7 @@ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experim
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EditIcon } from '@datalayer/icons-react';
11
11
  import { useCache, useNavigate } from '../../hooks';
12
- const DatasourcesTable = () => {
12
+ const DatasourcesTable = ({ datasourcesListRoute, }) => {
13
13
  const { useDatasources } = useCache();
14
14
  const datasourcesQuery = useDatasources();
15
15
  const navigate = useNavigate();
@@ -38,12 +38,14 @@ const DatasourcesTable = () => {
38
38
  {
39
39
  header: '',
40
40
  field: 'id',
41
- renderCell: datasource => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(`${datasource.id}`, e) })),
41
+ renderCell: datasource => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(datasourcesListRoute
42
+ ? `${datasourcesListRoute}/${datasource.id}`
43
+ : `${datasource.id}`, e) })),
42
44
  },
43
45
  ] })] }));
44
46
  };
45
- export const Datasources = () => {
47
+ export const Datasources = ({ newDatasourceRoute = '/new/datasource', datasourcesListRoute, } = {}) => {
46
48
  const navigate = useNavigate();
47
- return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "Datasources" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate('/new/datasource', e), children: "New datasource" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(DatasourcesTable, {}) }) })] }));
49
+ return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "Datasources" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate(newDatasourceRoute, e), children: "New datasource" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(DatasourcesTable, { datasourcesListRoute: datasourcesListRoute }) }) })] }));
48
50
  };
49
51
  export default Datasources;
@@ -1,2 +1,6 @@
1
- export declare const IAMTokenNew: () => import("react/jsx-runtime").JSX.Element;
1
+ export type IAMTokenNewProps = {
2
+ /** Route to navigate when clicking "List my Tokens". Defaults to '/settings/iam/tokens'. */
3
+ tokensListRoute?: string;
4
+ };
5
+ export declare const IAMTokenNew: ({ tokensListRoute, }?: IAMTokenNewProps) => import("react/jsx-runtime").JSX.Element;
2
6
  export default IAMTokenNew;
@@ -10,7 +10,7 @@ import { CopyIcon } from '@primer/octicons-react';
10
10
  import { Calendar, defaultCalendarStrings } from '@fluentui/react';
11
11
  import { useCache, useNavigate, useToast } from '../../hooks';
12
12
  import { useRunStore } from '../../state';
13
- export const IAMTokenNew = () => {
13
+ export const IAMTokenNew = ({ tokensListRoute = '/settings/iam/tokens', } = {}) => {
14
14
  const runStore = useRunStore();
15
15
  const { useCreateToken } = useCache();
16
16
  const createTokenMutation = useCreateToken();
@@ -108,7 +108,7 @@ export const IAMTokenNew = () => {
108
108
  variant: 'success',
109
109
  });
110
110
  }
111
- } })] })] }), _jsx(Box, { mt: 3, children: _jsx(Button, { onClick: e => navigate('/settings/iam/tokens', e), children: "List my Tokens" }) })] })) : (_jsxs(_Fragment, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New IAM Token" }) }) }), _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Token type" }), _jsx(Select, { name: "type", value: formValues.variant, onChange: valueVariantChange, children: _jsx(Select.Option, { value: "user_token", children: "User Token" }) }), _jsx(FormControl.Caption, { children: "Pick the most appropriate token type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: valueNameChange, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The token name is a short name that identifies in a unique way your token." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Expiration day" }), _jsx(Calendar, { showGoToToday: true, onSelectDate: expirationDateChange, value: formValues.expirationDate, strings: defaultCalendarStrings }), validationResult.expirationDate !== true ? (_jsx(FormControl.Validation, { variant: "error", children: "Pick an expiration date in the future." })) : (_jsxs(FormControl.Validation, { variant: "success", children: ["Expiration date:", ' ', formValues.expirationDate?.toLocaleDateString(), "."] }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: valueDescriptionChange }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.name ||
111
+ } })] })] }), _jsx(Box, { mt: 3, children: _jsx(Button, { onClick: e => navigate(tokensListRoute, e), children: "List my Tokens" }) })] })) : (_jsxs(_Fragment, { children: [_jsx(PageHeader, { children: _jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "New IAM Token" }) }) }), _jsx(Box, { display: "grid", gridTemplateColumns: "1fr 1fr", sx: { gap: 3 }, children: _jsx(Box, { children: _jsxs(Box, { sx: { label: { marginTop: 2 } }, children: [_jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Token type" }), _jsx(Select, { name: "type", value: formValues.variant, onChange: valueVariantChange, children: _jsx(Select.Option, { value: "user_token", children: "User Token" }) }), _jsx(FormControl.Caption, { children: "Pick the most appropriate token type." })] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Name" }), _jsx(TextInput, { block: true, value: formValues.name, onChange: valueNameChange, autoFocus: true }), _jsx(FormControl.Caption, { children: "Hint: The token name is a short name that identifies in a unique way your token." }), validationResult.name === false && (_jsx(FormControl.Validation, { variant: "error", children: "Name length must be between 2 and 32 characters." }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Expiration day" }), _jsx(Calendar, { showGoToToday: true, onSelectDate: expirationDateChange, value: formValues.expirationDate, strings: defaultCalendarStrings }), validationResult.expirationDate !== true ? (_jsx(FormControl.Validation, { variant: "error", children: "Pick an expiration date in the future." })) : (_jsxs(FormControl.Validation, { variant: "success", children: ["Expiration date:", ' ', formValues.expirationDate?.toLocaleDateString(), "."] }))] }), _jsxs(FormControl, { required: true, children: [_jsx(FormControl.Label, { children: "Description" }), _jsx(Textarea, { block: true, value: formValues.description, onChange: valueDescriptionChange }), validationResult.description === false && (_jsx(FormControl.Validation, { variant: "error", children: "Description must have more than 2 characters." }))] }), _jsx(Button, { variant: "primary", disabled: !validationResult.name ||
112
112
  !validationResult.description ||
113
113
  !validationResult.expirationDate, sx: { marginTop: 2 }, onClick: e => {
114
114
  e.preventDefault();
@@ -1,2 +1,8 @@
1
- export declare const IAMTokens: () => import("react/jsx-runtime").JSX.Element;
1
+ export type IAMTokensProps = {
2
+ /** Route to navigate when clicking "New IAM token" button. Defaults to '/new/token'. */
3
+ newTokenRoute?: string;
4
+ /** Base route for the tokens list (used for edit navigation). Defaults to current relative path. */
5
+ tokensListRoute?: string;
6
+ };
7
+ export declare const IAMTokens: ({ newTokenRoute, tokensListRoute, }?: IAMTokensProps) => import("react/jsx-runtime").JSX.Element;
2
8
  export default IAMTokens;
@@ -9,7 +9,7 @@ import { Blankslate, PageHeader, Table, DataTable, } from '@primer/react/experim
9
9
  import { Box } from '@datalayer/primer-addons';
10
10
  import { EditIcon } from '@datalayer/icons-react';
11
11
  import { useCache, useNavigate } from '../../hooks';
12
- const TokensTable = () => {
12
+ const TokensTable = ({ tokensListRoute }) => {
13
13
  const { useTokens } = useCache();
14
14
  const getTokensQuery = useTokens();
15
15
  const navigate = useNavigate();
@@ -42,12 +42,14 @@ const TokensTable = () => {
42
42
  {
43
43
  header: '',
44
44
  field: 'id',
45
- renderCell: token => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(`${token.id}`, e) })),
45
+ renderCell: token => (_jsx(IconButton, { icon: EditIcon, "aria-label": "Edit", size: "small", variant: "invisible", onClick: e => navigate(tokensListRoute
46
+ ? `${tokensListRoute}/${token.id}`
47
+ : `${token.id}`, e) })),
46
48
  },
47
49
  ] })] }));
48
50
  };
49
- export const IAMTokens = () => {
51
+ export const IAMTokens = ({ newTokenRoute = '/new/token', tokensListRoute, } = {}) => {
50
52
  const navigate = useNavigate();
51
- return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "IAM Tokens" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate('/new/token', e), children: "New IAM token" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(TokensTable, {}) }) })] }));
53
+ return (_jsxs(PageLayout, { containerWidth: "full", padding: "normal", style: { overflow: 'visible', minHeight: 'calc(100vh - 45px)' }, children: [_jsx(PageLayout.Header, { children: _jsxs(PageHeader, { children: [_jsx(PageHeader.TitleArea, { variant: "large", children: _jsx(PageHeader.Title, { children: "IAM Tokens" }) }), _jsx(PageHeader.Actions, { children: _jsx(Button, { size: "small", variant: "primary", onClick: e => navigate(newTokenRoute, e), children: "New IAM token" }) })] }) }), _jsx(PageLayout.Content, { children: _jsx(Box, { children: _jsx(TokensTable, { tokensListRoute: tokensListRoute }) }) })] }));
52
54
  };
53
55
  export default IAMTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/core",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+
6
+ .crosshairs {
7
+ position: fixed;
8
+ width: 100%;
9
+ z-index: 2147483645;
10
+ }
11
+
12
+ .crosshairs.hidden {
13
+ display: none;
14
+ }
15
+
16
+ .crosshairs::before,
17
+ .crosshairs::after {
18
+ content: '';
19
+ position: absolute;
20
+ }
21
+
22
+ .crosshairs::before {
23
+ height: 24px;
24
+ width: 2px;
25
+ background: #fff;
26
+ top: -11px;
27
+ }
28
+
29
+ .crosshairs::after {
30
+ width: 24px;
31
+ height: 2px;
32
+ background: #fff;
33
+ left: -11px;
34
+ }
35
+
36
+ .overlay {
37
+ position: fixed;
38
+ top: 0;
39
+ left: 0;
40
+ width: 100%;
41
+ height: 100%;
42
+ background-color: rgba(0, 0, 0, 0.5);
43
+ }
44
+
45
+ .overlay.highlighting {
46
+ background: none;
47
+ border-color: rgba(0, 0, 0, 0.5);
48
+ border-style: solid;
49
+ }
50
+
51
+ .crosshairs,
52
+ .crosshairs:before,
53
+ .crosshairs:after,
54
+ .overlay,
55
+ .overlay:before,
56
+ .overlay:after {
57
+ box-sizing: border-box;
58
+ }
@@ -1,3 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- export declare const ScreenCaptureButton: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
3
- export default ScreenCaptureButton;
@@ -1,2 +0,0 @@
1
- export * from './ScreenCapture';
2
- export * from './ScreenCaptureButton';
@@ -1,3 +0,0 @@
1
- import './LayoutScreenshot.css';
2
- export declare const LayoutScreenshot: () => import("react/jsx-runtime").JSX.Element;
3
- export default LayoutScreenshot;