@k2b/ui 0.1.0-rc.0 → 0.1.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/README.md +77 -312
- package/dist/types/actions/Button.d.ts +38 -0
- package/dist/types/actions/ContextMenu.d.ts +17 -0
- package/dist/types/actions/CopyButton.d.ts +20 -0
- package/dist/types/actions/Disclosure.d.ts +15 -0
- package/dist/types/actions/Dropdown.d.ts +100 -0
- package/dist/types/actions/FilterChip.d.ts +27 -0
- package/dist/types/actions/RemoveButton.d.ts +7 -0
- package/dist/types/actions/SegmentedControl.d.ts +20 -0
- package/dist/types/actions/SplitButton.d.ts +13 -0
- package/dist/types/actions/SpotlightSearch.d.ts +25 -0
- package/dist/types/actions/Tabs.d.ts +27 -0
- package/dist/types/actions/Toolbar.d.ts +23 -0
- package/dist/types/actions/index.d.ts +24 -0
- package/dist/types/chat/ChatComposer.d.ts +57 -0
- package/dist/types/chat/ChatPrimitives.d.ts +48 -0
- package/dist/types/chat/ChatRoot.d.ts +7 -0
- package/dist/types/chat/ChatTimeline.d.ts +52 -0
- package/dist/types/chat/chat-behavior.d.ts +29 -0
- package/dist/types/chat/index.d.ts +21 -0
- package/dist/types/chat/types.d.ts +62 -0
- package/dist/types/content/Calendar.d.ts +115 -0
- package/dist/types/content/Chart.d.ts +90 -0
- package/dist/types/content/CodeDisplay.d.ts +11 -0
- package/dist/types/content/DataTable.d.ts +113 -0
- package/dist/types/content/Docs.d.ts +52 -0
- package/dist/types/content/FileBrowser.d.ts +40 -0
- package/dist/types/content/FileTree.d.ts +29 -0
- package/dist/types/content/FileView.d.ts +59 -0
- package/dist/types/content/Lightbox.d.ts +16 -0
- package/dist/types/content/LogEntriesTable.d.ts +14 -0
- package/dist/types/content/MarkdownView.d.ts +46 -0
- package/dist/types/content/Pagination.d.ts +10 -0
- package/dist/types/content/PdfPreview.d.ts +11 -0
- package/dist/types/content/RangePicker.d.ts +29 -0
- package/dist/types/content/StructuredDataPreview.d.ts +20 -0
- package/dist/types/content/calendar-event-layout.d.ts +16 -0
- package/dist/types/content/calendar-pointer.d.ts +22 -0
- package/dist/types/content/chart-map-viewport.d.ts +5 -0
- package/dist/types/content/chart-state-timeline.d.ts +42 -0
- package/dist/types/content/code-highlight.d.ts +14 -0
- package/dist/types/content/file-tree.d.ts +41 -0
- package/dist/types/content/file-view-preview.d.ts +22 -0
- package/dist/types/content/index.d.ts +26 -0
- package/dist/types/feedback/InlineGuidance.d.ts +10 -0
- package/dist/types/feedback/Tooltip.d.ts +18 -0
- package/dist/types/feedback/dialog-core.d.ts +19 -0
- package/dist/types/feedback/index.d.ts +10 -0
- package/dist/types/feedback/prompts.d.ts +164 -0
- package/dist/types/feedback/toast.d.ts +25 -0
- package/dist/types/feedback/tooltip-position.d.ts +2 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/inputs/AutocompleteEditor.d.ts +21 -0
- package/dist/types/inputs/AutocompleteSelect.d.ts +30 -0
- package/dist/types/inputs/Checkbox.d.ts +9 -0
- package/dist/types/inputs/CheckboxCard.d.ts +9 -0
- package/dist/types/inputs/ChoiceGroups.d.ts +13 -0
- package/dist/types/inputs/ChoiceInputs.d.ts +24 -0
- package/dist/types/inputs/Combobox.d.ts +18 -0
- package/dist/types/inputs/DatePicker.d.ts +31 -0
- package/dist/types/inputs/FileInputs.d.ts +31 -0
- package/dist/types/inputs/MultiSelectInput.d.ts +41 -0
- package/dist/types/inputs/NumberInput.d.ts +24 -0
- package/dist/types/inputs/Select.d.ts +50 -0
- package/dist/types/inputs/SelectChip.d.ts +25 -0
- package/dist/types/inputs/SpecialInputs.d.ts +21 -0
- package/dist/types/inputs/Switch.d.ts +7 -0
- package/dist/types/inputs/TagEditor.d.ts +35 -0
- package/dist/types/inputs/TagsInput.d.ts +11 -0
- package/dist/types/inputs/TemplateEditor.d.ts +28 -0
- package/dist/types/inputs/TextInput.d.ts +26 -0
- package/dist/types/inputs/choice.d.ts +32 -0
- package/dist/types/inputs/completion/behaviors.d.ts +13 -0
- package/dist/types/inputs/completion/engine.d.ts +54 -0
- package/dist/types/inputs/completion/index.d.ts +3 -0
- package/dist/types/inputs/completion/overlay.d.ts +11 -0
- package/dist/types/inputs/date-picker.d.ts +42 -0
- package/dist/types/inputs/editor-dom.d.ts +6 -0
- package/dist/types/inputs/field-contract.d.ts +24 -0
- package/dist/types/inputs/icon-options.d.ts +37 -0
- package/dist/types/inputs/image-crop.d.ts +44 -0
- package/dist/types/inputs/index.d.ts +45 -0
- package/dist/types/inputs/markdown/MarkdownEditor.d.ts +25 -0
- package/dist/types/inputs/markdown/Toolbar.d.ts +9 -0
- package/dist/types/inputs/markdown/actions.d.ts +8 -0
- package/dist/types/inputs/markdown/active-formats.d.ts +1 -0
- package/dist/types/inputs/markdown/behaviors.d.ts +3 -0
- package/dist/types/inputs/markdown/code-zone.d.ts +1 -0
- package/dist/types/internal/color.d.ts +4 -0
- package/dist/types/internal/field.d.ts +27 -0
- package/dist/types/internal/portal.d.ts +1 -0
- package/dist/types/intl/Format.d.ts +84 -0
- package/dist/types/intl/index.d.ts +4 -0
- package/dist/types/intl/locale.d.ts +42 -0
- package/dist/types/intl/messages.d.ts +375 -0
- package/dist/types/layout/AppOverview.d.ts +29 -0
- package/dist/types/layout/AppWorkspace.d.ts +254 -0
- package/dist/types/layout/DataPanel.d.ts +16 -0
- package/dist/types/layout/DetailPanel.d.ts +89 -0
- package/dist/types/layout/Discussion.d.ts +52 -0
- package/dist/types/layout/FloatingWindow.d.ts +19 -0
- package/dist/types/layout/PanelDialog.d.ts +72 -0
- package/dist/types/layout/PanelHeader.d.ts +10 -0
- package/dist/types/layout/Panes.d.ts +48 -0
- package/dist/types/layout/ScrollArea.d.ts +8 -0
- package/dist/types/layout/Settings.d.ts +72 -0
- package/dist/types/layout/SettingsCollection.d.ts +41 -0
- package/dist/types/layout/SettingsModal.d.ts +39 -0
- package/dist/types/layout/app-workspace-controller.d.ts +7 -0
- package/dist/types/layout/app-workspace-state.d.ts +57 -0
- package/dist/types/layout/floating-window-geometry.d.ts +11 -0
- package/dist/types/layout/index.d.ts +32 -0
- package/dist/types/layout/panes-layout.d.ts +63 -0
- package/dist/types/layout/stable-id.d.ts +3 -0
- package/dist/types/semantics.d.ts +4 -0
- package/dist/types/surfaces/Avatar.d.ts +14 -0
- package/dist/types/surfaces/DescriptionList.d.ts +17 -0
- package/dist/types/surfaces/LinkCard.d.ts +11 -0
- package/dist/types/surfaces/NotFoundState.d.ts +15 -0
- package/dist/types/surfaces/NoticeCard.d.ts +39 -0
- package/dist/types/surfaces/Paper.d.ts +13 -0
- package/dist/types/surfaces/Placeholder.d.ts +17 -0
- package/dist/types/surfaces/ProgressBar.d.ts +13 -0
- package/dist/types/surfaces/StatCell.d.ts +22 -0
- package/dist/types/surfaces/StatGrid.d.ts +21 -0
- package/dist/types/surfaces/StatusBadge.d.ts +12 -0
- package/dist/types/surfaces/Tag.d.ts +16 -0
- package/dist/types/surfaces/index.d.ts +24 -0
- package/dist/types/widgets/Widget.d.ts +12 -0
- package/dist/types/widgets/WidgetHero.d.ts +11 -0
- package/dist/types/widgets/WidgetList.d.ts +17 -0
- package/dist/types/widgets/WidgetPills.d.ts +14 -0
- package/dist/types/widgets/WidgetStat.d.ts +17 -0
- package/dist/types/widgets/WidgetStatus.d.ts +12 -0
- package/dist/types/widgets/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { ValueFieldProps } from "./field-contract";
|
|
3
|
+
export type TagsInputProps = ValueFieldProps<string[]> & {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
activeIcon?: string;
|
|
7
|
+
maxTags?: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function TagsInput(props: TagsInputProps): JSX.Element;
|
|
11
|
+
export default TagsInput;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type PanesLayout } from "../layout/panes-layout";
|
|
3
|
+
import { type AutocompleteEditorProps } from "./AutocompleteEditor";
|
|
4
|
+
export type TemplateVariableKind = "string" | "email" | "url" | "number" | "boolean" | "array" | "object";
|
|
5
|
+
export type TemplateVariable = {
|
|
6
|
+
name: string;
|
|
7
|
+
kind?: TemplateVariableKind;
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
export type TemplateEditorProps = Omit<AutocompleteEditorProps, "completions" | "highlight"> & {
|
|
11
|
+
variables: readonly TemplateVariable[];
|
|
12
|
+
};
|
|
13
|
+
export type TemplatePreviewProps = {
|
|
14
|
+
html: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
class?: string;
|
|
17
|
+
};
|
|
18
|
+
export type TemplateSampleDataProps = {
|
|
19
|
+
variables: readonly TemplateVariable[];
|
|
20
|
+
values: Readonly<Record<string, string>>;
|
|
21
|
+
onValueChange: (name: string, value: string) => void;
|
|
22
|
+
class?: string;
|
|
23
|
+
};
|
|
24
|
+
export type TemplateEditorLayout = PanesLayout;
|
|
25
|
+
export declare const createTemplateEditorPanesLayout: () => TemplateEditorLayout;
|
|
26
|
+
export declare function TemplateEditor(props: TemplateEditorProps): JSX.Element;
|
|
27
|
+
export declare function TemplatePreview(props: TemplatePreviewProps): JSX.Element;
|
|
28
|
+
export declare function TemplateSampleData(props: TemplateSampleDataProps): JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { Completion } from "./completion";
|
|
3
|
+
import type { ValueFieldProps } from "./field-contract";
|
|
4
|
+
export type TextInputProps = Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "onChange" | "onInput" | "prefix" | "suffix" | "type" | "value" | keyof ValueFieldProps<string>> & ValueFieldProps<string> & {
|
|
5
|
+
minLength?: number;
|
|
6
|
+
maxLength?: number;
|
|
7
|
+
type?: "text" | "search" | "email" | "url" | "tel";
|
|
8
|
+
variant?: "default" | "ai";
|
|
9
|
+
icon?: string;
|
|
10
|
+
activeIcon?: string;
|
|
11
|
+
prefix?: JSX.Element;
|
|
12
|
+
suffix?: JSX.Element;
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
onClear?: () => void;
|
|
15
|
+
clearLabel?: string;
|
|
16
|
+
multiline?: boolean;
|
|
17
|
+
monospace?: boolean;
|
|
18
|
+
password?: boolean;
|
|
19
|
+
markdown?: boolean;
|
|
20
|
+
onSubmit?: () => void;
|
|
21
|
+
lines?: number;
|
|
22
|
+
abbreviations?: Record<string, string>;
|
|
23
|
+
completions?: readonly Completion[];
|
|
24
|
+
};
|
|
25
|
+
export declare function TextInput(props: TextInputProps): JSX.Element;
|
|
26
|
+
export default TextInput;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Setter } from "solid-js";
|
|
2
|
+
export type ChoiceOption<T extends string = string> = {
|
|
3
|
+
value: T;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Optional overlapping groups used by choice controls that expose group filtering. */
|
|
10
|
+
groups?: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
export type ChoiceOptionsLoader<T extends string = string> = (query: string, signal: AbortSignal) => Promise<readonly ChoiceOption<T>[]>;
|
|
13
|
+
export declare const filterChoiceOptions: <T extends string>(options: readonly ChoiceOption<T>[], query: string) => readonly ChoiceOption<T>[];
|
|
14
|
+
export declare const nextEnabledChoiceIndex: <T extends string>(options: readonly ChoiceOption<T>[], current: number, direction: 1 | -1) => number;
|
|
15
|
+
export declare function createChoiceLoader<T extends string>(loader: () => ChoiceOptionsLoader<T> | undefined, debounceMs: () => number): {
|
|
16
|
+
options: () => readonly ChoiceOption<T>[];
|
|
17
|
+
loading: () => boolean;
|
|
18
|
+
error: () => string | undefined;
|
|
19
|
+
load: (query: string, immediate?: boolean) => void;
|
|
20
|
+
retry: () => void;
|
|
21
|
+
cancel: () => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const placeChoicePopover: (trigger: HTMLElement, popover: HTMLElement) => void;
|
|
24
|
+
export declare function createChoicePopover(disabled: () => boolean): {
|
|
25
|
+
open: () => boolean;
|
|
26
|
+
setTrigger: Setter<HTMLElement | undefined>;
|
|
27
|
+
setPopover: Setter<HTMLElement | undefined>;
|
|
28
|
+
show: () => void;
|
|
29
|
+
hide: (restoreFocus?: boolean) => void;
|
|
30
|
+
toggle: () => void;
|
|
31
|
+
trigger: () => HTMLElement | undefined;
|
|
32
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Completion, type QueryContext, type Suggestion } from "./engine";
|
|
2
|
+
export type TryExpandOptions = {
|
|
3
|
+
isExcluded?: (text: string, position: number) => boolean;
|
|
4
|
+
};
|
|
5
|
+
/** Keeps abbreviation restoration isolated to one editor instance. */
|
|
6
|
+
export declare const createCompletionBehaviorState: () => {
|
|
7
|
+
applySuggestion: (textarea: HTMLTextAreaElement, context: QueryContext, suggestion: Suggestion, options?: {
|
|
8
|
+
trackExpansion?: boolean;
|
|
9
|
+
}) => boolean;
|
|
10
|
+
reset: () => void;
|
|
11
|
+
tryExpand: (textarea: HTMLTextAreaElement, completions: readonly Completion[] | undefined, options?: TryExpandOptions) => boolean;
|
|
12
|
+
tryRestore: (textarea: HTMLTextAreaElement) => boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type Suggestion = {
|
|
2
|
+
text: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
expansion?: string;
|
|
5
|
+
appendSpace?: boolean;
|
|
6
|
+
hint?: string;
|
|
7
|
+
textEdit?: {
|
|
8
|
+
start: number;
|
|
9
|
+
end: number;
|
|
10
|
+
text: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type SuggestContext = {
|
|
14
|
+
fullText: string;
|
|
15
|
+
caret: number;
|
|
16
|
+
tokenStart: number;
|
|
17
|
+
};
|
|
18
|
+
export type Completion = {
|
|
19
|
+
trigger?: string;
|
|
20
|
+
suggest: (query: string, context: SuggestContext, signal: AbortSignal) => readonly Suggestion[] | Promise<readonly Suggestion[]>;
|
|
21
|
+
/** Static labels used by editor highlighting. Providers are never invoked to derive metadata. */
|
|
22
|
+
knownLabels?: readonly string[];
|
|
23
|
+
debounceMs?: number;
|
|
24
|
+
dropdown?: boolean;
|
|
25
|
+
allowAfterWord?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type QueryContext = {
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
text: string;
|
|
31
|
+
query: string;
|
|
32
|
+
completion: Completion;
|
|
33
|
+
};
|
|
34
|
+
export type DetectOptions = {
|
|
35
|
+
isExcluded?: (text: string, position: number) => boolean;
|
|
36
|
+
};
|
|
37
|
+
export type ResolveResult = {
|
|
38
|
+
kind: "sync";
|
|
39
|
+
data: readonly Suggestion[];
|
|
40
|
+
} | {
|
|
41
|
+
kind: "async";
|
|
42
|
+
promise: Promise<readonly Suggestion[]>;
|
|
43
|
+
};
|
|
44
|
+
export declare const TRIGGER_CHARS: Set<string>;
|
|
45
|
+
export declare const WORD_CHAR: RegExp;
|
|
46
|
+
export declare const GHOST_SENTINEL: string;
|
|
47
|
+
export declare const abbreviations: (dictionary: Record<string, string>) => Completion;
|
|
48
|
+
export declare const detectQuery: (textarea: HTMLTextAreaElement, completions: readonly Completion[] | undefined, options?: DetectOptions) => QueryContext | null;
|
|
49
|
+
export declare const resolveSuggestions: (completion: Completion, query: string, context: SuggestContext, signal: AbortSignal) => ResolveResult;
|
|
50
|
+
export declare const suggestSync: (completion: Completion, query: string, context: SuggestContext) => readonly Suggestion[] | null;
|
|
51
|
+
export declare const pickGhost: (suggestions: readonly Suggestion[], typed: string) => Suggestion | null;
|
|
52
|
+
export declare const collectKnownLabels: (completions: readonly Completion[] | undefined) => Set<string>;
|
|
53
|
+
export declare const displayLabel: (suggestion: Suggestion, completion: Completion) => string;
|
|
54
|
+
export declare const buildSuggestContext: (textarea: HTMLTextAreaElement, context: QueryContext) => SuggestContext;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createCompletionBehaviorState, type TryExpandOptions, } from "./behaviors";
|
|
2
|
+
export { abbreviations, buildSuggestContext, type Completion, collectKnownLabels, type DetectOptions, detectQuery, displayLabel, GHOST_SENTINEL, pickGhost, type QueryContext, type ResolveResult, resolveSuggestions, type SuggestContext, type Suggestion, suggestSync, TRIGGER_CHARS, WORD_CHAR, } from "./engine";
|
|
3
|
+
export { plainTextHighlight, type RenderOptions, renderWithOverlay, } from "./overlay";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const plainTextHighlight: (value: string) => string;
|
|
2
|
+
export type RenderOptions = {
|
|
3
|
+
ghost?: {
|
|
4
|
+
at: number;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
anchor?: {
|
|
8
|
+
at: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const renderWithOverlay: (text: string, highlighter: (text: string) => string, options?: RenderOptions) => string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type DateContext } from "@k2b/stdlib";
|
|
2
|
+
export type DateRangeValue = {
|
|
3
|
+
start: string | null;
|
|
4
|
+
end: string | null;
|
|
5
|
+
};
|
|
6
|
+
export declare const pickerContext: (context?: DateContext) => DateContext;
|
|
7
|
+
export declare const hasInstantOffset: (value: string) => boolean;
|
|
8
|
+
export declare const dateKey: (date: Date | string, context?: DateContext) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Short month names for the month panel. `dates.months()` only returns the long
|
|
11
|
+
* form ("September"), which overflows the three-column month grid, so the short
|
|
12
|
+
* form is derived here while staying locale aware.
|
|
13
|
+
*/
|
|
14
|
+
export declare const monthNames: (context?: DateContext) => string[];
|
|
15
|
+
/**
|
|
16
|
+
* Picks the roving-tabindex day for a rendered month grid. The preferred day is
|
|
17
|
+
* used when the grid actually contains it, otherwise the first day of the
|
|
18
|
+
* visible month keeps exactly one cell reachable by Tab.
|
|
19
|
+
*/
|
|
20
|
+
export declare const resolveFocusDay: (monthDayKeys: readonly string[], preferred: string | null | undefined) => string | undefined;
|
|
21
|
+
export declare const yearMonth: (date: Date, context?: DateContext) => {
|
|
22
|
+
year: number;
|
|
23
|
+
month: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const monthDate: (year: number, month: number, context?: DateContext) => Date;
|
|
26
|
+
export declare const parseDateValue: (value: string | null | undefined, context?: DateContext) => Date;
|
|
27
|
+
export declare const displayDate: (value: string | null | undefined, context?: DateContext) => string;
|
|
28
|
+
export declare const dateTimeInput: (value: string | null | undefined, context?: DateContext) => string;
|
|
29
|
+
export declare const splitDateTime: (value: string | null | undefined, context?: DateContext) => {
|
|
30
|
+
date: string;
|
|
31
|
+
time: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const isCompleteTime: (value: string) => boolean;
|
|
34
|
+
export declare const toDateTimeValue: (date: string, time: string, context?: DateContext) => string | null;
|
|
35
|
+
export declare const formatDateTimeValue: (value: string | null | undefined, context?: DateContext) => string;
|
|
36
|
+
export declare const normalizeTimeInput: (value: string) => string;
|
|
37
|
+
export declare const filterTimeInput: (value: string) => string;
|
|
38
|
+
export declare const orderedRange: (start: string, end: string) => DateRangeValue;
|
|
39
|
+
export declare const previewRange: (range: DateRangeValue, preview: string | null) => DateRangeValue;
|
|
40
|
+
export declare const inRange: (day: string, range: DateRangeValue) => boolean;
|
|
41
|
+
export declare const isRangeEdge: (day: string, range: DateRangeValue) => boolean;
|
|
42
|
+
export declare const formatDateOnlyRangeDuration: (range: DateRangeValue, context?: DateContext) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces one textarea range while preserving the browser's native undo path
|
|
3
|
+
* where possible. The fallback emits the input event that the editing command
|
|
4
|
+
* would have emitted, so callers never need a second dispatch.
|
|
5
|
+
*/
|
|
6
|
+
export declare const replaceTextareaRange: (textarea: HTMLTextAreaElement, start: number, end: number, replacement: string) => boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DateContext as StdlibDateContext } from "@k2b/stdlib";
|
|
2
|
+
import type { JSX } from "solid-js";
|
|
3
|
+
export type DateContext = StdlibDateContext;
|
|
4
|
+
export type MaybeAccessor<T> = T | (() => T);
|
|
5
|
+
export type FieldProps = {
|
|
6
|
+
id?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
label?: JSX.Element;
|
|
9
|
+
description?: JSX.Element;
|
|
10
|
+
error?: MaybeAccessor<JSX.Element | undefined>;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
"aria-label"?: string;
|
|
14
|
+
"aria-describedby"?: string;
|
|
15
|
+
};
|
|
16
|
+
export type ValueFieldProps<T> = FieldProps & {
|
|
17
|
+
value: MaybeAccessor<T>;
|
|
18
|
+
onValueChange?: (value: T) => void;
|
|
19
|
+
onValueCommit?: (value: T) => void;
|
|
20
|
+
};
|
|
21
|
+
/** Reports one atomic edit as both the current and committed field value. */
|
|
22
|
+
export declare const commitFieldValue: <T>(owner: Pick<ValueFieldProps<T>, "onValueChange" | "onValueCommit">, value: T) => void;
|
|
23
|
+
export declare function resolveMaybeAccessor<T>(value: MaybeAccessor<T>): T;
|
|
24
|
+
export declare function resolveMaybeAccessor<T>(value: MaybeAccessor<T> | undefined): T | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IconOption } from "./SpecialInputs";
|
|
2
|
+
export declare const DEFAULT_ICON_GROUPS: readonly [{
|
|
3
|
+
readonly value: "recommended";
|
|
4
|
+
readonly label: "Recommended";
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: "people";
|
|
7
|
+
readonly label: "People";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "work";
|
|
10
|
+
readonly label: "Work";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "communication";
|
|
13
|
+
readonly label: "Communication";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "files";
|
|
16
|
+
readonly label: "Files";
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: "data";
|
|
19
|
+
readonly label: "Data & tech";
|
|
20
|
+
}, {
|
|
21
|
+
readonly value: "commerce";
|
|
22
|
+
readonly label: "Commerce";
|
|
23
|
+
}, {
|
|
24
|
+
readonly value: "places";
|
|
25
|
+
readonly label: "Places";
|
|
26
|
+
}, {
|
|
27
|
+
readonly value: "food";
|
|
28
|
+
readonly label: "Food";
|
|
29
|
+
}, {
|
|
30
|
+
readonly value: "media";
|
|
31
|
+
readonly label: "Media";
|
|
32
|
+
}, {
|
|
33
|
+
readonly value: "devices";
|
|
34
|
+
readonly label: "Devices";
|
|
35
|
+
}];
|
|
36
|
+
/** A curated, application-neutral Tabler catalogue for IconInput. */
|
|
37
|
+
export declare const DEFAULT_ICON_OPTIONS: readonly IconOption[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type ImageCropAspect = "free" | {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
};
|
|
5
|
+
export type ImageCropRotation = 0 | 90 | 180 | 270;
|
|
6
|
+
export type ImageCropRect = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
export type ImageCropState = {
|
|
13
|
+
crop: ImageCropRect;
|
|
14
|
+
rotation: ImageCropRotation;
|
|
15
|
+
};
|
|
16
|
+
export type ImageCropSource = File | Blob | HTMLImageElement | HTMLCanvasElement | string;
|
|
17
|
+
export type ImageCropOutput = {
|
|
18
|
+
width?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
maxWidth?: number;
|
|
21
|
+
maxHeight?: number;
|
|
22
|
+
format?: "webp" | "jpeg" | "png";
|
|
23
|
+
quality?: number;
|
|
24
|
+
};
|
|
25
|
+
export type ImageCropSize = {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
29
|
+
export type ImageCropResizeHandle = "nw" | "ne" | "sw" | "se";
|
|
30
|
+
export declare const normalizeImageCropRotation: (rotation: number) => ImageCropRotation;
|
|
31
|
+
export declare const rotateImageCropRight: (rotation: ImageCropRotation) => ImageCropRotation;
|
|
32
|
+
export declare const getInitialImageCropRect: (imageSize: ImageCropSize, aspect?: ImageCropAspect) => ImageCropRect;
|
|
33
|
+
export declare const clampImageCropRect: (rect: ImageCropRect, imageSize: ImageCropSize, aspect?: ImageCropAspect) => ImageCropRect;
|
|
34
|
+
export declare const resizeImageCropAroundCenter: (rect: ImageCropRect, imageSize: ImageCropSize, aspect: ImageCropAspect, scale: number) => ImageCropRect;
|
|
35
|
+
/** Resizes a crop from one corner while keeping the opposite corner anchored. */
|
|
36
|
+
export declare const resizeImageCropFromCorner: (rect: ImageCropRect, imageSize: ImageCropSize, aspect: ImageCropAspect, handle: ImageCropResizeHandle, dx: number, dy: number) => ImageCropRect;
|
|
37
|
+
export declare const imageCropRectToPixels: (rect: ImageCropRect, imageSize: ImageCropSize) => {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
};
|
|
43
|
+
export declare const createCroppedImageCanvas: (source: ImageCropSource, state: ImageCropState, output?: ImageCropOutput) => Promise<HTMLCanvasElement>;
|
|
44
|
+
export declare const createCroppedImageDataUrl: (source: ImageCropSource, state: ImageCropState, output?: ImageCropOutput) => Promise<string>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type { AutocompleteEditorProps } from "./AutocompleteEditor";
|
|
2
|
+
export { AutocompleteEditor } from "./AutocompleteEditor";
|
|
3
|
+
export type { AutocompleteSelectOption, AutocompleteSelectProps, AutocompleteSelectSearchResult, } from "./AutocompleteSelect";
|
|
4
|
+
export { AutocompleteSelect } from "./AutocompleteSelect";
|
|
5
|
+
export type { CheckboxProps } from "./Checkbox";
|
|
6
|
+
export { Checkbox } from "./Checkbox";
|
|
7
|
+
export type { CheckboxCardProps } from "./CheckboxCard";
|
|
8
|
+
export { CheckboxCard } from "./CheckboxCard";
|
|
9
|
+
export type { ColorInputProps, PinInputProps, SliderProps, } from "./ChoiceInputs";
|
|
10
|
+
export { ColorInput, PinInput, Slider } from "./ChoiceInputs";
|
|
11
|
+
export type { ComboboxOption, ComboboxProps } from "./Combobox";
|
|
12
|
+
export { Combobox } from "./Combobox";
|
|
13
|
+
export type { ChoiceOption, ChoiceOptionsLoader } from "./choice";
|
|
14
|
+
export type { Completion, QueryContext, SuggestContext, Suggestion, } from "./completion";
|
|
15
|
+
export { abbreviations } from "./completion";
|
|
16
|
+
export type { DatePickerBaseProps, DatePickerProps, DatePreset, DateRangePickerProps, DateRangeValue, DateTimePickerProps, DurationPreset, } from "./DatePicker";
|
|
17
|
+
export { DatePicker, DateRangePicker, DateTimePicker } from "./DatePicker";
|
|
18
|
+
export type { FileDropzoneProps, ImageCropperProps, ImageInputProps } from "./FileInputs";
|
|
19
|
+
export { FileDropzone, ImageCropper, ImageInput } from "./FileInputs";
|
|
20
|
+
export type { DateContext, FieldProps, MaybeAccessor, ValueFieldProps } from "./field-contract";
|
|
21
|
+
export { DEFAULT_ICON_GROUPS, DEFAULT_ICON_OPTIONS } from "./icon-options";
|
|
22
|
+
export type { ImageCropAspect, ImageCropOutput, ImageCropRect, ImageCropRotation, ImageCropSize, ImageCropSource, ImageCropState, } from "./image-crop";
|
|
23
|
+
export { clampImageCropRect, createCroppedImageCanvas, createCroppedImageDataUrl, getInitialImageCropRect, imageCropRectToPixels, normalizeImageCropRotation, resizeImageCropAroundCenter, rotateImageCropRight, } from "./image-crop";
|
|
24
|
+
export type { MultiSelectFetchDataFn, MultiSelectInputProps, MultiSelectOption, } from "./MultiSelectInput";
|
|
25
|
+
export { MultiSelectInput } from "./MultiSelectInput";
|
|
26
|
+
export type { MarkdownEditorProps } from "./markdown/MarkdownEditor";
|
|
27
|
+
export { MarkdownEditor } from "./markdown/MarkdownEditor";
|
|
28
|
+
export type { NumberInputProps } from "./NumberInput";
|
|
29
|
+
export { NumberInput } from "./NumberInput";
|
|
30
|
+
export type { SelectGridSize, SelectGroup, SelectOption, SelectProps, SelectSourceOption, SelectView } from "./Select";
|
|
31
|
+
export { Select } from "./Select";
|
|
32
|
+
export type { SelectChipOption, SelectChipProps } from "./SelectChip";
|
|
33
|
+
export { SelectChip } from "./SelectChip";
|
|
34
|
+
export type { IconInputProps, IconOption } from "./SpecialInputs";
|
|
35
|
+
export { IconInput } from "./SpecialInputs";
|
|
36
|
+
export type { SwitchProps } from "./Switch";
|
|
37
|
+
export { Switch } from "./Switch";
|
|
38
|
+
export type { TagEditorItem, TagEditorLabels, TagEditorProps, TagEditorValue } from "./TagEditor";
|
|
39
|
+
export { TagEditor } from "./TagEditor";
|
|
40
|
+
export type { TagsInputProps } from "./TagsInput";
|
|
41
|
+
export { TagsInput } from "./TagsInput";
|
|
42
|
+
export type { TemplateEditorLayout, TemplateEditorProps, TemplatePreviewProps, TemplateSampleDataProps, TemplateVariable, TemplateVariableKind, } from "./TemplateEditor";
|
|
43
|
+
export { createTemplateEditorPanesLayout, TemplateEditor, TemplatePreview, TemplateSampleData, } from "./TemplateEditor";
|
|
44
|
+
export type { TextInputProps } from "./TextInput";
|
|
45
|
+
export { TextInput } from "./TextInput";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import { type Completion } from "../completion";
|
|
3
|
+
import type { ValueFieldProps } from "../field-contract";
|
|
4
|
+
export type MarkdownEditorProps = ValueFieldProps<string> & {
|
|
5
|
+
onSubmit?: () => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
lines?: number;
|
|
8
|
+
noToolbar?: boolean;
|
|
9
|
+
spellcheck?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
textareaRef?: (element: HTMLTextAreaElement) => void;
|
|
13
|
+
abbreviations?: Record<string, string>;
|
|
14
|
+
completions?: readonly Completion[];
|
|
15
|
+
showStats?: boolean;
|
|
16
|
+
variant?: "default" | "paper";
|
|
17
|
+
fill?: boolean;
|
|
18
|
+
onSave?: () => void;
|
|
19
|
+
saveDisabled?: boolean;
|
|
20
|
+
saving?: boolean;
|
|
21
|
+
toolbarTrailing?: JSX.Element;
|
|
22
|
+
};
|
|
23
|
+
export declare function MarkdownEditor(props: MarkdownEditorProps): JSX.Element;
|
|
24
|
+
export type { Completion, SuggestContext, Suggestion } from "../completion";
|
|
25
|
+
export { abbreviations } from "../completion";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
type ToolbarProps = {
|
|
3
|
+
textarea: () => HTMLTextAreaElement | null;
|
|
4
|
+
activeFormats?: () => Set<string>;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
trailing?: JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export default function Toolbar(props: ToolbarProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const toggleBold: (textarea: HTMLTextAreaElement) => void;
|
|
2
|
+
export declare const toggleItalic: (textarea: HTMLTextAreaElement) => void;
|
|
3
|
+
export declare const toggleCode: (textarea: HTMLTextAreaElement) => void;
|
|
4
|
+
export declare const insertLink: (textarea: HTMLTextAreaElement, url?: string) => void;
|
|
5
|
+
export declare const toggleHeading: (textarea: HTMLTextAreaElement, level: 1 | 2 | 3) => void;
|
|
6
|
+
export declare const toggleBulletList: (textarea: HTMLTextAreaElement) => void;
|
|
7
|
+
export declare const toggleQuote: (textarea: HTMLTextAreaElement) => void;
|
|
8
|
+
export declare const toggleNumberedList: (textarea: HTMLTextAreaElement) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const computeActiveFormats: (textarea: HTMLTextAreaElement) => Set<string>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const handleShortcut: (event: KeyboardEvent, textarea: HTMLTextAreaElement) => boolean;
|
|
2
|
+
export declare const handleListContinuation: (textarea: HTMLTextAreaElement) => boolean;
|
|
3
|
+
export declare const handleSmartPaste: (event: ClipboardEvent, textarea: HTMLTextAreaElement) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isInCodeZone: (text: string, position: number) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
export declare const normalizeHexColor: (value: string | null | undefined) => string | undefined;
|
|
3
|
+
export declare const hexWithAlpha: (value: string, alpha: string) => string;
|
|
4
|
+
export declare const colorTintStyle: (value: string | null | undefined) => JSX.CSSProperties | undefined;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type JSX } from "solid-js";
|
|
2
|
+
import type { FieldProps } from "../inputs/field-contract";
|
|
3
|
+
export type FieldMeta = {
|
|
4
|
+
controlId: string;
|
|
5
|
+
labelId: string;
|
|
6
|
+
descriptionId: string;
|
|
7
|
+
errorId: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const createFieldMeta: (id?: string) => FieldMeta;
|
|
10
|
+
type FieldLayoutProps = {
|
|
11
|
+
children: JSX.Element;
|
|
12
|
+
meta: FieldMeta;
|
|
13
|
+
fill?: boolean;
|
|
14
|
+
/** Composite controls use aria-labelledby instead of an HTML label target. */
|
|
15
|
+
labelFor?: string | false;
|
|
16
|
+
} & Pick<FieldProps, "class" | "description" | "error" | "label" | "required" | "disabled">;
|
|
17
|
+
export declare function Field(props: FieldLayoutProps): JSX.Element;
|
|
18
|
+
type FieldAriaOwner = Pick<FieldProps, "aria-describedby" | "aria-label" | "description" | "error" | "label" | "required">;
|
|
19
|
+
export declare const fieldDescribedBy: (meta: FieldMeta, owner: FieldAriaOwner) => string | undefined;
|
|
20
|
+
export declare const fieldControlAria: (meta: FieldMeta, owner: FieldAriaOwner) => {
|
|
21
|
+
readonly "aria-label": string | undefined;
|
|
22
|
+
readonly "aria-labelledby": string | undefined;
|
|
23
|
+
readonly "aria-describedby": string | undefined;
|
|
24
|
+
readonly "aria-invalid": "true" | undefined;
|
|
25
|
+
readonly "aria-required": true | undefined;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getK2bPortalRoot: (scope?: HTMLElement | null) => HTMLElement;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type ByteMode } from "@k2b/stdlib";
|
|
2
|
+
import { type JSX } from "solid-js";
|
|
3
|
+
type SpanProps = JSX.HTMLAttributes<HTMLSpanElement>;
|
|
4
|
+
type TimeElementProps = Omit<JSX.HTMLAttributes<HTMLElement>, "ref">;
|
|
5
|
+
type LocaleProp = {
|
|
6
|
+
/** Explicit locale override; defaults to the inherited render locale. */
|
|
7
|
+
locale?: string;
|
|
8
|
+
};
|
|
9
|
+
type FallbackProp = {
|
|
10
|
+
/** Text rendered for null or invalid input. Defaults to `"—"`. */
|
|
11
|
+
fallback?: string;
|
|
12
|
+
};
|
|
13
|
+
export type FormatNumberProps = SpanProps & LocaleProp & FallbackProp & {
|
|
14
|
+
value: number | null | undefined;
|
|
15
|
+
/** Use deterministic compact suffixes (`k`, `M`, `B`, `T`). */
|
|
16
|
+
compact?: boolean;
|
|
17
|
+
/** Fixed fraction digits. */
|
|
18
|
+
decimals?: number;
|
|
19
|
+
};
|
|
20
|
+
export type FormatPercentProps = SpanProps & LocaleProp & FallbackProp & {
|
|
21
|
+
/** Ratio input: `0.12` renders as `12%`. */
|
|
22
|
+
value: number | null | undefined;
|
|
23
|
+
/** Fixed fraction digits. Defaults to 0. */
|
|
24
|
+
decimals?: number;
|
|
25
|
+
/** Clamp the ratio to 0..1 before formatting. */
|
|
26
|
+
clamp?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type FormatCurrencyProps = SpanProps & LocaleProp & FallbackProp & {
|
|
29
|
+
value: number | null | undefined;
|
|
30
|
+
/** ISO 4217 currency code, e.g. `"EUR"` or `"USD"`. */
|
|
31
|
+
currency: string;
|
|
32
|
+
/** Fixed fraction digits. Defaults to the currency's standard digits. */
|
|
33
|
+
decimals?: number;
|
|
34
|
+
};
|
|
35
|
+
export type FormatBytesProps = SpanProps & LocaleProp & FallbackProp & {
|
|
36
|
+
value: number | null | undefined;
|
|
37
|
+
/** `"iec"` (default, 1024-base) or `"si"` (1000-base). */
|
|
38
|
+
mode?: ByteMode;
|
|
39
|
+
};
|
|
40
|
+
export type FormatDateProps = TimeElementProps & LocaleProp & FallbackProp & {
|
|
41
|
+
value: Date | string | null | undefined;
|
|
42
|
+
/** IANA timezone. Defaults to `"UTC"` so server and browser text agree. */
|
|
43
|
+
timeZone?: string;
|
|
44
|
+
};
|
|
45
|
+
export type FormatTimeProps = FormatDateProps;
|
|
46
|
+
export type FormatDateTimeProps = FormatDateProps;
|
|
47
|
+
export type FormatRelativeTimeProps = TimeElementProps & LocaleProp & FallbackProp & {
|
|
48
|
+
value: Date | string | null | undefined;
|
|
49
|
+
/** Deterministic base timestamp; defaults to now. */
|
|
50
|
+
base?: Date | string;
|
|
51
|
+
/** IANA timezone used to select calendar-relative labels. Defaults to `"UTC"`. */
|
|
52
|
+
timeZone?: string;
|
|
53
|
+
};
|
|
54
|
+
export type FormatDurationProps = TimeElementProps & LocaleProp & FallbackProp & {
|
|
55
|
+
from: Date | string | null | undefined;
|
|
56
|
+
to: Date | string | null | undefined;
|
|
57
|
+
};
|
|
58
|
+
export type FormatDurationMsProps = TimeElementProps & LocaleProp & FallbackProp & {
|
|
59
|
+
/** Duration in milliseconds. */
|
|
60
|
+
value: number | null | undefined;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Unstyled semantic formatter components backed by `@k2b/stdlib`.
|
|
64
|
+
*
|
|
65
|
+
* Numeric components render a plain `<span>`; date/time components render
|
|
66
|
+
* `<time>` with a canonical `datetime` attribute. All components inherit the
|
|
67
|
+
* render locale (see `LocaleProvider` / `useLocale`) and accept an explicit
|
|
68
|
+
* `locale` override. Date, Time, and DateTime format in UTC unless an
|
|
69
|
+
* explicit `timeZone` is given, so server and browser output never diverge
|
|
70
|
+
* with the runtime timezone.
|
|
71
|
+
*/
|
|
72
|
+
export declare const Format: {
|
|
73
|
+
readonly Number: (props: FormatNumberProps) => JSX.Element;
|
|
74
|
+
readonly Percent: (props: FormatPercentProps) => JSX.Element;
|
|
75
|
+
readonly Currency: (props: FormatCurrencyProps) => JSX.Element;
|
|
76
|
+
readonly Bytes: (props: FormatBytesProps) => JSX.Element;
|
|
77
|
+
readonly Date: (props: FormatDateProps) => JSX.Element;
|
|
78
|
+
readonly Time: (props: FormatDateProps) => JSX.Element;
|
|
79
|
+
readonly DateTime: (props: FormatDateProps) => JSX.Element;
|
|
80
|
+
readonly RelativeTime: (props: FormatRelativeTimeProps) => JSX.Element;
|
|
81
|
+
readonly Duration: (props: FormatDurationProps) => JSX.Element;
|
|
82
|
+
readonly DurationMs: (props: FormatDurationMsProps) => JSX.Element;
|
|
83
|
+
};
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { FormatBytesProps, FormatCurrencyProps, FormatDateProps, FormatDateTimeProps, FormatDurationMsProps, FormatDurationProps, FormatNumberProps, FormatPercentProps, FormatRelativeTimeProps, FormatTimeProps, } from "./Format";
|
|
2
|
+
export { Format } from "./Format";
|
|
3
|
+
export type { LocaleProviderProps } from "./locale";
|
|
4
|
+
export { LocaleProvider, useLocale } from "./locale";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DateContext } from "@k2b/stdlib";
|
|
2
|
+
import { type JSX } from "solid-js";
|
|
3
|
+
/**
|
|
4
|
+
* Deterministic fallback locale used when neither a `LocaleProvider` nor a
|
|
5
|
+
* browser `<html lang>` value is available.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_LOCALE = "en";
|
|
8
|
+
export type LocaleProviderProps = {
|
|
9
|
+
/** BCP 47 locale tag, e.g. `"en"`, `"de"`, or `"de-AT"`. */
|
|
10
|
+
locale: string;
|
|
11
|
+
children?: JSX.Element;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Provides the render locale to all descendant `@k2b/ui` components.
|
|
15
|
+
*
|
|
16
|
+
* On the server this is the only locale source, so SSR consumers wrap their
|
|
17
|
+
* page in a provider and emit a matching `<html lang>` attribute. A browser
|
|
18
|
+
* island is an independent Solid root: an outer server-side provider does not
|
|
19
|
+
* survive the island's browser re-render, which instead falls back to
|
|
20
|
+
* `document.documentElement.lang`. Keeping `<html lang>` equal to the server
|
|
21
|
+
* provider locale therefore keeps both passes coherent.
|
|
22
|
+
*/
|
|
23
|
+
export declare const LocaleProvider: (props: LocaleProviderProps) => JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the effective render locale as a reactive accessor.
|
|
26
|
+
*
|
|
27
|
+
* Precedence: nearest `LocaleProvider`, then the browser's
|
|
28
|
+
* `document.documentElement.lang`, then `"en"`. Components with an explicit
|
|
29
|
+
* `locale` prop apply it before consulting this hook.
|
|
30
|
+
*/
|
|
31
|
+
export declare const useLocale: () => (() => string);
|
|
32
|
+
/**
|
|
33
|
+
* Effective date config for date surfaces: an explicit `dateConfig.locale`
|
|
34
|
+
* wins, otherwise the inherited render locale fills the gap. Timezone and
|
|
35
|
+
* week-start configuration pass through untouched.
|
|
36
|
+
*/
|
|
37
|
+
export declare const useDateConfigLocale: (config: () => DateContext | undefined) => (() => DateContext);
|
|
38
|
+
/**
|
|
39
|
+
* The decimal separator `Intl.NumberFormat` uses for a locale, e.g. `"."`
|
|
40
|
+
* for English and `","` for German.
|
|
41
|
+
*/
|
|
42
|
+
export declare const decimalSeparator: (locale: string) => string;
|