@camstack/ui-library 1.2.227 → 1.2.228
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/composites/device-item/quick-detail-action.d.ts +6 -0
- package/dist/composites/device-list/generic-mode.d.ts +5 -0
- package/dist/composites/device-picker/SelectedChip.d.ts +3 -1
- package/dist/composites/index.d.ts +4 -0
- package/dist/composites/notification-targets-field.d.ts +66 -0
- package/dist/composites/notification-targets-options.d.ts +11 -0
- package/dist/composites/option-select/OptionSelect.d.ts +30 -0
- package/dist/composites/option-select/index.d.ts +4 -0
- package/dist/composites/option-select/option-select-model.d.ts +56 -0
- package/dist/contexts/device-quick-detail.d.ts +9 -0
- package/dist/generated/system-hooks.d.ts +4 -0
- package/dist/index.cjs +1086 -308
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1069 -309
- package/dist/primitives/badge.d.ts +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/icon-button.d.ts +1 -1
- package/package.json +1 -1
|
@@ -65,6 +65,11 @@ export interface DeviceListGenericProps<T> {
|
|
|
65
65
|
readonly filterOptions?: readonly MultiSelectOption[];
|
|
66
66
|
/** Label for the type multi-select trigger. Default 'Type'. */
|
|
67
67
|
readonly filterLabel?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Initial type-filter selection. Empty (default) = no filter. Used once at
|
|
70
|
+
* mount — later changes to this prop are ignored (local state owns it).
|
|
71
|
+
*/
|
|
72
|
+
readonly initialTypeFilters?: readonly string[];
|
|
68
73
|
readonly isLoading?: boolean;
|
|
69
74
|
readonly searchPlaceholder?: string;
|
|
70
75
|
readonly emptyLabel?: string;
|
|
@@ -6,7 +6,9 @@ export interface SelectedChipProps {
|
|
|
6
6
|
/** A selection the hub no longer has — drawn in warning colour. */
|
|
7
7
|
readonly warning?: boolean;
|
|
8
8
|
readonly iconId?: string;
|
|
9
|
+
/** Brand / raster icon URL (e.g. notifier kind icon). */
|
|
10
|
+
readonly iconUrl?: string;
|
|
9
11
|
readonly testId?: string;
|
|
10
12
|
}
|
|
11
13
|
/** One selected entry as a removable chip. */
|
|
12
|
-
export declare function SelectedChip({ label, onRemove, warning, iconId, testId, }: SelectedChipProps): import("react").JSX.Element;
|
|
14
|
+
export declare function SelectedChip({ label, onRemove, warning, iconId, iconUrl, testId, }: SelectedChipProps): import("react").JSX.Element;
|
|
@@ -79,6 +79,8 @@ export { DeviceBatchToolbar } from './device-list/batch-toolbar';
|
|
|
79
79
|
export * from './device-meta';
|
|
80
80
|
export * from './icon-picker';
|
|
81
81
|
export { DeviceMultiSelectField, DeviceSelectField } from './device-select-field';
|
|
82
|
+
export type { NotificationTargetOption, NotificationTargetSelectFieldProps, NotificationTargetsFieldProps, } from './notification-targets-field';
|
|
83
|
+
export { ConfigNotificationTargetMultiSelectFieldView, ConfigNotificationTargetSelectFieldView, NotificationTargetSelectField, NotificationTargetsField, } from './notification-targets-field';
|
|
82
84
|
export type { DeviceSelectCandidate } from './device-select-filter';
|
|
83
85
|
export { deviceMatchesFilter, deviceOptionLabel, devicesToOptions, filterDeviceOptions, selectedDeviceOptions, } from './device-select-filter';
|
|
84
86
|
export type { DeviceSelectorTab, SelectorDevice } from './device-selector-picker';
|
|
@@ -170,6 +172,8 @@ export * from './version-badge';
|
|
|
170
172
|
export * from './widget-panel.js';
|
|
171
173
|
export type { WidgetSlotProps } from './widget-slot';
|
|
172
174
|
export { WidgetSlot } from './widget-slot';
|
|
175
|
+
export type { OptionSelectMultiProps, OptionSelectOption, OptionSelectProps, OptionSelectSingleProps, } from './option-select/index.js';
|
|
176
|
+
export { OptionSelect, OPTION_SELECT_SEARCH_MIN_OPTIONS, catalogHasDraft, draftFromQuery, filterOptions as filterOptionSelectOptions, optionSearchText as optionSelectSearchText, partitionSelected as partitionOptionSelectSelected, resolveSearchable as resolveOptionSelectSearchable, shouldShowAddNewFooter, shouldShowUseQueryRow, } from './option-select/index.js';
|
|
173
177
|
export * from './device-picker/index.js';
|
|
174
178
|
export * from './unit-picker/index.js';
|
|
175
179
|
export * from './placeholder-field/index.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ConfigNotificationTargetMultiSelectField, ConfigNotificationTargetSelectField } from '@camstack/types';
|
|
2
|
+
import { TranslationFn } from './config-form-builder';
|
|
3
|
+
import { NotificationTargetOption } from './notification-targets-options';
|
|
4
|
+
export type { NotificationTargetOption } from './notification-targets-options';
|
|
5
|
+
export interface NotificationTargetsFieldProps {
|
|
6
|
+
readonly targets: readonly NotificationTargetOption[];
|
|
7
|
+
readonly value: readonly string[];
|
|
8
|
+
readonly onChange: (next: string[]) => void;
|
|
9
|
+
readonly disabled?: boolean;
|
|
10
|
+
/** Cap on how many targets may be selected. */
|
|
11
|
+
readonly maxItems?: number;
|
|
12
|
+
/** Per-target test id is `<prefix>-<id>`. Default `notification-target`. */
|
|
13
|
+
readonly testIdPrefix?: string;
|
|
14
|
+
/** What an empty catalog says. */
|
|
15
|
+
readonly emptyMessage?: string;
|
|
16
|
+
/** Target ids that carry an extra note badge (e.g. already covered by a rule). */
|
|
17
|
+
readonly noteIds?: ReadonlySet<string>;
|
|
18
|
+
/** Label on the note badge. Default `note`. */
|
|
19
|
+
readonly noteLabel?: string;
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
readonly description?: string;
|
|
22
|
+
/** Kind brand icons keyed as `addonId:kind`. */
|
|
23
|
+
readonly kindIconUrls?: ReadonlyMap<string, string>;
|
|
24
|
+
}
|
|
25
|
+
export interface NotificationTargetSelectFieldProps {
|
|
26
|
+
readonly targets: readonly NotificationTargetOption[];
|
|
27
|
+
readonly value: string;
|
|
28
|
+
readonly onChange: (next: string) => void;
|
|
29
|
+
readonly disabled?: boolean;
|
|
30
|
+
readonly emptyMessage?: string;
|
|
31
|
+
readonly placeholder?: string;
|
|
32
|
+
readonly testId?: string;
|
|
33
|
+
readonly label?: string;
|
|
34
|
+
readonly description?: string;
|
|
35
|
+
readonly kindIconUrls?: ReadonlyMap<string, string>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Multi-select of delivery targets (NC Summaries / Timelapses / Rules shape).
|
|
39
|
+
*/
|
|
40
|
+
export declare function NotificationTargetsField({ targets, value, onChange, disabled, maxItems, testIdPrefix, emptyMessage, noteIds, noteLabel, label, description, kindIconUrls: kindIconUrlsProp, }: NotificationTargetsFieldProps): import("react").JSX.Element;
|
|
41
|
+
/**
|
|
42
|
+
* Single-select of one delivery target (Calendar events / script settings).
|
|
43
|
+
*/
|
|
44
|
+
export declare function NotificationTargetSelectField({ targets, value, onChange, disabled, emptyMessage, placeholder, testId, label, description, kindIconUrls: kindIconUrlsProp, }: NotificationTargetSelectFieldProps): import("react").JSX.Element;
|
|
45
|
+
/**
|
|
46
|
+
* ConfigUISchema `notification-target-multiselect` — fetches listTargets and
|
|
47
|
+
* stores a `string[]` of target ids.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ConfigNotificationTargetMultiSelectFieldView({ field, value, onChange, disabled, translationFn, }: {
|
|
50
|
+
readonly field: ConfigNotificationTargetMultiSelectField;
|
|
51
|
+
readonly value: unknown;
|
|
52
|
+
readonly onChange: (v: unknown) => void;
|
|
53
|
+
readonly disabled?: boolean;
|
|
54
|
+
readonly translationFn?: TranslationFn;
|
|
55
|
+
}): import("react").JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* ConfigUISchema `notification-target-select` — fetches listTargets and stores
|
|
58
|
+
* one target id string.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ConfigNotificationTargetSelectFieldView({ field, value, onChange, disabled, translationFn, }: {
|
|
61
|
+
readonly field: ConfigNotificationTargetSelectField;
|
|
62
|
+
readonly value: unknown;
|
|
63
|
+
readonly onChange: (v: unknown) => void;
|
|
64
|
+
readonly disabled?: boolean;
|
|
65
|
+
readonly translationFn?: TranslationFn;
|
|
66
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OptionSelectOption } from './option-select/option-select-model';
|
|
2
|
+
export type NotificationTargetOption = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly enabled: boolean;
|
|
6
|
+
readonly kind?: string;
|
|
7
|
+
readonly addonId?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function targetsToOptions(targets: readonly NotificationTargetOption[], kindIconUrls: ReadonlyMap<string, string>, noteIds: ReadonlySet<string> | undefined, noteLabel: string): readonly OptionSelectOption[];
|
|
10
|
+
export declare function buildKindIconMap(rows: unknown): ReadonlyMap<string, string>;
|
|
11
|
+
export declare function toTargetOptions(rows: unknown): readonly NotificationTargetOption[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { OptionSelectOption } from './option-select-model';
|
|
2
|
+
type OptionSelectSharedProps = {
|
|
3
|
+
readonly options: readonly OptionSelectOption[];
|
|
4
|
+
readonly placeholder?: string;
|
|
5
|
+
readonly searchable?: boolean;
|
|
6
|
+
readonly disabled?: boolean;
|
|
7
|
+
readonly emptyMessage?: string;
|
|
8
|
+
readonly creatable?: boolean;
|
|
9
|
+
readonly createLabel?: string;
|
|
10
|
+
readonly onCreateRequest?: (draft: string) => void;
|
|
11
|
+
readonly label?: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
readonly testId?: string;
|
|
14
|
+
readonly optionTestIdPrefix?: string;
|
|
15
|
+
readonly listboxId?: string;
|
|
16
|
+
};
|
|
17
|
+
export type OptionSelectSingleProps = OptionSelectSharedProps & {
|
|
18
|
+
readonly mode: 'single';
|
|
19
|
+
readonly value: string;
|
|
20
|
+
readonly onChange: (next: string) => void;
|
|
21
|
+
};
|
|
22
|
+
export type OptionSelectMultiProps = OptionSelectSharedProps & {
|
|
23
|
+
readonly mode: 'multi';
|
|
24
|
+
readonly value: readonly string[];
|
|
25
|
+
readonly onChange: (next: string[]) => void;
|
|
26
|
+
readonly maxItems?: number;
|
|
27
|
+
};
|
|
28
|
+
export type OptionSelectProps = OptionSelectSingleProps | OptionSelectMultiProps;
|
|
29
|
+
export declare function OptionSelect(props: OptionSelectProps): import("react").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { OptionSelectOption } from './option-select-model';
|
|
2
|
+
export { OPTION_SELECT_SEARCH_MIN_OPTIONS, catalogHasDraft, draftFromQuery, filterOptions, optionSearchText, partitionSelected, resolveSearchable, shouldShowAddNewFooter, shouldShowUseQueryRow, } from './option-select-model';
|
|
3
|
+
export type { OptionSelectMultiProps, OptionSelectProps, OptionSelectSingleProps, } from './OptionSelect';
|
|
4
|
+
export { OptionSelect } from './OptionSelect';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure filter/partition helpers for OptionSelect.
|
|
3
|
+
*
|
|
4
|
+
* Search is a case-insensitive substring match folded over each option's
|
|
5
|
+
* `value`, `label`, and `description`. Multi-token queries require every
|
|
6
|
+
* token to match (AND).
|
|
7
|
+
*/
|
|
8
|
+
export type OptionSelectOption = {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
iconUrl?: string;
|
|
13
|
+
iconId?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
badge?: string;
|
|
16
|
+
};
|
|
17
|
+
/** Number of options at/above which search is enabled by default (unless creatable). */
|
|
18
|
+
export declare const OPTION_SELECT_SEARCH_MIN_OPTIONS = 8;
|
|
19
|
+
/** Fold an option into a single lower-cased haystack (value + label + description). */
|
|
20
|
+
export declare function optionSearchText(opt: OptionSelectOption): string;
|
|
21
|
+
/**
|
|
22
|
+
* Filter options by a free-text query. An empty / whitespace-only query
|
|
23
|
+
* returns every option (identity, preserving order).
|
|
24
|
+
*/
|
|
25
|
+
export declare function filterOptions(options: readonly OptionSelectOption[], query: string): readonly OptionSelectOption[];
|
|
26
|
+
/**
|
|
27
|
+
* Split options into the currently-selected set (in selection order) and the
|
|
28
|
+
* rest. Selected values with no matching option are surfaced as synthetic
|
|
29
|
+
* options whose label falls back to the raw value.
|
|
30
|
+
*/
|
|
31
|
+
export declare function partitionSelected(options: readonly OptionSelectOption[], selected: readonly string[]): {
|
|
32
|
+
readonly selectedOptions: readonly OptionSelectOption[];
|
|
33
|
+
readonly unselected: readonly OptionSelectOption[];
|
|
34
|
+
};
|
|
35
|
+
export declare function resolveSearchable(optionCount: number, creatable: boolean, searchable: boolean | undefined): boolean;
|
|
36
|
+
/** Trimmed non-empty draft from the search box, or null when absent. */
|
|
37
|
+
export declare function draftFromQuery(query: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* True when an existing catalog option already represents this draft (value or
|
|
40
|
+
* label, case-insensitive). Used to hide the “Use «query»” row when redundant.
|
|
41
|
+
*/
|
|
42
|
+
export declare function catalogHasDraft(options: readonly OptionSelectOption[], draft: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Show the footer “Add new…” action only when creatable AND the caller
|
|
45
|
+
* provided `onCreateRequest` (e.g. open a dedicated create dialog).
|
|
46
|
+
*
|
|
47
|
+
* Without that hook the footer was a no-op (it only focused the search box),
|
|
48
|
+
* which read as “Add new is broken”. Free-form create already works via the
|
|
49
|
+
* “Use «query»” row once the operator types — no footer needed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function shouldShowAddNewFooter(creatable: boolean, hasCreateRequest: boolean): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Show the “Use «query»” commit row: creatable, a non-empty draft, and no
|
|
54
|
+
* catalog option that already matches the draft.
|
|
55
|
+
*/
|
|
56
|
+
export declare function shouldShowUseQueryRow(creatable: boolean, query: string, options: readonly OptionSelectOption[]): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type DeviceQuickDetailOpen = (deviceId: number) => void;
|
|
3
|
+
export interface DeviceQuickDetailProviderProps {
|
|
4
|
+
readonly open: DeviceQuickDetailOpen;
|
|
5
|
+
readonly children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function DeviceQuickDetailProvider({ open, children, }: DeviceQuickDetailProviderProps): ReactNode;
|
|
8
|
+
/** The host's open callback, or null when no provider is mounted. */
|
|
9
|
+
export declare function useDeviceQuickDetailOpen(): DeviceQuickDetailOpen | null;
|
|
@@ -1077,8 +1077,12 @@ export declare const useNodesExecuteQuery: typeof trpc.nodes.executeQuery.useMut
|
|
|
1077
1077
|
export declare const useNotificationOutputListTargetKinds: typeof trpc.notificationOutput.listTargetKinds.useQuery;
|
|
1078
1078
|
/** Generated alias around `trpc.notificationOutput.listTargets.useQuery`. */
|
|
1079
1079
|
export declare const useNotificationOutputListTargets: typeof trpc.notificationOutput.listTargets.useQuery;
|
|
1080
|
+
/** Generated alias around `trpc.notificationOutput.getTarget.useQuery`. */
|
|
1081
|
+
export declare const useNotificationOutputGetTarget: typeof trpc.notificationOutput.getTarget.useQuery;
|
|
1080
1082
|
/** Generated alias around `trpc.notificationOutput.discoverTargets.useQuery`. */
|
|
1081
1083
|
export declare const useNotificationOutputDiscoverTargets: typeof trpc.notificationOutput.discoverTargets.useQuery;
|
|
1084
|
+
/** Generated alias around `trpc.notificationOutput.probeTargetConfig.useMutation`. */
|
|
1085
|
+
export declare const useNotificationOutputProbeTargetConfig: typeof trpc.notificationOutput.probeTargetConfig.useMutation;
|
|
1082
1086
|
/** Generated alias around `trpc.notificationOutput.send.useMutation`. */
|
|
1083
1087
|
export declare const useNotificationOutputSend: typeof trpc.notificationOutput.send.useMutation;
|
|
1084
1088
|
/** Generated alias around `trpc.notificationOutput.testTarget.useMutation`. */
|