@datalayer/core 0.0.16 → 0.0.18

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 (133) hide show
  1. package/README.md +9 -13
  2. package/lib/client/auth/AuthenticationManager.d.ts +95 -0
  3. package/lib/client/auth/AuthenticationManager.js +214 -0
  4. package/lib/client/auth/index.d.ts +8 -0
  5. package/lib/client/auth/index.js +17 -0
  6. package/lib/client/auth/storage.d.ts +154 -0
  7. package/lib/client/auth/storage.js +447 -0
  8. package/lib/client/auth/strategies.d.ts +54 -0
  9. package/lib/client/auth/strategies.js +238 -0
  10. package/lib/client/auth/types.d.ts +151 -0
  11. package/lib/{examples/index.js → client/auth/types.js} +4 -2
  12. package/lib/client/base.d.ts +3 -0
  13. package/lib/client/base.js +9 -0
  14. package/lib/client/index.d.ts +1 -0
  15. package/lib/client/index.js +2 -0
  16. package/lib/components/auth/Login.d.ts +40 -0
  17. package/lib/components/auth/Login.js +173 -0
  18. package/lib/components/auth/Login.stories.d.ts +54 -0
  19. package/lib/components/auth/Login.stories.js +104 -0
  20. package/lib/components/auth/LoginToken.d.ts +16 -0
  21. package/lib/components/auth/LoginToken.js +63 -0
  22. package/lib/components/auth/index.d.ts +5 -0
  23. package/lib/components/auth/index.js +16 -0
  24. package/lib/components/avatars/BoringAvatar.d.ts +6 -15
  25. package/lib/components/avatars/BoringAvatar.js +30 -34
  26. package/lib/components/avatars/BoringAvatar.stories.d.ts +7 -16
  27. package/lib/components/avatars/UserProfileAvatar.d.ts +1 -6
  28. package/lib/components/avatars/UserProfileAvatar.js +3 -8
  29. package/lib/components/buttons/DownloadCSVButton.d.ts +2 -7
  30. package/lib/components/buttons/DownloadCSVButton.js +1 -5
  31. package/lib/components/buttons/DownloadJsonButton.d.ts +3 -10
  32. package/lib/components/buttons/DownloadJsonButton.js +1 -7
  33. package/lib/components/buttons/UploadButton.d.ts +1 -4
  34. package/lib/components/buttons/UploadButton.js +3 -7
  35. package/lib/components/chat/ChatComponent.d.ts +4 -0
  36. package/lib/components/chat/ChatComponent.js +143 -0
  37. package/lib/components/chat/MessagePart.d.ts +11 -0
  38. package/lib/components/chat/MessagePart.js +23 -0
  39. package/lib/components/chat/display/DynamicToolPart.d.ts +6 -0
  40. package/lib/components/chat/display/DynamicToolPart.js +5 -0
  41. package/lib/components/chat/display/ReasoningPart.d.ts +6 -0
  42. package/lib/components/chat/display/ReasoningPart.js +58 -0
  43. package/lib/components/chat/display/TextPart.d.ts +9 -0
  44. package/lib/components/chat/display/TextPart.js +93 -0
  45. package/lib/components/chat/display/ToolPart.d.ts +6 -0
  46. package/lib/components/chat/display/ToolPart.js +148 -0
  47. package/lib/components/chat/display/index.d.ts +4 -0
  48. package/lib/components/chat/display/index.js +13 -0
  49. package/lib/components/chat/handler.d.ts +8 -0
  50. package/lib/components/chat/handler.js +43 -0
  51. package/lib/components/chat/index.d.ts +4 -0
  52. package/lib/components/chat/index.js +13 -0
  53. package/lib/components/display/CenteredSpinner.d.ts +1 -4
  54. package/lib/components/display/CenteredSpinner.js +1 -5
  55. package/lib/components/display/HorizontalCenter.d.ts +1 -4
  56. package/lib/components/display/HorizontalCenter.js +1 -5
  57. package/lib/components/flashes/FlashClosable.d.ts +1 -4
  58. package/lib/components/flashes/FlashClosable.js +1 -5
  59. package/lib/components/flashes/FlashDisclaimer.js +1 -1
  60. package/lib/components/index.d.ts +2 -1
  61. package/lib/components/index.js +2 -1
  62. package/lib/components/notebooks/JupyterNotebook.d.ts +1 -6
  63. package/lib/components/notebooks/JupyterNotebook.js +1 -5
  64. package/lib/components/runtimes/RuntimeSimplePicker.d.ts +4 -0
  65. package/lib/components/runtimes/RuntimeSimplePicker.js +3 -3
  66. package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -4
  67. package/lib/components/snapshots/RuntimeSnapshotMenu.js +1 -5
  68. package/lib/config/Configuration.js +1 -1
  69. package/lib/examples/CellExample.js +11 -47
  70. package/lib/examples/lexical-theme.css +436 -0
  71. package/lib/examples/notebooks/Matplotlib.ipynb.json +1 -1
  72. package/lib/examples/notebooks/NotebookExample1.ipynb.json +1 -1
  73. package/lib/hooks/useAIJupyterChat.d.ts +36 -0
  74. package/lib/hooks/useAIJupyterChat.js +53 -0
  75. package/lib/hooks/useBackdrop.d.ts +4 -4
  76. package/lib/hooks/useBackdrop.js +5 -9
  77. package/lib/hooks/useCache.d.ts +5 -1
  78. package/lib/hooks/useCache.js +126 -58
  79. package/lib/hooks/useMobile.d.ts +1 -0
  80. package/lib/hooks/useMobile.js +26 -0
  81. package/lib/hooks/useScreenshot.d.ts +3 -5
  82. package/lib/hooks/useScreenshot.js +1 -8
  83. package/lib/hooks/useUpload.js +29 -21
  84. package/lib/index.d.ts +1 -0
  85. package/lib/index.js +8 -4
  86. package/lib/models/Outbound.d.ts +2 -0
  87. package/lib/models/Outbound.js +3 -1
  88. package/lib/state/substates/CoreState.js +1 -1
  89. package/lib/state/substates/IAMState.js +15 -6
  90. package/lib/stateful/index.d.ts +0 -1
  91. package/lib/stateful/index.js +0 -1
  92. package/lib/stateful/runtimes/actions.d.ts +1 -1
  93. package/lib/stateful/runtimes/actions.js +1 -1
  94. package/lib/theme/DatalayerTheme.d.ts +2 -2
  95. package/lib/theme/DatalayerTheme.js +4 -4
  96. package/lib/theme/DatalayerThemeProvider.js +2 -2
  97. package/lib/tools/adapters/agui/AgUIToolAdapter.d.ts +75 -0
  98. package/lib/tools/adapters/agui/AgUIToolAdapter.js +244 -0
  99. package/lib/tools/adapters/agui/index.d.ts +10 -0
  100. package/lib/tools/adapters/agui/index.js +19 -0
  101. package/lib/tools/adapters/agui/lexicalHooks.d.ts +27 -0
  102. package/lib/tools/adapters/agui/lexicalHooks.js +64 -0
  103. package/lib/tools/adapters/agui/notebookHooks.d.ts +27 -0
  104. package/lib/tools/adapters/agui/notebookHooks.js +61 -0
  105. package/lib/tools/index.d.ts +6 -0
  106. package/lib/tools/index.js +18 -0
  107. package/lib/types.d.ts +5 -0
  108. package/lib/types.js +5 -0
  109. package/lib/utils/cli/index.d.ts +4 -0
  110. package/lib/utils/cli/index.js +13 -0
  111. package/lib/utils/cli/query.d.ts +6 -0
  112. package/lib/utils/cli/query.js +26 -0
  113. package/lib/utils/index.d.ts +1 -0
  114. package/lib/utils/index.js +1 -0
  115. package/package.json +62 -5
  116. package/style/base.css +4 -0
  117. package/lib/examples/DatalayerNotebookExample.d.ts +0 -16
  118. package/lib/examples/DatalayerNotebookExample.js +0 -75
  119. package/lib/examples/NativeNavigationExample.d.ts +0 -8
  120. package/lib/examples/NativeNavigationExample.js +0 -97
  121. package/lib/examples/NotebookMutationsKernel.d.ts +0 -2
  122. package/lib/examples/NotebookMutationsKernel.js +0 -115
  123. package/lib/examples/NotebookMutationsServiceManager.d.ts +0 -2
  124. package/lib/examples/NotebookMutationsServiceManager.js +0 -107
  125. package/lib/examples/ReactRouterExample.d.ts +0 -6
  126. package/lib/examples/ReactRouterExample.js +0 -175
  127. package/lib/examples/example-selector.d.ts +0 -22
  128. package/lib/examples/example-selector.js +0 -45
  129. package/lib/examples/index.d.ts +0 -2
  130. package/lib/examples/main.d.ts +0 -1
  131. package/lib/examples/main.js +0 -153
  132. package/lib/examples/notebooks/OutputIPyWidgetsExample.d.ts +0 -145
  133. package/lib/examples/notebooks/OutputIPyWidgetsExample.js +0 -153
