@moyarich/console-addon-search 0.0.0-stage → 0.2.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/README.md CHANGED
@@ -1,3 +1,39 @@
1
- # Temporary Holding Version
1
+ # @moyarich/console-addon-search
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Search and highlight output. Find text matches, move between occurrences, and use optional controls and an observable controller.
4
+
5
+ [Documentation and live examples](https://moyarich.github.io/console/)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @moyarich/console @moyarich/console-addon-search react
11
+ ```
12
+
13
+ Configure the `@moyarich` scope and authenticate with GitHub Packages as described in the [installation guide](../../../README.md#installation).
14
+
15
+ Required peer dependencies: `@moyarich/console-core@^0.2.0`, `react@>=18`.
16
+
17
+ ## Quick start
18
+
19
+ ```tsx
20
+ import { Console } from "@moyarich/console";
21
+ import { createConsoleSearchAddon } from "@moyarich/console-addon-search";
22
+
23
+ const addons = [createConsoleSearchAddon()];
24
+
25
+ // Pass your application's structured messages to Console.
26
+ <Console messages={messages} addons={addons} />;
27
+ ```
28
+
29
+ The addon is optional and can be combined with other Console addons. The host application remains responsible for supplying and retaining messages.
30
+
31
+ ## Learn more
32
+
33
+ Explore [runnable package examples](./examples) and the [Console documentation](https://moyarich.github.io/console/) for available settings and integration patterns.
34
+
35
+ Review the [changelog](./CHANGELOG.md) for changes by version and [package metadata](./package.json) for dependency requirements.
36
+
37
+ ## License
38
+
39
+ MIT
@@ -0,0 +1,8 @@
1
+ import { type AddonTranslations } from "../../localization.cjs";
2
+ import type { ConsoleSearchController } from "../../index.cjs";
3
+
4
+ export declare function ConsoleSearchControls({ controller, locale, translations, }: {
5
+ controller: ConsoleSearchController;
6
+ locale?: string;
7
+ translations?: AddonTranslations;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { type AddonTranslations } from "../../localization.js";
2
+ import type { ConsoleSearchController } from "../../index.js";
3
+
4
+ export declare function ConsoleSearchControls({ controller, locale, translations, }: {
5
+ controller: ConsoleSearchController;
6
+ locale?: string;
7
+ translations?: AddonTranslations;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { ConsoleSearchController } from "../../index.cjs";
2
+
3
+ export declare function ConsoleSearchHighlight({ controller, index, }: {
4
+ controller: ConsoleSearchController;
5
+ index: number;
6
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import type { ConsoleSearchController } from "../../index.js";
2
+
3
+ export declare function ConsoleSearchHighlight({ controller, index, }: {
4
+ controller: ConsoleSearchController;
5
+ index: number;
6
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,166 @@
1
+ /* Public --console-search-* inputs resolve to private component-local tokens. */
2
+ .console-search-controls {
3
+ --_console-search-background-color: var(
4
+ --console-search-background-color,
5
+ var(--console-panel-background-color, transparent)
6
+ );
7
+ --_console-search-color: var(
8
+ --console-search-color,
9
+ var(--console-panel-color, light-dark(#27272a, #f4f4f5))
10
+ );
11
+ --_console-search-border-color: var(
12
+ --console-search-border-color,
13
+ color-mix(in srgb, var(--_console-search-color) 16%, transparent)
14
+ );
15
+ --_console-search-focus-color: var(--console-search-focus-color, #635bff);
16
+
17
+ box-sizing: border-box;
18
+ flex: 1 1 22rem;
19
+ min-width: 0;
20
+ display: grid;
21
+ gap: 8px;
22
+ padding: 12px;
23
+ background: var(--_console-search-background-color);
24
+ color: var(--_console-search-color);
25
+ font:
26
+ 400 12px/1.4 ui-sans-serif,
27
+ system-ui,
28
+ sans-serif;
29
+ }
30
+
31
+ .console-search-controls-row {
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 4px;
35
+ min-width: 0;
36
+ padding-inline-end: 4px;
37
+ border: 1px solid var(--_console-search-border-color);
38
+ border-radius: 8px;
39
+ background: color-mix(
40
+ in srgb,
41
+ var(--_console-search-color) 3%,
42
+ var(--_console-search-background-color)
43
+ );
44
+ }
45
+
46
+ .console-search-controls-field {
47
+ display: flex;
48
+ align-items: center;
49
+ gap: 8px;
50
+ flex: 1;
51
+ min-width: 0;
52
+ padding-inline-start: 10px;
53
+ }
54
+
55
+ .console-search-controls-field svg {
56
+ flex-shrink: 0;
57
+ opacity: 0.6;
58
+ }
59
+
60
+ .console-search-controls input[type="search"] {
61
+ box-sizing: border-box;
62
+ width: 100%;
63
+ min-width: 0;
64
+ border: 0;
65
+ padding: 9px 0;
66
+ background: transparent;
67
+ color: inherit;
68
+ font: inherit;
69
+ }
70
+
71
+ .console-search-controls input::placeholder {
72
+ color: inherit;
73
+ opacity: 0.55;
74
+ }
75
+
76
+ .console-search-controls-row:focus-within {
77
+ border-color: var(--_console-search-focus-color);
78
+ box-shadow: 0 0 0 2px
79
+ color-mix(in srgb, var(--_console-search-focus-color) 15%, transparent);
80
+ }
81
+
82
+ .console-search-controls-row [role="status"] {
83
+ max-width: 10rem;
84
+ font-size: 11px;
85
+ opacity: 0.65;
86
+ }
87
+
88
+ .console-search-controls button {
89
+ flex-shrink: 0;
90
+ width: 28px;
91
+ height: 28px;
92
+ padding: 0;
93
+ border: 0;
94
+ border-radius: 5px;
95
+ background: transparent;
96
+ color: inherit;
97
+ font: inherit;
98
+ font-size: 16px;
99
+ cursor: pointer;
100
+ }
101
+
102
+ .console-search-controls button:hover:not(:disabled) {
103
+ background: color-mix(in srgb, var(--_console-search-color) 9%, transparent);
104
+ }
105
+
106
+ .console-search-controls-options {
107
+ display: flex;
108
+ flex-wrap: wrap;
109
+ gap: 6px 14px;
110
+ }
111
+
112
+ .console-search-controls-options label {
113
+ display: inline-flex;
114
+ align-items: center;
115
+ gap: 5px;
116
+ cursor: pointer;
117
+ }
118
+
119
+ .console-search-controls input[type="checkbox"] {
120
+ margin: 0;
121
+ accent-color: var(--_console-search-focus-color);
122
+ }
123
+
124
+ .console-search-controls :focus-visible {
125
+ outline: 2px solid var(--_console-search-focus-color);
126
+ outline-offset: 2px;
127
+ }
128
+
129
+ .console-search-controls input[type="search"]:focus-visible {
130
+ outline: none;
131
+ }
132
+
133
+ .console-search-controls button:disabled {
134
+ opacity: 0.3;
135
+ cursor: default;
136
+ }
137
+
138
+ .console-search-controls-error {
139
+ color: var(--console-error-color, light-dark(#b42318, #fda4af));
140
+ overflow-wrap: anywhere;
141
+ }
142
+ /* Search match colors can be themed independently from the Console panel. */
143
+ .console-search-highlight {
144
+ --_console-search-highlight-background-color: var(
145
+ --console-search-highlight-background-color,
146
+ light-dark(#ffdf70, #745b16)
147
+ );
148
+ --_console-search-highlight-color: var(
149
+ --console-search-highlight-color,
150
+ light-dark(#231c00, #fff7d6)
151
+ );
152
+ --_console-search-highlight-active-color: var(
153
+ --console-search-highlight-active-color,
154
+ var(--console-header-icon-color, currentColor)
155
+ );
156
+
157
+ background: var(--_console-search-highlight-background-color);
158
+ color: var(--_console-search-highlight-color);
159
+ border-radius: 2px;
160
+ padding: 0 0.2em;
161
+ }
162
+
163
+ .console-search-highlight[data-active] {
164
+ outline: 2px solid var(--_console-search-highlight-active-color);
165
+ outline-offset: 1px;
166
+ }