@molecule/app-search-ui-solid 0.0.0-stage → 1.1.0
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 +202 -0
- package/README.md +425 -2
- package/dist/Highlight.d.ts +17 -0
- package/dist/Highlight.d.ts.map +1 -0
- package/dist/Highlight.jsx +22 -0
- package/dist/Highlight.jsx.map +1 -0
- package/dist/Kbd.d.ts +17 -0
- package/dist/Kbd.d.ts.map +1 -0
- package/dist/Kbd.jsx +21 -0
- package/dist/Kbd.jsx.map +1 -0
- package/dist/QuickSearchDialog.d.ts +22 -0
- package/dist/QuickSearchDialog.d.ts.map +1 -0
- package/dist/QuickSearchDialog.jsx +68 -0
- package/dist/QuickSearchDialog.jsx.map +1 -0
- package/dist/SearchBox.d.ts +19 -0
- package/dist/SearchBox.d.ts.map +1 -0
- package/dist/SearchBox.jsx +168 -0
- package/dist/SearchBox.jsx.map +1 -0
- package/dist/SearchResults.d.ts +27 -0
- package/dist/SearchResults.d.ts.map +1 -0
- package/dist/SearchResults.jsx +177 -0
- package/dist/SearchResults.jsx.map +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +162 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -4
package/dist/Kbd.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid key cap — the counterpart of `@molecule/app-search-ui-react`'s `Kbd`.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { JSX } from 'solid-js';
|
|
7
|
+
import type { KbdProps } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* A key cap, for shortcut hints (`/` to focus, `↵` to open). The cap shows a
|
|
10
|
+
* key name, not prose (a physical key such as `esc` reads the same in every
|
|
11
|
+
* language), so it carries HTML's own `translate="no"`.
|
|
12
|
+
*
|
|
13
|
+
* @param props - See {@link KbdProps}.
|
|
14
|
+
* @returns A `<kbd>` styled by the ClassMap.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Kbd: (props: KbdProps) => JSX.Element;
|
|
17
|
+
//# sourceMappingURL=Kbd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kbd.d.ts","sourceRoot":"","sources":["../src/Kbd.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,GAAI,OAAO,QAAQ,KAAG,GAAG,CAAC,OAOzC,CAAA"}
|
package/dist/Kbd.jsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid key cap — the counterpart of `@molecule/app-search-ui-react`'s `Kbd`.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
7
|
+
/**
|
|
8
|
+
* A key cap, for shortcut hints (`/` to focus, `↵` to open). The cap shows a
|
|
9
|
+
* key name, not prose (a physical key such as `esc` reads the same in every
|
|
10
|
+
* language), so it carries HTML's own `translate="no"`.
|
|
11
|
+
*
|
|
12
|
+
* @param props - See {@link KbdProps}.
|
|
13
|
+
* @returns A `<kbd>` styled by the ClassMap.
|
|
14
|
+
*/
|
|
15
|
+
export const Kbd = (props) => {
|
|
16
|
+
const cm = getClassMap();
|
|
17
|
+
return (<kbd class={cm.cn(cm.kbd, props.className)} translate="no">
|
|
18
|
+
{props.children}
|
|
19
|
+
</kbd>);
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=Kbd.jsx.map
|
package/dist/Kbd.jsx.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kbd.jsx","sourceRoot":"","sources":["../src/Kbd.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAAe,EAAe,EAAE;IAClD,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CACxD;MAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid quick-search dialog — the counterpart of
|
|
3
|
+
* `@molecule/app-search-ui-react`'s `QuickSearchDialog`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { type JSX } from 'solid-js';
|
|
8
|
+
import type { ClientSearchDocument } from '@molecule/app-client-search';
|
|
9
|
+
import type { QuickSearchDialogProps } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* A search dialog for `mod+k`: the box on top with focus, the hits below in
|
|
12
|
+
* a scrolling pane, and the key hints in the footer. Before anything is
|
|
13
|
+
* typed the pane shows `idleText` rather than a browse list. Enter opens the active
|
|
14
|
+
* hit through the session (which closes the dialog by the caller's `onOpen`).
|
|
15
|
+
* The dialog is named for screen readers through `label` (or the translated
|
|
16
|
+
* "Search" default).
|
|
17
|
+
*
|
|
18
|
+
* @param props - See {@link QuickSearchDialogProps}.
|
|
19
|
+
* @returns The dialog, or nothing while closed.
|
|
20
|
+
*/
|
|
21
|
+
export declare const QuickSearchDialog: <T extends ClientSearchDocument>(props: QuickSearchDialogProps<T>) => JSX.Element;
|
|
22
|
+
//# sourceMappingURL=QuickSearchDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickSearchDialog.d.ts","sourceRoot":"","sources":["../src/QuickSearchDialog.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA+B,KAAK,GAAG,EAAQ,MAAM,UAAU,CAAA;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAQvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAqBxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,oBAAoB,EAC9D,OAAO,sBAAsB,CAAC,CAAC,CAAC,KAC/B,GAAG,CAAC,OA+DN,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid quick-search dialog — the counterpart of
|
|
3
|
+
* `@molecule/app-search-ui-react`'s `QuickSearchDialog`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { createEffect, Show } from 'solid-js';
|
|
8
|
+
import { useTranslation } from '@molecule/app-solid';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import { Modal } from '@molecule/app-ui-solid';
|
|
11
|
+
import { Kbd } from './Kbd.jsx';
|
|
12
|
+
import { SearchBox } from './SearchBox.jsx';
|
|
13
|
+
import { SearchResults } from './SearchResults.jsx';
|
|
14
|
+
/**
|
|
15
|
+
* Whether a session field is an accessor (what a `useSearchSession` result
|
|
16
|
+
* holds) rather than a plain value.
|
|
17
|
+
*
|
|
18
|
+
* @param value - The session field.
|
|
19
|
+
* @returns True for an accessor.
|
|
20
|
+
*/
|
|
21
|
+
const isAccessor = (value) => typeof value === 'function';
|
|
22
|
+
/**
|
|
23
|
+
* Reads a session field, calling an accessor and passing a plain value
|
|
24
|
+
* through, so the dialog takes a session from `useSearchSession` or a plain
|
|
25
|
+
* object alike.
|
|
26
|
+
*
|
|
27
|
+
* @param value - The session field.
|
|
28
|
+
* @returns The value.
|
|
29
|
+
*/
|
|
30
|
+
const read = (value) => (isAccessor(value) ? value() : value);
|
|
31
|
+
/**
|
|
32
|
+
* A search dialog for `mod+k`: the box on top with focus, the hits below in
|
|
33
|
+
* a scrolling pane, and the key hints in the footer. Before anything is
|
|
34
|
+
* typed the pane shows `idleText` rather than a browse list. Enter opens the active
|
|
35
|
+
* hit through the session (which closes the dialog by the caller's `onOpen`).
|
|
36
|
+
* The dialog is named for screen readers through `label` (or the translated
|
|
37
|
+
* "Search" default).
|
|
38
|
+
*
|
|
39
|
+
* @param props - See {@link QuickSearchDialogProps}.
|
|
40
|
+
* @returns The dialog, or nothing while closed.
|
|
41
|
+
*/
|
|
42
|
+
export const QuickSearchDialog = (props) => {
|
|
43
|
+
const cm = getClassMap();
|
|
44
|
+
const { t } = useTranslation();
|
|
45
|
+
// React's default parameter: the ids carry the `quick-search` prefix unless overridden.
|
|
46
|
+
const molId = () => props.molId ?? 'quick-search';
|
|
47
|
+
// The dialog pattern: focus moves into the field when it opens. The input
|
|
48
|
+
// is mounted only while open, and the effect runs after the field exists.
|
|
49
|
+
createEffect(() => {
|
|
50
|
+
if (props.open)
|
|
51
|
+
props.session.inputRef.current?.focus();
|
|
52
|
+
});
|
|
53
|
+
return (<Show when={props.open}>
|
|
54
|
+
<Modal open={props.open} onClose={props.onClose} size="lg" closeOnEscape={false} showCloseButton={false} closeLabel={t('searchUi.close', undefined, { defaultValue: 'Close' })} aria-label={props.label ?? t('searchUi.dialogLabel', undefined, { defaultValue: 'Search' })} data-mol-id={molId()}>
|
|
55
|
+
<SearchBox value={read(props.session.query)} onChange={(value) => props.session.setQuery(value)} onKeyDown={(event) => props.session.onKeyDown(event)} inputRef={props.session.inputRef} placeholder={props.placeholder} count={read(props.session.active) ? read(props.session.hits).length : undefined} filters={read(props.session.parsed).filters} onRemoveFilter={(index) => props.session.removeFilter(index)} onClear={() => props.session.clear()} examples={props.examples} shortcut={null} molId={molId()}/>
|
|
56
|
+
<div class={cm.dialogBody} data-mol-id={`${molId()}-pane`}>
|
|
57
|
+
<SearchResults hits={read(props.session.active) ? read(props.session.hits) : []} view={props.view} activeIndex={read(props.session.activeIndex)} onActivate={(index) => props.session.setActiveIndex(index)} onOpen={(doc) => props.session.open(doc)} onPrefetch={(doc) => props.session.prefetch(doc)} renderLink={props.renderLink} emptyText={read(props.session.active) ? props.emptyText : (props.idleText ?? props.emptyText)} molId={molId()}/>
|
|
58
|
+
</div>
|
|
59
|
+
<p class={cm.cn(cm.dialogFooter, cm.resultMeta)} data-mol-id={`${molId()}-keys`}>
|
|
60
|
+
<Kbd>↑</Kbd> <Kbd>↓</Kbd> <Kbd>↵</Kbd> <Kbd>esc</Kbd>{' '}
|
|
61
|
+
{t('searchUi.dialogKeys', undefined, {
|
|
62
|
+
defaultValue: 'The arrow keys move through the results, Enter opens one, Escape closes.',
|
|
63
|
+
})}
|
|
64
|
+
</p>
|
|
65
|
+
</Modal>
|
|
66
|
+
</Show>);
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=QuickSearchDialog.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickSearchDialog.jsx","sourceRoot":"","sources":["../src/QuickSearchDialog.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAiB,YAAY,EAAY,IAAI,EAAE,MAAM,UAAU,CAAA;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,E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AC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAE,CAAA,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAE,CAAA,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,CACzD;UAAA,CAAC,CAAC,CAAC,qBAAqB,EAAE,SAAS,EAAE;YACnC,YAAY,EACV,0EAA0E;SAC7E,CAAC,CACJ;QAAA,EAAE,CAAC,CACL;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid search field — the counterpart of `@molecule/app-search-ui-react`'s
|
|
3
|
+
* `SearchBox`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { type JSX } from 'solid-js';
|
|
8
|
+
import type { SearchBoxProps } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* A search field: a leading icon, the input, a help icon that shows the
|
|
11
|
+
* syntax on hover, an × to clear, and the shortcut cap; under it, whatever
|
|
12
|
+
* `afterField` holds, then the active filters as removable chips and the
|
|
13
|
+
* hit count. The field stays mounted, and its text with it, across searches.
|
|
14
|
+
*
|
|
15
|
+
* @param props - See {@link SearchBoxProps}.
|
|
16
|
+
* @returns The field and its status row.
|
|
17
|
+
*/
|
|
18
|
+
export declare const SearchBox: (props: SearchBoxProps) => JSX.Element;
|
|
19
|
+
//# sourceMappingURL=SearchBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchBox.d.ts","sourceRoot":"","sources":["../src/SearchBox.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAmC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AASpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAOhD;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,KAAG,GAAG,CAAC,OA+MrD,CAAA"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid search field — the counterpart of `@molecule/app-search-ui-react`'s
|
|
3
|
+
* `SearchBox`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { createEffect, createSignal, For } from 'solid-js';
|
|
8
|
+
import { unwrap } from 'solid-js/store';
|
|
9
|
+
import { useTranslation } from '@molecule/app-solid';
|
|
10
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
11
|
+
import { Icon, Tooltip } from '@molecule/app-ui-solid';
|
|
12
|
+
import { Kbd } from './Kbd.jsx';
|
|
13
|
+
/**
|
|
14
|
+
* A search field: a leading icon, the input, a help icon that shows the
|
|
15
|
+
* syntax on hover, an × to clear, and the shortcut cap; under it, whatever
|
|
16
|
+
* `afterField` holds, then the active filters as removable chips and the
|
|
17
|
+
* hit count. The field stays mounted, and its text with it, across searches.
|
|
18
|
+
*
|
|
19
|
+
* @param props - See {@link SearchBoxProps}.
|
|
20
|
+
* @returns The field and its status row.
|
|
21
|
+
*/
|
|
22
|
+
export const SearchBox = (props) => {
|
|
23
|
+
const cm = getClassMap();
|
|
24
|
+
const { t } = useTranslation();
|
|
25
|
+
const [focused, setFocused] = createSignal(false);
|
|
26
|
+
// React's default parameters: the cap shows `/` unless hidden, and the ids
|
|
27
|
+
// carry the `search` prefix unless overridden.
|
|
28
|
+
const shortcut = () => (props.shortcut === undefined ? '/' : props.shortcut);
|
|
29
|
+
const molId = () => props.molId ?? 'search';
|
|
30
|
+
// Focus the input on mount and whenever the ask (or the ref) changes, the
|
|
31
|
+
// way React's effect keyed on `autoFocus` and `inputRef` does.
|
|
32
|
+
createEffect(() => {
|
|
33
|
+
if (props.autoFocus)
|
|
34
|
+
props.inputRef?.current?.focus();
|
|
35
|
+
});
|
|
36
|
+
/** The input element, held so the value sync and the clear button can reach it. */
|
|
37
|
+
let inputEl = null;
|
|
38
|
+
/**
|
|
39
|
+
* Assigns the input element into `inputRef`, as React's `ref` does, and
|
|
40
|
+
* clears it when the field unmounts. Written through the raw object, since
|
|
41
|
+
* a reactive props holder proxies the caller's ref and refuses direct
|
|
42
|
+
* mutation.
|
|
43
|
+
*
|
|
44
|
+
* @param el - The input element, or `null` as it unmounts.
|
|
45
|
+
*/
|
|
46
|
+
const inputRefFn = (el) => {
|
|
47
|
+
inputEl = el;
|
|
48
|
+
const ref = props.inputRef;
|
|
49
|
+
if (ref)
|
|
50
|
+
unwrap(ref).current = el;
|
|
51
|
+
};
|
|
52
|
+
// React keeps a controlled input's content attribute and API value in sync
|
|
53
|
+
// with the rendered value; Solid's `value` writes only the API value, so
|
|
54
|
+
// the attribute is set beside it on mount and on every change.
|
|
55
|
+
createEffect(() => {
|
|
56
|
+
const value = props.value;
|
|
57
|
+
if (inputEl) {
|
|
58
|
+
inputEl.setAttribute('value', value);
|
|
59
|
+
inputEl.value = value;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Reports the typed text, then restores the field to the value the props
|
|
64
|
+
* still hold, the way React's controlled input renders it back when the
|
|
65
|
+
* caller keeps the old one.
|
|
66
|
+
*
|
|
67
|
+
* @param event - The input event.
|
|
68
|
+
*/
|
|
69
|
+
const onInput = (event) => {
|
|
70
|
+
const el = event.currentTarget;
|
|
71
|
+
props.onChange(el.value);
|
|
72
|
+
el.value = props.value;
|
|
73
|
+
el.setAttribute('value', props.value);
|
|
74
|
+
};
|
|
75
|
+
/** Clears the text and puts focus back in the field, as React's button does. */
|
|
76
|
+
const onClearClick = () => {
|
|
77
|
+
props.onClear?.();
|
|
78
|
+
props.inputRef?.current?.focus();
|
|
79
|
+
};
|
|
80
|
+
/** One stable record per chip key, so a re-passed or reordered array keeps the rendered chips per key. */
|
|
81
|
+
const chipRecords = new Map();
|
|
82
|
+
const keyedChips = () => {
|
|
83
|
+
const seen = new Set();
|
|
84
|
+
const chips = filters().map((f, i) => {
|
|
85
|
+
const key = `${f.field}:${f.values.join(',')}:${i}`;
|
|
86
|
+
seen.add(key);
|
|
87
|
+
let chip = chipRecords.get(key);
|
|
88
|
+
if (!chip) {
|
|
89
|
+
chip = { key };
|
|
90
|
+
chipRecords.set(key, chip);
|
|
91
|
+
}
|
|
92
|
+
return chip;
|
|
93
|
+
});
|
|
94
|
+
for (const key of [...chipRecords.keys()])
|
|
95
|
+
if (!seen.has(key))
|
|
96
|
+
chipRecords.delete(key);
|
|
97
|
+
return chips;
|
|
98
|
+
};
|
|
99
|
+
const showCount = () => props.count !== undefined && props.value.trim().length > 0;
|
|
100
|
+
const showHelp = () => Boolean(props.examples?.length);
|
|
101
|
+
const filters = () => props.filters ?? [];
|
|
102
|
+
/** The hit count text, or null while the text is blank or no count was given. */
|
|
103
|
+
const countText = () => {
|
|
104
|
+
const count = props.count;
|
|
105
|
+
if (count === undefined || props.value.trim().length === 0)
|
|
106
|
+
return null;
|
|
107
|
+
return t('searchUi.count', { count }, { defaultValue: '{{count}} results' });
|
|
108
|
+
};
|
|
109
|
+
return (<div data-mol-id={`${molId()}-box`}>
|
|
110
|
+
<div class={cm.cn(cm.searchField, props.className)}>
|
|
111
|
+
<span class={cm.searchFieldIcon} aria-hidden="true">
|
|
112
|
+
<Icon name="search" size={18}/>
|
|
113
|
+
</span>
|
|
114
|
+
<input ref={inputRefFn} type="search" onInput={onInput} onKeyDown={(event) => props.onKeyDown?.(event)} onFocusIn={() => setFocused(true)} onFocusOut={() => setFocused(false)} placeholder={props.placeholder} aria-label={props.label ?? props.placeholder} autocomplete="off" autocorrect="off" spellcheck="false" enterkeyhint="search" class={cm.searchFieldInput} data-mol-id={`${molId()}-input`}/>
|
|
115
|
+
<span class={cm.searchFieldActions}>
|
|
116
|
+
{showHelp() ? (
|
|
117
|
+
// The tooltip's content class keeps short labels on one line; the tips
|
|
118
|
+
// are a sentence or two, so the inner block wraps on its own.
|
|
119
|
+
<Tooltip content={<div class={cm.searchTips} style={{ 'white-space': 'normal', 'max-width': '360px' }}>
|
|
120
|
+
{t('searchUi.syntax', undefined, {
|
|
121
|
+
defaultValue: 'Narrow with a field, quote a phrase, or exclude a word:',
|
|
122
|
+
})}{' '}
|
|
123
|
+
{[
|
|
124
|
+
...(props.examples ?? []),
|
|
125
|
+
t('searchUi.examplePhrase', undefined, { defaultValue: '"exact phrase"' }),
|
|
126
|
+
t('searchUi.exampleExcluded', undefined, { defaultValue: '-word' }),
|
|
127
|
+
].map((ex, i) => (<span>
|
|
128
|
+
{i > 0 ? ' · ' : ''}
|
|
129
|
+
<code>{ex}</code>
|
|
130
|
+
</span>))}{' '}
|
|
131
|
+
{' · '}
|
|
132
|
+
<Kbd>↑</Kbd> <Kbd>↓</Kbd> <Kbd>↵</Kbd>{' '}
|
|
133
|
+
{t('searchUi.keys', undefined, {
|
|
134
|
+
defaultValue: 'The arrow keys move through the results and Enter opens one.',
|
|
135
|
+
})}
|
|
136
|
+
</div>} placement="bottom-end">
|
|
137
|
+
<button type="button" aria-label={t('searchUi.help', undefined, { defaultValue: 'Search tips' })} class={cm.searchFieldClear} data-mol-id={`${molId()}-help`}>
|
|
138
|
+
<Icon name="question" size={16}/>
|
|
139
|
+
</button>
|
|
140
|
+
</Tooltip>) : null}
|
|
141
|
+
{props.value && props.onClear ? (<button type="button" onClick={onClearClick} aria-label={t('searchUi.clear', undefined, { defaultValue: 'Clear search' })} class={cm.searchFieldClear} data-mol-id={`${molId()}-clear`}>
|
|
142
|
+
<span aria-hidden="true">×</span>
|
|
143
|
+
</button>) : null}
|
|
144
|
+
{shortcut() && !props.value && !focused() ? <Kbd>{shortcut()}</Kbd> : null}
|
|
145
|
+
</span>
|
|
146
|
+
</div>
|
|
147
|
+
{props.afterField}
|
|
148
|
+
{filters().length > 0 || showCount() ? (<div class={cm.searchStatusRow}>
|
|
149
|
+
<For each={keyedChips()}>
|
|
150
|
+
{(_chip, i) => {
|
|
151
|
+
const f = () => filters()[i()];
|
|
152
|
+
const text = () => `${f().negate ? '−' : ''}${f().field}: ${f().values.join(', ')}`;
|
|
153
|
+
return (<button type="button" onClick={() => props.onRemoveFilter?.(i())} aria-label={t('searchUi.removeFilter', { filter: text() }, {
|
|
154
|
+
defaultValue: 'Remove filter {{filter}}',
|
|
155
|
+
})} class={cm.cn(cm.filterChip, f().negate && cm.filterChipNegated)} data-mol-id={`${molId()}-filter`} data-filter-field={f().field}>
|
|
156
|
+
{text()}
|
|
157
|
+
<span class={cm.filterChipRemove} aria-hidden="true">
|
|
158
|
+
×
|
|
159
|
+
</span>
|
|
160
|
+
</button>);
|
|
161
|
+
}}
|
|
162
|
+
</For>
|
|
163
|
+
<span class={cm.mxAuto}/>
|
|
164
|
+
{countText() ? <span data-mol-id={`${molId()}-count`}>{countText()}</span> : null}
|
|
165
|
+
</div>) : null}
|
|
166
|
+
</div>);
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=SearchBox.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchBox.jsx","sourceRoot":"","sources":["../src/SearchBox.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,EAAY,MAAM,UAAU,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAQ/B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAe,EAAE;IAC9D,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,C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app-search-ui-react`'s `SearchResults`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { type JSX } from 'solid-js';
|
|
8
|
+
import type { SearchResultsProps } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* The ranked hits: title and description with the matched terms marked, the
|
|
11
|
+
* meta line, hover making a row active and warming its page. The whole row is
|
|
12
|
+
* the link, so the list is a plain list of links (no listbox roles: an
|
|
13
|
+
* option's children are presentational and would hide the row's link and
|
|
14
|
+
* action); the active row is marked with `aria-current` on its `<li>` and
|
|
15
|
+
* announced through a polite, visually hidden status region after the list.
|
|
16
|
+
*
|
|
17
|
+
* React keys each row by the hit's `id` value, so a re-passed or re-ordered
|
|
18
|
+
* array keeps the rendered rows per id. Solid's `For` keys by reference, so
|
|
19
|
+
* the rows are keyed through stable per-id records: the record for an id is
|
|
20
|
+
* created once and reused, while the row's content reads the CURRENT hit for
|
|
21
|
+
* that id reactively.
|
|
22
|
+
*
|
|
23
|
+
* @param props - See {@link SearchResultsProps}.
|
|
24
|
+
* @returns The list, or the empty state.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SearchResults: <T>(props: SearchResultsProps<T>) => JSX.Element;
|
|
27
|
+
//# sourceMappingURL=SearchResults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../src/SearchResults.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,GAAG,EAAQ,MAAM,UAAU,CAAA;AAM5D,OAAO,KAAK,EAA0C,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAuB5F;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAG,OAAO,kBAAkB,CAAC,CAAC,CAAC,KAAG,GAAG,CAAC,OAwLpE,CAAA"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid ranked search results — the counterpart of
|
|
3
|
+
* `@molecule/app-search-ui-react`'s `SearchResults`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { createEffect, For, Show } from 'solid-js';
|
|
8
|
+
import { useTranslation } from '@molecule/app-solid';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import { Highlight } from './Highlight.jsx';
|
|
11
|
+
/**
|
|
12
|
+
* The default row link: a plain anchor. Apps pass a router link instead; the
|
|
13
|
+
* opaque `state` is theirs to consume and never reaches the DOM.
|
|
14
|
+
*
|
|
15
|
+
* @param linkProps - The link props.
|
|
16
|
+
* @returns The anchor.
|
|
17
|
+
*/
|
|
18
|
+
const defaultLink = (linkProps) => {
|
|
19
|
+
const { state: _state, children, className, ...rest } = linkProps;
|
|
20
|
+
return (<a {...rest} class={className}>
|
|
21
|
+
{children}
|
|
22
|
+
</a>);
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The ranked hits: title and description with the matched terms marked, the
|
|
26
|
+
* meta line, hover making a row active and warming its page. The whole row is
|
|
27
|
+
* the link, so the list is a plain list of links (no listbox roles: an
|
|
28
|
+
* option's children are presentational and would hide the row's link and
|
|
29
|
+
* action); the active row is marked with `aria-current` on its `<li>` and
|
|
30
|
+
* announced through a polite, visually hidden status region after the list.
|
|
31
|
+
*
|
|
32
|
+
* React keys each row by the hit's `id` value, so a re-passed or re-ordered
|
|
33
|
+
* array keeps the rendered rows per id. Solid's `For` keys by reference, so
|
|
34
|
+
* the rows are keyed through stable per-id records: the record for an id is
|
|
35
|
+
* created once and reused, while the row's content reads the CURRENT hit for
|
|
36
|
+
* that id reactively.
|
|
37
|
+
*
|
|
38
|
+
* @param props - See {@link SearchResultsProps}.
|
|
39
|
+
* @returns The list, or the empty state.
|
|
40
|
+
*/
|
|
41
|
+
export const SearchResults = (props) => {
|
|
42
|
+
const cm = getClassMap();
|
|
43
|
+
const { t } = useTranslation();
|
|
44
|
+
// React's default parameter: the ids carry the `search` prefix unless overridden.
|
|
45
|
+
const molId = () => props.molId ?? 'search';
|
|
46
|
+
let listRef;
|
|
47
|
+
/**
|
|
48
|
+
* Assigns the list element, as React's `ref` does.
|
|
49
|
+
*
|
|
50
|
+
* @param el - The list element.
|
|
51
|
+
*/
|
|
52
|
+
const listRefFn = (el) => {
|
|
53
|
+
listRef = el;
|
|
54
|
+
};
|
|
55
|
+
// Keep the keyboard-active row in view.
|
|
56
|
+
createEffect(() => {
|
|
57
|
+
const index = props.activeIndex;
|
|
58
|
+
if (index < 0)
|
|
59
|
+
return;
|
|
60
|
+
const el = listRef?.querySelector(`[data-index="${index}"]`);
|
|
61
|
+
el?.scrollIntoView?.({ block: 'nearest' });
|
|
62
|
+
});
|
|
63
|
+
const records = new Map();
|
|
64
|
+
const keyedHits = () => {
|
|
65
|
+
const seen = new Set();
|
|
66
|
+
const rows = props.hits.map((hit) => {
|
|
67
|
+
seen.add(hit.id);
|
|
68
|
+
let row = records.get(hit.id);
|
|
69
|
+
if (!row) {
|
|
70
|
+
row = { id: hit.id };
|
|
71
|
+
records.set(hit.id, row);
|
|
72
|
+
}
|
|
73
|
+
return row;
|
|
74
|
+
});
|
|
75
|
+
for (const id of [...records.keys()])
|
|
76
|
+
if (!seen.has(id))
|
|
77
|
+
records.delete(id);
|
|
78
|
+
return rows;
|
|
79
|
+
};
|
|
80
|
+
const hitFor = (id) => props.hits.find((hit) => hit.id === id);
|
|
81
|
+
/**
|
|
82
|
+
* The active row's announcement; empty when no row is keyboard-active.
|
|
83
|
+
*
|
|
84
|
+
* @returns The status text.
|
|
85
|
+
*/
|
|
86
|
+
const activeText = () => {
|
|
87
|
+
const hit = props.activeIndex >= 0 ? props.hits[props.activeIndex] : undefined;
|
|
88
|
+
if (!hit)
|
|
89
|
+
return '';
|
|
90
|
+
return t('searchUi.activeResult', {
|
|
91
|
+
title: props.view(hit.doc).title,
|
|
92
|
+
position: props.activeIndex + 1,
|
|
93
|
+
count: props.hits.length,
|
|
94
|
+
}, { defaultValue: '{{title}}, {{position}} of {{count}}' });
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Builds the row body the link carries: the title and meta line, then the
|
|
98
|
+
* description, with the matched terms marked.
|
|
99
|
+
*
|
|
100
|
+
* @param hit - The hit.
|
|
101
|
+
* @param v - The hit's view.
|
|
102
|
+
* @returns The body.
|
|
103
|
+
*/
|
|
104
|
+
const bodyOf = (hit, v) => {
|
|
105
|
+
const meta = [...(v.meta ?? [])];
|
|
106
|
+
return (<>
|
|
107
|
+
<span class={cm.flex({ align: 'baseline', wrap: 'wrap', gap: 2 })}>
|
|
108
|
+
<span class={cm.cn(cm.resultTitle, v.mono && cm.resultTitleMono)}>
|
|
109
|
+
<Highlight text={v.title} terms={hit.terms}/>
|
|
110
|
+
</span>
|
|
111
|
+
{meta.length ? <span class={cm.resultMeta}>{meta.join(' · ')}</span> : null}
|
|
112
|
+
{hit.related ? (<span class={cm.resultMeta} data-mol-id={`${molId()}-related`} title={t('searchUi.relatedTitle', undefined, {
|
|
113
|
+
defaultValue: 'Matches the meaning of your search, not its words',
|
|
114
|
+
})}>
|
|
115
|
+
{t('searchUi.related', undefined, { defaultValue: 'related' })}
|
|
116
|
+
</span>) : null}
|
|
117
|
+
</span>
|
|
118
|
+
{v.description ? (<span class={cm.cn(cm.resultDescription, cm.displayBlock)}>
|
|
119
|
+
<Highlight text={v.description} terms={hit.terms}/>
|
|
120
|
+
</span>) : null}
|
|
121
|
+
</>);
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Builds the link props one row's link gets, closing over the hit so a
|
|
125
|
+
* plain click opens it.
|
|
126
|
+
*
|
|
127
|
+
* @param hit - The hit.
|
|
128
|
+
* @param v - The hit's view.
|
|
129
|
+
* @returns The link props.
|
|
130
|
+
*/
|
|
131
|
+
const linkPropsOf = (hit, v) => ({
|
|
132
|
+
href: v.href,
|
|
133
|
+
state: v.state,
|
|
134
|
+
className: cm.resultBody,
|
|
135
|
+
'data-mol-id': `${molId()}-link`,
|
|
136
|
+
children: bodyOf(hit, v),
|
|
137
|
+
onClick: (event) => {
|
|
138
|
+
// A modified click opens a new tab; the router handles the rest.
|
|
139
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0)
|
|
140
|
+
return;
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
props.onOpen(hit.doc);
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
return (<Show when={props.hits.length === 0} fallback={<>
|
|
146
|
+
<ul ref={listRefFn} aria-label={t('searchUi.results', undefined, { defaultValue: 'Search results' })} class={cm.cn(cm.resultList, props.className)} data-mol-id={`${molId()}-results`}>
|
|
147
|
+
<For each={keyedHits()}>
|
|
148
|
+
{(row) => {
|
|
149
|
+
const index = () => props.hits.findIndex((h) => h.id === row.id);
|
|
150
|
+
const hit = () => hitFor(row.id);
|
|
151
|
+
const v = () => props.view(hit().doc);
|
|
152
|
+
return (<li aria-current={index() === props.activeIndex ? 'true' : undefined} data-index={index()} data-mol-id={`${molId()}-hit`} data-hit-id={row.id} class={cm.cn(cm.resultItem, index() === props.activeIndex && cm.resultItemActive)} onPointerOver={() => {
|
|
153
|
+
props.onActivate?.(index());
|
|
154
|
+
props.onPrefetch?.(hit().doc);
|
|
155
|
+
}} onFocusIn={() => props.onPrefetch?.(hit().doc)} onTouchStart={() => props.onPrefetch?.(hit().doc)}>
|
|
156
|
+
{props.renderLink
|
|
157
|
+
? props.renderLink(linkPropsOf(hit(), v()))
|
|
158
|
+
: defaultLink(linkPropsOf(hit(), v()))}
|
|
159
|
+
{props.action ? (<span class={cm.resultAction}>{props.action(hit().doc)}</span>) : null}
|
|
160
|
+
</li>);
|
|
161
|
+
}}
|
|
162
|
+
</For>
|
|
163
|
+
</ul>
|
|
164
|
+
<p role="status" class={cm.srOnly} data-mol-id={`${molId()}-active`}>
|
|
165
|
+
{activeText()}
|
|
166
|
+
</p>
|
|
167
|
+
</>}>
|
|
168
|
+
<>
|
|
169
|
+
<p class={cm.resultEmpty} data-mol-id={`${molId()}-empty`}>
|
|
170
|
+
{props.emptyText}
|
|
171
|
+
</p>
|
|
172
|
+
{/* The status region exists before results arrive, so it is live. */}
|
|
173
|
+
<p role="status" class={cm.srOnly} data-mol-id={`${molId()}-active`}/>
|
|
174
|
+
</>
|
|
175
|
+
</Show>);
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=SearchResults.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchResults.jsx","sourceRoot":"","sources":["../src/SearchResults.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,GAAG,EAAY,IAAI,EAAE,MAAM,UAAU,CAAA;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,SAAgC,EAAe,EAAE;IACpE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,CAAA;IACjE,OAAO,CACL,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAC5B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,CAAC,CAAC,CACL,CAAA;AACH,CAAC,CAAA;AAOD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAK,KAA4B,EAAe,EAAE;IAC7E,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,kFAAkF;IAClF,MAAM,KAAK,GAAG,GAAW,EAAE,CAAC,KAAK,CAAC,KAAK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