@coolms/ui-react 0.1.0-alpha.13 → 0.1.0-alpha.14
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/CHANGELOG.md +8 -0
- package/dist/components/Fields.d.ts +48 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +851 -786
- package/package.json +1 -1
- package/src/kit.css +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@coolms/ui-react` are listed here. Versions follow [semantic versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## 0.1.0-alpha.14 (2026-11-18)
|
|
6
|
+
|
|
7
|
+
Number, date and time fields, and a field of several lines, for forms the server declares.
|
|
8
|
+
|
|
9
|
+
- `TextField`: `type` adds `number`, `date`, `time` and `datetime-local`, native inputs, so a phone shows its own keyboard or picker and assistive technology reads them as what they are. The server's constraints are the input's own: `min`, `max`, `step`, `minLength`, `maxLength` and `required`. A number with a fractional or `any` step asks for the decimal keyboard. `locale` (the person's) is the input's language, and a read-only or pinned date or time is written out in it as the wall-clock value it is, with its ISO value in `data-value`; a value naming no real date or time is shown as given. While a date or time is edited, the device's picker shows the browser's own format.
|
|
10
|
+
- `writtenOut(type, value, locale)`: the same writing out, for a host.
|
|
11
|
+
- `TextArea`: several lines in the text field's frame and states, with `rows`, `minLength`, `maxLength`, `required` and `locale`.
|
|
12
|
+
|
|
5
13
|
## 0.1.0-alpha.13 (2026-11-17)
|
|
6
14
|
|
|
7
15
|
The viewer's side arrows say where they go, and the next one stands clear of the scrollbar.
|
|
@@ -9,11 +9,32 @@ interface FieldFrame {
|
|
|
9
9
|
/** Shown, focusable and copyable, but not changed here. */
|
|
10
10
|
readonly readOnly?: boolean;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
/** The native kinds of one line: each brings the device's own keyboard or picker and its accessibility. */
|
|
13
|
+
export type TextFieldType = 'text' | 'email' | 'url' | 'search' | 'tel' | 'password' | 'number' | 'date' | 'time' | 'datetime-local';
|
|
14
|
+
/** What the server declares about a value: its bounds, its step and its length. */
|
|
15
|
+
interface Constraints {
|
|
16
|
+
/** The least value: a number, or an ISO date or time for the date and time types. */
|
|
17
|
+
readonly min?: string | number;
|
|
18
|
+
/** The greatest value, as `min`. */
|
|
19
|
+
readonly max?: string | number;
|
|
20
|
+
/** The step between values (`any` for none): seconds for `time` and `datetime-local`, days for `date`. */
|
|
21
|
+
readonly step?: number | 'any';
|
|
22
|
+
readonly minLength?: number;
|
|
23
|
+
readonly maxLength?: number;
|
|
24
|
+
/** A value is needed: marked for assistive technology, and checked by the browser on submit. */
|
|
25
|
+
readonly required?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TextFieldProps extends FieldFrame, Constraints {
|
|
28
|
+
/** The value as the input holds it: digits for `number`, ISO for the date and time types (`2026-11-18`, `14:30`, `2026-11-18T14:30`). */
|
|
13
29
|
readonly value: string;
|
|
14
30
|
readonly onChange?: (value: string) => void;
|
|
15
31
|
readonly placeholder?: string;
|
|
16
|
-
readonly type?:
|
|
32
|
+
readonly type?: TextFieldType;
|
|
33
|
+
/**
|
|
34
|
+
* The person's locale (BCP 47, from their settings): the field's language, and how a read-only or pinned date or
|
|
35
|
+
* time is written out. An editable date or time is the device's own picker.
|
|
36
|
+
*/
|
|
37
|
+
readonly locale?: string;
|
|
17
38
|
/**
|
|
18
39
|
* The value is set by the environment, not here (a pinned setting): shown read-only with why, the way the admin
|
|
19
40
|
* shows a key the deployment pins.
|
|
@@ -21,8 +42,31 @@ export interface TextFieldProps extends FieldFrame {
|
|
|
21
42
|
readonly pinned?: ReactNode;
|
|
22
43
|
readonly name?: string;
|
|
23
44
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
45
|
+
/**
|
|
46
|
+
* A date or time value written out in a locale, as the wall-clock value it is (no time zone is applied); the value
|
|
47
|
+
* itself when it is not one the type holds, or names no real date or time (a 30 February, a 25th hour).
|
|
48
|
+
*/
|
|
49
|
+
export declare function writtenOut(type: TextFieldType, value: string, locale: string | undefined): string;
|
|
50
|
+
/**
|
|
51
|
+
* One line of text (contract component `text-field`: default, focused, disabled, read-only, invalid, pinned), of any
|
|
52
|
+
* native kind: a number, a date, a time or both bring the device's keyboard or picker. The server's constraints are the
|
|
53
|
+
* input's own (`min`, `max`, `step`, `minlength`, `maxlength`, `required`). A date or time that is read-only or pinned
|
|
54
|
+
* is written out in the person's locale, and keeps its ISO value in `data-value`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function TextField({ label, help, error, disabled, readOnly, pinned, value, onChange, placeholder, type, name, locale, min, max, step, minLength, maxLength, required }: TextFieldProps): ReactNode;
|
|
57
|
+
export interface TextAreaProps extends FieldFrame, Pick<Constraints, 'minLength' | 'maxLength' | 'required'> {
|
|
58
|
+
readonly value: string;
|
|
59
|
+
readonly onChange?: (value: string) => void;
|
|
60
|
+
readonly placeholder?: string;
|
|
61
|
+
/** The lines it shows before it scrolls (4 by default); the person may make it taller. */
|
|
62
|
+
readonly rows?: number;
|
|
63
|
+
/** The person's locale (BCP 47): the field's language, for spelling and the input method. */
|
|
64
|
+
readonly locale?: string;
|
|
65
|
+
readonly pinned?: ReactNode;
|
|
66
|
+
readonly name?: string;
|
|
67
|
+
}
|
|
68
|
+
/** Several lines of text: the text field's frame and states (`text-field`), with the server's length and need. */
|
|
69
|
+
export declare function TextArea({ label, help, error, disabled, readOnly, pinned, value, onChange, placeholder, rows, name, locale, minLength, maxLength, required }: TextAreaProps): ReactNode;
|
|
26
70
|
export interface SelectOption {
|
|
27
71
|
readonly value: string;
|
|
28
72
|
readonly label: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Button, type ButtonProps } from './components/Button';
|
|
2
|
-
export { TextField, Select, Toggle, type TextFieldProps, type SelectProps, type SelectOption, type ToggleProps } from './components/Fields';
|
|
2
|
+
export { TextField, TextArea, Select, Toggle, writtenOut, type TextFieldProps, type TextFieldType, type TextAreaProps, type SelectProps, type SelectOption, type ToggleProps } from './components/Fields';
|
|
3
3
|
export { Modal, ConfirmDialog, MODAL_CLOSE_MS, type ModalProps, type ConfirmDialogProps } from './components/Dialogs';
|
|
4
4
|
export { Toast, ToastRegion, Loading, EmptyState, ErrorBanner, type ToastProps, type LoadingProps, type EmptyStateProps, type ErrorBannerProps } from './components/Status';
|
|
5
5
|
export { State, STATE_DELAY_MS, type StateKind, type StatePlacement, type StateProps } from './components/State';
|