@dbx-tools/ui 0.9.154 → 0.9.158

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.
@@ -0,0 +1,10 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ export * as authGate from "./src/auth/react/auth-gate.tsx";
6
+ export * as passkeyManager from "./src/auth/react/passkey-manager.tsx";
7
+ export { AuthGate } from "./src/auth/react/auth-gate.tsx";
8
+ export type { AuthGateProps } from "./src/auth/react/auth-gate.tsx";
9
+ export { PasskeyManager } from "./src/auth/react/passkey-manager.tsx";
10
+ export type { PasskeyManagerProps } from "./src/auth/react/passkey-manager.tsx";
@@ -2,5 +2,5 @@
2
2
  // Regenerated from the exporting modules in ./src.
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
- export * as assets from "./assets.ts";
6
- export { dbxToolsAssetSvg, dbxToolsAssetDataUrls } from "./assets.ts";
5
+ export * as assets from "./src/branding/generated/assets.ts";
6
+ export { dbxToolsAssetSvg, dbxToolsAssetDataUrls } from "./src/branding/generated/assets.ts";
@@ -0,0 +1,7 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ export * as brand from "./src/branding/react/brand.tsx";
6
+ export { BrandProvider, useBrand, BrandIcon, BrandLogo } from "./src/branding/react/brand.tsx";
7
+ export type { BrandProviderProps, BrandImageProps } from "./src/branding/react/brand.tsx";
@@ -2,7 +2,6 @@
2
2
  // Regenerated from the exporting modules in ./src.
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
- export * as browser from "./browser.ts";
6
- export * as generated from "./generated/index.ts";
7
- export { resolveBrandAsset } from "./browser.ts";
8
- export type { BrandAssetResolver, ApplyBrandContextOptions } from "./browser.ts";
5
+ export * as browser from "./src/branding/browser.ts";
6
+ export { resolveBrandAsset, brandCssVariables, applyBrandContext } from "./src/branding/browser.ts";
7
+ export type { BrandAssetResolver, ApplyBrandContextOptions } from "./src/branding/browser.ts";
@@ -0,0 +1,16 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ export * as emailApprovalCard from "./src/email/react/email-approval-card.tsx";
6
+ export * as emailBody from "./src/email/react/email-body.tsx";
7
+ export * as emailCompose from "./src/email/react/email-compose.tsx";
8
+ export * as fields from "./src/email/react/fields.ts";
9
+ export { EmailPreview, EmailApprovalCard } from "./src/email/react/email-approval-card.tsx";
10
+ export type { EmailPreviewProps, EmailApprovalCardProps } from "./src/email/react/email-approval-card.tsx";
11
+ export { EmailBody } from "./src/email/react/email-body.tsx";
12
+ export type { EmailBodyProps } from "./src/email/react/email-body.tsx";
13
+ export { EmailComposeView } from "./src/email/react/email-compose.tsx";
14
+ export type { EmailComposeProps } from "./src/email/react/email-compose.tsx";
15
+ export { joinAddresses, parseAddresses, attachmentNames } from "./src/email/react/fields.ts";
16
+ export type { EmailDraft } from "./src/email/react/fields.ts";
package/index.react.ts ADDED
@@ -0,0 +1,20 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ export * as brandPicker from "./src/react/brand-picker.tsx";
6
+ export * as errorBoundary from "./src/react/error-boundary.tsx";
7
+ export * as highlightedCode from "./src/react/highlighted-code.tsx";
8
+ export * as recordPreviewData from "./src/react/record-preview-data.ts";
9
+ export * as recordPreview from "./src/react/record-preview.tsx";
10
+ export * as shikiPlugin from "./src/react/shiki-plugin.ts";
11
+ export { BrandPicker } from "./src/react/brand-picker.tsx";
12
+ export type { BrandPreset, BrandPickerProps } from "./src/react/brand-picker.tsx";
13
+ export { ErrorBoundary } from "./src/react/error-boundary.tsx";
14
+ export { detectCodeLanguage, useHighlightedHtml, HighlightedCodeBlock, JsonBlock } from "./src/react/highlighted-code.tsx";
15
+ export type { DetectedCodeLanguage } from "./src/react/highlighted-code.tsx";
16
+ export { recordPreviewRows, formatRecordPreviewJson, parseNestedJsonText, looksLikeMarkdown, markdownForPreview } from "./src/react/record-preview-data.ts";
17
+ export type { RecordPreviewRow } from "./src/react/record-preview-data.ts";
18
+ export { RecordPreview } from "./src/react/record-preview.tsx";
19
+ export type { RecordPreviewProps } from "./src/react/record-preview.tsx";
20
+ export { highlightToHtml, createShikiPlugin } from "./src/react/shiki-plugin.ts";
@@ -0,0 +1,12 @@
1
+ // GENERATED by projen watch - DO NOT EDIT.
2
+ // Regenerated from the exporting modules in ./src.
3
+ // Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ export * as searchBox from "./src/search/react/search-box.tsx";
6
+ export * as searchResults from "./src/search/react/search-results.tsx";
7
+ export { SearchBox } from "./src/search/react/search-box.tsx";
8
+ export type { SearchBoxProps } from "./src/search/react/search-box.tsx";
9
+ export { SearchResults } from "./src/search/react/search-results.tsx";
10
+ export type { SearchResultsProps } from "./src/search/react/search-results.tsx";
11
+ export { parseUniversalSearchResult, parseSearchClientConfig, usesUniversalSearchRoute, useSearch } from "./src/search/react/use-search.ts";
12
+ export type { UseSearchOptions, UseSearchState } from "./src/search/react/use-search.ts";
package/index.ts CHANGED
@@ -3,45 +3,4 @@
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/ui";
6
- export const PACKAGE_VERSION = "0.9.154";
7
- export * as authReactAuthClient from "./src/auth/react/auth-client.ts";
8
- export * as authReactAuthGate from "./src/auth/react/auth-gate.tsx";
9
- export * as authReactPasskeyManager from "./src/auth/react/passkey-manager.tsx";
10
- export * as brandingBrowser from "./src/branding/browser.ts";
11
- export * as brandingGeneratedAssets from "./src/branding/generated/assets.ts";
12
- export * as brandingReactBrand from "./src/branding/react/brand.tsx";
13
- export * as emailReactEmailApprovalCard from "./src/email/react/email-approval-card.tsx";
14
- export * as emailReactEmailBody from "./src/email/react/email-body.tsx";
15
- export * as emailReactEmailCompose from "./src/email/react/email-compose.tsx";
16
- export * as emailReactFields from "./src/email/react/fields.ts";
17
- export * as reactAppkitUi from "./src/react/appkit-ui.ts";
18
- export * as reactBrandPicker from "./src/react/brand-picker.tsx";
19
- export * as reactHighlightedCode from "./src/react/highlighted-code.tsx";
20
- export * as reactRecordPreview from "./src/react/record-preview.tsx";
21
- export * as reactRecordPreviewData from "./src/react/record-preview-data.ts";
22
- export * as reactShikiPlugin from "./src/react/shiki-plugin.ts";
23
- export * as searchReactSearchBox from "./src/search/react/search-box.tsx";
24
- export * as searchReactSearchResults from "./src/search/react/search-results.tsx";
25
- export * as searchReactUseSearch from "./src/search/react/use-search.ts";
26
- export type { AuthGateProps } from "./src/auth/react/auth-gate.tsx";
27
- export type { PasskeyManagerProps } from "./src/auth/react/passkey-manager.tsx";
28
- export { resolveBrandAsset } from "./src/branding/browser.ts";
29
- export type { BrandAssetResolver, ApplyBrandContextOptions } from "./src/branding/browser.ts";
30
- export { dbxToolsAssetSvg, dbxToolsAssetDataUrls } from "./src/branding/generated/assets.ts";
31
- export type { BrandProviderProps, BrandImageProps } from "./src/branding/react/brand.tsx";
32
- export { EmailPreview, EmailApprovalCard } from "./src/email/react/email-approval-card.tsx";
33
- export type { EmailPreviewProps, EmailApprovalCardProps } from "./src/email/react/email-approval-card.tsx";
34
- export { EmailBody } from "./src/email/react/email-body.tsx";
35
- export type { EmailBodyProps } from "./src/email/react/email-body.tsx";
36
- export { EmailComposeView } from "./src/email/react/email-compose.tsx";
37
- export type { EmailComposeProps } from "./src/email/react/email-compose.tsx";
38
- export { joinAddresses, parseAddresses, attachmentNames } from "./src/email/react/fields.ts";
39
- export type { EmailDraft } from "./src/email/react/fields.ts";
40
- export type { BrandPreset, BrandPickerProps } from "./src/react/brand-picker.tsx";
41
- export { HighlightedCodeBlock, JsonBlock } from "./src/react/highlighted-code.tsx";
42
- export type { DetectedCodeLanguage } from "./src/react/highlighted-code.tsx";
43
- export type { RecordPreviewProps } from "./src/react/record-preview.tsx";
44
- export type { RecordPreviewRow } from "./src/react/record-preview-data.ts";
45
- export type { SearchBoxProps } from "./src/search/react/search-box.tsx";
46
- export type { SearchResultsProps } from "./src/search/react/search-results.tsx";
47
- export type { UseSearchOptions, UseSearchState } from "./src/search/react/use-search.ts";
6
+ export const PACKAGE_VERSION = "0.9.158";
package/package.json CHANGED
@@ -29,22 +29,25 @@
29
29
  "react-dom": "~19.2.4"