@@ -0,0 +1,54 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ /**
3
+ * Login component provides a comprehensive authentication interface with multiple methods:
4
+ * - Email/password authentication
5
+ * - OAuth (GitHub, LinkedIn)
6
+ * - Direct token input
7
+ *
8
+ * The component includes form validation, loading states, and error handling.
9
+ */
10
+ declare const meta: {
11
+ title: string;
12
+ component: (props: import("./Login").ILoginProps) => JSX.Element;
13
+ parameters: {
14
+ layout: string;
15
+ };
16
+ decorators: ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
17
+ heading?: string | undefined;
18
+ homeRoute: string;
19
+ loginRoute?: string | undefined;
20
+ joinRoute?: string | undefined;
21
+ joinConfirmRoute?: string | undefined;
22
+ passwordRoute?: string | undefined;
23
+ showEmailLogin?: boolean | undefined;
24
+ showGitHubLogin?: boolean | undefined;
25
+ showTokenLogin?: boolean | undefined;
26
+ }>) => import("react/jsx-runtime").JSX.Element)[];
27
+ tags: string[];
28
+ };
29
+ export default meta;
30
+ type Story = StoryObj<typeof meta>;
31
+ /**
32
+ * Default login form with all authentication methods enabled
33
+ */
34
+ export declare const Default: Story;
35
+ /**
36
+ * Login form with only email/password authentication
37
+ */
38
+ export declare const EmailOnly: Story;
39
+ /**
40
+ * Login form with only OAuth authentication
41
+ */
42
+ export declare const OAuthOnly: Story;
43
+ /**
44
+ * Login form with only token authentication
45
+ */
46
+ export declare const TokenOnly: Story;
47
+ /**
48
+ * Login form with custom heading
49
+ */
50
+ export declare const CustomHeading: Story;
51
+ /**
52
+ * Login form with all authentication methods including password reset link
53
+ */
54
+ export declare const WithPasswordReset: Story;
@@ -0,0 +1,104 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BrowserRouter } from 'react-router-dom';
3
+ import { QueryClientProvider } from '@tanstack/react-query';
4
+ import { queryClient } from '../../utils/cli/query';
5
+ import { Login } from './Login';
6
+ /**
7
+ * Login component provides a comprehensive authentication interface with multiple methods:
8
+ * - Email/password authentication
9
+ * - OAuth (GitHub, LinkedIn)
10
+ * - Direct token input
11
+ *
12
+ * The component includes form validation, loading states, and error handling.
13
+ */
14
+ const meta = {
15
+ title: 'Components/Auth/Login',
16
+ component: Login,
17
+ parameters: {
18
+ layout: 'fullscreen',
19
+ },
20
+ decorators: [
21
+ Story => (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(BrowserRouter, { children: _jsx(Story, {}) }) })),
22
+ ],
23
+ tags: ['autodocs'],
24
+ };
25
+ export default meta;
26
+ /**
27
+ * Default login form with all authentication methods enabled
28
+ */
29
+ export const Default = {
30
+ args: {
31
+ heading: 'Login to Datalayer',
32
+ homeRoute: '/home',
33
+ loginRoute: '/login',
34
+ showEmailLogin: true,
35
+ showGitHubLogin: true,
36
+ showTokenLogin: true,
37
+ },
38
+ };
39
+ /**
40
+ * Login form with only email/password authentication
41
+ */
42
+ export const EmailOnly = {
43
+ args: {
44
+ heading: 'Login to Datalayer',
45
+ homeRoute: '/home',
46
+ loginRoute: '/login',
47
+ showEmailLogin: true,
48
+ showGitHubLogin: false,
49
+ showTokenLogin: false,
50
+ },
51
+ };
52
+ /**
53
+ * Login form with only OAuth authentication
54
+ */
55
+ export const OAuthOnly = {
56
+ args: {
57
+ heading: 'Login to Datalayer',
58
+ homeRoute: '/home',
59
+ loginRoute: '/login',
60
+ showEmailLogin: false,
61
+ showGitHubLogin: true,
62
+ showTokenLogin: false,
63
+ },
64
+ };
65
+ /**
66
+ * Login form with only token authentication
67
+ */
68
+ export const TokenOnly = {
69
+ args: {
70
+ heading: 'Login to Datalayer',
71
+ homeRoute: '/home',
72
+ loginRoute: '/login',
73
+ showEmailLogin: false,
74
+ showGitHubLogin: false,
75
+ showTokenLogin: true,
76
+ },
77
+ };
78
+ /**
79
+ * Login form with custom heading
80
+ */
81
+ export const CustomHeading = {
82
+ args: {
83
+ heading: 'Welcome Back!',
84
+ homeRoute: '/home',
85
+ loginRoute: '/login',
86
+ showEmailLogin: true,
87
+ showGitHubLogin: true,
88
+ showTokenLogin: true,
89
+ },
90
+ };
91
+ /**
92
+ * Login form with all authentication methods including password reset link
93
+ */
94
+ export const WithPasswordReset = {
95
+ args: {
96
+ heading: 'Login to Datalayer',
97
+ homeRoute: '/home',
98
+ loginRoute: '/login',
99
+ passwordRoute: '/password-reset',
100
+ showEmailLogin: true,
101
+ showGitHubLogin: true,
102
+ showTokenLogin: true,
103
+ },
104
+ };
@@ -0,0 +1,16 @@
1
+ export interface ILoginTokenProps {
2
+ /**
3
+ * Home page route to navigate to after successful login
4
+ */
5
+ homeRoute: string;
6
+ /**
7
+ * CSS style object
8
+ */
9
+ style?: React.CSSProperties;
10
+ }
11
+ /**
12
+ * Component for token-based authentication
13
+ * Provides a simple button that expands to show a token input form
14
+ */
15
+ export declare const LoginToken: (props: ILoginTokenProps) => JSX.Element;
16
+ export default LoginToken;
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2025 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ *
6
+ * Datalayer License
7
+ */
8
+ import { useState } from 'react';
9
+ import { Button, FormControl, TextInput } from '@primer/react';
10
+ import { Box } from '@datalayer/primer-addons';
11
+ import { useIAM, useNavigate, useToast } from '../../hooks';
12
+ import { useIAMStore } from '../../state';
13
+ /**
14
+ * Component for token-based authentication
15
+ * Provides a simple button that expands to show a token input form
16
+ */
17
+ export const LoginToken = (props) => {
18
+ const { homeRoute, style } = props;
19
+ const [showForm, setShowForm] = useState(false);
20
+ const [token, setToken] = useState('');
21
+ const [loading, setLoading] = useState(false);
22
+ const { loginAndNavigate } = useIAM();
23
+ const { logout, checkIAMToken } = useIAMStore();
24
+ const { enqueueToast } = useToast();
25
+ const navigate = useNavigate();
26
+ const handleLogin = async () => {
27
+ if (!token.trim()) {
28
+ enqueueToast('Please enter a valid token', { variant: 'warning' });
29
+ return;
30
+ }
31
+ setLoading(true);
32
+ try {
33
+ await loginAndNavigate(token, logout, checkIAMToken, navigate, homeRoute);
34
+ setShowForm(false);
35
+ setToken('');
36
+ }
37
+ catch (error) {
38
+ console.error('Token login failed:', error);
39
+ enqueueToast('Failed to authenticate with provided token', {
40
+ variant: 'error',
41
+ });
42
+ }
43
+ finally {
44
+ setLoading(false);
45
+ }
46
+ };
47
+ if (!showForm) {
48
+ return (_jsx(Button, { onClick: () => setShowForm(true), style: style, children: "Login with Token" }));
49
+ }
50
+ return (_jsxs(Box, { style: style, children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Your Authentication Token" }), _jsx(TextInput, { block: true, placeholder: "Paste your authentication token here", value: token, onChange: e => setToken(e.target.value), onKeyDown: e => {
51
+ if (e.key === 'Enter') {
52
+ handleLogin();
53
+ }
54
+ else if (e.key === 'Escape') {
55
+ setShowForm(false);
56
+ setToken('');
57
+ }
58
+ } }), _jsx(FormControl.Caption, { children: "Enter your Datalayer authentication token to log in" })] }), _jsxs(Box, { mt: 3, display: "flex", justifyContent: "flex-start", children: [_jsx(Button, { variant: "primary", onClick: handleLogin, disabled: loading || !token.trim(), sx: { mr: 2 }, children: loading ? 'Authenticating...' : 'Login' }), _jsx(Button, { variant: "default", onClick: () => {
59
+ setShowForm(false);
60
+ setToken('');
61
+ }, children: "Cancel" })] })] }));
62
+ };
63
+ export default LoginToken;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Authentication components for Datalayer platform
3
+ */
4
+ export * from './Login';
5
+ export * from './LoginToken';
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /*
6
+ * Copyright (c) 2021-2024 Datalayer, Inc.
7
+ *
8
+ * Datalayer License
9
+ */
10
+ /**
11
+ * Authentication components for Datalayer platform
12
+ */
13
+ export * from './Login';
14
+ // LoginCLI is excluded from build - it's meant for CLI apps with full routing
15
+ // export * from './LoginCLI';
16
+ export * from './LoginToken';
@@ -1,19 +1,10 @@
1
1
  type VariantType = 'marble' | 'beam' | 'pixel' | 'sunset' | 'ring' | 'bauhaus' | undefined;
