@pathscale/ui 0.0.120 → 0.0.122
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/dist/components/language-switcher/LanguageSwitcher.d.ts +31 -0
- package/dist/components/language-switcher/createI18n.d.ts +102 -0
- package/dist/components/language-switcher/index.d.ts +3 -0
- package/dist/components/live-chat/LiveChatBubble.d.ts +38 -0
- package/dist/components/live-chat/LiveChatPanel.d.ts +54 -0
- package/dist/components/live-chat/index.d.ts +5 -0
- package/dist/components/live-chat/types.d.ts +13 -0
- package/dist/components/theme-color-picker/ThemeColorPicker.d.ts +23 -0
- package/dist/components/theme-color-picker/hueShift.d.ts +14 -0
- package/dist/components/theme-color-picker/index.d.ts +3 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1152 -7
- package/dist/styles/icons/generated-icons.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Component } from "solid-js";
|
|
2
|
+
import type { IComponentBaseProps } from "../types";
|
|
3
|
+
import type { I18nStore } from "./createI18n";
|
|
4
|
+
export interface LanguageSwitcherProps extends IComponentBaseProps {
|
|
5
|
+
/**
|
|
6
|
+
* The i18n store to use for language state
|
|
7
|
+
*/
|
|
8
|
+
i18n: I18nStore;
|
|
9
|
+
/**
|
|
10
|
+
* ARIA label for the dropdown
|
|
11
|
+
*/
|
|
12
|
+
"aria-label"?: string;
|
|
13
|
+
/**
|
|
14
|
+
* ARIA label for current language (for screen readers)
|
|
15
|
+
*/
|
|
16
|
+
currentLanguageLabel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* ARIA label for language options menu
|
|
19
|
+
*/
|
|
20
|
+
optionsLabel?: string;
|
|
21
|
+
/**
|
|
22
|
+
* ARIA label shown while loading
|
|
23
|
+
*/
|
|
24
|
+
loadingLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when language changes
|
|
27
|
+
*/
|
|
28
|
+
onLanguageChange?: (lang: string) => void;
|
|
29
|
+
}
|
|
30
|
+
declare const LanguageSwitcher: Component<LanguageSwitcherProps>;
|
|
31
|
+
export default LanguageSwitcher;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type JSX, type FlowComponent } from "solid-js";
|
|
2
|
+
export interface Language {
|
|
3
|
+
code: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface I18nOptions {
|
|
7
|
+
/**
|
|
8
|
+
* List of supported languages
|
|
9
|
+
*/
|
|
10
|
+
languages: Language[];
|
|
11
|
+
/**
|
|
12
|
+
* Default language code
|
|
13
|
+
* @default first language in the list
|
|
14
|
+
*/
|
|
15
|
+
defaultLanguage?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Storage key for persisting locale
|
|
18
|
+
*/
|
|
19
|
+
storageKey: string;
|
|
20
|
+
/**
|
|
21
|
+
* Function to load translations for a locale
|
|
22
|
+
* Should return a record of translation keys to values
|
|
23
|
+
*/
|
|
24
|
+
loadTranslations?: (locale: string) => Promise<Record<string, unknown>>;
|
|
25
|
+
/**
|
|
26
|
+
* Initial translations (for default language)
|
|
27
|
+
*/
|
|
28
|
+
initialTranslations?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export interface I18nStore {
|
|
31
|
+
/**
|
|
32
|
+
* Current locale code (getter, reactive)
|
|
33
|
+
*/
|
|
34
|
+
readonly locale: string;
|
|
35
|
+
/**
|
|
36
|
+
* Whether translations are currently loading (getter, reactive)
|
|
37
|
+
*/
|
|
38
|
+
readonly isLoading: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Translation function
|
|
41
|
+
*/
|
|
42
|
+
t: (key: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Set the current locale
|
|
45
|
+
*/
|
|
46
|
+
setLocale: (lang: string) => Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Initialize the store (detect language from URL, storage, browser)
|
|
49
|
+
*/
|
|
50
|
+
init: () => Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Available languages
|
|
53
|
+
*/
|
|
54
|
+
readonly languages: Language[];
|
|
55
|
+
/**
|
|
56
|
+
* Language names map for quick lookup
|
|
57
|
+
*/
|
|
58
|
+
readonly languageNames: Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* Supported language codes
|
|
61
|
+
*/
|
|
62
|
+
readonly supportedCodes: string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates an i18n store with configurable options.
|
|
66
|
+
* API matches nofilter.io's i18nStore for easy migration.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* // Create the store
|
|
71
|
+
* const i18n = createI18n({
|
|
72
|
+
* languages: [
|
|
73
|
+
* { code: "en", name: "English" },
|
|
74
|
+
* { code: "es", name: "Español" },
|
|
75
|
+
* ],
|
|
76
|
+
* storageKey: "myapp_locale",
|
|
77
|
+
* initialTranslations: enTranslations,
|
|
78
|
+
* loadTranslations: (locale) => fetch(`/locales/${locale}.json`).then(r => r.json()),
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* // Use in components
|
|
82
|
+
* <p>{i18n.t("greeting")}</p>
|
|
83
|
+
* <p>Current: {i18n.locale}</p>
|
|
84
|
+
*
|
|
85
|
+
* // Initialize on app mount
|
|
86
|
+
* onMount(() => i18n.init());
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function createI18n(options: I18nOptions): I18nStore;
|
|
90
|
+
export interface I18nContextValue {
|
|
91
|
+
i18n: I18nStore;
|
|
92
|
+
}
|
|
93
|
+
export declare const I18nContext: import("solid-js").Context<I18nContextValue | undefined>;
|
|
94
|
+
export declare function useI18n(): I18nStore;
|
|
95
|
+
export interface I18nProviderProps {
|
|
96
|
+
i18n: I18nStore;
|
|
97
|
+
children: JSX.Element;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Provider component for i18n context
|
|
101
|
+
*/
|
|
102
|
+
export declare const I18nProvider: FlowComponent<I18nProviderProps>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default as LanguageSwitcher } from "./LanguageSwitcher";
|
|
2
|
+
export type { LanguageSwitcherProps } from "./LanguageSwitcher";
|
|
3
|
+
export { createI18n, I18nProvider, I18nContext, useI18n, type I18nStore, type I18nOptions, type I18nContextValue, type I18nProviderProps, type Language, } from "./createI18n";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Component, type JSX } from "solid-js";
|
|
2
|
+
import type { IComponentBaseProps } from "../types";
|
|
3
|
+
import type { LiveChatPanelProps } from "./LiveChatPanel";
|
|
4
|
+
export interface LiveChatBubbleProps extends IComponentBaseProps {
|
|
5
|
+
/**
|
|
6
|
+
* Position of the chat bubble
|
|
7
|
+
* @default "bottom-right"
|
|
8
|
+
*/
|
|
9
|
+
position?: "bottom-right" | "bottom-left";
|
|
10
|
+
/**
|
|
11
|
+
* ARIA label for the button
|
|
12
|
+
* @default "Open chat"
|
|
13
|
+
*/
|
|
14
|
+
"aria-label"?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Number of unread messages to show in badge
|
|
17
|
+
* @default 0
|
|
18
|
+
*/
|
|
19
|
+
unreadCount?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Props to pass to the LiveChatPanel when opened
|
|
22
|
+
*/
|
|
23
|
+
panelProps?: Omit<LiveChatPanelProps, "onClose">;
|
|
24
|
+
/**
|
|
25
|
+
* Callback when chat is opened
|
|
26
|
+
*/
|
|
27
|
+
onOpen?: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Callback when chat is closed
|
|
30
|
+
*/
|
|
31
|
+
onClose?: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Custom children to render inside the button (replaces default icons)
|
|
34
|
+
*/
|
|
35
|
+
children?: JSX.Element;
|
|
36
|
+
}
|
|
37
|
+
declare const LiveChatBubble: Component<LiveChatBubbleProps>;
|
|
38
|
+
export default LiveChatBubble;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Component } from "solid-js";
|
|
2
|
+
import type { IComponentBaseProps } from "../types";
|
|
3
|
+
import type { ChatMessage, SendMessagePayload, SendMessageResponse } from "./types";
|
|
4
|
+
export interface LiveChatPanelProps extends IComponentBaseProps {
|
|
5
|
+
/**
|
|
6
|
+
* Callback when the panel close button is clicked
|
|
7
|
+
*/
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Title shown in the header
|
|
11
|
+
* @default "Chat with us"
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Placeholder text for the input field
|
|
16
|
+
* @default "Message support..."
|
|
17
|
+
*/
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Label for the close button (for accessibility)
|
|
21
|
+
* @default "Close chat"
|
|
22
|
+
*/
|
|
23
|
+
closeLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Label for the send button
|
|
26
|
+
* @default "Send"
|
|
27
|
+
*/
|
|
28
|
+
sendLabel?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Empty state message when there are no messages
|
|
31
|
+
* @default "No messages yet. Start a conversation!"
|
|
32
|
+
*/
|
|
33
|
+
emptyMessage?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Enable mock mode with demo messages
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
mockMode?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Initial messages to display (only used if mockMode is false)
|
|
41
|
+
*/
|
|
42
|
+
messages?: ChatMessage[];
|
|
43
|
+
/**
|
|
44
|
+
* Callback when a message is sent
|
|
45
|
+
* Should return the message ID and timestamp from the server
|
|
46
|
+
*/
|
|
47
|
+
onSendMessage?: (payload: SendMessagePayload) => Promise<SendMessageResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a message is currently being sent
|
|
50
|
+
*/
|
|
51
|
+
isSending?: boolean;
|
|
52
|
+
}
|
|
53
|
+
declare const LiveChatPanel: Component<LiveChatPanelProps>;
|
|
54
|
+
export default LiveChatPanel;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as LiveChatBubble } from "./LiveChatBubble";
|
|
2
|
+
export type { LiveChatBubbleProps } from "./LiveChatBubble";
|
|
3
|
+
export { default as LiveChatPanel } from "./LiveChatPanel";
|
|
4
|
+
export type { LiveChatPanelProps } from "./LiveChatPanel";
|
|
5
|
+
export type { ChatMessage, SendMessagePayload, SendMessageResponse } from "./types";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ChatMessage {
|
|
2
|
+
messageId: string;
|
|
3
|
+
content: string;
|
|
4
|
+
sender: "user" | "agent";
|
|
5
|
+
timestamp: number;
|
|
6
|
+
}
|
|
7
|
+
export interface SendMessagePayload {
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SendMessageResponse {
|
|
11
|
+
messageId: string;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Component, type JSX } from "solid-js";
|
|
2
|
+
import type { IComponentBaseProps } from "../types";
|
|
3
|
+
export interface ThemeColorPickerProps extends IComponentBaseProps {
|
|
4
|
+
/**
|
|
5
|
+
* Prefix for localStorage keys (e.g., "myapp" becomes "myapp_hue_shift")
|
|
6
|
+
* @default "theme"
|
|
7
|
+
*/
|
|
8
|
+
storagePrefix?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Callback when color changes
|
|
11
|
+
*/
|
|
12
|
+
onColorChange?: (hue: number | null, saturation: number) => void;
|
|
13
|
+
/**
|
|
14
|
+
* ARIA label for the button
|
|
15
|
+
*/
|
|
16
|
+
"aria-label"?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Custom button content (defaults to palette icon)
|
|
19
|
+
*/
|
|
20
|
+
children?: JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
declare const ThemeColorPicker: Component<ThemeColorPickerProps>;
|
|
23
|
+
export default ThemeColorPicker;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare function resetHueShift(): void;
|
|
2
|
+
export interface HueShiftStore {
|
|
3
|
+
hueShift: () => number | null;
|
|
4
|
+
hueSaturation: () => number;
|
|
5
|
+
setHueShift: (hue: number | null, saturation?: number) => void;
|
|
6
|
+
isAvailable: () => boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Creates a hue shift store with configurable storage prefix.
|
|
10
|
+
* @param storagePrefix - Prefix for localStorage keys (e.g., "myapp" becomes "myapp_hue_shift")
|
|
11
|
+
*/
|
|
12
|
+
export declare function createHueShiftStore(storagePrefix: string): HueShiftStore;
|
|
13
|
+
export declare function getDefaultHueShiftStore(): HueShiftStore;
|
|
14
|
+
export { resetHueShift };
|
package/dist/index.d.ts
CHANGED
|
@@ -47,7 +47,11 @@ export { default as Input } from "./components/input";
|
|
|
47
47
|
export { default as Join } from "./components/join";
|
|
48
48
|
export { default as Kbd } from "./components/kbd";
|
|
49
49
|
export { default as Link } from "./components/link";
|
|
50
|
+
export { LiveChatBubble, LiveChatPanel, } from "./components/live-chat";
|
|
51
|
+
export type { LiveChatBubbleProps, LiveChatPanelProps, ChatMessage, SendMessagePayload, SendMessageResponse, } from "./components/live-chat";
|
|
50
52
|
export { default as Loading } from "./components/loading";
|
|
53
|
+
export { LanguageSwitcher, createI18n, I18nProvider, I18nContext, useI18n, } from "./components/language-switcher";
|
|
54
|
+
export type { LanguageSwitcherProps, I18nStore, I18nOptions, I18nContextValue, I18nProviderProps, Language, } from "./components/language-switcher";
|
|
51
55
|
export { default as Mask } from "./components/mask";
|
|
52
56
|
export { Menu } from "./components/menu";
|
|
53
57
|
export { default as Modal } from "./components/modal";
|
|
@@ -88,6 +92,8 @@ export type { StreamingTableStore } from "./components/streaming-table";
|
|
|
88
92
|
export { default as Tabs } from "./components/tabs";
|
|
89
93
|
export type { RadioTabProps, TabProps, TabsProps } from "./components/tabs";
|
|
90
94
|
export { default as Textarea } from "./components/textarea";
|
|
95
|
+
export { ThemeColorPicker, createHueShiftStore, getDefaultHueShiftStore, resetHueShift, } from "./components/theme-color-picker";
|
|
96
|
+
export type { ThemeColorPickerProps, HueShiftStore, } from "./components/theme-color-picker";
|
|
91
97
|
export { Timeline, TimelineEnd, TimelineItem, TimelineMiddle, TimelineStart, } from "./components/timeline";
|
|
92
98
|
export { default as Toast } from "./components/toast";
|
|
93
99
|
export { ToastContainer, ToastStack } from "./components/toastcontainer";
|