30
30
  },
31
31
  "dependencies": {
32
+ "@better-auth/passkey": "1.7.6",
32
33
  "@databricks/appkit-ui": "0.81.0",
33
- "@dbx-tools/shared-auth": "^0.9.154",
34
- "@dbx-tools/shared-core": "^0.9.154",
35
- "@dbx-tools/shared-email": "^0.9.154",
36
- "@dbx-tools/shared-email-template": "^0.9.154",
37
- "@dbx-tools/shared-search": "^0.9.154",
34
+ "@dbx-tools/shared-auth": "^0.9.158",
35
+ "@dbx-tools/shared-core": "^0.9.158",
36
+ "@dbx-tools/shared-email": "^0.9.158",
37
+ "@dbx-tools/shared-email-template": "^0.9.158",
38
+ "@dbx-tools/shared-search": "^0.9.158",
38
39
  "lucide-react": "^0.554.0",
39
40
  "shiki": "^3.0.0",
40
41
  "streamdown": "^2.5.0",
41
42
  "tailwindcss": "^4.3.2"
42
43
  },
44
+ "main": "index.ts",
43
45
  "license": "Apache-2.0",
44
46
  "publishConfig": {
45
47
  "access": "public"
46
48
  },
47
- "version": "0.9.154",
49
+ "version": "0.9.158",
50
+ "types": "index.ts",
48
51
  "dbxToolsConfig": {
49
52
  "tags": [
50
53
  "ui"
@@ -52,27 +55,27 @@
52
55
  },
53
56
  "type": "module",
54
57
  "exports": {
55
- "./react": "./src/react/index.ts",
58
+ ".": "./index.ts",
59
+ "./auth/react": "./index.auth.react.ts",
60
+ "./branding": "./index.branding.ts",
61
+ "./branding/generated": "./index.branding.generated.ts",
62
+ "./branding/react": "./index.branding.react.ts",
63
+ "./email/react": "./index.email.react.ts",
64
+ "./react": "./index.react.ts",
65
+ "./search/react": "./index.search.react.ts",
56
66
  "./styles.css": "./src/styles.css",
57
- "./*": "./src/*/index.ts",
58
- "./branding/react": "./src/branding/react/index.ts",
59
- "./branding/browser": "./src/branding/browser.ts",
60
- "./branding/assets": "./src/branding/generated/assets.ts",
67
+ "./email/styles.css": "./src/email/styles.css",
68
+ "./search/styles.css": "./src/search/styles.css",
61
69
  "./branding/styles.css": "./src/branding/styles.css",
62
70
  "./branding/brand-bridge.css": "./src/branding/brand-bridge.css",
63
71
  "./branding/assets/icon-light.svg": "./src/branding/generated/icon-light.svg",
64
72
  "./branding/assets/icon-dark.svg": "./src/branding/generated/icon-dark.svg",
65
73
  "./branding/assets/logo-light.svg": "./src/branding/generated/logo-light.svg",
66
74
  "./branding/assets/logo-dark.svg": "./src/branding/generated/logo-dark.svg",
67
- "./auth/react": "./src/auth/react/index.ts",
68
- "./email/react": "./src/email/react/index.ts",
69
- "./email/styles.css": "./src/email/styles.css",
70
- "./search/react": "./src/search/react/index.ts",
71
- "./search/styles.css": "./src/search/styles.css",
72
75
  "./package.json": "./package.json"
73
76
  },
74
77
  "files": [
75
- "index.ts",
78
+ "index*.ts",
76
79
  "src"
77
80
  ],
78
81
  "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"bunx projen\"."
@@ -1,18 +1,18 @@
1
- import { net } from "@dbx-tools/shared-core";
2
- import { type FormEvent, type ReactNode, useCallback, useEffect, useRef, useState } from "react";
3
-
1
+ import { Button, Checkbox, Input, Label } from "@databricks/appkit-ui/react";
4
2
  import {
5
- beginPasskeyEnrollment,
6
- beginPasskeySignIn,
3
+ browser,
4
+ type PasskeyOperation,
7
5
  getAuthStatus,
8
- passkeyDisplayName,
9
6
  passkeysAvailable,
7
+ beginPasskeySignIn,
10
8
  requestEmailOtp,
11
- type PasskeyOperation,
12
9
  verifyEmailOtp,
13
- } from "./auth-client.ts";
14
- import { BrandIcon, useBrand } from "../../branding/react/index.ts";
15
- import { Button, Checkbox, Input, Label } from "../../react/index.ts";
10
+ beginPasskeyEnrollment,
11
+ } from "@dbx-tools/shared-auth";
12
+ import { parseEmails, isEmail } from "@dbx-tools/shared-core";
13
+ import { type FormEvent, type ReactNode, useCallback, useEffect, useRef, useState } from "react";
14
+
15
+ import { BrandIcon, useBrand } from "../../branding/react/brand.tsx";
16
16
 
