@mdbase-dev/ui 0.2.1 → 0.2.2
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 +119 -0
- package/css/controls.css +37 -0
- package/css/date-picker.css +176 -0
- package/css/filter-builder.css +336 -0
- package/css/properties.css +398 -0
- package/dist/AnchoredPopover.d.ts +20 -0
- package/dist/AnchoredPopover.js +100 -0
- package/dist/Combo.d.ts +41 -0
- package/dist/Combo.js +82 -0
- package/dist/DatePicker.d.ts +69 -0
- package/dist/DatePicker.js +317 -0
- package/dist/Menu.d.ts +3 -1
- package/dist/Menu.js +3 -2
- package/dist/QuickCreate.js +1 -16
- package/dist/date-picker-model.d.ts +31 -0
- package/dist/date-picker-model.js +97 -0
- package/dist/filter-builder/AddFilter.d.ts +13 -0
- package/dist/filter-builder/AddFilter.js +295 -0
- package/dist/filter-builder/FilterBuilder.d.ts +36 -0
- package/dist/filter-builder/FilterBuilder.js +225 -0
- package/dist/filter-builder/FilterPill.d.ts +17 -0
- package/dist/filter-builder/FilterPill.js +494 -0
- package/dist/filter-builder/context.d.ts +40 -0
- package/dist/filter-builder/context.js +67 -0
- package/dist/filter-builder/editors.d.ts +31 -0
- package/dist/filter-builder/editors.js +294 -0
- package/dist/filter-builder/filter-ast.d.ts +13 -0
- package/dist/filter-builder/filter-ast.js +382 -0
- package/dist/filter-builder/labels.d.ts +99 -0
- package/dist/filter-builder/labels.js +555 -0
- package/dist/filter-builder/menu.d.ts +21 -0
- package/dist/filter-builder/menu.js +60 -0
- package/dist/filter-builder/operators.d.ts +30 -0
- package/dist/filter-builder/operators.js +192 -0
- package/dist/filter-builder/tree.d.ts +12 -0
- package/dist/filter-builder/tree.js +61 -0
- package/dist/filter-builder/types.d.ts +69 -0
- package/dist/filter-builder/types.js +48 -0
- package/dist/filter-builder.d.ts +13 -0
- package/dist/filter-builder.js +10 -0
- package/dist/glyphs.d.ts +32 -0
- package/dist/glyphs.js +143 -0
- package/dist/locales/de/messages.json +1 -1
- package/dist/locales/en/messages.json +1 -1
- package/dist/locales/es/messages.json +1 -1
- package/dist/locales/fr/messages.json +1 -1
- package/dist/locales/it/messages.json +1 -1
- package/dist/locales/ja/messages.json +1 -1
- package/dist/locales/ko/messages.json +1 -1
- package/dist/locales/pt/messages.json +1 -1
- package/dist/locales/ru/messages.json +1 -1
- package/dist/locales/zh/messages.json +1 -1
- package/dist/popover.d.ts +5 -0
- package/dist/popover.js +15 -0
- package/dist/properties/PropertyList.d.ts +31 -0
- package/dist/properties/PropertyList.js +233 -0
- package/dist/properties/PropertyValue.d.ts +42 -0
- package/dist/properties/PropertyValue.js +304 -0
- package/dist/properties/fields.d.ts +20 -0
- package/dist/properties/fields.js +81 -0
- package/dist/properties/labels.d.ts +29 -0
- package/dist/properties/labels.js +127 -0
- package/dist/properties/model.d.ts +52 -0
- package/dist/properties/model.js +195 -0
- package/dist/properties.d.ts +13 -0
- package/dist/properties.js +9 -0
- package/package.json +25 -2
package/README.md
CHANGED
|
@@ -260,6 +260,125 @@ app supplies the fields as children and every string except Cancel. Escape and
|
|
|
260
260
|
Cancel call `onClose(true)`; a press elsewhere calls `onClose(false)`, because
|
|
261
261
|
the focus has already moved. A list open inside the form takes the first Escape.
|
|
262
262
|
|
|
263
|
+
## Anchored popover
|
|
264
|
+
|
|
265
|
+
`AnchoredPopover` from `@mdbase-dev/ui/anchored-popover` is a small panel beside
|
|
266
|
+
the control that opened it, for a value to choose or type: a calendar, a
|
|
267
|
+
checklist, a short form. Include `controls.css`.
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
<button ref={anchor} aria-haspopup="dialog" aria-expanded={open} onClick={() => setOpen(!open)}>{t`Due`}</button>
|
|
271
|
+
{open && <AnchoredPopover anchor={anchor} label={t`Due date`} onClose={() => setOpen(false)}>
|
|
272
|
+
<Calendar value={due} onPick={pick} />
|
|
273
|
+
</AnchoredPopover>}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Render it while it is wanted. It opens in the top layer, follows its anchor, and
|
|
277
|
+
puts the keyboard in the element marked `data-autofocus`, or failing that in its
|
|
278
|
+
first control. Escape calls `onClose(true)` with the focus back on the anchor; a
|
|
279
|
+
press elsewhere calls `onClose(false)` after the field being typed in has lost
|
|
280
|
+
the focus, so a field that commits when it is left keeps what was typed. A list
|
|
281
|
+
or menu open inside it takes the first Escape. A menu of actions is `Menu`.
|
|
282
|
+
|
|
283
|
+
## Date picker
|
|
284
|
+
|
|
285
|
+
`@mdbase-dev/ui/date-picker` has `DateField`, a date that reads as a date and
|
|
286
|
+
opens a calendar to change it, and `Calendar`, the month on its own for a panel
|
|
287
|
+
that is already open. Dates go in and out as they are stored (`2026-11-28`).
|
|
288
|
+
Include `controls.css` and `date-picker.css`; `filter-builder.css` and
|
|
289
|
+
`properties.css` already bring the second with them.
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
<DateField value={due ?? ""} label={t`Due`} placeholder={t`No date`} onChange={setDue} />
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
The calendar's field takes a typed day: a stored date, today, tomorrow or
|
|
296
|
+
yesterday in the interface's language, a weekday (the next one), or a number of
|
|
297
|
+
days or weeks from today (`+3`, `-1`, `2w`). The arrow keys move through the
|
|
298
|
+
days and Page Up and Page Down through the months, from the field or the grid.
|
|
299
|
+
The week starts where the reader's locale starts it. `readDay(text)` and
|
|
300
|
+
`formatDay(value)` read and write a day the same way outside the picker. The
|
|
301
|
+
text is in the shared catalogue; pass `labels` to word any of it differently.
|
|
302
|
+
|
|
303
|
+
## Combo
|
|
304
|
+
|
|
305
|
+
`Combo` from `@mdbase-dev/ui/combo` is a text field with a list of plain values
|
|
306
|
+
under it: type to narrow the list, choose a row, or take what was typed. It is
|
|
307
|
+
the link picker given values in place of records. Include `controls.css`.
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
<Combo
|
|
311
|
+
label={t`Stage`}
|
|
312
|
+
value={stage}
|
|
313
|
+
options={stages.map((value) => ({ value }))}
|
|
314
|
+
newLabel={t`Use`}
|
|
315
|
+
emptyMessage={t`Nothing matches.`}
|
|
316
|
+
commitOnBlur
|
|
317
|
+
onCommit={(value) => setStage(value)}
|
|
318
|
+
/>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Without `newLabel` only the options can be chosen. `accepts` says whether typed
|
|
322
|
+
text may be taken, and `emptyMessage` shows when it may not and nothing
|
|
323
|
+
matches. `onCommit(value, made)` reports whether the value was typed rather than
|
|
324
|
+
chosen. Every string is passed in.
|
|
325
|
+
|
|
326
|
+
## Filter builder
|
|
327
|
+
|
|
328
|
+
`FilterBuilder` from `@mdbase-dev/ui/filter-builder` is an inline filter bar
|
|
329
|
+
over a CEL `where` expression. Each filter is a pill: a rule on a field, with
|
|
330
|
+
one value or several, or an expression kept as written. Pills combine in nested
|
|
331
|
+
all, any and none groups. Include `controls.css` and `filter-builder.css`.
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
334
|
+
<FilterBuilder
|
|
335
|
+
query={where}
|
|
336
|
+
fields={filterFieldsFromProperties(propertiesInUse(records, declared))}
|
|
337
|
+
error={queryError}
|
|
338
|
+
onChange={setWhere}
|
|
339
|
+
/>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
`query` is the expression and `onChange` receives the next one; an expression
|
|
343
|
+
the builder cannot show as rules stays an expression pill and is written back
|
|
344
|
+
unchanged. `fields` are the properties offered (`fieldsFromJsonSchema` makes
|
|
345
|
+
them from a JSON schema). Optional parts: `sharedQuery` and `onSharedChange` add
|
|
346
|
+
a second tier of filters that every view applies; `contextVars` offers the
|
|
347
|
+
host's `this.*` values to compare with; `lockedFields` keeps the filters on
|
|
348
|
+
fields the host owns from being removed; `defaultOpen` opens the list of fields
|
|
349
|
+
at once. `parseWhere`, `compileWhere` and `countActive` read and write the same
|
|
350
|
+
tree outside the component. The text is in the shared catalogue; pass `labels`
|
|
351
|
+
to word any of it differently.
|
|
352
|
+
|
|
353
|
+
## Properties
|
|
354
|
+
|
|
355
|
+
`PropertyList` from `@mdbase-dev/ui/properties` shows a record's properties,
|
|
356
|
+
each edited in place with the control its value calls for: a choice, a switch, a
|
|
357
|
+
date, a number, a list of values, links to other records, or text. Include
|
|
358
|
+
`controls.css` and `properties.css`.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
<PropertyList
|
|
362
|
+
values={record.frontmatter}
|
|
363
|
+
declared={type.fields}
|
|
364
|
+
inUse={propertiesInUse(others.map((other) => other.frontmatter))}
|
|
365
|
+
hidden={(name) => name === "title"}
|
|
366
|
+
records={{ describe, search, open }}
|
|
367
|
+
onChange={(name, value) => update(record.path, { [name]: value })}
|
|
368
|
+
/>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
`declared` is what the record's type says about its properties, in the type's
|
|
372
|
+
order: a name, a kind, and where known the values it may take and whether it is
|
|
373
|
+
a date. `inUse` is what other records hold, offered when a property is added;
|
|
374
|
+
`propertiesInUse` works that out from their values. Properties that hold
|
|
375
|
+
nothing stay out of the way until one is added by name or all are shown.
|
|
376
|
+
`onChange` receives null for a value that was cleared or a property that was
|
|
377
|
+
removed; without it the properties are only shown. `records` looks other
|
|
378
|
+
records up for properties that link to them. `PropertyValue` is one value's
|
|
379
|
+
control on its own, and `filterFieldsFromProperties` turns the same descriptions
|
|
380
|
+
into the filter builder's fields.
|
|
381
|
+
|
|
263
382
|
## Live preview
|
|
264
383
|
|
|
265
384
|
`livePreview()` from `@mdbase-dev/ui/live-preview` renders Markdown in a
|
package/css/controls.css
CHANGED
|
@@ -420,6 +420,43 @@ textarea.mdbase-field {
|
|
|
420
420
|
padding: var(--space-2) var(--space-3) var(--space-3);
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
+
/* Popovers: a small panel beside the control that opened it (AnchoredPopover). */
|
|
424
|
+
.mdbase-popover {
|
|
425
|
+
position: fixed;
|
|
426
|
+
inset: auto;
|
|
427
|
+
box-sizing: border-box;
|
|
428
|
+
min-width: 180px;
|
|
429
|
+
max-width: calc(100vw - 16px);
|
|
430
|
+
margin: 0;
|
|
431
|
+
overflow: auto;
|
|
432
|
+
overscroll-behavior: contain;
|
|
433
|
+
--popover-inset: 5px;
|
|
434
|
+
padding: var(--popover-inset);
|
|
435
|
+
border: 1px solid var(--color-border-strong);
|
|
436
|
+
/* Row radius plus the padding, as the menus have. */
|
|
437
|
+
border-radius: calc(var(--control-radius) + var(--popover-inset));
|
|
438
|
+
outline: 0;
|
|
439
|
+
color: var(--color-text);
|
|
440
|
+
background: var(--color-surface-overlay);
|
|
441
|
+
box-shadow: var(--elevation-low);
|
|
442
|
+
font-family: var(--sans);
|
|
443
|
+
font-size: var(--control-font-size);
|
|
444
|
+
font-weight: var(--font-weight-regular);
|
|
445
|
+
text-align: start;
|
|
446
|
+
white-space: normal;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/* Combo: a text field whose list offers values to take or one to make (Combo). */
|
|
450
|
+
.mdbase-combo {
|
|
451
|
+
width: 100%;
|
|
452
|
+
min-width: 0;
|
|
453
|
+
display: flex;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.mdbase-combo > .mdbase-link-picker {
|
|
457
|
+
flex: 1;
|
|
458
|
+
}
|
|
459
|
+
|
|
423
460
|
/* Menus anchored to a trigger (useMenuPopover). */
|
|
424
461
|
.mdbase-menu {
|
|
425
462
|
position: fixed;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Date picker (./date-picker): a typed day over a month to pick from, and the field that opens
|
|
3
|
+
* it. The popover it opens in is in controls.css, which the host loads beside this file.
|
|
4
|
+
*/
|
|
5
|
+
.mdbase-calendar {
|
|
6
|
+
min-width: 0;
|
|
7
|
+
display: grid;
|
|
8
|
+
gap: 6px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.mdbase-calendar :where(button) {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
border: 0;
|
|
15
|
+
color: inherit;
|
|
16
|
+
background: none;
|
|
17
|
+
font: inherit;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.mdbase-calendar-read {
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: 0 2px;
|
|
24
|
+
color: var(--color-accent-strong);
|
|
25
|
+
font-size: var(--font-size-caption);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.mdbase-calendar-read[data-unread] {
|
|
29
|
+
color: var(--color-text-muted);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.mdbase-calendar-head {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 2px;
|
|
36
|
+
padding-inline-start: 6px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.mdbase-calendar-title {
|
|
40
|
+
flex: 1;
|
|
41
|
+
font-weight: var(--font-weight-semibold);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.mdbase-calendar-step {
|
|
45
|
+
width: 24px;
|
|
46
|
+
height: 24px;
|
|
47
|
+
display: grid;
|
|
48
|
+
place-items: center;
|
|
49
|
+
border-radius: var(--control-radius);
|
|
50
|
+
color: var(--color-text-muted);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.mdbase-calendar-step:hover {
|
|
54
|
+
color: var(--color-text);
|
|
55
|
+
background: var(--color-surface-subtle);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.mdbase-calendar-grid {
|
|
59
|
+
display: grid;
|
|
60
|
+
gap: 1px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.mdbase-calendar-week {
|
|
64
|
+
display: grid;
|
|
65
|
+
grid-template-columns: repeat(7, 1fr);
|
|
66
|
+
justify-items: center;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.mdbase-calendar-week > [role="columnheader"] {
|
|
70
|
+
height: 24px;
|
|
71
|
+
display: grid;
|
|
72
|
+
place-items: center;
|
|
73
|
+
color: var(--color-text-muted);
|
|
74
|
+
font-size: 11px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.mdbase-calendar-day {
|
|
78
|
+
width: 30px;
|
|
79
|
+
height: 30px;
|
|
80
|
+
display: grid;
|
|
81
|
+
place-items: center;
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
color: var(--color-text);
|
|
84
|
+
font-variant-numeric: tabular-nums;
|
|
85
|
+
transition: background var(--motion-quick) var(--ease-standard);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.mdbase-calendar-day[data-outside] {
|
|
89
|
+
color: var(--color-placeholder);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.mdbase-calendar-day:hover,
|
|
93
|
+
.mdbase-calendar-day[data-cursor] {
|
|
94
|
+
background: var(--color-surface-subtle);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.mdbase-calendar-day[aria-current="date"] {
|
|
98
|
+
box-shadow: inset 0 0 0 1px var(--color-accent);
|
|
99
|
+
color: var(--color-accent-strong);
|
|
100
|
+
font-weight: var(--font-weight-semibold);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.mdbase-calendar-day[aria-selected="true"] {
|
|
104
|
+
box-shadow: none;
|
|
105
|
+
color: var(--color-on-accent);
|
|
106
|
+
background: var(--color-accent);
|
|
107
|
+
font-weight: var(--font-weight-semibold);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.mdbase-calendar-foot {
|
|
111
|
+
display: flex;
|
|
112
|
+
gap: 2px;
|
|
113
|
+
margin: 2px -3px -3px;
|
|
114
|
+
padding-top: 5px;
|
|
115
|
+
border-top: 1px solid var(--color-border);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.mdbase-calendar-quick {
|
|
119
|
+
height: 26px;
|
|
120
|
+
padding: 0 8px;
|
|
121
|
+
border-radius: var(--control-radius);
|
|
122
|
+
color: var(--color-text-soft);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.mdbase-calendar-quick:hover {
|
|
126
|
+
color: var(--color-text);
|
|
127
|
+
background: var(--color-surface-subtle);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.mdbase-calendar-quick[data-clear] {
|
|
131
|
+
margin-inline-start: auto;
|
|
132
|
+
color: var(--color-text-muted);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Date field: a day that reads as a date; pressing it opens the calendar (DateField). */
|
|
136
|
+
.mdbase-date-field {
|
|
137
|
+
max-width: 100%;
|
|
138
|
+
display: block;
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
padding: 0;
|
|
141
|
+
border: 0;
|
|
142
|
+
color: var(--color-text);
|
|
143
|
+
background: none;
|
|
144
|
+
font: inherit;
|
|
145
|
+
font-variant-numeric: tabular-nums;
|
|
146
|
+
text-align: start;
|
|
147
|
+
text-overflow: ellipsis;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.mdbase-date-field[data-empty] {
|
|
153
|
+
color: var(--color-text-faint);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.mdbase-date-popover {
|
|
157
|
+
width: 252px;
|
|
158
|
+
--popover-inset: 8px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@media (pointer: coarse) {
|
|
162
|
+
.mdbase-calendar-day {
|
|
163
|
+
width: 36px;
|
|
164
|
+
height: 36px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.mdbase-date-popover {
|
|
168
|
+
width: 270px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.mdbase-calendar-step,
|
|
172
|
+
.mdbase-calendar-quick {
|
|
173
|
+
min-width: 36px;
|
|
174
|
+
height: 36px;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The filter bar (./filter-builder). Its menus are .mdbase-menu and its panels .mdbase-popover,
|
|
3
|
+
* both in controls.css, which the host loads beside this file. Panels open in the top layer,
|
|
4
|
+
* outside .mdbase-filter, so the rules below name both. A date is picked from the calendar.
|
|
5
|
+
*/
|
|
6
|
+
@import "./date-picker.css";
|
|
7
|
+
|
|
8
|
+
.mdbase-filter {
|
|
9
|
+
min-width: 0;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
color: var(--color-text);
|
|
12
|
+
font-size: var(--control-font-size);
|
|
13
|
+
line-height: 1.3;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Zero specificity, so the rules below and the shared controls both win over it. */
|
|
17
|
+
:where(.mdbase-filter, .mdbase-filter-popover),
|
|
18
|
+
:where(.mdbase-filter, .mdbase-filter-popover) *,
|
|
19
|
+
:where(.mdbase-filter, .mdbase-filter-popover) *::before,
|
|
20
|
+
:where(.mdbase-filter, .mdbase-filter-popover) *::after { box-sizing: border-box; }
|
|
21
|
+
:where(.mdbase-filter, .mdbase-filter-popover) :where(button) { margin: 0; padding: 0; border: 0; color: inherit; background: none; font: inherit; cursor: pointer; }
|
|
22
|
+
:where(.mdbase-filter, .mdbase-filter-popover) :where(p) { margin: 0; }
|
|
23
|
+
:where(.mdbase-filter, .mdbase-filter-popover, .mdbase-filter-menu) :where(.mdbase-glyph) { flex: none; }
|
|
24
|
+
|
|
25
|
+
.mdbase-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
|
|
26
|
+
.mdbase-filter-anchor { display: inline-flex; align-self: stretch; min-width: 0; }
|
|
27
|
+
|
|
28
|
+
/* The bar's own controls: how the filters combine, and the way to add one. */
|
|
29
|
+
.mdbase-filter-match,
|
|
30
|
+
.mdbase-filter-add {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 5px;
|
|
34
|
+
height: 26px;
|
|
35
|
+
padding: 0 8px;
|
|
36
|
+
border: 1px solid transparent;
|
|
37
|
+
border-radius: var(--control-radius);
|
|
38
|
+
color: var(--color-text-muted);
|
|
39
|
+
font-weight: var(--font-weight-medium);
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
transition:
|
|
42
|
+
background var(--motion-quick) var(--ease-standard),
|
|
43
|
+
color var(--motion-quick) var(--ease-standard),
|
|
44
|
+
border-color var(--motion-quick) var(--ease-standard);
|
|
45
|
+
}
|
|
46
|
+
.mdbase-filter-match { gap: 3px; padding-right: 5px; }
|
|
47
|
+
.mdbase-filter-add:not([data-active]) { border-color: var(--color-border-strong); color: var(--color-text-soft); }
|
|
48
|
+
:is(.mdbase-filter-match, .mdbase-filter-add):hover,
|
|
49
|
+
:is(.mdbase-filter-match, .mdbase-filter-add)[aria-expanded="true"] { background: var(--color-surface-subtle); color: var(--color-text); }
|
|
50
|
+
|
|
51
|
+
/* Pills: one outlined control split into segments, quiet until pointed at. */
|
|
52
|
+
.mdbase-filter-pill {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: stretch;
|
|
55
|
+
height: 26px;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
max-width: 100%;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
border: 1px solid var(--color-border);
|
|
60
|
+
border-radius: var(--control-radius);
|
|
61
|
+
color: var(--color-text);
|
|
62
|
+
transition: border-color var(--motion-quick) var(--ease-standard);
|
|
63
|
+
}
|
|
64
|
+
.mdbase-filter-pill:hover,
|
|
65
|
+
.mdbase-filter-pill:focus-within { border-color: var(--color-border-strong); }
|
|
66
|
+
.mdbase-filter-pill > * + * { border-left: 1px solid var(--color-border); }
|
|
67
|
+
.mdbase-filter-pill[data-draft] { border-style: dashed; border-color: var(--color-border-strong); }
|
|
68
|
+
.mdbase-filter-seg {
|
|
69
|
+
display: inline-flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 5px;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
padding: 0 7px;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
transition:
|
|
76
|
+
background var(--motion-quick) var(--ease-standard),
|
|
77
|
+
color var(--motion-quick) var(--ease-standard);
|
|
78
|
+
}
|
|
79
|
+
button.mdbase-filter-seg:hover,
|
|
80
|
+
button.mdbase-filter-seg[aria-expanded="true"] { background: var(--color-surface-subtle); }
|
|
81
|
+
.mdbase-filter-seg:focus-visible { outline-offset: -2px; }
|
|
82
|
+
.mdbase-filter-seg-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
83
|
+
/* In a narrow column the value gives way; a field's name keeps its width up to a cap. */
|
|
84
|
+
.mdbase-filter-anchor:has(> :is(.mdbase-filter-seg-field, .mdbase-filter-seg-op)) { flex: none; }
|
|
85
|
+
.mdbase-filter-seg-field .mdbase-filter-seg-text { max-width: 7rem; }
|
|
86
|
+
.mdbase-filter-seg-field > .mdbase-glyph { color: var(--color-text-muted); }
|
|
87
|
+
.mdbase-filter-seg-field[data-locked] { color: var(--color-text-soft); cursor: default; }
|
|
88
|
+
.mdbase-filter-seg-op { color: var(--color-text-muted); }
|
|
89
|
+
button.mdbase-filter-seg-op:hover { color: var(--color-text); }
|
|
90
|
+
.mdbase-filter-seg-value { font-weight: var(--font-weight-medium); }
|
|
91
|
+
.mdbase-filter-seg-value .mdbase-filter-seg-text { max-width: 14rem; }
|
|
92
|
+
.mdbase-filter-seg-value[data-context] { color: var(--color-accent-strong); font-family: var(--mono); font-size: var(--font-size-caption); }
|
|
93
|
+
.mdbase-filter-pill[data-draft] :is(.mdbase-filter-seg-value, .mdbase-filter-seg-code code) { color: var(--color-text-muted); font-weight: var(--font-weight-regular); }
|
|
94
|
+
.mdbase-filter-seg-remove { flex: none; justify-content: center; width: 22px; padding: 0; color: var(--color-text-muted); }
|
|
95
|
+
.mdbase-filter-seg-remove:hover { color: var(--color-text); }
|
|
96
|
+
|
|
97
|
+
/* A filter every view applies: a small tag ahead of the pill. */
|
|
98
|
+
.mdbase-filter-shared {
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
flex: none;
|
|
101
|
+
align-items: center;
|
|
102
|
+
padding: 0 6px;
|
|
103
|
+
color: var(--color-text-muted);
|
|
104
|
+
background: var(--color-surface-subtle);
|
|
105
|
+
font-size: 11px;
|
|
106
|
+
font-weight: var(--font-weight-medium);
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
user-select: none;
|
|
109
|
+
}
|
|
110
|
+
.mdbase-filter-pill[data-shared] .mdbase-filter-seg-field { color: var(--color-text-soft); }
|
|
111
|
+
.mdbase-filter-group > .mdbase-filter-shared { align-self: center; height: 20px; border-radius: calc(var(--control-radius) - 2px); }
|
|
112
|
+
|
|
113
|
+
/* An expression pill: the expression as written, in mono. */
|
|
114
|
+
.mdbase-filter-fx { color: var(--color-accent-strong); font: italic 600 11px/1 var(--mono); letter-spacing: -0.02em; }
|
|
115
|
+
.mdbase-filter-seg-code { gap: 0; padding: 0 8px 0 0; }
|
|
116
|
+
.mdbase-filter-seg-code .mdbase-filter-fx { display: flex; flex: none; align-self: stretch; align-items: center; margin-right: 7px; padding: 0 7px; border-right: 1px solid var(--color-border); }
|
|
117
|
+
.mdbase-filter-seg-code code { min-width: 0; max-width: 18rem; overflow: hidden; color: var(--color-text); font: var(--font-size-caption)/normal var(--mono); text-overflow: ellipsis; }
|
|
118
|
+
|
|
119
|
+
/* A nested group: a shaded run of pills, the shade alternating with depth. */
|
|
120
|
+
.mdbase-filter-group {
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
align-items: center;
|
|
124
|
+
gap: 4px;
|
|
125
|
+
min-width: 0;
|
|
126
|
+
max-width: 100%;
|
|
127
|
+
padding: 2px;
|
|
128
|
+
border: 1px solid var(--color-border);
|
|
129
|
+
border-radius: calc(var(--control-radius) + 2px);
|
|
130
|
+
background: var(--color-surface-subtle);
|
|
131
|
+
}
|
|
132
|
+
.mdbase-filter-group .mdbase-filter-group { background: var(--color-surface); }
|
|
133
|
+
.mdbase-filter-group .mdbase-filter-group .mdbase-filter-group { background: var(--color-surface-subtle); }
|
|
134
|
+
.mdbase-filter-group .mdbase-filter-pill { height: 24px; background: var(--color-surface); }
|
|
135
|
+
.mdbase-filter-group .mdbase-filter-group .mdbase-filter-pill { background: var(--color-surface-subtle); }
|
|
136
|
+
.mdbase-filter-group-chip {
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
flex: none;
|
|
139
|
+
align-items: center;
|
|
140
|
+
gap: 2px;
|
|
141
|
+
height: 24px;
|
|
142
|
+
padding: 0 4px 0 7px;
|
|
143
|
+
border-radius: var(--control-radius);
|
|
144
|
+
color: var(--color-accent-strong);
|
|
145
|
+
font-size: var(--font-size-caption);
|
|
146
|
+
font-weight: var(--font-weight-semibold);
|
|
147
|
+
transition: background var(--motion-quick) var(--ease-standard);
|
|
148
|
+
}
|
|
149
|
+
.mdbase-filter-group-chip:hover,
|
|
150
|
+
.mdbase-filter-group-chip[aria-expanded="true"] { background: var(--color-accent-soft); }
|
|
151
|
+
.mdbase-filter-group-button,
|
|
152
|
+
.mdbase-filter-icon-button {
|
|
153
|
+
display: grid;
|
|
154
|
+
flex: none;
|
|
155
|
+
place-items: center;
|
|
156
|
+
width: 22px;
|
|
157
|
+
height: 22px;
|
|
158
|
+
border-radius: calc(var(--control-radius) - 1px);
|
|
159
|
+
color: var(--color-text-muted);
|
|
160
|
+
transition:
|
|
161
|
+
background var(--motion-quick) var(--ease-standard),
|
|
162
|
+
color var(--motion-quick) var(--ease-standard);
|
|
163
|
+
}
|
|
164
|
+
.mdbase-filter-icon-button { width: 24px; height: 24px; border-radius: var(--control-radius); }
|
|
165
|
+
:is(.mdbase-filter-group-button, .mdbase-filter-icon-button):hover,
|
|
166
|
+
.mdbase-filter-group-button[aria-expanded="true"] { background: var(--color-selected); color: var(--color-text); }
|
|
167
|
+
|
|
168
|
+
/* Menus: the shared menu, its rows one line each with a hint or a tick at the end. */
|
|
169
|
+
.mdbase-filter-menu { min-width: 160px; }
|
|
170
|
+
.mdbase-filter-menu .mdbase-menu-item { min-height: 30px; padding-block: 0; white-space: nowrap; }
|
|
171
|
+
.mdbase-filter-menu .mdbase-menu-item[aria-checked="true"] { color: var(--color-text); background: var(--color-selected); }
|
|
172
|
+
.mdbase-filter-menu .mdbase-menu-item > .mdbase-glyph { color: var(--color-text-muted); }
|
|
173
|
+
.mdbase-filter-menu .mdbase-menu-item.is-danger > .mdbase-glyph { color: inherit; }
|
|
174
|
+
.mdbase-filter-menu-label,
|
|
175
|
+
.mdbase-filter-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
176
|
+
.mdbase-filter-menu-check { display: grid; flex: none; color: var(--color-accent-strong); }
|
|
177
|
+
.mdbase-filter-hint { min-width: 0; color: var(--color-text-muted); font-size: var(--font-size-caption); }
|
|
178
|
+
.mdbase-filter-menu .mdbase-filter-hint { flex: none; }
|
|
179
|
+
|
|
180
|
+
/* Panels beside a pill or the add control. */
|
|
181
|
+
.mdbase-filter-popover { display: grid; align-content: start; gap: 1px; line-height: 1.3; }
|
|
182
|
+
.mdbase-filter-command { width: 260px; }
|
|
183
|
+
.mdbase-filter-value-popover { width: 250px; }
|
|
184
|
+
.mdbase-filter-expression-popover { width: 320px; }
|
|
185
|
+
|
|
186
|
+
/* Adding a filter: a search header over the list of fields, then the picked field's value. */
|
|
187
|
+
.mdbase-filter-step { display: grid; gap: 1px; min-width: 0; }
|
|
188
|
+
.mdbase-filter-search,
|
|
189
|
+
.mdbase-filter-step-head {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
gap: 8px;
|
|
193
|
+
min-width: 0;
|
|
194
|
+
height: 36px;
|
|
195
|
+
margin: calc(-1 * var(--popover-inset)) calc(-1 * var(--popover-inset)) 4px;
|
|
196
|
+
padding: 0 10px;
|
|
197
|
+
border-bottom: 1px solid var(--color-border);
|
|
198
|
+
}
|
|
199
|
+
.mdbase-filter-search > .mdbase-glyph { color: var(--color-text-muted); }
|
|
200
|
+
.mdbase-filter-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; color: var(--color-text); background: none; font: inherit; }
|
|
201
|
+
.mdbase-filter-search input::placeholder { color: var(--color-placeholder); }
|
|
202
|
+
.mdbase-filter-options { display: grid; gap: 1px; max-height: min(300px, 50dvh); overflow: auto; overscroll-behavior: contain; }
|
|
203
|
+
.mdbase-filter-option {
|
|
204
|
+
display: flex;
|
|
205
|
+
align-items: center;
|
|
206
|
+
gap: 10px;
|
|
207
|
+
width: 100%;
|
|
208
|
+
min-width: 0;
|
|
209
|
+
min-height: 30px;
|
|
210
|
+
padding: 0 8px;
|
|
211
|
+
border-radius: var(--control-radius);
|
|
212
|
+
color: var(--color-text-soft);
|
|
213
|
+
text-align: start;
|
|
214
|
+
white-space: nowrap;
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
}
|
|
217
|
+
/* The row Enter takes, as in the menus: pointer and keyboard share one highlight. */
|
|
218
|
+
.mdbase-filter-option[aria-selected="true"] { color: var(--color-text); background: var(--color-accent-soft); }
|
|
219
|
+
.mdbase-filter-option > .mdbase-glyph { color: var(--color-text-muted); }
|
|
220
|
+
.mdbase-filter-option > .mdbase-filter-fx { width: 14px; text-align: center; }
|
|
221
|
+
.mdbase-filter-empty { padding: 6px 8px; }
|
|
222
|
+
.mdbase-filter-scope {
|
|
223
|
+
display: flex;
|
|
224
|
+
align-items: center;
|
|
225
|
+
justify-content: space-between;
|
|
226
|
+
gap: 8px;
|
|
227
|
+
margin: 4px calc(-1 * var(--popover-inset)) calc(-1 * var(--popover-inset));
|
|
228
|
+
padding: 6px 6px 6px 10px;
|
|
229
|
+
border-top: 1px solid var(--color-border);
|
|
230
|
+
color: var(--color-text-muted);
|
|
231
|
+
font-size: var(--font-size-caption);
|
|
232
|
+
}
|
|
233
|
+
.mdbase-filter-scope .mdbase-segmented { --control-height: 24px; font-size: var(--font-size-caption); }
|
|
234
|
+
.mdbase-filter-step-head { gap: 6px; padding: 0 6px 0 4px; }
|
|
235
|
+
.mdbase-filter-step-field { display: inline-flex; flex: 1; align-items: center; gap: 6px; min-width: 0; font-weight: var(--font-weight-medium); white-space: nowrap; }
|
|
236
|
+
.mdbase-filter-step-field > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
237
|
+
.mdbase-filter-step-field > .mdbase-glyph { color: var(--color-text-muted); }
|
|
238
|
+
.mdbase-filter-operator.mdbase-select { flex: none; max-width: 55%; color: var(--color-text-soft); }
|
|
239
|
+
|
|
240
|
+
/* A value: a checklist, a typed value, a calendar, or an expression. */
|
|
241
|
+
.mdbase-filter-panel { display: grid; gap: 6px; min-width: 0; }
|
|
242
|
+
.mdbase-filter-panel > .mdbase-calendar { padding: 3px; }
|
|
243
|
+
.mdbase-filter-checklist { display: grid; gap: 1px; max-height: min(260px, 44dvh); overflow: auto; overscroll-behavior: contain; }
|
|
244
|
+
.mdbase-filter-check {
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
gap: 10px;
|
|
248
|
+
min-width: 0;
|
|
249
|
+
min-height: 30px;
|
|
250
|
+
padding: 0 8px;
|
|
251
|
+
border-radius: var(--control-radius);
|
|
252
|
+
color: var(--color-text-soft);
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
}
|
|
255
|
+
.mdbase-filter-check:hover,
|
|
256
|
+
.mdbase-filter-check:has(input:focus-visible) { color: var(--color-text); background: var(--color-accent-soft); }
|
|
257
|
+
.mdbase-filter-check > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
258
|
+
/* The row carries the focus mark and is the fingertip target. */
|
|
259
|
+
.mdbase-filter-check > .mdbase-checkbox:focus-visible { outline: 0; }
|
|
260
|
+
.mdbase-filter-check > .mdbase-checkbox::before { content: none; }
|
|
261
|
+
|
|
262
|
+
.mdbase-filter-input-row { position: relative; display: flex; align-items: center; }
|
|
263
|
+
.mdbase-filter-input-row > .mdbase-field { padding-right: 28px; font-variant-numeric: tabular-nums; }
|
|
264
|
+
.mdbase-filter-enter { position: absolute; right: 9px; display: grid; color: var(--color-text-muted); pointer-events: none; }
|
|
265
|
+
textarea.mdbase-filter-code { display: block; min-height: 56px; caret-color: var(--color-accent); font: var(--font-size-caption)/1.5 var(--mono); }
|
|
266
|
+
|
|
267
|
+
.mdbase-filter-vars { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
|
|
268
|
+
.mdbase-filter-var {
|
|
269
|
+
display: inline-flex;
|
|
270
|
+
align-items: center;
|
|
271
|
+
min-width: 0;
|
|
272
|
+
max-width: 100%;
|
|
273
|
+
height: 24px;
|
|
274
|
+
padding: 0 8px;
|
|
275
|
+
border: 1px solid transparent;
|
|
276
|
+
border-radius: var(--control-radius);
|
|
277
|
+
color: var(--color-accent-strong);
|
|
278
|
+
background: var(--color-accent-soft);
|
|
279
|
+
font-size: var(--font-size-caption);
|
|
280
|
+
white-space: nowrap;
|
|
281
|
+
transition: border-color var(--motion-quick) var(--ease-standard);
|
|
282
|
+
}
|
|
283
|
+
.mdbase-filter-var code { min-width: 0; overflow: hidden; font: var(--font-weight-medium) var(--font-size-caption)/1 var(--mono); text-overflow: ellipsis; }
|
|
284
|
+
.mdbase-filter-var span { flex: none; margin-left: 3px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
|
|
285
|
+
.mdbase-filter-var:hover { border-color: color-mix(in srgb, var(--color-accent) 45%, transparent); }
|
|
286
|
+
.mdbase-filter-var[aria-pressed="true"] { border-color: var(--color-accent); }
|
|
287
|
+
|
|
288
|
+
.mdbase-filter-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
|
|
289
|
+
.mdbase-filter-choice {
|
|
290
|
+
height: 28px;
|
|
291
|
+
border: 1px solid var(--color-border-strong);
|
|
292
|
+
border-radius: var(--control-radius);
|
|
293
|
+
font-weight: var(--font-weight-medium);
|
|
294
|
+
transition:
|
|
295
|
+
background var(--motion-quick) var(--ease-standard),
|
|
296
|
+
border-color var(--motion-quick) var(--ease-standard);
|
|
297
|
+
}
|
|
298
|
+
.mdbase-filter-choice:hover { background: var(--color-surface-subtle); }
|
|
299
|
+
.mdbase-filter-choice[aria-pressed="true"] { border-color: var(--color-accent); color: var(--color-accent-strong); background: var(--color-accent-soft); }
|
|
300
|
+
|
|
301
|
+
.mdbase-filter-foot {
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
justify-content: space-between;
|
|
305
|
+
gap: 8px;
|
|
306
|
+
min-width: 0;
|
|
307
|
+
margin: 0 calc(-1 * var(--popover-inset)) calc(-1 * var(--popover-inset));
|
|
308
|
+
padding: 5px 5px 5px 10px;
|
|
309
|
+
border-top: 1px solid var(--color-border);
|
|
310
|
+
}
|
|
311
|
+
.mdbase-filter-foot > .mdbase-button { --control-height: 26px; flex: none; }
|
|
312
|
+
.mdbase-filter-foot > .mdbase-filter-convert { flex: 0 1 auto; min-width: 0; margin-left: -5px; padding: 0 6px; color: var(--color-text-muted); }
|
|
313
|
+
.mdbase-filter-convert > .mdbase-glyph { color: var(--color-accent); }
|
|
314
|
+
|
|
315
|
+
.mdbase-filter-error {
|
|
316
|
+
width: fit-content;
|
|
317
|
+
max-width: 100%;
|
|
318
|
+
margin-top: 6px;
|
|
319
|
+
padding: 4px 8px;
|
|
320
|
+
border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent);
|
|
321
|
+
border-radius: var(--control-radius);
|
|
322
|
+
color: var(--color-danger);
|
|
323
|
+
background: var(--color-danger-soft);
|
|
324
|
+
font-size: var(--font-size-caption);
|
|
325
|
+
overflow-wrap: anywhere;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* A fingertip target, as the shared controls have. */
|
|
329
|
+
@media (pointer: coarse) {
|
|
330
|
+
.mdbase-filter-pill, .mdbase-filter-match, .mdbase-filter-add { height: 32px; }
|
|
331
|
+
.mdbase-filter-group .mdbase-filter-pill, .mdbase-filter-group-chip { height: 30px; }
|
|
332
|
+
.mdbase-filter-menu .mdbase-menu-item, .mdbase-filter-option, .mdbase-filter-check { min-height: 40px; }
|
|
333
|
+
.mdbase-filter-foot > .mdbase-button { --control-height: 32px; }
|
|
334
|
+
/* Below 16px, iOS zooms the page when a field takes the focus. */
|
|
335
|
+
.mdbase-filter-popover :is(input:not([type="checkbox"]), textarea) { font-size: 16px; }
|
|
336
|
+
}
|