2
2
  type IBoringAvatarProps = {
3
- displayName: string;
4
- variant: VariantType;
5
- size: number;
6
- square: boolean;
7
- style: object;
8
- };
9
- export declare const BoringAvatar: {
10
- (props: IBoringAvatarProps): import("react/jsx-runtime").JSX.Element;
11
- defaultProps: {
12
- displayName: string;
13
- variant: VariantType;
14
- size: number;
15
- square: boolean;
16
- style: undefined;
17
- };
3
+ displayName?: string;
4
+ variant?: VariantType;
5
+ size?: number;
6
+ square?: boolean;
7
+ style?: object;
18
8
  };
9
+ export declare const BoringAvatar: ({ displayName, variant, size, square, style, }: IBoringAvatarProps) => import("react/jsx-runtime").JSX.Element;
19
10
  export default BoringAvatar;
@@ -4,41 +4,37 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
6
  import BoringAvatars from 'boring-avatars';
7
- /*
8
- const variants = [
9
- "bauhaus",
10
- "beam",
11
- "marble",
12
- "pixel",
13
- "ring",
14
- "sunset",
15
- ];
16
- export const getRandomBoringAvatarVariant = () => variants[Math.floor(Math.random() * variants.length)] as VariantType;
17
- */
7
+ // export const getRandomBoringAvatarVariant = () => VARIANTS[Math.floor(Math.random() * VARIANTS.length)] as VariantType;
18
8
  const getRandomBoringAvatarVariant = () => 'bauhaus';
