@makoai/app-sdk 2.11.0 → 2.11.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 +17 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/ui.css +44 -6
- package/ui.d.ts +1 -1
- package/ui.js +3 -1
package/README.md
CHANGED
|
@@ -363,6 +363,10 @@ const COLUMNS: DataTableColumn<Customer>[] = [
|
|
|
363
363
|
A page past the end shows the last page and reports it through
|
|
364
364
|
`onPageChange`. The table scrolls to the top on a page change. `rows`
|
|
365
365
|
defaults to `[]`, so a table can render while its data loads.
|
|
366
|
+
- **Page size.** 50 rows by default, with 25 / 50 / 100 in the select.
|
|
367
|
+
`defaultPageSize={100}` opens on 100 rows. `pageSizes` sets the choices (one
|
|
368
|
+
entry hides the select). A size outside the list still shows as the selected
|
|
369
|
+
option.
|
|
366
370
|
- **Height.** `fill` makes the card fill its parent's height and the body
|
|
367
371
|
scroll inside it, with the pager always in view: give the parent a height
|
|
368
372
|
(e.g. `<main style={{ height: "100dvh", display: "flex", flexDirection: "column" }}>`).
|
|
@@ -386,6 +390,19 @@ const COLUMNS: DataTableColumn<Customer>[] = [
|
|
|
386
390
|
every kit class is prefixed `mk-`. It also sets the house base: Inter 14px on
|
|
387
391
|
the warm `--canvas`.
|
|
388
392
|
|
|
393
|
+
**Native `<select>` (2.11.1+).** macOS draws the native dropdown arrow flush
|
|
394
|
+
against the right border. `ui.css` styles every single-line `<select>` like the
|
|
395
|
+
MultiSelect trigger: 32px tall, 14px text, a token-coloured chevron 10px in
|
|
396
|
+
from the right, 28px of right padding, hover and focus rings, dark mode from
|
|
397
|
+
the tokens. It stays a native select, so keyboard and screen readers work as
|
|
398
|
+
before. The rule sits in `@layer base`, so any rule of the app wins (plain CSS
|
|
399
|
+
and Tailwind utilities alike). `[multiple]` and `[size]` list boxes keep the
|
|
400
|
+
native look. A select with `appearance-none` in its classes (shadcn's
|
|
401
|
+
`NativeSelect`) draws its own arrow and is left alone. Setting
|
|
402
|
+
`appearance: none` or a `padding` shorthand in your own CSS takes the chevron or
|
|
403
|
+
its 28px gap away: draw your own arrow at least 10px from the edge, or leave
|
|
404
|
+
the base alone.
|
|
405
|
+
|
|
389
406
|
## In `vite.config.ts`
|
|
390
407
|
|
|
391
408
|
```ts
|
package/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
* in a page (or this export) says which SDK a deployed app actually runs.
|
|
33
33
|
* Kept in step with package.json by snapshot.test.mjs.
|
|
34
34
|
*/
|
|
35
|
-
export const SDK_VERSION = "2.11.
|
|
35
|
+
export const SDK_VERSION = "2.11.1";
|
|
36
36
|
if (typeof window !== "undefined") {
|
|
37
37
|
try {
|
|
38
38
|
window.__MAKO_APP_SDK__ = SDK_VERSION;
|
package/package.json
CHANGED
package/ui.css
CHANGED
|
@@ -45,6 +45,48 @@ button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
|
|
|
45
45
|
*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/* ---- Native <select> ------------------------------------------------------
|
|
49
|
+
* macOS draws the native dropdown arrow flush against the right border, so
|
|
50
|
+
* every unstyled <select> looked broken. The base takes the arrow over: no
|
|
51
|
+
* native appearance, a chevron in the --muted-foreground token 10px in from
|
|
52
|
+
* the right edge, 28px of right padding so the text never runs under it, and
|
|
53
|
+
* the MultiSelect trigger's box (32px, 14px text, border, radius, shadow).
|
|
54
|
+
* Tokens carry it into dark mode.
|
|
55
|
+
*
|
|
56
|
+
* It lives in @layer base so the app always wins: unlayered app CSS beats any
|
|
57
|
+
* layered rule, and Tailwind v4 utilities sit in a later layer. Inside base it
|
|
58
|
+
* outranks Tailwind's preflight. List boxes ([multiple], [size]) keep the
|
|
59
|
+
* native look. A select with appearance-none in its classes (shadcn's
|
|
60
|
+
* NativeSelect) draws its own arrow and is left alone.
|
|
61
|
+
*/
|
|
62
|
+
@layer base {
|
|
63
|
+
select:not([multiple], [size], [class*="appearance-none"]) {
|
|
64
|
+
appearance: none;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
height: 32px;
|
|
67
|
+
padding: 0 28px 0 12px;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
color: var(--foreground);
|
|
70
|
+
background-color: var(--background);
|
|
71
|
+
background-image:
|
|
72
|
+
linear-gradient(45deg, transparent calc(50% - 1px), var(--muted-foreground) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 1px)),
|
|
73
|
+
linear-gradient(135deg, transparent calc(50% - 1px), var(--muted-foreground) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 1px));
|
|
74
|
+
background-position: right 15px center, right 10px center;
|
|
75
|
+
background-size: 5px 5px;
|
|
76
|
+
background-repeat: no-repeat;
|
|
77
|
+
border: 1px solid var(--border);
|
|
78
|
+
border-radius: var(--mk-radius-md);
|
|
79
|
+
box-shadow: var(--mk-shadow-xs);
|
|
80
|
+
transition: background-color .15s var(--mk-ease), border-color .15s var(--mk-ease);
|
|
81
|
+
}
|
|
82
|
+
select:not([multiple], [size], [class*="appearance-none"]):hover:not(:disabled) { background-color: var(--accent); }
|
|
83
|
+
select:not([multiple], [size], [class*="appearance-none"]):focus-visible { outline: none; border-color: var(--ring); box-shadow: var(--mk-ring-focus); }
|
|
84
|
+
select:not([multiple], [size], [class*="appearance-none"]):disabled { cursor: not-allowed; opacity: .5; }
|
|
85
|
+
@media (max-width: 640px) {
|
|
86
|
+
select:not([multiple], [size], [class*="appearance-none"]) { height: 38px; }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
48
90
|
/* ---- Tones --------------------------------------------------------------- */
|
|
49
91
|
.mk-dot { display: inline-block; width: 6px; height: 6px; border-radius: 999px; flex-shrink: 0; background: var(--muted-foreground); }
|
|
50
92
|
.mk-dot.mk-tone-ok { background: var(--positive); }
|
|
@@ -202,18 +244,14 @@ button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
|
|
|
202
244
|
.mk-dt-foot b { font-weight: 500; color: var(--foreground); font-variant-numeric: tabular-nums; }
|
|
203
245
|
.mk-dt-nav { display: flex; align-items: center; gap: 4px; }
|
|
204
246
|
.mk-dt-nav .mk-btn { width: 28px; padding: 0; }
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
background: var(--background); border: 1px solid var(--border); border-radius: var(--mk-radius-md); box-shadow: var(--mk-shadow-xs);
|
|
208
|
-
}
|
|
209
|
-
.mk-dt-size:focus-visible { outline: none; border-color: var(--ring); box-shadow: var(--mk-ring-focus); }
|
|
247
|
+
/* The rows-per-page select takes its look from the native <select> base above. */
|
|
248
|
+
.mk-dt-size { margin-right: 8px; }
|
|
210
249
|
.mk-dt-page { padding: 0 6px; font-variant-numeric: tabular-nums; }
|
|
211
250
|
@media (max-width: 640px) {
|
|
212
251
|
/* Phones: the page scrolls as usual and the table keeps a scroll box of its own. */
|
|
213
252
|
.mk-dt--fill { height: auto; }
|
|
214
253
|
.mk-dt--fill .mk-dt-scroll { max-height: 70vh; }
|
|
215
254
|
.mk-dt-nav .mk-btn { width: 38px; }
|
|
216
|
-
.mk-dt-size { height: 38px; }
|
|
217
255
|
}
|
|
218
256
|
|
|
219
257
|
/* ---- MultiSelect --------------------------------------------------------- */
|
package/ui.d.ts
CHANGED
|
@@ -256,7 +256,7 @@ export interface DataTableProps<R = any> {
|
|
|
256
256
|
*/
|
|
257
257
|
resetKey?: unknown;
|
|
258
258
|
pageSize?: number;
|
|
259
|
-
/** Default 50. */
|
|
259
|
+
/** Default 50. `defaultPageSize={100}` opens on 100 rows; a size outside `pageSizes` is added to the select. */
|
|
260
260
|
defaultPageSize?: number;
|
|
261
261
|
onPageSizeChange?: (size: number) => void;
|
|
262
262
|
/** Default [25, 50, 100]; one entry hides the select. */
|
package/ui.js
CHANGED
|
@@ -401,6 +401,8 @@ export function DataTable({
|
|
|
401
401
|
const [sort, setSort] = useControlled(sortProp, defaultSort, onSortChange);
|
|
402
402
|
const [rawPage, setRawPage] = useControlled(pageProp, 1, onPageChange);
|
|
403
403
|
const [pageSize, setPageSize] = useControlled(pageSizeProp, defaultPageSize, onPageSizeChange);
|
|
404
|
+
// A page size outside the list (defaultPageSize={200}) still shows as the selected option.
|
|
405
|
+
const sizeOptions = pageSizes.includes(pageSize) ? pageSizes : [...pageSizes, pageSize].sort((a, b) => a - b);
|
|
404
406
|
const [note, setNote] = React.useState(null);
|
|
405
407
|
const scrollRef = React.useRef(null);
|
|
406
408
|
|
|
@@ -553,7 +555,7 @@ export function DataTable({
|
|
|
553
555
|
goTo(1);
|
|
554
556
|
},
|
|
555
557
|
},
|
|
556
|
-
...
|
|
558
|
+
...sizeOptions.map(n => h("option", { key: n, value: n }, `${n} per page`)),
|
|
557
559
|
),
|
|
558
560
|
h(Button, { size: "sm", "aria-label": "First page", disabled: page <= 1, onClick: () => goTo(1) }, "«"),
|
|
559
561
|
h(Button, { size: "sm", "aria-label": "Previous page", disabled: page <= 1, onClick: () => goTo(page - 1) }, "‹"),
|