@xeplr/ui-utils 1.1.5 → 1.1.7
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 +5 -1
- package/package.json +1 -1
- package/src/dateField/designs/dateField.css +5 -0
- package/src/dateRange/designs/dateRange.css +1 -0
- package/src/dropdown/designs/dropdown.css +7 -0
- package/src/gridDisplayer/designs/gridDisplayer.css +1 -1
- package/src/imports/designs/imports.css +1 -1
- package/src/numberField/designs/numberField.css +5 -0
- package/src/optionSources/optionSources.js +8 -2
- package/src/panel/designs/panel.css +6 -0
- package/src/rangeField/designs/rangeField.css +1 -1
- package/src/textField/designs/textField.css +5 -0
package/README.md
CHANGED
|
@@ -522,7 +522,7 @@ await sources.fetchSuggestions('procedureParams', { connectionId, procedure })
|
|
|
522
522
|
|
|
523
523
|
- **A kind nobody configured** is `has() === false`: show a text box. An empty dropdown looks broken.
|
|
524
524
|
- **`where`** keeps only rows with those values, e.g. `{ connectionType: 'api' }`: sent to the server as query values and checked again in the browser.
|
|
525
|
-
- **`key`** names the list in a hand-written endpoint's answer (default `dataArray`). Guessing
|
|
525
|
+
- **`key`** names the list in a hand-written endpoint's answer (default `dataArray`); an answer that is itself a list is read as one. Guessing the key wrong would show an empty list and no error.
|
|
526
526
|
- **Pure, no React, no login of its own:** the host passes its own fetch.
|
|
527
527
|
|
|
528
528
|
## `fieldLabel`
|
|
@@ -570,6 +570,10 @@ These create their own DOM nodes with inline styles, so they need no provider, m
|
|
|
570
570
|
| `IMPORT_HISTORY_RULES` | nothing |
|
|
571
571
|
| `DROPPED_ROWS_RULES` | `#xeplr-dropped-rows-copy`, `#xeplr-dropped-rows-download`, `#xeplr-dropped-rows-close` — checked when the dialog opens, since it is not on the page before |
|
|
572
572
|
|
|
573
|
+
## On a phone
|
|
574
|
+
|
|
575
|
+
Below 640px wide every text, number and date input, and a dropdown's trigger and search box, is at least **16px** — smaller makes iOS zoom the whole page when the field is focused (a text field keeps a larger `--xeplr-input-text-font-size` if the theme sets one). A dropdown's trigger is 44px tall. A panel field puts its label above the control instead of in a 112px column. Nothing has a fixed width that can push a 360px page sideways: the grid's cards, the import pickers, the date-range box and the range field all shrink to the space they have. Nothing changes above 640px.
|
|
576
|
+
|
|
573
577
|
## Theming
|
|
574
578
|
|
|
575
579
|
The designs use `xeplr-*` class prefixes (`xeplr-dropdown-*`, `xeplr-daterange-*`, `xeplr-rangefield-*`, `xeplr-datefield-*`, `xeplr-numberfield-*`, `xeplr-textfield-*`, `xeplr-upload-*`, `xeplr-data-import-*`, `xeplr-import-history-*`, `xeplr-grid-*`, `xeplr-colorpicker-*`, `xeplr-panel-*`, `xeplr-expander-*`, `xeplr-tree-*`). The progress notifier uses `xpn`, `xpn--running` / `--complete` / `--error`, `xpn-bar` and `xpn-text`. What each design reads:
|
package/package.json
CHANGED
|
@@ -224,3 +224,10 @@
|
|
|
224
224
|
color: var(--xeplr-accent, #9fb2ff);
|
|
225
225
|
font-weight: 700;
|
|
226
226
|
}
|
|
227
|
+
|
|
228
|
+
/* On a phone: a target a thumb can hit, and text large enough that iOS does
|
|
229
|
+
not zoom the page when the search box inside is focused. */
|
|
230
|
+
@media (max-width: 640px) {
|
|
231
|
+
.xeplr-dropdown-trigger { min-height: 44px; font-size: 16px; }
|
|
232
|
+
.xeplr-dropdown-search-input { font-size: 16px; }
|
|
233
|
+
}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
.xeplr-grid {
|
|
49
49
|
display: grid;
|
|
50
|
-
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
50
|
+
grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
|
|
51
51
|
gap: 16px;
|
|
52
52
|
/* room for hovered tiles to scale up without clipping against the container edge */
|
|
53
53
|
padding: 6px;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
margin-bottom: 12px; padding: 10px 12px; border-radius: 6px; font-size: 13px;
|
|
14
14
|
background: var(--xeplr-danger-bg, #3d1111); color: var(--xeplr-danger, #ff6b6b); border: 1px solid var(--xeplr-danger-border, #5a1a1a);
|
|
15
15
|
}
|
|
16
|
-
.xeplr-imports-pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
|
|
16
|
+
.xeplr-imports-pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
|
|
17
17
|
.xeplr-imports-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--xeplr-text-secondary, #999); }
|
|
18
18
|
.xeplr-imports-field select {
|
|
19
19
|
padding: 9px 10px; border-radius: 6px; font-size: 14px; font-family: inherit;
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
function whereQuery(src) {
|
|
27
27
|
return Object.entries(src.where || {}).map(([k, v]) => `&${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join('')
|
|
28
28
|
}
|
|
29
|
+
// The list in an answer: under `key` (default dataArray), or the answer
|
|
30
|
+
// itself when it IS a list — the auth service's /admin/roles answers so.
|
|
31
|
+
function listOf(res, src) {
|
|
32
|
+
if (Array.isArray(res)) return res
|
|
33
|
+
return (res && res[src.key || 'dataArray']) || []
|
|
34
|
+
}
|
|
29
35
|
function matchesWhere(src, row) {
|
|
30
36
|
return Object.entries(src.where || {}).every(([k, v]) => row[k] === v)
|
|
31
37
|
}
|
|
@@ -50,7 +56,7 @@ export function createOptionSources(sources, fetchJson) {
|
|
|
50
56
|
// `dataArray` is what a generic route answers; a hand-written endpoint
|
|
51
57
|
// answers with its own key, which the host names. Guessing wrong would
|
|
52
58
|
// give an empty list and no error, which reads as "you have none".
|
|
53
|
-
const rows = (res
|
|
59
|
+
const rows = listOf(res, src)
|
|
54
60
|
return rows
|
|
55
61
|
.filter((r) => matchesWhere(src, r))
|
|
56
62
|
.filter((r) => (filter && filter.clientKey ? r[filter.clientKey] === filter.value : true))
|
|
@@ -69,7 +75,7 @@ export function createOptionSources(sources, fetchJson) {
|
|
|
69
75
|
if (pairs.some(([, v]) => v === undefined || v === null || v === '')) return []
|
|
70
76
|
const q = pairs.map(([k, v]) => `&${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join('')
|
|
71
77
|
const res = await fetchJson(`${src.url}?limit=0${q}`)
|
|
72
|
-
const list = (res
|
|
78
|
+
const list = listOf(res, src)
|
|
73
79
|
return list.map((o) => String(o[src.value || 'value'])).filter(Boolean)
|
|
74
80
|
}
|
|
75
81
|
|
|
@@ -70,3 +70,9 @@
|
|
|
70
70
|
padding: 14px; border-top: 1px solid var(--xeplr-border-secondary, #eef0f4);
|
|
71
71
|
display: flex; flex-direction: column; gap: 12px;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/* On a phone the label goes above its control: a fixed 112px label column
|
|
75
|
+
leaves the control a sliver of a 360px screen. */
|
|
76
|
+
@media (max-width: 640px) {
|
|
77
|
+
.xeplr-panel-field { grid-template-columns: minmax(0, 1fr); gap: 6px; }
|
|
78
|
+
}
|
|
@@ -90,3 +90,8 @@ textarea.xeplr-textfield-input { resize: vertical; min-height: 64px; }
|
|
|
90
90
|
}
|
|
91
91
|
.xeplr-textfield-error { color: var(--xeplr-input-text-invalid-color, #c2372e); }
|
|
92
92
|
.xeplr-textfield-count { color: var(--xeplr-input-text-label-color, #6b6a63); text-align: right; }
|
|
93
|
+
|
|
94
|
+
/* On a phone: under 16px, iOS zooms the whole page when the field is focused. */
|
|
95
|
+
@media (max-width: 640px) {
|
|
96
|
+
.xeplr-textfield-input { font-size: max(16px, var(--xeplr-input-text-font-size, 12.5px)); }
|
|
97
|
+
}
|