19
9
  const RANDOM_BORING_AVATOR_VARIANT = getRandomBoringAvatarVariant();
20
- export const BoringAvatar = (props) => {
21
- const { displayName, size, square, style } = props;
22
- const variant = props.variant ?? getRandomBoringAvatarVariant();
23
- return (_jsx("span", { style: { ...(style || {}) }, children: _jsx(BoringAvatars, { size: size, name: displayName, variant: variant, square: square, colors: [
24
- '#000000',
25
- '#146A7C',
26
- '#16A085',
27
- '#1ABC9C',
28
- '#2ECC71',
29
- '#59595C',
30
- '#92A1C6',
31
- '#C20D90',
32
- '#C271B4',
33
- '#F0AB3D',
34
- // '#FFFFFF',
35
- ] }) }));
36
- };
37
- BoringAvatar.defaultProps = {
38
- displayName: '',
39
- variant: RANDOM_BORING_AVATOR_VARIANT,
40
- size: 40,
41
- square: false,
42
- style: undefined,
10
+ export const BoringAvatar = ({ displayName = '', variant, size = 40, square = false, style, }) => {
11
+ const resolvedVariant = variant ?? RANDOM_BORING_AVATOR_VARIANT;
12
+ const safeName = String(displayName ?? '');
13
+ try {
14
+ return (_jsx("span", { style: { ...(style || {}) }, children: _jsx(BoringAvatars, { size: size, name: safeName, variant: resolvedVariant, square: square, colors: [
15
+ '#000000',
16
+ '#146A7C',
17
+ '#16A085',
18
+ '#1ABC9C',
19
+ '#2ECC71',
20
+ '#59595C',
21
+ '#92A1C6',
22
+ '#C20D90',
23
+ '#C271B4',
24
+ '#F0AB3D',
25
+ // '#FFFFFF',
26
+ ] }) }));
27
+ }
28
+ catch (error) {
29
+ console.error('BoringAvatar error:', error);
30
+ return (_jsx("span", { style: {
31
+ display: 'inline-block',
32
+ width: `${size}px`,
33
+ height: `${size}px`,
34
+ borderRadius: square ? '4px' : '50%',
35
+ backgroundColor: '#59595C',
36
+ ...(style || {}),
37
+ } }));
38
+ }
43
39
  };
44
40
  export default BoringAvatar;
@@ -1,22 +1,13 @@
1
1
  import type { StoryObj } from '@storybook/react-vite';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: {
5
- (props: {
6
- displayName: string;
7
- variant: "marble" | "beam" | "pixel" | "sunset" | "ring" | "bauhaus" | undefined;
8
- size: number;
9
- square: boolean;
10
- style: object;
11
- }): import("react/jsx-runtime").JSX.Element;
12
- defaultProps: {
13
- displayName: string;
14
- variant: "marble" | "beam" | "pixel" | "sunset" | "ring" | "bauhaus" | undefined;
15
- size: number;
16
- square: boolean;
17
- style: undefined;
18
- };
19
- };
4
+ component: ({ displayName, variant, size, square, style, }: {
5
+ displayName?: string;
6
+ variant?: "marble" | "beam" | "pixel" | "sunset" | "ring" | "bauhaus" | undefined;
7
+ size?: number;
8
+ square?: boolean;
9
+ style?: object;
10
+ }) => import("react/jsx-runtime").JSX.Element;
20
11
  tags: string[];
21
12
  parameters: {
22
13
  layout: string;
@@ -4,10 +4,5 @@ type IUserProfileAvatarProps = {
4
4
  size?: number;
5
5
  onClick?: React.MouseEventHandler<any>;
6
6
  };
7
- export declare const UserProfileAvatar: {
8
- (props: IUserProfileAvatarProps): import("react/jsx-runtime").JSX.Element;
9
- defaultProps: {
10
- size: number;
11
- };
12
- };
7
+ export declare const UserProfileAvatar: ({ onClick, user, size, }: IUserProfileAvatarProps) => import("react/jsx-runtime").JSX.Element;
13
8
  export default UserProfileAvatar;
@@ -7,19 +7,14 @@ import { Avatar, Link } from '@primer/react';
7
7
  import { Box } from '@datalayer/primer-addons';
8
8
  import { AvatarSkeleton } from '../../components/display';
9
9
  import { getAvatarURL } from '../../utils';
10
- const Profile = (props) => {
11
- const { user, size, onClick } = props;
10
+ const Profile = ({ user, size = 100, onClick }) => {
12
11
  return (_jsx(Box, { style: { width: size }, children: _jsx(Avatar
13
12
  // square
14
13
  , {
15
14
  // square
16
15
  src: getAvatarURL(user?.avatarUrl), size: size, onClick: onClick }) }));
17
16
  };
18
- export const UserProfileAvatar = (props) => {
19
- const { onClick, user, size } = props;
20
- return user ? (onClick ? (_jsx(Link, { href: "javascript: return false;", onClick: onClick, children: _jsx(Profile, { ...props }) })) : (_jsx(Profile, { ...props }))) : (_jsx(AvatarSkeleton, { size: size }));
21
- };
22
- UserProfileAvatar.defaultProps = {
23
- size: 100,
17
+ export const UserProfileAvatar = ({ onClick, user, size = 100, }) => {
18
+ return user ? (onClick ? (_jsx(Link, { href: "javascript: return false;", onClick: onClick, children: _jsx(Profile, { user: user, size: size, onClick: onClick }) })) : (_jsx(Profile, { user: user, size: size, onClick: onClick }))) : (_jsx(AvatarSkeleton, { size: size }));
24
19
  };
25
20
  export default UserProfileAvatar;
@@ -2,12 +2,7 @@ import { VariantType } from './VariantType';
2
2
  type IDownloadCSVButtonProps = {
3
3
  data?: object;
4
4
  fileName: string;
5
- variant: VariantType;
6
- };
7
- export declare const DownloadCSVButton: {
8
- (props: IDownloadCSVButtonProps): import("react/jsx-runtime").JSX.Element;
9
- defaultProps: {
10
- variant: string;
11
- };
5
+ variant?: VariantType;
12
6
  };
7
+ export declare const DownloadCSVButton: ({ data, fileName, variant, }: IDownloadCSVButtonProps) => import("react/jsx-runtime").JSX.Element;
13
8
  export default DownloadCSVButton;
@@ -6,11 +6,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { Button } from '@primer/react';
7
7
  import { DownloadIcon } from '@primer/octicons-react';
8
8
  import { downloadCSV } from '../../utils';
9
- export const DownloadCSVButton = (props) => {
10
- const { data, fileName, variant } = props;
9
+ export const DownloadCSVButton = ({ data, fileName, variant = 'default', }) => {
11
10
  return (_jsx(Button, { variant: variant, leadingVisual: DownloadIcon, onClick: e => downloadCSV(data, fileName), children: "Download" }));
12
11
  };
13
- DownloadCSVButton.defaultProps = {
14
- variant: 'default',
15
- };
16
12
  export default DownloadCSVButton;
@@ -2,15 +2,8 @@ import { VariantType } from './VariantType';
2
2
  type IDownloadJsonButtonProps = {
3
3
  data?: object;
4
4
  fileName: string;
5
- extension: string;
6
- variant: VariantType;
7
- };
8
- export declare const DownloadJsonButton: {
9
- (props: IDownloadJsonButtonProps): import("react/jsx-runtime").JSX.Element;
10
- defaultProps: {
11
- variant: string;
12
- name: string;
13
- extension: string;
14
- };
5
+ extension?: string;
6
+ variant?: VariantType;
15
7
  };
8
+ export declare const DownloadJsonButton: ({ data, fileName, variant, extension, }: IDownloadJsonButtonProps) => import("react/jsx-runtime").JSX.Element;
16
9
  export default DownloadJsonButton;
@@ -6,13 +6,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { Button } from '@primer/react';
7
7
  import { DownloadIcon } from '@primer/octicons-react';
8
8
  import { downloadJson } from '../../utils';
9
- export const DownloadJsonButton = (props) => {
10
- const { data, fileName, variant, extension } = props;
9
+ export const DownloadJsonButton = ({ data, fileName, variant = 'default', extension = 'json', }) => {
11
10
  return (_jsx(Button, { variant: variant, leadingVisual: DownloadIcon, onClick: e => downloadJson(data, fileName, extension), children: "Download" }));
12
11
  };
13
- DownloadJsonButton.defaultProps = {
14
- variant: 'default',
15
- name: 'data',
16
- extension: 'json',
17
- };
18
12
  export default DownloadJsonButton;
@@ -30,8 +30,5 @@ export interface IUploadButtonProps extends Omit<IUploadBaseButtonProps, 'button
30
30
  */
31
31
  variant?: VariantType;
32
32
  }
33
- export declare function UploadButton(props: IUploadButtonProps): JSX.Element;
34
- export declare namespace UploadButton {
35
- var defaultProps: Partial<IUploadButtonProps>;
36
- }
33
+ export declare function UploadButton({ label, variant, ...others }: IUploadButtonProps): JSX.Element;
37
34
  export default UploadButton;
@@ -29,15 +29,11 @@ function UploadBaseButton(props) {
29
29
  }
30
30
  export function UploadIconButton(props) {
31
31
  const { label, ...others } = props;
32
- const factory = useMemo(() => (onClick) => (_jsx(IconButton, { "aria-label": label, icon: UploadIcon, size: "small", variant: "invisible", onClick: onClick })), []);
32
+ const factory = useMemo(() => (onClick) => (_jsx(IconButton, { "aria-label": label, icon: UploadIcon, size: "small", variant: "invisible", onClick: onClick })), [label]);
33
33
  return _jsx(UploadBaseButton, { buttonFactory: factory, ...others });
34
34
  }
35
- export function UploadButton(props) {
36
- const { label, variant, ...others } = props;
37
- const factory = useMemo(() => (onClick) => (_jsx(Button, { "aria-label": label, leadingVisual: () => _jsx(UploadIcon, { fill: "white" }), size: "small", variant: variant, onClick: onClick, children: label })), []);
35
+ export function UploadButton({ label, variant = 'primary', ...others }) {
36
+ const factory = useMemo(() => (onClick) => (_jsx(Button, { "aria-label": label, leadingVisual: () => _jsx(UploadIcon, { fill: "white" }), size: "small", variant: variant, onClick: onClick, children: label })), [label, variant]);
38
37
  return _jsx(UploadBaseButton, { buttonFactory: factory, ...others });
39
38
  }
40
- UploadButton.defaultProps = {
41
- variant: 'primary',
42
- };
43
39
  export default UploadButton;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Main Chat component using Primer React
3
+ */
4
+ export declare const ChatComponent: React.FC;