@makoai/app-sdk 2.11.0 → 2.12.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.
- package/README.md +97 -3
- package/data-core.js +45 -0
- package/index.d.ts +50 -1
- package/index.js +911 -73
- package/package.json +1 -1
- package/ui.css +44 -6
- package/ui.d.ts +1 -1
- package/ui.js +3 -1
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) }, "‹"),
|