17
17
  type Phase = "loading" | "email" | "code" | "authed" | "open";
18
18
 
@@ -112,9 +112,9 @@ export function AuthGate({
112
112
  async (event: FormEvent) => {
113
113
  event.preventDefault();
114
114
  if (busy) return;
115
- const addresses = net.parseEmails(email);
115
+ const addresses = parseEmails(email);
116
116
  const address = addresses[0];
117
- if (addresses.length !== 1 || !address || !net.isEmail(address)) {
117
+ if (addresses.length !== 1 || !address || !isEmail(address)) {
118
118
  setNotice("Enter a valid email address.");
119
119
  return;
120
120
  }
@@ -155,7 +155,7 @@ export function AuthGate({
155
155
  let operation: PasskeyOperation | undefined;
156
156
  try {
157
157
  operation = beginPasskeyEnrollment(
158
- passkeyDisplayName(passkeyNamePrefix ?? configuredPasskeyNamePrefix),
158
+ browser.passkeyDisplayName(passkeyNamePrefix ?? configuredPasskeyNamePrefix),
159
159
  );
160
160
  passkeyOperation.current = operation;
161
161
  await operation.result;
@@ -1,17 +1,16 @@
1
- import { type ReactNode, useCallback, useEffect, useRef, useState } from "react";
2
-
1
+ import type { Passkey } from "@better-auth/passkey/client";
2
+ import { Button, Input } from "@databricks/appkit-ui/react";
3
3
  import {
4
- beginPasskeyEnrollment,
5
- getAuthStatus,
6
- listPasskeys,
7
- passkeyDisplayName,
4
+ browser,
8
5
  passkeysAvailable,
9
6
  type PasskeyOperation,
10
- type Passkey,
11
- removePasskey,
7
+ listPasskeys,
8
+ getAuthStatus,
9
+ beginPasskeyEnrollment,
12
10
  renamePasskey,
13
- } from "./auth-client.ts";
14
- import { Button, Input } from "../../react/index.ts";
11
+ removePasskey,
12
+ } from "@dbx-tools/shared-auth";
13
+ import { type ReactNode, useCallback, useEffect, useRef, useState } from "react";
15
14
 
16
15
  /** Styling options for the authenticated passkey management surface. */
17
16
  export interface PasskeyManagerProps {
@@ -58,7 +57,7 @@ export function PasskeyManager({ className, passkeyNamePrefix }: PasskeyManagerP
58
57
  const add = useCallback(async () => {
59
58
  cancelEnrollment();
60
59
  const operation = beginPasskeyEnrollment(
61
- passkeyDisplayName(passkeyNamePrefix ?? configuredPasskeyNamePrefix),
60
+ browser.passkeyDisplayName(passkeyNamePrefix ?? configuredPasskeyNamePrefix),
62
61
  );
63
62
  enrollment.current = operation;
64
63
  setBusy(true);
@@ -1,12 +1,12 @@
1
- import { brandUtils } from "@dbx-tools/shared-core";
1
+ import { DEFAULT_BRAND_ASSETS, type BrandContext } from "@dbx-tools/shared-core";
2
2
  import { dbxToolsAssetDataUrls } from "./generated/assets.ts";
3
3
 
4
4
  const builtInAssets = new Map<string, string>([
5
- [brandUtils.DEFAULT_BRAND_ASSETS.icon.light, dbxToolsAssetDataUrls.iconLight],
6
- [brandUtils.DEFAULT_BRAND_ASSETS.icon.dark, dbxToolsAssetDataUrls.iconDark],
7
- [brandUtils.DEFAULT_BRAND_ASSETS.logo.light, dbxToolsAssetDataUrls.logoLight],
8
- [brandUtils.DEFAULT_BRAND_ASSETS.logo.dark, dbxToolsAssetDataUrls.logoDark],
9
- [brandUtils.DEFAULT_BRAND_ASSETS.favicon, dbxToolsAssetDataUrls.iconLight],
5
+ [DEFAULT_BRAND_ASSETS.icon.light, dbxToolsAssetDataUrls.iconLight],
6
+ [DEFAULT_BRAND_ASSETS.icon.dark, dbxToolsAssetDataUrls.iconDark],
7
+ [DEFAULT_BRAND_ASSETS.logo.light, dbxToolsAssetDataUrls.logoLight],
8
+ [DEFAULT_BRAND_ASSETS.logo.dark, dbxToolsAssetDataUrls.logoDark],
9
+ [DEFAULT_BRAND_ASSETS.favicon, dbxToolsAssetDataUrls.iconLight],
10
10
  ]);
11
11
 
12
12
  /** Resolve a brand asset identifier to a browser-loadable URL. */
@@ -17,7 +17,7 @@ export const resolveBrandAsset: BrandAssetResolver = (source) =>
17
17
  builtInAssets.get(source) ?? source;
18
18
 
19
19
  /** Convert a validated context to CSS custom properties. */
20
- export function brandCssVariables(context: brandUtils.BrandContext): Record<string, string> {
20
+ export function brandCssVariables(context: BrandContext): Record<string, string> {
21
21
  return {
22
22
  "--brand-color-primary": context.colors.primary,
23
23
  "--brand-color-primary-hover": context.colors.primaryHover,
@@ -43,7 +43,7 @@ export interface ApplyBrandContextOptions {
43
43
 
44
44
  /** Apply tokens and optional page metadata to a browser document. */
45
45
  export function applyBrandContext(
46
- context: brandUtils.BrandContext,
46
+ context: BrandContext,
47
47
  options: ApplyBrandContextOptions = {},
48
48
  ): void {
49
49
  const documentRef = options.document ?? globalThis.document;
@@ -1,4 +1,10 @@
1
- import { brandUtils } from "@dbx-tools/shared-core";
1
+ import {
2
+ type BrandContext,
3
+ defaultBrandContext,
4
+ type BrandContextInput,
5
+ parseBrandContext,
6
+ type BrandAssetSet,
7
+ } from "@dbx-tools/shared-core";
2
8
  import {
3
9
  createContext,
4
10
  type ImgHTMLAttributes,
@@ -10,18 +16,18 @@ import {
10
16
  import { applyBrandContext, type BrandAssetResolver, resolveBrandAsset } from "../browser.ts";
11
17
 
12
18
  interface BrandState {
13
- context: brandUtils.BrandContext;
19
+ context: BrandContext;
14
20
  resolveAsset: BrandAssetResolver;
15
21
  }
16
22
 
17
23
  const BrandReactContext = createContext<BrandState>({
18
- context: brandUtils.defaultBrandContext,
24
+ context: defaultBrandContext,
19
25
  resolveAsset: resolveBrandAsset,
20
26
  });
21
27
 
22
28
  /** Brand input, asset resolver, and document-application behavior for {@link BrandProvider}. */
23
29
  export interface BrandProviderProps extends PropsWithChildren {
24
- context?: brandUtils.BrandContextInput;
30
+ context?: BrandContextInput;
25
31
  resolveAsset?: BrandAssetResolver;
26
32
  applyToDocument?: boolean;
27
33
  }
@@ -33,7 +39,7 @@ export function BrandProvider({
33
39
  resolveAsset = resolveBrandAsset,
34
40
  applyToDocument = false,
35
41
  }: BrandProviderProps) {
36
- const parsed = useMemo(() => brandUtils.parseBrandContext(context), [context]);
42
+ const parsed = useMemo(() => parseBrandContext(context), [context]);
37
43
  const value = useMemo(() => ({ context: parsed, resolveAsset }), [parsed, resolveAsset]);
38
44
 
39
45
  useEffect(() => {
@@ -59,7 +65,7 @@ function BrandImage({
59
65
  alt,
60
66
  mode = "auto",
61
67
  ...props
62
- }: BrandImageProps & { asset: brandUtils.BrandAssetSet }) {
68
+ }: BrandImageProps & { asset: BrandAssetSet }) {
63
69
  const { resolveAsset } = useBrand();
64
70
  const light = resolveAsset(asset.light);
65
71
  const dark = resolveAsset(asset.dark ?? asset.light);
@@ -1,3 +1,4 @@
1
+ import { Button } from "@databricks/appkit-ui/react";
1
2
  import {
2
3
  EmailCard,
3
4
  emailBrandFromContext,
@@ -7,8 +8,7 @@ import {
7
8
  import { CheckIcon, MailIcon, PaperclipIcon, XIcon } from "lucide-react";
8
9
 
9
10
  import { attachmentNames, joinAddresses, type EmailDraft } from "./fields.ts";
10
- import { useBrand } from "../../branding/react/index.ts";
11
- import { Button } from "../../react/index.ts";
11
+ import { useBrand } from "../../branding/react/brand.tsx";
12
12
 
13
13
  // Presentational pieces for an outbound email awaiting a human Approve /
14
14
  // Deny: a mail-client chrome (sender, recipients, subject, attachments)
@@ -18,8 +18,6 @@ import { Button } from "../../react/index.ts";
18
18
  // `EmailComposeView` in `./email-compose`; both share `./fields` and
19
19
  // `./email-body`.
20
20
 
21
- export type { EmailDraft } from "./fields.ts";
22
-
23
21
  /** Props for {@link EmailPreview}. */
24
22
  export interface EmailPreviewProps {
25
23
  email: EmailDraft;
@@ -3,8 +3,8 @@
3
3
  // render the drafted Markdown identically (links, lists, emphasis, and
4
4
  // tables rather than raw syntax).
5
5
 
6
+ import { cn } from "@databricks/appkit-ui/react";
6
7
  import { EmailBody as SharedEmailBody, type EmailBrand } from "@dbx-tools/shared-email-template";
7
- import { cn } from "@dbx-tools/ui/react";
8
8
 
9
9
  /** Props for {@link EmailBody}. */
10
10
  export interface EmailBodyProps {
@@ -1,9 +1,3 @@
1
- import type { EmailAttachment, EmailMessage } from "@dbx-tools/shared-email";
2
- import { EyeIcon, PaperclipIcon, PencilIcon, SendIcon, XIcon } from "lucide-react";
3
- import { useCallback, useEffect, useId, useRef, useState, type ReactNode } from "react";
4
-
5
- import { EmailPreview } from "./email-approval-card.tsx";
6
- import { joinAddresses, parseAddresses, type EmailDraft } from "./fields.ts";
7
1
  import {
8
2
  Button,
9
3
  Input,
@@ -15,7 +9,13 @@ import {
15
9
  SelectValue,
16
10
  Textarea,
17
11
  cn,
18
- } from "../../react/index.ts";
12
+ } from "@databricks/appkit-ui/react";
13
+ import type { EmailAttachment, EmailMessage } from "@dbx-tools/shared-email";
14
+ import { EyeIcon, PaperclipIcon, PencilIcon, SendIcon, XIcon } from "lucide-react";
15
+ import { useCallback, useEffect, useId, useRef, useState, type ReactNode } from "react";
16
+
17
+ import { EmailPreview } from "./email-approval-card.tsx";
18
+ import { joinAddresses, parseAddresses, type EmailDraft } from "./fields.ts";
19
19
 
20
20
  // A standard, editable email compose form usable outside a chat bubble
21
21
  // (a settings page, a standalone "send" view, etc.). It shares the
@@ -3,7 +3,7 @@
3
3
  // and attachment formatting here lets both surfaces agree on how a draft
4
4
  // is displayed and how free-text address input is normalized.
5
5
 
6
- import { net } from "@dbx-tools/shared-core";
6
+ import { parseEmails } from "@dbx-tools/shared-core";
7
7
  import type { EmailAttachment, EmailMessage } from "@dbx-tools/shared-email";
8
8
 
9
9
  /** A partially-filled email, as it streams in from a tool call or a form. */
@@ -23,7 +23,7 @@ export const joinAddresses = (addresses: string[] | undefined): string =>
23
23
  * {@link net.parseEmails} so the UI reads addresses the same way the
24
24
  * server does.
25
25
  */
26
- export const parseAddresses = (raw: string): string[] => net.parseEmails(raw);
26
+ export const parseAddresses = (raw: string): string[] => parseEmails(raw);
27
27
 
28
28
  /** Comma-separated list of attachment filenames for a compact display. */
29
29
  export const attachmentNames = (attachments: EmailAttachment[] | undefined): string =>
@@ -10,10 +10,17 @@ import {
10
10
  Separator,
11
11
  cn,
12
12
  } from "@databricks/appkit-ui/react";
13
- import { brandUtils, object } from "@dbx-tools/shared-core";
13
+ import {
14
+ type BrandContextInput,
15
+ type BrandContext,
16
+ defaultBrandContext,
17
+ parseBrandContext,
18
+ BrandContextSchema,
19
+ deepEqual,
20
+ } from "@dbx-tools/shared-core";
14
21
  import { useEffect, useId, useMemo, useState } from "react";
15
22
 
16
- import { useBrand } from "../branding/react/index.ts";
23
+ import { useBrand } from "../branding/react/brand.tsx";
17
24
 
18
25
  const COLOR_FIELDS = [
19
26
  ["primary", "Primary"],
@@ -33,19 +40,19 @@ export interface BrandPreset {
33
40
  id: string;
34
41
  label: string;
35
42
  description?: string;
36
- context: brandUtils.BrandContextInput;
43
+ context: BrandContextInput;
37
44
  }
38
45
 
39
46
  /** Props for {@link BrandPicker}. */
40
47
  export interface BrandPickerProps {
41
48
  /** Current brand. Defaults to the nearest `BrandProvider` context. */
42
- value?: brandUtils.BrandContextInput;
49
+ value?: BrandContextInput;
43
50
  /** Receives each valid edited or selected brand context. */
44
- onChange: (value: brandUtils.BrandContext) => void;
51
+ onChange: (value: BrandContext) => void;
45
52
  /** Optional complete brand choices rendered as quick-select buttons. */
46
53
  presets?: readonly BrandPreset[];
47
54
  /** Value restored by Reset. Defaults to the dbx-tools brand. */
48
- resetValue?: brandUtils.BrandContextInput;
55
+ resetValue?: BrandContextInput;
49
56
  /** Show editable icon, logo, and favicon references. */
50
57
  showAssets?: boolean;
51
58
  className?: string;
@@ -65,21 +72,18 @@ export function BrandPicker({
65
72
  value,
66
73
  onChange,
67
74
  presets = [],
68
- resetValue = brandUtils.defaultBrandContext,
75
+ resetValue = defaultBrandContext,
69
76
  showAssets = true,
70
77
  className,
71
78
  }: BrandPickerProps) {
72
79
  const { context: inherited } = useBrand();
73
- const current = useMemo(
74
- () => brandUtils.parseBrandContext(value ?? inherited),
75
- [inherited, value],
76
- );
77
- const reset = useMemo(() => brandUtils.parseBrandContext(resetValue), [resetValue]);
80
+ const current = useMemo(() => parseBrandContext(value ?? inherited), [inherited, value]);
81
+ const reset = useMemo(() => parseBrandContext(resetValue), [resetValue]);
78
82
  const resolvedPresets = useMemo(
79
83
  () =>
80
84
  presets.map((preset) => ({
81
85
  ...preset,
82
- context: brandUtils.parseBrandContext(preset.context),
86
+ context: parseBrandContext(preset.context),
83
87
  })),
84
88
  [presets],
85
89
  );
@@ -88,9 +92,9 @@ export function BrandPicker({
88
92
 
89
93
  useEffect(() => setDraft(current), [current]);
90
94
 
91
- const update = (next: brandUtils.BrandContext) => {
95
+ const update = (next: BrandContext) => {
92
96
  setDraft(next);
93
- const parsed = brandUtils.BrandContextSchema.safeParse(next);
97
+ const parsed = BrandContextSchema.safeParse(next);
94
98
  if (parsed.success) onChange(parsed.data);
95
99
  };
96
100
 
@@ -138,7 +142,7 @@ export function BrandPicker({
138
142
  <Label>Presets</Label>
139
143
  <div className="grid gap-2 sm:grid-cols-3">
140
144
  {resolvedPresets.map((preset) => {
141
- const active = object.deepEqual(current, preset.context);
145
+ const active = deepEqual(current, preset.context);
142
146
  return (
143
147
  <Button
144
148
  key={preset.id}
@@ -0,0 +1,84 @@
1
+ import { Card, CardContent, CardHeader, CardTitle } from "@databricks/appkit-ui/react";
2
+ import { log, errorMessage } from "@dbx-tools/shared-core";
3
+ import type { ReactNode } from "react";
4
+ import React, { Component } from "react";
5
+
6
+ const logger = log.logger("client/error-boundary");
7
+
8
+ interface Props {
9
+ children: ReactNode;
10
+ }
11
+
12
+ interface State {
13
+ hasError: boolean;
14
+ error: Error | null;
15
+ errorInfo: React.ErrorInfo | null;
16
+ }
17
+
18
+ export class ErrorBoundary extends Component<Props, State> {
19
+ constructor(props: Props) {
20
+ super(props);
21
+ this.state = {
22
+ hasError: false,
23
+ error: null,
24
+ errorInfo: null,
25
+ };
26
+ }
27
+
28
+ static getDerivedStateFromError(error: Error): Partial<State> {
29
+ return { hasError: true, error };
30
+ }
31
+
32
+ override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
33
+ logger.error("caught", {
34
+ error,
35
+ componentStack: errorInfo.componentStack,
36
+ });
37
+ this.setState({
38
+ error,
39
+ errorInfo,
40
+ });
41
+ }
42
+
43
+ override render() {
44
+ if (this.state.hasError) {
45
+ return (
46
+ <div className="min-h-screen bg-background p-4">
47
+ <Card className="max-w-2xl mx-auto mt-8">
48
+ <CardHeader>
49
+ <CardTitle className="text-destructive">Application Error</CardTitle>
50
+ </CardHeader>
51
+ <CardContent>
52
+ <div className="space-y-4">
53
+ <div>
54
+ <h3 className="font-semibold mb-2">Error Message:</h3>
55
+ <pre className="bg-muted p-3 rounded text-sm overflow-auto">
56
+ {errorMessage(this.state.error)}
57
+ </pre>
58
+ </div>
59
+ {this.state.errorInfo && (
60
+ <div>
61
+ <h3 className="font-semibold mb-2">Component Stack:</h3>
62
+ <pre className="bg-muted p-3 rounded text-sm overflow-auto">
63
+ {this.state.errorInfo.componentStack}
64
+ </pre>
65
+ </div>
66
+ )}
67
+ {this.state.error?.stack && (
68
+ <div>
69
+ <h3 className="font-semibold mb-2">Stack Trace:</h3>
70
+ <pre className="bg-muted p-3 rounded text-sm overflow-auto max-h-96">
71
+ {this.state.error.stack}
72
+ </pre>
73
+ </div>
74
+ )}
75
+ </div>
76
+ </CardContent>
77
+ </Card>
78
+ </div>
79
+ );
80
+ }
81
+
82
+ return this.props.children;
83
+ }
84
+ }
@@ -4,14 +4,12 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { json } from "@dbx-tools/shared-core";
7
+ import { cn } from "@databricks/appkit-ui/react";
8
+ import { parse } from "@dbx-tools/shared-core";
8
9
  import { useEffect, useState } from "react";
9
10
 
10
- import { cn } from "./appkit-ui.ts";
11
11
  import { highlightToHtml } from "./shiki-plugin.ts";
12
12
 
13
- export { createShikiPlugin, highlightToHtml } from "./shiki-plugin.ts";
14
-
15
13
  /** Code languages detected automatically in free-form text fields. */
16
14
  export type DetectedCodeLanguage = "sql" | "python" | "typescript" | "bash" | "json";
17
15
 
@@ -29,7 +27,7 @@ export function detectCodeLanguage(source: string): DetectedCodeLanguage | undef
29
27
  if (
30
28
  (trimmed.startsWith("{") || trimmed.startsWith("[")) &&
31
29
  trimmed.length > 1 &&
32
- json.parse(trimmed) !== undefined
30
+ parse(trimmed) !== undefined
33
31
  ) {
34
32
  return "json";
35
33
  }
@@ -4,7 +4,7 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import { json, object as objectUtils, stringUtils } from "@dbx-tools/shared-core";
7
+ import { parse, isRecord, toLabel } from "@dbx-tools/shared-core";
8
8
 
9
9
  /** One field shown in the table view of {@link RecordPreview}. */
10
10
  export interface RecordPreviewRow {
@@ -24,7 +24,7 @@ export function recordPreviewRows(value: unknown): RecordPreviewRow[] {
24
24
  }
25
25
  return Object.entries(value as Record<string, unknown>).map(([key, nested]) => ({
26
26
  key,
27
- label: stringUtils.toLabel(key),
27
+ label: toLabel(key),
28
28
  value: nested,
29
29
  }));
30
30
  }
@@ -46,9 +46,9 @@ export function parseNestedJsonText(
46
46
  if (typeof value !== "string") return undefined;
47
47
  const trimmed = value.trim();
48
48
  if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return undefined;
49
- const parsed = json.parse(trimmed);
49
+ const parsed = parse(trimmed);
50
50
  if (Array.isArray(parsed)) return parsed;
51
- return objectUtils.isRecord(parsed) ? parsed : undefined;
51
+ return isRecord(parsed) ? parsed : undefined;
52
52
  }
53
53
 
54
54
  /** YAML document fence at the start of a markdown file (`---` ... `---`). */
@@ -5,10 +5,6 @@
5
5
  * @module
6
6
  */
7
7
 
8
- import { BracesIcon, Table2Icon } from "lucide-react";
9
- import { Fragment, useState } from "react";
10
- import { Streamdown } from "streamdown";
11
-
12
8
  import {
13
9
  Button,
14
10
  Table,
@@ -20,7 +16,11 @@ import {
20
16
  TooltipContent,
21
17
  TooltipTrigger,
22
18
  cn,
23
- } from "./appkit-ui.ts";
19
+ } from "@databricks/appkit-ui/react";
20
+ import { BracesIcon, Table2Icon } from "lucide-react";
21
+ import { Fragment, useState } from "react";
22
+ import { Streamdown } from "streamdown";
23
+
24
24
  import { detectCodeLanguage, HighlightedCodeBlock, JsonBlock } from "./highlighted-code.tsx";
25
25
  import {
26
26
  formatRecordPreviewJson,
@@ -31,15 +31,6 @@ import {
31
31
  type RecordPreviewRow,
32
32
  } from "./record-preview-data.ts";
33
33
 
34
- export type { RecordPreviewRow } from "./record-preview-data.ts";
35
- export {
36
- formatRecordPreviewJson,
37
- looksLikeMarkdown,
38
- markdownForPreview,
39
- parseNestedJsonText,
40
- recordPreviewRows,
41
- } from "./record-preview-data.ts";
42
-
43
34
  /** Compact Streamdown in a table cell: match 11px rows, keep lists tight. */
44
35
  const MARKDOWN_CELL_CLASSES = cn(
45
36
  "min-w-0 max-w-full text-[11px] leading-snug",
@@ -1,4 +1,4 @@
1
- import { stringUtils } from "@dbx-tools/shared-core";
1
+ import { escapeHtml } from "@dbx-tools/shared-core";
2
2
  import type { BundledLanguage, BundledTheme } from "shiki";
3
3
  import type { HighlighterCore } from "shiki/core";
4
4
  import type { CodeHighlighterPlugin } from "streamdown";
@@ -86,9 +86,6 @@ function highlightTokens(h: HighlighterCore, code: string, language: string) {
86
86
  };
87
87
  }
88
88
 
89
- /** Escape HTML-significant characters (from the shared string utils). */
90
- const escapeHtml = stringUtils.escapeHtml;
91
-
92
89
  /**
93
90
  * Highlight `code` into minimal inline HTML: one colored `<span>` per
94
91
  * token, lines joined by real newlines, with no line-number gutter or
@@ -8,11 +8,6 @@
8
8
  // string-ish field as a title and the primary-key `id` as a subtitle. Styled
9
9
  // with AppKit tokens (see `../styles.css`).
10
10
 
11
- import type { SearchHit } from "@dbx-tools/shared-search";
12
- import { XIcon } from "lucide-react";
13
- import { useCallback, useState, type ReactNode } from "react";
14
-
15
- import { useSearch, type UseSearchOptions } from "./use-search.ts";
16
11
  import {
17
12
  Badge,
18
13
  Button,
@@ -23,7 +18,12 @@ import {
23
18
  CommandList,
24
19
  Spinner,
25
20
  cn,
26
- } from "../../react/index.ts";
21
+ } from "@databricks/appkit-ui/react";
22
+ import type { SearchHit } from "@dbx-tools/shared-search";
23
+ import { XIcon } from "lucide-react";
24
+ import { useCallback, useState, type ReactNode } from "react";
25
+
26
+ import { useSearch, type UseSearchOptions } from "./use-search.ts";
27
27
 
28
28
  /** Props for {@link SearchBox}. */
29
29
  export interface SearchBoxProps extends UseSearchOptions {
@@ -3,11 +3,10 @@
3
3
  // `useSearch` (or any `SearchResult`) and it renders a scored, index-tagged
4
4
  // list; pass `renderHit` to control a row. Styled with AppKit tokens.
5
5
 
6
+ import { Badge, cn } from "@databricks/appkit-ui/react";
6
7
  import type { SearchHit } from "@dbx-tools/shared-search";
7
8
  import type { ReactNode } from "react";
8
9
 
9
- import { Badge, cn } from "../../react/index.ts";
10
-
11
10
  /** Props for {@link SearchResults}. */
12
11
  export interface SearchResultsProps {
13
12
  /** The hits to render, most relevant first. */
@@ -8,11 +8,14 @@ import {
8
8
  SEARCH_DEFAULT_BASE_PATH,
9
9
  SEARCH_PLUGIN_NAME,
10
10
  SEARCH_ROUTES,
11
- searchSchemas,
12
11
  type SearchClientConfig,
13
12
  type SearchHit,
14
13
  type SearchMode,
15
14
  type SearchResult,
15
+ searchResultSchema,
16
+ searchClientConfigSchema,
17
+ searchRoute,
18
+ toAiSearchQueryType,
16
19
  } from "@dbx-tools/shared-search";
17
20
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
18
21
 
@@ -54,7 +57,7 @@ export interface UseSearchState {
54
57
 
55
58
  /** Validate one universal-search response with the owning shared schema. */
56
59
  export function parseUniversalSearchResult(value: unknown): SearchResult {
57
- return searchSchemas.searchResultSchema.parse(value);
60
+ return searchResultSchema.parse(value);
58
61
  }
59
62
 
60
63
  /** Validate the published extension config, treating AppKit's empty sentinel as absent. */
@@ -67,7 +70,7 @@ export function parseSearchClientConfig(value: unknown): SearchClientConfig | un
67
70
  ) {
68
71
  return undefined;
69
72
  }
70
- return searchSchemas.searchClientConfigSchema.parse(value);
73
+ return searchClientConfigSchema.parse(value);
71
74
  }
72
75
 
73
76
  /** A single configured index is already the complete universal-search set. */
@@ -105,7 +108,7 @@ export function useSearch(options: UseSearchOptions = {}): UseSearchState {
105
108
  options.universal,
106
109
  config?.indexes.length ?? native.indexes.length,
107
110
  );
108
- const universalSearchPath = searchSchemas.searchRoute(
111
+ const universalSearchPath = searchRoute(
109
112
  config?.basePath ?? SEARCH_DEFAULT_BASE_PATH,
110
113
  SEARCH_ROUTES.universal,
111
114
  );
@@ -127,7 +130,7 @@ export function useSearch(options: UseSearchOptions = {}): UseSearchState {
127
130
  return;
128
131
  }
129
132
  if (!useUniversalRoute) {
130
- const resolvedQueryType = searchSchemas.toAiSearchQueryType(options.mode);
133
+ const resolvedQueryType = toAiSearchQueryType(options.mode);
131
134
  const request: AiSearchRequest = {
132
135
  queryText: text,
133
136
  ...(options.limit ? { numResults: options.limit } : {}),
@@ -1,23 +0,0 @@
1
- /**
2
- * Compatibility exports for the browser client now owned by
3
- * `@dbx-tools/shared-auth/browser`.
4
- */
5
-
6
- export {
7
- AUTH_BASE_PATH,
8
- addPasskey,
9
- beginPasskeyEnrollment,
10
- beginPasskeySignIn,
11
- cancelPasskeyOperation,
12
- getAuthStatus,
13
- listPasskeys,
14
- logout,
15
- passkeyDisplayName,
16
- passkeysAvailable,
17
- removePasskey,
18
- renamePasskey,
19
- requestEmailOtp,
20
- signInPasskey,
21
- verifyEmailOtp,
22
- } from "@dbx-tools/shared-auth/browser";
23
- export type { Passkey, PasskeyOperation } from "@dbx-tools/shared-auth/browser";
@@ -1,4 +0,0 @@
1
- export { AUTH_BASE_PATH, getAuthStatus, logout } from "./auth-client.ts";
2
- export type { Passkey } from "./auth-client.ts";
3
- export { AuthGate, type AuthGateProps } from "./auth-gate.tsx";
4
- export { PasskeyManager, type PasskeyManagerProps } from "./passkey-manager.tsx";
@@ -1,9 +0,0 @@
1
- export {
2
- BrandIcon,
3
- BrandLogo,
4
- BrandProvider,
5
- useBrand,
6
- type BrandImageProps,
7
- type BrandProviderProps,
8
- } from "./brand.tsx";
9
- export type { BrandContext, BrandContextInput } from "@dbx-tools/shared-core";
@@ -1,17 +0,0 @@
1
- // React surface for `@dbx-tools/ui/email`: a read-only Approve / Deny card for
2
- // the `send_email` tool's approval flow, the field preview it wraps, a standard
3
- // editable compose view for use outside a chat bubble. The email components
4
- // share `./fields` and `./email-body`, so a drafted message renders identically
5
- // across them. Styled with AppKit tokens.
6
-
7
- export type { EmailAttachment, EmailMessage } from "@dbx-tools/shared-email";
8
- export {
9
- EmailApprovalCard,
10
- EmailPreview,
11
- type EmailApprovalCardProps,
12
- type EmailPreviewProps,
13
- } from "./email-approval-card.tsx";
14
- export { EmailBody, type EmailBodyProps } from "./email-body.tsx";
15
- export { EmailComposeView, type EmailComposeProps } from "./email-compose.tsx";
16
- export { attachmentNames, joinAddresses, parseAddresses } from "./fields.ts";
17
- export type { EmailDraft } from "./fields.ts";
@@ -1,9 +0,0 @@
1
- // Re-export of AppKit's React UI kit so the `@dbx-tools/*` UI packages import
2
- // their primitives (Button, Input, cn, etc.) through one stable specifier -
3
- // `@dbx-tools/ui/react` - and resolve AppKit + React from this package's
4
- // dependencies rather than each consumer's.
5
- //
6
- // This lives in a NAMED module (not the `index.ts` barrel) so package discovery
7
- // - which ignores barrels + `.css` - still sees `ui-appkit` as a real package.
8
-
9
- export * from "@databricks/appkit-ui/react";
@@ -1,4 +0,0 @@
1
- export * from "./appkit-ui.ts";
2
- export * from "./brand-picker.tsx";
3
- export * from "./highlighted-code.tsx";
4
- export * from "./record-preview.tsx";
@@ -1,16 +0,0 @@
1
- // React surface for `@dbx-tools/ui/search`: a drop-in `SearchBox`
2
- // (search-as-you-type over Databricks AI Search), a `SearchResults` list for a
3
- // full-page layout, and the `useSearch` hook they share. Single-index queries
4
- // delegate to AppKit's native `useAiSearchQuery`; universal search uses the
5
- // dbx-tools extension route.
6
- // Styled with AppKit tokens (import `@dbx-tools/ui/search/styles.css`).
7
-
8
- export type {
9
- SearchHit,
10
- SearchResult,
11
- SearchMode,
12
- SearchClientConfig,
13
- } from "@dbx-tools/shared-search";
14
- export { SearchBox, type SearchBoxProps } from "./search-box.tsx";
15
- export { SearchResults, type SearchResultsProps } from "./search-results.tsx";
16
- export { useSearch, type UseSearchOptions, type UseSearchState } from "./use-search.ts";