You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix inconsistent data attribute location for web component
For the most part 1.3.0, expected data attributes on the `<form>`
element, but this didn't work right for styling where we largely
swap selectors from `.tsmb-form` to `typesense-minibar`. This means
the following selector didn't work right in web component context:
```
.tsmb-form[data-group="true"] .tsmb-suggestion_title
typesense-minibar[data-group="true"] .tsmb-suggestion_title
```
Thinking about it some more, it seems more elegant to have these
on the custom element rather than on the form. So rather than fix
the bug by changing the styles, let's change the place where we
set the data attributes to match the style.
Also use this time to promote the web component by default in
documentation.
Copy file name to clipboardExpand all lines: API-Style.md
+93-60Lines changed: 93 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ This works best for making minor changes, such as changing the link and
12
12
highlight color, or creating a dark mode. Copy or import the [typesense-minibar.css](./typesense-minibar.css)
13
13
stylesheet, then override any of the below variables from your own stylesheet.
14
14
15
-
Note: Set variables on the `.tsmb-form` selector only. The variables are
15
+
Note: Set variables on the `.tsmb-form`or `typesense-minibar`selector only. The variables are
16
16
automatically picked up by the internal more specific selectors.
17
17
You don't have to write any custom CSS rules!
18
18
@@ -46,7 +46,19 @@ Primary colors, by default only used in the active layout:
46
46
*`--tsmb-color-primary50`: Medium contrast, for colorful links or buttons.
47
47
*`--tsmb-color-primary90`: Subtle contrast, for selection background.
48
48
49
-
Example:
49
+
Example (Web Component):
50
+
51
+
```css
52
+
/* Dark theme for inactive input field. */
53
+
typesense-minibar {
54
+
--tsmb-color-base-background: #691c69;
55
+
--tsmb-color-base30: #390f39;
56
+
--tsmb-color-base50: #c090c0;
57
+
--tsmb-color-base90: #c090c0;
58
+
}
59
+
```
60
+
61
+
Example (class):
50
62
51
63
```css
52
64
/* Dark theme for inactive input field. */
@@ -67,12 +79,12 @@ In that case, we recommend you target the documented selectors below.
67
79
| --- | :---
68
80
| `.tsmb-form--slash …` | Pressing a slash will activate this form. Use as basis for longer selectors.<br/><br/>This selector matches after the JavaScript code has run, unless configured with `data-slash=false`). This ensures you can safely use it to create a slash icon, and trust that it won't be displayed if JavaScript failed, was unsupported, or was disabled.<br><br>**Example**: `.tsmb-form--slash:not(:focus-within)::after { content: '/'; }`
69
81
| `.tsmb-form--open` | The form currently has an open result box.
70
-
| `.tsmb-form[data-group=true] …` | Override styled when using grouped results. Use as basis for longer selectors.
| `.tsmb-form [role=listbox]` | Dropdown menu, populated with either one or more search results, or `.tsmb-empty`. When the results are closed, this element is hidden by setting the native `hidden` attribute.
| `.tsmb-form [role=option] a` | Clickable portion of result (title + content). This covers the full search result, except when results are grouped, then the first result in a group additionally contains `.tsmb-suggestion_group` outside the clickable portion.
75
-
| `.tsmb-form [role=option] mark` | Matching characters or words, e.g. in the excerpt.
82
+
| `.tsmb-form[data-group=true] …`<br><br>`typesense-minibar[data-group=true] …` | Override styled when using grouped results. Use as basis for longer selectors.
| `.tsmb-form [role=listbox]`<br><br>`typesense-minibar [role=listbox]` | Dropdown menu, populated with either one or more search results, or `.tsmb-empty`. When the results are closed, this element is hidden by setting the native `hidden` attribute.
| `.tsmb-form [role=option] a`<br><br>`typesense-minibar [role=option] a` | Clickable portion of result (title + content). This covers the full search result, except when results are grouped, then the first result in a group additionally contains `.tsmb-suggestion_group` outside the clickable portion.
87
+
| `.tsmb-form [role=option] mark`<br><br>`typesense-minibar [role=option] mark` | Matching characters or words, e.g. in the excerpt.
76
88
| `.tsmb-suggestion_group` | Group heading, may appear if the form is configured with `data-group=true`.
77
89
| `.tsmb-suggestion_title` | Page title and optionally heading breadcrumbs to the matching paragraph.
78
90
| `.tsmb-suggestion_content` | Page excerpt, typically a matching sentence.
@@ -82,67 +94,88 @@ In that case, we recommend you target the documented selectors below.
0 commit comments