@makoai/app-sdk 2.17.0 → 2.18.1
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 +14 -2
- package/index.js +1 -1
- package/package.json +3 -2
- package/ui.css +15 -2
- package/ui.js +35 -4
package/README.md
CHANGED
|
@@ -434,8 +434,9 @@ option's value when `false`.
|
|
|
434
434
|
lists the selected labels. Chips and `maxChips` are gone.
|
|
435
435
|
|
|
436
436
|
**Checkbox.** `Checkbox` (`checked`: `true` / `false` / `"mixed"`) is the
|
|
437
|
-
kit's one checkbox
|
|
438
|
-
|
|
437
|
+
kit's one checkbox. From 2.18 it ticks white on `--brand` (`--primary` when a
|
|
438
|
+
theme has no `--brand`), unticked boxes use `--input`. Draw the rows of an
|
|
439
|
+
app's own Radix menu with it, so every menu on the page ticks alike.
|
|
439
440
|
|
|
440
441
|
**One open at a time.** Opening a kit popover (`MultiSelect`,
|
|
441
442
|
`FreshnessBadge`) closes any other. Escape, a pointerdown outside and focus
|
|
@@ -447,6 +448,17 @@ app's own menu opens, call `closePopovers()`:
|
|
|
447
448
|
<DropdownMenu modal={false} onOpenChange={o => o && closePopovers()}>
|
|
448
449
|
```
|
|
449
450
|
|
|
451
|
+
**Inside a `<label>` (2.18+).** A label clicks its control when you click
|
|
452
|
+
plain content inside it. In 2.17 a click on an option row reached the label,
|
|
453
|
+
the label clicked the trigger, and the menu closed. Kit popovers now cancel
|
|
454
|
+
that click, so a `MultiSelect` or `FreshnessBadge` can sit in a label.
|
|
455
|
+
|
|
456
|
+
**Cursor (2.18+).** `ui.css` gives a pointer to every enabled button, summary,
|
|
457
|
+
select, checkbox, radio, tab, option and Radix menu item (`menuitem`,
|
|
458
|
+
`menuitemradio`, `menuitemcheckbox`). The rule is unlayered, so it beats
|
|
459
|
+
shadcn's `cursor-default` on menu items. Disabled ones (`:disabled`,
|
|
460
|
+
`aria-disabled="true"`, `data-disabled`) show `not-allowed`.
|
|
461
|
+
|
|
450
462
|
Pure helpers for app-side menus: `multiSelectState(value, optionValues)`,
|
|
451
463
|
`multiSelectToggle(value, optionValues, v, emptyMeansAll)`,
|
|
452
464
|
`multiSelectText(value, options, allLabel, formatMany)`.
|
package/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
* in a page (or this export) says which SDK a deployed app actually runs.
|
|
38
38
|
* Kept in step with package.json by snapshot.test.mjs.
|
|
39
39
|
*/
|
|
40
|
-
export const SDK_VERSION = "2.
|
|
40
|
+
export const SDK_VERSION = "2.18.1";
|
|
41
41
|
if (typeof window !== "undefined") {
|
|
42
42
|
try {
|
|
43
43
|
window.__MAKO_APP_SDK__ = SDK_VERSION;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makoai/app-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.1",
|
|
4
4
|
"description": "Mako app SDK: data bindings (useQuery/useDuckDB), URL state, theme, and the house dashboard kit (/ui).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"test": "node --test"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"apache-arrow": "17.0.0"
|
|
67
|
+
"apache-arrow": "17.0.0",
|
|
68
|
+
"jsdom": "^30.1.2"
|
|
68
69
|
}
|
|
69
70
|
}
|
package/ui.css
CHANGED
|
@@ -40,7 +40,19 @@ body {
|
|
|
40
40
|
-webkit-font-smoothing: antialiased;
|
|
41
41
|
}
|
|
42
42
|
button, input, select, textarea { font-family: inherit; }
|
|
43
|
-
|
|
43
|
+
/* A hand on everything clickable, the kit's controls and the shadcn/Radix
|
|
44
|
+
* menus apps vendor. shadcn gives menu items `cursor-default`, so items
|
|
45
|
+
* showed an arrow. Unlayered on purpose: it beats Tailwind v4's layered
|
|
46
|
+
* utilities. Disabled items (disabled, aria-disabled, Radix data-disabled)
|
|
47
|
+
* keep not-allowed. */
|
|
48
|
+
:is(button, summary, select, input[type="checkbox"], input[type="radio"], [role="button"], [role="tab"],
|
|
49
|
+
[role="option"], [role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]):not(:disabled, [aria-disabled="true"], [data-disabled]) {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
:is(button, select, input[type="checkbox"], input[type="radio"], [role="button"], [role="tab"],
|
|
53
|
+
[role="option"], [role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]):is(:disabled, [aria-disabled="true"], [data-disabled]) {
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
}
|
|
44
56
|
@media (prefers-reduced-motion: reduce) {
|
|
45
57
|
*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
|
|
46
58
|
}
|
|
@@ -297,7 +309,8 @@ button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
|
|
|
297
309
|
border: 1px solid var(--input); background: var(--background); color: transparent; box-shadow: var(--mk-shadow-xs);
|
|
298
310
|
transition: background .12s, border-color .12s, color .12s;
|
|
299
311
|
}
|
|
300
|
-
|
|
312
|
+
/* Ticked in the brand blue (white tick), --primary where a theme has no --brand. */
|
|
313
|
+
.mk-ms-box.on { background: var(--brand, var(--primary)); border-color: var(--brand, var(--primary)); color: #fff; }
|
|
301
314
|
.mk-ms-swatch { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
|
|
302
315
|
.mk-ms-sep { height: 1px; background: var(--border); margin: 4px -4px; flex: none; }
|
|
303
316
|
.mk-ms-only {
|
package/ui.js
CHANGED
|
@@ -180,6 +180,27 @@ function usePopover(open, setOpen, wrapRef, align) {
|
|
|
180
180
|
}, [open, wrapRef, align]);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* onClick for a popover panel. An app may wrap a kit control in a <label>
|
|
185
|
+
* (a natural form-field wrapper). A click on plain content inside the label,
|
|
186
|
+
* like a MultiSelect option row, runs the label's activation behaviour: the
|
|
187
|
+
* browser clicks the labelled control, the popover's trigger, which closed
|
|
188
|
+
* the menu. Cancelling the click stops that. Clicks on links, buttons and
|
|
189
|
+
* form fields keep their default, and the label ignores those anyway. A label
|
|
190
|
+
* the app renders inside the popover (a FreshnessBadge action) keeps working.
|
|
191
|
+
*/
|
|
192
|
+
const LABEL_SAFE = "a[href],button,input,select,textarea,summary";
|
|
193
|
+
function cancelLabelActivation(e) {
|
|
194
|
+
const t = e.target;
|
|
195
|
+
if (t instanceof Element) {
|
|
196
|
+
if (t.closest(LABEL_SAFE)) return;
|
|
197
|
+
// A label inside the popover is the app's own: let it click its control.
|
|
198
|
+
const own = t.closest("label");
|
|
199
|
+
if (own && e.currentTarget.contains(own)) return;
|
|
200
|
+
}
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
}
|
|
203
|
+
|
|
183
204
|
// ---------------------------------------------------------------------------
|
|
184
205
|
// Page blocks
|
|
185
206
|
// ---------------------------------------------------------------------------
|
|
@@ -654,8 +675,8 @@ function toOption(o) {
|
|
|
654
675
|
/**
|
|
655
676
|
* The kit's one checkbox, drawn only (the row around it takes the click).
|
|
656
677
|
* `checked`: true, false or "mixed". Colours come from the theme tokens
|
|
657
|
-
* (--
|
|
658
|
-
* the kit's or the app's own Radix menus, ticks the same way.
|
|
678
|
+
* (--brand with a white tick when ticked, --input border when not), so every
|
|
679
|
+
* menu on a page, the kit's or the app's own Radix menus, ticks the same way.
|
|
659
680
|
*/
|
|
660
681
|
export function Checkbox({ checked = false, className }) {
|
|
661
682
|
const on = checked === true || checked === "mixed";
|
|
@@ -727,7 +748,12 @@ export function MultiSelect({
|
|
|
727
748
|
open &&
|
|
728
749
|
h(
|
|
729
750
|
"div",
|
|
730
|
-
{
|
|
751
|
+
{
|
|
752
|
+
className: "mk-pop mk-ms-menu",
|
|
753
|
+
role: "listbox",
|
|
754
|
+
"aria-multiselectable": true,
|
|
755
|
+
onClick: cancelLabelActivation,
|
|
756
|
+
},
|
|
731
757
|
h(
|
|
732
758
|
"button",
|
|
733
759
|
{ type: "button", className: cx("mk-ms-opt", allOn && "active"), "aria-pressed": allOn, onClick: all },
|
|
@@ -827,7 +853,12 @@ export function FreshnessBadge({
|
|
|
827
853
|
hasPanel &&
|
|
828
854
|
h(
|
|
829
855
|
"div",
|
|
830
|
-
{
|
|
856
|
+
{
|
|
857
|
+
className: "mk-pop mk-fresh-pop",
|
|
858
|
+
role: "dialog",
|
|
859
|
+
"aria-label": "Data freshness",
|
|
860
|
+
onClick: cancelLabelActivation,
|
|
861
|
+
},
|
|
831
862
|
(title != null || meta != null) &&
|
|
832
863
|
h(
|
|
833
864
|
"div",
|