@launchdarkly/toolbar 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/README.md +197 -0
- package/dist/index.d.ts +3 -0
- package/dist/js/index.js +4157 -0
- package/dist/services/DevServerClient.d.ts +34 -0
- package/dist/services/FlagStateManager.d.ts +15 -0
- package/dist/static/font/Audimat3000-Regulier.var-subset.woff2 +0 -0
- package/dist/static/font/Inter.var-subset.woff2 +0 -0
- package/dist/tests/LaunchDarklyToolbar.test.d.ts +1 -0
- package/dist/tests/Tabs.test.d.ts +1 -0
- package/dist/tests/mocks/flags.d.ts +2 -0
- package/dist/types/devServer.d.ts +29 -0
- package/dist/ui/List/List.css.d.ts +2 -0
- package/dist/ui/List/List.d.ts +5 -0
- package/dist/ui/List/ListItem.d.ts +6 -0
- package/dist/ui/Tabs/TabButton.d.ts +8 -0
- package/dist/ui/Tabs/Tabs.css.d.ts +6 -0
- package/dist/ui/Tabs/Tabs.d.ts +8 -0
- package/dist/ui/Tabs/useTabsContext.d.ts +7 -0
- package/dist/ui/Toolbar/Header/Header.css.d.ts +18 -0
- package/dist/ui/Toolbar/Header/Header.d.ts +10 -0
- package/dist/ui/Toolbar/Header/components/ActionButtons.d.ts +10 -0
- package/dist/ui/Toolbar/Header/components/EnvironmentLabel.d.ts +5 -0
- package/dist/ui/Toolbar/Header/components/LogoSection.d.ts +1 -0
- package/dist/ui/Toolbar/Header/components/SearchSection.d.ts +8 -0
- package/dist/ui/Toolbar/Header/components/index.d.ts +4 -0
- package/dist/ui/Toolbar/LaunchDarklyToolbar.css.d.ts +12 -0
- package/dist/ui/Toolbar/LaunchDarklyToolbar.d.ts +10 -0
- package/dist/ui/Toolbar/TabContent/EventsTabContent.css.d.ts +3 -0
- package/dist/ui/Toolbar/TabContent/EventsTabContent.d.ts +1 -0
- package/dist/ui/Toolbar/TabContent/FlagTabContent.css.d.ts +8 -0
- package/dist/ui/Toolbar/TabContent/FlagTabContent.d.ts +1 -0
- package/dist/ui/Toolbar/TabContent/SettingsTab.css.d.ts +11 -0
- package/dist/ui/Toolbar/TabContent/SettingsTabContent.d.ts +1 -0
- package/dist/ui/Toolbar/components/ActionButtonsContainer.css.d.ts +4 -0
- package/dist/ui/Toolbar/components/ActionButtonsContainer.d.ts +6 -0
- package/dist/ui/Toolbar/components/CircleLogo.d.ts +5 -0
- package/dist/ui/Toolbar/components/ConnectionStatus.css.d.ts +4 -0
- package/dist/ui/Toolbar/components/ConnectionStatus.d.ts +6 -0
- package/dist/ui/Toolbar/components/ErrorMessage.css.d.ts +2 -0
- package/dist/ui/Toolbar/components/ErrorMessage.d.ts +5 -0
- package/dist/ui/Toolbar/components/ExpandedToolbarContent.d.ts +15 -0
- package/dist/ui/Toolbar/components/FlagControls.css.d.ts +11 -0
- package/dist/ui/Toolbar/components/FlagControls.d.ts +20 -0
- package/dist/ui/Toolbar/components/GenericHelpText.css.d.ts +3 -0
- package/dist/ui/Toolbar/components/GenericHelpText.d.ts +6 -0
- package/dist/ui/Toolbar/components/IconButton.css.d.ts +4 -0
- package/dist/ui/Toolbar/components/IconButton.d.ts +11 -0
- package/dist/ui/Toolbar/components/OverrideIndicator.css.d.ts +5 -0
- package/dist/ui/Toolbar/components/OverrideIndicator.d.ts +5 -0
- package/dist/ui/Toolbar/components/StatusDot.css.d.ts +1 -0
- package/dist/ui/Toolbar/components/StatusDot.d.ts +5 -0
- package/dist/ui/Toolbar/components/TabContentRenderer.d.ts +7 -0
- package/dist/ui/Toolbar/components/icons/ArrowUndoIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/CancelCircleIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/CheckIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/ChevronDownIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/DeleteIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/EditIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/GearIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/Icon.css.d.ts +1 -0
- package/dist/ui/Toolbar/components/icons/LaunchDarklyIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/SearchIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/SyncIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/ToggleOffIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/XIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/index.d.ts +11 -0
- package/dist/ui/Toolbar/components/index.d.ts +8 -0
- package/dist/ui/Toolbar/constants/animations.d.ts +99 -0
- package/dist/ui/Toolbar/constants/config.d.ts +3 -0
- package/dist/ui/Toolbar/constants/index.d.ts +2 -0
- package/dist/ui/Toolbar/context/LaunchDarklyToolbarProvider.d.ts +20 -0
- package/dist/ui/Toolbar/context/SearchProvider.d.ts +10 -0
- package/dist/ui/Toolbar/hooks/index.d.ts +3 -0
- package/dist/ui/Toolbar/hooks/useToolbarAnimations.d.ts +20 -0
- package/dist/ui/Toolbar/hooks/useToolbarState.d.ts +22 -0
- package/dist/ui/Toolbar/hooks/useToolbarVisibility.d.ts +5 -0
- package/dist/ui/Toolbar/types/index.d.ts +1 -0
- package/dist/ui/Toolbar/types/toolbar.d.ts +12 -0
- package/package.json +100 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface DevServerProjectResponse {
|
|
2
|
+
_lastSyncedFromSource: number;
|
|
3
|
+
availableVariations: Record<string, Variation[]>;
|
|
4
|
+
flagsState: Record<string, FlagState>;
|
|
5
|
+
overrides: Record<string, Override>;
|
|
6
|
+
sourceEnvironmentKey: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Variation {
|
|
9
|
+
_id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
value: any;
|
|
12
|
+
}
|
|
13
|
+
export interface FlagState {
|
|
14
|
+
value: any;
|
|
15
|
+
version: number;
|
|
16
|
+
}
|
|
17
|
+
export interface Override {
|
|
18
|
+
value: any;
|
|
19
|
+
version: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class DevServerClient {
|
|
22
|
+
private baseUrl;
|
|
23
|
+
private projectKey;
|
|
24
|
+
constructor(baseUrl: string, projectKey?: string);
|
|
25
|
+
setProjectKey(projectKey: string): void;
|
|
26
|
+
getProjectKey(): string | null;
|
|
27
|
+
getProjectData(): Promise<DevServerProjectResponse>;
|
|
28
|
+
setOverride(flagKey: string, value: any): Promise<{
|
|
29
|
+
override: boolean;
|
|
30
|
+
value: any;
|
|
31
|
+
}>;
|
|
32
|
+
clearOverride(flagKey: string): Promise<void>;
|
|
33
|
+
getAvailableProjects(): Promise<string[]>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DevServerClient } from './DevServerClient';
|
|
2
|
+
import { EnhancedFlag } from '../types/devServer';
|
|
3
|
+
export declare class FlagStateManager {
|
|
4
|
+
private devServerClient;
|
|
5
|
+
private listeners;
|
|
6
|
+
constructor(devServerClient: DevServerClient);
|
|
7
|
+
getEnhancedFlags(): Promise<Record<string, EnhancedFlag>>;
|
|
8
|
+
private formatFlagName;
|
|
9
|
+
private determineFlagType;
|
|
10
|
+
setOverride(flagKey: string, value: any): Promise<void>;
|
|
11
|
+
clearOverride(flagKey: string): Promise<void>;
|
|
12
|
+
subscribe(listener: (flags: Record<string, EnhancedFlag>) => void): () => void;
|
|
13
|
+
private notifyListeners;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Variation } from '../services/DevServerClient';
|
|
2
|
+
export type { Variation } from '../services/DevServerClient';
|
|
3
|
+
export interface EnhancedFlag {
|
|
4
|
+
key: string;
|
|
5
|
+
name: string;
|
|
6
|
+
currentValue: any;
|
|
7
|
+
isOverridden: boolean;
|
|
8
|
+
originalValue: any;
|
|
9
|
+
availableVariations: Variation[];
|
|
10
|
+
type: 'boolean' | 'multivariate' | 'string' | 'number';
|
|
11
|
+
sourceEnvironment: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface LdToolbarConfig {
|
|
15
|
+
devServerUrl: string;
|
|
16
|
+
pollIntervalInMs: number;
|
|
17
|
+
projectKey?: string;
|
|
18
|
+
showEnvironmentInfo?: boolean;
|
|
19
|
+
onFlagOverride?: (flagKey: string, value: any, isOverride: boolean) => void;
|
|
20
|
+
onError?: (error: string) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface ToolbarState {
|
|
23
|
+
flags: Record<string, EnhancedFlag>;
|
|
24
|
+
connectionStatus: 'connected' | 'disconnected' | 'error';
|
|
25
|
+
lastSyncTime: number;
|
|
26
|
+
isLoading: boolean;
|
|
27
|
+
error: string | null;
|
|
28
|
+
sourceEnvironmentKey: string | null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ElementType } from 'react';
|
|
2
|
+
export interface TabButtonProps {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: ElementType;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const TabButton: React.ForwardRefExoticComponent<TabButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TabsProps {
|
|
3
|
+
defaultActiveTab?: string;
|
|
4
|
+
activeTab?: string;
|
|
5
|
+
onTabChange?: (tabId: string) => void;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const header: string;
|
|
2
|
+
export declare const leftSection: string;
|
|
3
|
+
export declare const logo: string;
|
|
4
|
+
export declare const headerTitle: string;
|
|
5
|
+
export declare const centerSection: string;
|
|
6
|
+
export declare const environmentLabel: string;
|
|
7
|
+
export declare const rightSection: string;
|
|
8
|
+
export declare const searchButtonArea: string;
|
|
9
|
+
export declare const closeButtonArea: string;
|
|
10
|
+
export declare const actionButton: string;
|
|
11
|
+
export declare const actionButtonSvg: string;
|
|
12
|
+
export declare const searchField: string;
|
|
13
|
+
export declare const searchGroup: string;
|
|
14
|
+
export declare const searchFieldWrapper: string;
|
|
15
|
+
export declare const searchFieldWrapperSvg: string;
|
|
16
|
+
export declare const searchWrapper: string;
|
|
17
|
+
export declare const environmentWrapper: string;
|
|
18
|
+
export declare const icon: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export interface HeaderProps {
|
|
3
|
+
searchTerm: string;
|
|
4
|
+
onSearch: (searchTerm: string) => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
searchIsExpanded: boolean;
|
|
7
|
+
setSearchIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function Header(props: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
interface ActionButtonsProps {
|
|
3
|
+
searchIsExpanded: boolean;
|
|
4
|
+
setSearchIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onRefresh: () => void;
|
|
7
|
+
showSearchButton: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function ActionButtons(props: ActionButtonsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LogoSection(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
interface SearchSectionProps {
|
|
3
|
+
searchTerm: string;
|
|
4
|
+
onSearch: (searchTerm: string) => void;
|
|
5
|
+
setSearchIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
}
|
|
7
|
+
export declare function SearchSection(props: SearchSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const toolbarContainer: string;
|
|
2
|
+
export declare const positionRight: string;
|
|
3
|
+
export declare const positionLeft: string;
|
|
4
|
+
export declare const toolbarCircle: string;
|
|
5
|
+
export declare const toolbarExpanded: string;
|
|
6
|
+
export declare const circleContent: string;
|
|
7
|
+
export declare const circleLogo: string;
|
|
8
|
+
export declare const toolbarContent: string;
|
|
9
|
+
export declare const contentArea: string;
|
|
10
|
+
export declare const scrollableContent: string;
|
|
11
|
+
export declare const tabsContainer: string;
|
|
12
|
+
export declare const tabsContainerChild: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface LdToolbarProps {
|
|
2
|
+
position?: 'left' | 'right';
|
|
3
|
+
}
|
|
4
|
+
export declare function LdToolbar(props: LdToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export interface LaunchDarklyToolbarProps extends LdToolbarProps {
|
|
6
|
+
devServerUrl?: string;
|
|
7
|
+
projectKey?: string;
|
|
8
|
+
pollIntervalInMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function LaunchDarklyToolbar(props: LaunchDarklyToolbarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function EventsTabContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const flagName: string;
|
|
2
|
+
export declare const flagNameText: string;
|
|
3
|
+
export declare const flagHeader: string;
|
|
4
|
+
export declare const flagKey: string;
|
|
5
|
+
export declare const flagOptions: string;
|
|
6
|
+
export declare const virtualContainer: string;
|
|
7
|
+
export declare const virtualInner: string;
|
|
8
|
+
export declare const virtualItem: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FlagTabContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const settingsGroup: string;
|
|
2
|
+
export declare const settingsGroupTitle: string;
|
|
3
|
+
export declare const settingInfo: string;
|
|
4
|
+
export declare const settingDetails: string;
|
|
5
|
+
export declare const settingName: string;
|
|
6
|
+
export declare const settingValue: string;
|
|
7
|
+
export declare const statusIndicator: string;
|
|
8
|
+
export declare const statusText: string;
|
|
9
|
+
export declare const icon: string;
|
|
10
|
+
export declare const select: string;
|
|
11
|
+
export declare const selectedValue: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SettingsTabContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { ActiveTabId } from '../types';
|
|
3
|
+
interface ExpandedToolbarContentProps {
|
|
4
|
+
isExpanded: boolean;
|
|
5
|
+
activeTab: ActiveTabId;
|
|
6
|
+
slideDirection: number;
|
|
7
|
+
searchTerm: string;
|
|
8
|
+
searchIsExpanded: boolean;
|
|
9
|
+
onSearch: (searchTerm: string) => void;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onTabChange: (tabId: string) => void;
|
|
12
|
+
setSearchIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
13
|
+
}
|
|
14
|
+
export declare function ExpandedToolbarContent(props: ExpandedToolbarContentProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const switch_: string;
|
|
2
|
+
export declare const switchContainer: string;
|
|
3
|
+
export declare const customVariantContainer: string;
|
|
4
|
+
export declare const currentValueGroup: string;
|
|
5
|
+
export declare const customVariantFieldGroup: string;
|
|
6
|
+
export declare const currentValue: string;
|
|
7
|
+
export declare const customVariantField: string;
|
|
8
|
+
export declare const currentValueText: string;
|
|
9
|
+
export declare const select: string;
|
|
10
|
+
export declare const selectedValue: string;
|
|
11
|
+
export declare const icon: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EnhancedFlag } from '../../../types/devServer';
|
|
2
|
+
interface BooleanFlagControlProps {
|
|
3
|
+
flag: EnhancedFlag;
|
|
4
|
+
onOverride: (value: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function BooleanFlagControl(props: BooleanFlagControlProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
interface MultivariateFlagControlProps {
|
|
9
|
+
flag: EnhancedFlag;
|
|
10
|
+
onOverride: (value: any) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function MultivariateFlagControl(props: MultivariateFlagControlProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
interface StringNumberFlagControlProps {
|
|
15
|
+
flag: EnhancedFlag;
|
|
16
|
+
onOverride: (value: string | number) => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function StringNumberFlagControl(props: StringNumberFlagControlProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IconButtonProps {
|
|
3
|
+
icon: React.ReactNode;
|
|
4
|
+
label: string;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
|
+
}
|
|
10
|
+
export declare function IconButton(props: IconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const statusDot: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const icon: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { SearchIcon } from './SearchIcon';
|
|
2
|
+
export { ChevronDownIcon } from './ChevronDownIcon';
|
|
3
|
+
export { EditIcon } from './EditIcon';
|
|
4
|
+
export { SyncIcon } from './SyncIcon';
|
|
5
|
+
export { ArrowUndoIcon } from './ArrowUndoIcon';
|
|
6
|
+
export { CheckIcon } from './CheckIcon';
|
|
7
|
+
export { ToggleOffIcon } from './ToggleOffIcon';
|
|
8
|
+
export { GearIcon } from './GearIcon';
|
|
9
|
+
export { DeleteIcon } from './DeleteIcon';
|
|
10
|
+
export { CancelCircleIcon } from './CancelCircleIcon';
|
|
11
|
+
export { XIcon } from './XIcon';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ActionButtonsContainer } from './ActionButtonsContainer';
|
|
2
|
+
export { CircleLogo } from './CircleLogo';
|
|
3
|
+
export { ConnectionStatus } from './ConnectionStatus';
|
|
4
|
+
export { ExpandedToolbarContent } from './ExpandedToolbarContent';
|
|
5
|
+
export { LaunchDarklyIcon } from './icons/LaunchDarklyIcon';
|
|
6
|
+
export { StatusDot } from './StatusDot';
|
|
7
|
+
export { TabContentRenderer } from './TabContentRenderer';
|
|
8
|
+
export { ErrorMessage } from './ErrorMessage';
|