@xeplr/ui-utils 1.1.6 → 1.1.8

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 CHANGED
@@ -95,7 +95,7 @@ export default function SelectCompany() {
95
95
  | `RangeFieldPage` | [see below](#rangefieldpage) | A From and a To date input drawn as one field, each bounded by the other |
96
96
  | `DateFieldPage` | [see below](#datefieldpage) | Date, datetime, or date of birth with the age computed |
97
97
  | `NumberFieldPage` | [see below](#numberfieldpage) | Float, currency or units input with an affix picker |
98
- | `TextFieldPage` | [see below](#textfieldpage) | Text, multiline or search input, themed by `--xeplr-input-text-*` |
98
+ | `TextFieldPage` | [see below](#textfieldpage) | Text, multiline, search or password input, themed by `--xeplr-input-text-*` |
99
99
  | `FileUploadPage` | [see below](#fileuploadpage) | Drag-and-drop upload with type and size checks and a progress bar |
100
100
  | `ImportsPage` | [see below](#importspage) | The whole import screen against `@xeplr/imports`: database picker, import, progress, history |
101
101
  | `DataImportPage` | [see below](#dataimportpage) | Upload a file, map its parts to targets, commit |
@@ -128,7 +128,8 @@ export default function SelectCompany() {
128
128
  | `useColorPickerController(props)` | ColorPickerPage props | `label, value, hex, opacity, swatches [{color, selected}], custom, allowNone, allowOpacity, previewText, pick(hex), setOpacity(0–100), clear` |
129
129
  | `useExpandersController(props)` | ExpandersPage props | `items` (each with `open`), `toggle(key)` |
130
130
  | `useSettingsTreeController(props)` | SettingsTreePage props | `nodes` (each with `open`, `depth`, `parentKey`, `children`), `toggle(parentKey, key)` |
131
- | `useDesignValidator(name, rules)` | page name, rule list | a ref for the design's container |
131
+ | `useDesignValidator(name, rules)` | page name, rule list | a ref for the design's container (reports, lets it load) |
132
+ | `useDesignCheck(rules, state)` | rule list (with `when`), the state `when` reads | `{ ref, missing }`: render an error instead of the design while `missing` is not empty |
132
133
 
133
134
  ### Model functions (no React)
134
135
 
@@ -144,7 +145,7 @@ export default function SelectCompany() {
144
145
  | `RANGE_TYPES`, `emptyRange`, `normalizeRange`, `rangeIsSet` | `['date','datetime']`, `() → {from:'',to:''}`, `(r) → {from,to}`, `(r) → boolean` | From/to helpers. A range with one side set counts as set. |
145
146
  | `DATE_TYPES`, `isValidISODate`, `calculateAge`, `inputTypeFor`, `toInputValue`, `validateBounds` | `['date','datetime','age']`, `(s)`, `(dob, now?)`, `(type)`, `(value, type)`, `(value, min, max) → { valid, error? }` | Date field helpers |
146
147
  | `NUMBER_TYPES`, `sanitizeNumberInput`, `toNumeric`, `formatDisplay`, `validateRange`, `resolveAffixState` | `['float','currency','units']`, `(raw)`, `(raw) → number \| null`, `(value, decimals?)`, `(value, min, max) → { valid, error? }`, `(type, options)` | Number field helpers. `sanitizeNumberInput` keeps digits, the first `.`, and a leading `-`. |
147
- | `TEXT_TYPES`, `toValue`, `normalise`, `validate`, `remaining` | `['text','multiline','search']`, `(raw) → string`, `(raw, { trim, maxLength })`, `(raw, { required, requiredMessage, minLength, maxLength, pattern, patternMessage }) → string \| null`, `(raw, maxLength) → number \| null` | Text field helpers |
148
+ | `TEXT_TYPES`, `toValue`, `normalise`, `validate`, `remaining` | `['text','multiline','search','password']`, `(raw) → string`, `(raw, { trim, maxLength })`, `(raw, { required, requiredMessage, minLength, maxLength, pattern, patternMessage }) → string \| null`, `(raw, maxLength) → number \| null` | Text field helpers |
148
149
  | `DROPDOWN_MODES`, `normalizeKeys`, `sortByKey`, `filterByQuery`, `pickSelected` | `['single','multi']`, `(keys) → { id, name, extras }`, `(items, key)`, `(items, query, searchKeys)`, `(items, ids, idKey)` | Dropdown helpers |
149
150
  | `DEFAULT_SWATCHES`, `parseColor`, `formatColor`, `sameHue` | `[hex]`, `(css) → { hex, opacity } \| null`, `(hex, opacity) → css \| null`, `(a, b) → boolean` | Colour helpers. Opacity 100 writes `#RRGGBB`; anything less writes `#RRGGBBAA`. |
150
151
  | `toggleOpen`, `initialOpen` | `(open, key, multiple?) → keys`, `(items, initial?, multiple?) → keys` | Which expanders are open |
@@ -226,6 +227,7 @@ url.set({ widget: id, drawer: null })
226
227
  | `onClose` | `() => void` | — | Called after a choice that ends the interaction: a preset, a suggestion, Apply (or Enter) in Range or Single, or Clear |
227
228
  | `presets` | `[{ key, label }]` | `QUICK_PRESETS` | The Quick list. Only keys that `resolveQuickPreset` knows will resolve. |
228
229
  | `allowClear` | `boolean` | `true` | `false` removes the Clear button, and `clear()` refuses too |
230
+ | `withTime` | `boolean` | `false` | The Range tab's From and To take a time too (`datetime-local`, `"2026-11-12T09:30"`), for what is read by the minute, such as a log. The label reads `2026-11-12 09:30 → …`; From after To is caught to the minute. Presets and Single still name whole days |
229
231
  | `inheritedLabel` | `string` | — | Shows "Using …" when `value` is empty |
230
232
 
231
233
  **Every selection resolves to `{ from, to }`, including a single date.** "May 2022" becomes 1–31 May and "2022" becomes the whole year, so a consumer never has to ask which comparison was meant. **The Range tab is applied, not taken as you type.** A browser date input holds a complete date while a year is half typed (`2` is `0002-01-01`), so committing each edit ran the host's query for the year 2. The inputs edit a draft, and `onChange` fires once, on **Apply** or Enter. Apply is disabled until the draft is valid (`rangeProblem`: something chosen, From not after To) and differs from what is applied. One open side is allowed. The Single tab commits only once the text parses ("Not a date yet" otherwise), on blur, Enter or Apply. While you type, it suggests months and years, putting the committed year first. The financial-year presets use `fiscalStartMonth` (default April). The page itself does not pass that option, so change it by calling `resolveDateValue(value, now, { fiscalStartMonth })` where you consume the value.
@@ -275,7 +277,7 @@ The input is `type="text" inputMode="decimal"`. Typing is sanitised. An affix li
275
277
 
276
278
  | prop | type | default | meaning |
277
279
  |---|---|---|---|
278
- | `type` | `'text' \| 'multiline' \| 'search'` | `'text'` | Any other value throws |
280
+ | `type` | `'text' \| 'multiline' \| 'search' \| 'password'` | `'text'` | `'password'` is masked. Any other value throws |
279
281
  | `value` / `defaultValue` | `string` | — | Controlled / uncontrolled. `null` and `undefined` become `''`. |
280
282
  | `onChange` | `(value) => void` | — | Every keystroke |
281
283
  | `onCommit` | `(value) => void` | — | On blur, or Enter in a single-line field, after `trim` / `maxLength` are applied |
@@ -552,6 +554,22 @@ These create their own DOM nodes with inline styles, so they need no provider, m
552
554
 
553
555
  `useDesignValidator(name, rules)` returns a ref. After mount it checks, **once**, that the container has each required element. A rule is `{ id | role | selector | anyOf: [selectors], label }`. For every rule that fails it logs `[xeplr-ui-utils] <name> design is missing required elements: …` with `console.error`, and it sets `data-xeplr-design-invalid="<name>"` and a `title` on the container.
554
556
 
557
+ ### A design that must not load without its controls: `useDesignCheck`
558
+
559
+ `useDesignValidator` reports and lets the design load. For a page whose design must **not** load without its controls (a sign-in without a password box, a monitor without its Restart button), use `useDesignCheck(rules, state)`:
560
+
561
+ ```jsx
562
+ import { useDesignCheck } from '@xeplr/ui-utils'
563
+
564
+ const check = useDesignCheck(LOGIN_RULES, controller)
565
+ if (check.missing.length) return <Broken missing={check.missing} /> // your own error view
566
+ return <div ref={check.ref}><Design {...controller} /></div>
567
+ ```
568
+
569
+ - Rules are the same shapes as above, plus **`when(state)`**: checked only while it holds (`{ selector: '#code', label: 'Code input', when: (c) => c.needsCode }`).
570
+ - Checked after **every** render, since `when` depends on what is open. Once something is missing it stays missing, and the page shows the error rather than a design that half works.
571
+ - `missingFrom(root, rules, state)` is the same check with no React: the labels of the broken rules.
572
+
555
573
  | rules | require |
556
574
  |---|---|
557
575
  | `DROPDOWN_RULES` | `.xeplr-dropdown-trigger` or `[role="combobox"]`; `.xeplr-dropdown-panel` or `[role="listbox"]` |
@@ -559,7 +577,7 @@ These create their own DOM nodes with inline styles, so they need no provider, m
559
577
  | `RANGE_FIELD_RULES` | `.xeplr-rangefield-field` |
560
578
  | `DATE_FIELD_RULES` | `input[type="date"]`, `input[type="datetime-local"]` or `.xeplr-datefield-input` |
561
579
  | `NUMBER_FIELD_RULES` | `input[inputmode="decimal"]` or `input.xeplr-numberfield-input` |
562
- | `TEXT_FIELD_RULES` | a text or search input, a `textarea`, or `.xeplr-textfield-input` |
580
+ | `TEXT_FIELD_RULES` | a text, search or password input, a `textarea`, or `.xeplr-textfield-input` |
563
581
  | `FILE_UPLOAD_RULES` | `input[type="file"]`; `.xeplr-upload-dropzone` or `[role="dropzone"]`; a `button` |
564
582
  | `IMPORTS_RULES` | `#xeplr-imports-connection`, `#xeplr-imports-database` |
565
583
  | `DATA_IMPORT_RULES` | `input[type="file"]` |
@@ -570,6 +588,10 @@ These create their own DOM nodes with inline styles, so they need no provider, m
570
588
  | `IMPORT_HISTORY_RULES` | nothing |
571
589
  | `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
590
 
591
+ ## On a phone
592
+
593
+ 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.
594
+
573
595
  ## Theming
574
596
 
575
597
  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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeplr/ui-utils",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "UI utility components: file upload with progress, snackbar, static data (countries/states)",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -58,3 +58,8 @@
58
58
  font-size: 12px;
59
59
  color: #e25555;
60
60
  }
61
+
62
+ /* On a phone: under 16px, iOS zooms the whole page when the field is focused. */
63
+ @media (max-width: 640px) {
64
+ .xeplr-datefield-input { font-size: 16px; }
65
+ }
@@ -246,15 +246,18 @@ export function resolveDateValue(value, now, options) {
246
246
  return null
247
247
  }
248
248
 
249
+ // A range with times (DateRange withTime) reads "2026-11-12 09:30", not "…T09:30".
250
+ function shown(v) { return String(v).replace('T', ' ') }
251
+
249
252
  /** What the chip and the panel read. */
250
253
  export function dateValueLabel(value) {
251
254
  if (!value) return null
252
255
  if (value.kind === 'quick') return PRESET_LABEL.get(value.preset) || value.preset
253
256
  if (value.kind === 'single') return value.value || null
254
257
  if (value.kind === 'range') {
255
- if (value.from && value.to) return `${value.from} → ${value.to}`
256
- if (value.from) return `From ${value.from}`
257
- if (value.to) return `Until ${value.to}`
258
+ if (value.from && value.to) return `${shown(value.from)} → ${shown(value.to)}`
259
+ if (value.from) return `From ${shown(value.from)}`
260
+ if (value.to) return `Until ${shown(value.to)}`
258
261
  return null
259
262
  }
260
263
  return null
@@ -61,12 +61,12 @@ export default function DateRangeSample(props) {
61
61
  the year 2. Enter in either input applies too. */}
62
62
  <label className="xeplr-daterange-field">
63
63
  <span>From</span>
64
- <input type="date" value={props.range.from || ''} onChange={function(e) { props.setRangeFrom(e.target.value); }}
64
+ <input type={props.withTime ? 'datetime-local' : 'date'} value={props.range.from || ''} onChange={function(e) { props.setRangeFrom(e.target.value); }}
65
65
  onKeyDown={function(e) { if (e.key === 'Enter') { e.preventDefault(); props.applyRange(); } }} />
66
66
  </label>
67
67
  <label className="xeplr-daterange-field">
68
68
  <span>To</span>
69
- <input type="date" value={props.range.to || ''} onChange={function(e) { props.setRangeTo(e.target.value); }}
69
+ <input type={props.withTime ? 'datetime-local' : 'date'} value={props.range.to || ''} onChange={function(e) { props.setRangeTo(e.target.value); }}
70
70
  onKeyDown={function(e) { if (e.key === 'Enter') { e.preventDefault(); props.applyRange(); } }} />
71
71
  </label>
72
72
  {/* One-sided is legitimate — "everything since April" is a real
@@ -3,6 +3,7 @@
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  width: 260px;
6
+ max-width: 100%;
6
7
  background: var(--xeplr-surface, #fff);
7
8
  border: 1px solid var(--xeplr-border-strong, #c9cdd6);
8
9
  border-radius: 9px;
@@ -13,6 +13,9 @@ import { QUICK_PRESETS, parseSingleDate, dateValueLabel, singleDateSuggestions,
13
13
  * @param {boolean} [props.allowClear] - default true. Set false where an
14
14
  * empty selection is not a state the host can accept — a report bounded by
15
15
  * a date, say, for which "no date" means scanning all of history.
16
+ * @param {boolean} [props.withTime] - default false. The From/To of a range
17
+ * take a time too ("2026-11-12T09:30"), for what is read by the minute, such
18
+ * as a log. Presets and Single still name whole days.
16
19
  */
17
20
  export function useDateRangeController(props) {
18
21
  var value = props.value || null;
@@ -138,6 +141,7 @@ export function useDateRangeController(props) {
138
141
  commitSingle: commitSingle,
139
142
  clear: clear,
140
143
  allowClear: allowClear,
144
+ withTime: Boolean(props.withTime),
141
145
  inheritedLabel: props.inheritedLabel || null
142
146
  };
143
147
  }
@@ -13,6 +13,7 @@ export var DATE_RANGE_RULES = [
13
13
  '.xeplr-daterange-list button',
14
14
  '[data-xeplr-daterange-preset]',
15
15
  'input[type="date"]',
16
+ 'input[type="datetime-local"]',
16
17
  '.xeplr-daterange-input'
17
18
  ],
18
19
  label: 'A way to pick a date — a quick preset list, or a date input'
@@ -0,0 +1,48 @@
1
+ /**
2
+ * DesignCheck — model. Which required elements a rendered design is missing.
3
+ * Pure: it only calls querySelector on the root it is given.
4
+ *
5
+ * The BLOCKING check, for a page whose design must not load without its
6
+ * controls: the page renders an error naming what is missing INSTEAD of the
7
+ * design (useDesignCheck). useDesignValidator (fileUpload/validateDesign.js)
8
+ * is the other kind — it reports and lets the design load — and stays as it is.
9
+ *
10
+ * Rules take the same shapes as useDesignValidator's, plus `when`:
11
+ * { id: 'x-email', label: 'Email input' }
12
+ * { role: 'listbox', label: '…' }
13
+ * { selector: 'button[type="submit"]', label: '…' }
14
+ * { anyOf: ['#a', '#b'], label: '…' }
15
+ * { selector: '#x-code', label: '…', when: (c) => c.needsCode } // only while that holds
16
+ */
17
+
18
+ /** The selector a rule looks for, or a list of them for anyOf. */
19
+ export function ruleSelectors(rule) {
20
+ if (rule.id) return ['#' + rule.id];
21
+ if (rule.role) return ['[role="' + rule.role + '"]'];
22
+ if (rule.anyOf) return rule.anyOf.slice();
23
+ if (rule.selector) return [rule.selector];
24
+ return [];
25
+ }
26
+
27
+ /** Whether a rule is checked now: always, or while its `when(state)` holds. */
28
+ export function ruleApplies(rule, state) {
29
+ return !rule.when || Boolean(rule.when(state));
30
+ }
31
+
32
+ /** What a missing rule is called: its label and where it was looked for. */
33
+ export function ruleLabel(rule) {
34
+ var where = rule.id ? ' (id="' + rule.id + '")'
35
+ : rule.anyOf ? ' (one of: ' + rule.anyOf.join(', ') + ')'
36
+ : rule.selector ? ' (' + rule.selector + ')'
37
+ : rule.role ? ' (role="' + rule.role + '")' : '';
38
+ return rule.label + where;
39
+ }
40
+
41
+ /** The labels of the rules `root` breaks, given the page's `state` for `when`. [] when none. */
42
+ export function missingFrom(root, rules, state) {
43
+ if (!root) return [];
44
+ return (rules || []).filter(function(rule) {
45
+ if (!ruleApplies(rule, state)) return false;
46
+ return !ruleSelectors(rule).some(function(s) { return root.querySelector(s); });
47
+ }).map(ruleLabel);
48
+ }
@@ -0,0 +1,31 @@
1
+ import { useLayoutEffect, useRef, useState } from 'react';
2
+ import { missingFrom } from './designCheck.js';
3
+
4
+ /**
5
+ * DesignCheck — controller. Checks the design after EVERY render (rules with
6
+ * `when` depend on what is open), and once something is missing, keeps it
7
+ * missing: the page shows the error, not a design that half works.
8
+ *
9
+ * var check = useDesignCheck(LOGIN_RULES, controller)
10
+ * if (check.missing.length) return <MyBroken missing={check.missing} />
11
+ * return <div ref={check.ref}><Design {...controller} /></div>
12
+ *
13
+ * @param {Array} rules - see designCheck.js
14
+ * @param {any} state - what `when` is asked about (usually the controller)
15
+ * @returns {{ ref, missing: string[] }}
16
+ */
17
+ export function useDesignCheck(rules, state) {
18
+ var ref = useRef(null);
19
+ var missingState = useState([]);
20
+ var missing = missingState[0];
21
+ var setMissing = missingState[1];
22
+ useLayoutEffect(function() {
23
+ if (missing.length) return;
24
+ var m = missingFrom(ref.current, rules, state);
25
+ if (m.length) {
26
+ console.error('[xeplr-ui-utils] design is missing required elements:\n' + m.map(function(x) { return ' - ' + x; }).join('\n'));
27
+ setMissing(m);
28
+ }
29
+ });
30
+ return { ref: ref, missing: missing };
31
+ }
@@ -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;
package/src/index.js CHANGED
@@ -7,6 +7,12 @@ export { useFileUploadController } from './fileUpload/useFileUploadController.js
7
7
  // File Upload — design validation
8
8
  export { useDesignValidator, FILE_UPLOAD_RULES } from './fileUpload/validateDesign.js';
9
9
 
10
+ // DesignCheck — the BLOCKING design check: a page whose design lacks a
11
+ // required element renders an error naming it instead of the design. Rules
12
+ // as useDesignValidator's, plus `when(state)`; checked after every render.
13
+ export { missingFrom, ruleSelectors, ruleApplies, ruleLabel } from './designCheck/designCheck.js';
14
+ export { useDesignCheck } from './designCheck/useDesignCheck.js';
15
+
10
16
  // File Upload — sample design
11
17
  export { FileUploadSample } from './fileUpload/designs/index.js';
12
18
 
@@ -64,3 +64,8 @@
64
64
  font-size: 12px;
65
65
  color: #e25555;
66
66
  }
67
+
68
+ /* On a phone: under 16px, iOS zooms the whole page when the field is focused. */
69
+ @media (max-width: 640px) {
70
+ .xeplr-numberfield-input { font-size: 16px; }
71
+ }
@@ -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
+ }
@@ -10,7 +10,7 @@
10
10
  flex-direction: column;
11
11
  gap: 6px;
12
12
  flex: 1;
13
- min-width: 160px;
13
+ min-width: min(160px, 100%);
14
14
  }
15
15
  .xeplr-rangefield-label {
16
16
  font-size: 12px;
@@ -38,7 +38,7 @@ export default function TextFieldSample({
38
38
  ) : (
39
39
  <input
40
40
  className="xeplr-textfield-input"
41
- type={search ? 'search' : 'text'}
41
+ type={search ? 'search' : type === 'password' ? 'password' : 'text'}
42
42
  value={raw}
43
43
  placeholder={placeholder}
44
44
  disabled={disabled}
@@ -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
+ }
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * TextField — pure model. No React.
3
3
  *
4
- * The plain text input, and the two shapes that are the same control with a
5
- * different edge: a multi-line one and a search one. Kept together because
4
+ * The plain text input, and the shapes that are the same control with a
5
+ * different edge: a multi-line one, a search one, and a password one (masked). Kept together because
6
6
  * they are one thing to style — an app that wants a bottom-rule-only textbox
7
7
  * wants a bottom-rule-only search box too, and splitting them is how those
8
8
  * drift apart.
9
9
  */
10
10
 
11
- export var TEXT_TYPES = ['text', 'multiline', 'search'];
11
+ export var TEXT_TYPES = ['text', 'multiline', 'search', 'password'];
12
12
 
13
13
  /**
14
14
  * What the control accepts as a value. Anything nullish is the empty string:
@@ -3,7 +3,7 @@ import { toValue, normalise, validate, remaining, TEXT_TYPES } from './textField
3
3
 
4
4
  /**
5
5
  * @param {object} props
6
- * @param {'text'|'multiline'|'search'} [props.type='text']
6
+ * @param {'text'|'multiline'|'search'|'password'} [props.type='text']
7
7
  * @param {string} [props.value] — controlled
8
8
  * @param {string} [props.defaultValue] — uncontrolled initial
9
9
  * @param {(value) => void} [props.onChange]
@@ -1,3 +1,3 @@
1
1
  export var TEXT_FIELD_RULES = [
2
- { selector: 'input[type="text"], input[type="search"], textarea, .xeplr-textfield-input', label: 'Text input element' }
2
+ { selector: 'input[type="text"], input[type="search"], input[type="password"], textarea, .xeplr-textfield-input', label: 'Text input element' }
3
3
  ];