@keemakr/ui-sdk 1.6.0-dev-20261027215807 → 1.6.0-dev-20261027220914
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/form.d.ts +10 -0
- package/dist/form.js +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/negotiate.js +1 -1
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +15 -0
- package/package.json +1 -1
package/dist/form.d.ts
CHANGED
|
@@ -18,6 +18,16 @@ export declare function localInputToIso(local: string): string;
|
|
|
18
18
|
export declare function initialDraft(field: FormFieldLike): FormDraft;
|
|
19
19
|
/** What the module receives for a field. See the form schema for each kind. */
|
|
20
20
|
export declare function postedValue(field: Pick<FormFieldLike, 'kind'>, draft: FormDraft): string | number | boolean | string[] | null;
|
|
21
|
+
/**
|
|
22
|
+
* The options of a `searchable` multiselect in drawing order: the `pinned` ones first, always on
|
|
23
|
+
* show, then the rest whose label holds the query (any case). Pass the values that were ticked when
|
|
24
|
+
* the query last changed, not the live ones, so an option does not jump away from under the
|
|
25
|
+
* reader's pointer the moment they tick or untick it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function searchableOptions<T extends {
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}>(options: readonly T[], pinned: readonly string[], query: string): T[];
|
|
21
31
|
/** One send button of a form: its `submit` or one of its `secondary`. */
|
|
22
32
|
export interface FormSubmit {
|
|
23
33
|
label: string;
|
package/dist/form.js
CHANGED
|
@@ -51,6 +51,18 @@ export function postedValue(field, draft) {
|
|
|
51
51
|
return typeof draft === 'string' ? draft : '';
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The options of a `searchable` multiselect in drawing order: the `pinned` ones first, always on
|
|
56
|
+
* show, then the rest whose label holds the query (any case). Pass the values that were ticked when
|
|
57
|
+
* the query last changed, not the live ones, so an option does not jump away from under the
|
|
58
|
+
* reader's pointer the moment they tick or untick it.
|
|
59
|
+
*/
|
|
60
|
+
export function searchableOptions(options, pinned, query) {
|
|
61
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
62
|
+
const top = options.filter((o) => pinned.includes(o.value));
|
|
63
|
+
const rest = options.filter((o) => !pinned.includes(o.value) && o.label.toLocaleLowerCase().includes(needle));
|
|
64
|
+
return [...top, ...rest];
|
|
65
|
+
}
|
|
54
66
|
/** Every send button of a form in drawing order: `submit` first, then `secondary`. */
|
|
55
67
|
export function formSubmits(form) {
|
|
56
68
|
// A reason is only for a disabled send, as on a button: an enabled one says nothing.
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { PLAYBACK_RATES, SEEK_AT_MAX, formatPlayhead, isSeekPress, nextPlaybackR
|
|
|
21
21
|
export type { PlaybackRate, PlayerKey, SeekReference } from './player.js';
|
|
22
22
|
export { heatmapCellText, heatmapIntensity, heatmapMixPercent, heatmapRange, heatmapStrong, } from './heatmap.js';
|
|
23
23
|
export type { HeatmapLike, HeatmapRange } from './heatmap.js';
|
|
24
|
-
export { chosenSubmit, formPress, formSubmits, initialDraft, isoToLocalInput, localInputToIso, postedValue, } from './form.js';
|
|
24
|
+
export { chosenSubmit, formPress, formSubmits, initialDraft, isoToLocalInput, localInputToIso, postedValue, searchableOptions, } from './form.js';
|
|
25
25
|
export type { FormDraft, FormFieldKind, FormFieldLike, FormSubmit } from './form.js';
|
|
26
26
|
export { stackedBarParts, stackedBarValue } from './stacked-bar.js';
|
|
27
27
|
export type { StackedBarLike, StackedBarParts, StackedBarSegmentPart } from './stacked-bar.js';
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export { PUBLISHED_PARSERS } from './published/index.js';
|
|
|
21
21
|
export { MEDIA_CONTENT_TYPES, mediaContentType, mediaPathOf } from './media.js';
|
|
22
22
|
export { PLAYBACK_RATES, SEEK_AT_MAX, formatPlayhead, isSeekPress, nextPlaybackRate, playbackRateLabel, playheadWords, seekTarget, seeksIn, } from './player.js';
|
|
23
23
|
export { heatmapCellText, heatmapIntensity, heatmapMixPercent, heatmapRange, heatmapStrong, } from './heatmap.js';
|
|
24
|
-
export { chosenSubmit, formPress, formSubmits, initialDraft, isoToLocalInput, localInputToIso, postedValue, } from './form.js';
|
|
24
|
+
export { chosenSubmit, formPress, formSubmits, initialDraft, isoToLocalInput, localInputToIso, postedValue, searchableOptions, } from './form.js';
|
|
25
25
|
export { stackedBarParts, stackedBarValue } from './stacked-bar.js';
|
|
26
26
|
export { statTrend } from './stat.js';
|
|
27
27
|
export { createSectionMemory, sectionBadge, sectionCollapsible, sectionColumnWeights, sectionGridTemplate, sectionScrollHeight, } from './section.js';
|
package/dist/negotiate.js
CHANGED
|
@@ -954,7 +954,7 @@ export function foldChoiceField(field) {
|
|
|
954
954
|
* list -> textarea, one item per line
|
|
955
955
|
*/
|
|
956
956
|
export function foldFormField(field) {
|
|
957
|
-
const { values, checked, min: _min, max: _max, step: _step, ...rest } = field;
|
|
957
|
+
const { values, checked, min: _min, max: _max, step: _step, searchable: _searchable, ...rest } = field;
|
|
958
958
|
switch (field.kind) {
|
|
959
959
|
case 'number':
|
|
960
960
|
case 'date':
|
package/dist/schema.d.ts
CHANGED
|
@@ -587,6 +587,7 @@ declare const leafNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
587
587
|
badge: z.ZodOptional<z.ZodString>;
|
|
588
588
|
description: z.ZodOptional<z.ZodString>;
|
|
589
589
|
}, z.core.$strip>>>;
|
|
590
|
+
searchable: z.ZodOptional<z.ZodBoolean>;
|
|
590
591
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
591
592
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
592
593
|
hint: z.ZodOptional<z.ZodString>;
|
package/dist/schema.js
CHANGED
|
@@ -1680,6 +1680,14 @@ const leafNodeSchema = z.discriminatedUnion('type', [
|
|
|
1680
1680
|
}))
|
|
1681
1681
|
.max(200)
|
|
1682
1682
|
.optional(),
|
|
1683
|
+
/**
|
|
1684
|
+
* A multiselect only: a search box above the checkboxes, for a long list
|
|
1685
|
+
* such as the forms to send a patient. The ticked options stay on top and
|
|
1686
|
+
* always on show; the rest are filtered by their label as the reader
|
|
1687
|
+
* types (`searchableOptions`). `placeholder` is the box's hint text. It
|
|
1688
|
+
* posts what a multiselect posts. Default false.
|
|
1689
|
+
*/
|
|
1690
|
+
searchable: z.boolean().optional(),
|
|
1683
1691
|
required: z.boolean().default(false),
|
|
1684
1692
|
placeholder: z.string().max(120).optional(),
|
|
1685
1693
|
/** Shown under the field. */
|
|
@@ -1851,6 +1859,13 @@ const leafNodeSchema = z.discriminatedUnion('type', [
|
|
|
1851
1859
|
message: 'values is for multiselect and list fields',
|
|
1852
1860
|
});
|
|
1853
1861
|
}
|
|
1862
|
+
if (field.searchable !== undefined && field.kind !== 'multiselect') {
|
|
1863
|
+
ctx.addIssue({
|
|
1864
|
+
code: 'custom',
|
|
1865
|
+
path: at('searchable'),
|
|
1866
|
+
message: 'searchable is for multiselect fields',
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1854
1869
|
if (field.checked !== undefined && field.kind !== 'checkbox') {
|
|
1855
1870
|
ctx.addIssue({
|
|
1856
1871
|
code: 'custom',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keemakr/ui-sdk",
|
|
3
|
-
"version": "1.6.0-dev-
|
|
3
|
+
"version": "1.6.0-dev-20261027220914",
|
|
4
4
|
"description": "Product screens for keemakr marketplace modules: a versioned, server-driven UI tree schema plus defineScreen() handlers. Module code never ships to the browser — keemakr-core validates the tree and renders it with platform components.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|