@makoai/app-sdk 2.17.0 → 2.18.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.
Files changed (5) hide show
  1. package/README.md +14 -2
  2. package/index.js +1 -1
  3. package/package.json +3 -2
  4. package/ui.css +15 -2
  5. package/ui.js +28 -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, coloured from `--primary` and `--input`. Draw the rows of
438
- an app's own Radix menu with it, so every menu on the page ticks alike.
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.17.0";
40
+ export const SDK_VERSION = "2.18.0";
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.17.0",
3
+ "version": "2.18.0",
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
- button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
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
- .mk-ms-box.on { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
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,20 @@ 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.
190
+ */
191
+ const LABEL_SAFE = "a[href],button,input,select,textarea,summary";
192
+ function cancelLabelActivation(e) {
193
+ const t = e.target;
194
+ if (!(t instanceof Element) || !t.closest(LABEL_SAFE)) e.preventDefault();
195
+ }
196
+
183
197
  // ---------------------------------------------------------------------------
184
198
  // Page blocks
185
199
  // ---------------------------------------------------------------------------
@@ -654,8 +668,8 @@ function toOption(o) {
654
668
  /**
655
669
  * The kit's one checkbox, drawn only (the row around it takes the click).
656
670
  * `checked`: true, false or "mixed". Colours come from the theme tokens
657
- * (--primary when ticked, --input border when not), so every menu on a page,
658
- * the kit's or the app's own Radix menus, ticks the same way.
671
+ * (--brand with a white tick when ticked, --input border when not), so every
672
+ * menu on a page, the kit's or the app's own Radix menus, ticks the same way.
659
673
  */
660
674
  export function Checkbox({ checked = false, className }) {
661
675
  const on = checked === true || checked === "mixed";
@@ -727,7 +741,12 @@ export function MultiSelect({
727
741
  open &&
728
742
  h(
729
743
  "div",
730
- { className: "mk-pop mk-ms-menu", role: "listbox", "aria-multiselectable": true },
744
+ {
745
+ className: "mk-pop mk-ms-menu",
746
+ role: "listbox",
747
+ "aria-multiselectable": true,
748
+ onClick: cancelLabelActivation,
749
+ },
731
750
  h(
732
751
  "button",
733
752
  { type: "button", className: cx("mk-ms-opt", allOn && "active"), "aria-pressed": allOn, onClick: all },
@@ -827,7 +846,12 @@ export function FreshnessBadge({
827
846
  hasPanel &&
828
847
  h(
829
848
  "div",
830
- { className: "mk-pop mk-fresh-pop", role: "dialog", "aria-label": "Data freshness" },
849
+ {
850
+ className: "mk-pop mk-fresh-pop",
851
+ role: "dialog",
852
+ "aria-label": "Data freshness",
853
+ onClick: cancelLabelActivation,
854
+ },
831
855
  (title != null || meta != null) &&
832
856
  h(
833
857
  "div",