viewkitjs 0.26.0 → 0.27.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/CHANGELOG.md +24 -0
- package/MIGRATION.md +84 -6
- package/package.json +1 -1
- package/views/dist/contract.d.ts +171 -1
- package/views/dist/contract.js +162 -0
- package/views/dist/controls/compound-editor/map-parts-body.js +2 -1
- package/views/dist/controls/compound-editor/name-parts.js +10 -2
- package/views/dist/controls/compound-editor/place.d.ts +2 -1
- package/views/dist/controls/compound-editor/place.js +2 -0
- package/views/dist/controls/controls.d.ts +8 -0
- package/views/dist/controls/controls.js +8 -0
- package/views/dist/controls/index.d.ts +16 -0
- package/views/dist/controls/index.js +16 -0
- package/views/dist/controls/internal/editor-parts.d.ts +40 -0
- package/views/dist/controls/internal/editor-parts.js +43 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +78 -0
- package/views/dist/controls/links-editor/links-editor.js +308 -0
- package/views/dist/controls/links-editor/links.d.ts +62 -0
- package/views/dist/controls/links-editor/links.js +50 -0
- package/views/dist/controls/links-editor/map-links-body.d.ts +10 -0
- package/views/dist/controls/links-editor/map-links-body.js +71 -0
- package/views/dist/controls/links-editor/tokens.d.ts +71 -0
- package/views/dist/controls/links-editor/tokens.js +20 -0
- package/views/dist/controls/links-editor/words.d.ts +56 -0
- package/views/dist/controls/links-editor/words.js +33 -0
- package/views/dist/controls/links-editor.css +132 -0
- package/views/dist/controls/number-editor/format.d.ts +31 -0
- package/views/dist/controls/number-editor/format.js +79 -0
- package/views/dist/controls/number-editor/looks.d.ts +14 -0
- package/views/dist/controls/number-editor/looks.js +17 -0
- package/views/dist/controls/number-editor/map-number-body.d.ts +16 -0
- package/views/dist/controls/number-editor/map-number-body.js +57 -0
- package/views/dist/controls/number-editor/number-editor.d.ts +72 -0
- package/views/dist/controls/number-editor/number-editor.js +202 -0
- package/views/dist/controls/number-editor/tokens.d.ts +28 -0
- package/views/dist/controls/number-editor/tokens.js +9 -0
- package/views/dist/controls/number-editor/words.d.ts +23 -0
- package/views/dist/controls/number-editor/words.js +13 -0
- package/views/dist/controls/number-editor.css +37 -0
- package/views/dist/controls/number-field/number-field.js +57 -5
- package/views/dist/controls/radio/radio.d.ts +33 -0
- package/views/dist/controls/radio/radio.js +19 -0
- package/views/dist/controls/radio/tokens.d.ts +127 -0
- package/views/dist/controls/radio/tokens.js +34 -0
- package/views/dist/controls/radio.css +104 -0
- package/views/dist/controls/text-editor/phone-number.d.ts +4 -0
- package/views/dist/controls/text-editor/phone-number.js +20 -0
- package/views/dist/controls/text-editor/text-editor.js +2 -19
- package/views/dist/controls/tokens.js +10 -0
- package/views/dist/controls/values-editor/looks.d.ts +16 -0
- package/views/dist/controls/values-editor/looks.js +19 -0
- package/views/dist/controls/values-editor/map-values-body.d.ts +12 -0
- package/views/dist/controls/values-editor/map-values-body.js +71 -0
- package/views/dist/controls/values-editor/tokens.d.ts +132 -0
- package/views/dist/controls/values-editor/tokens.js +35 -0
- package/views/dist/controls/values-editor/values-editor.d.ts +62 -0
- package/views/dist/controls/values-editor/values-editor.js +435 -0
- package/views/dist/controls/values-editor/values.d.ts +71 -0
- package/views/dist/controls/values-editor/values.js +59 -0
- package/views/dist/controls/values-editor/words.d.ts +50 -0
- package/views/dist/controls/values-editor/words.js +29 -0
- package/views/dist/controls/values-editor.css +207 -0
- package/views/dist/controls/views-list/looks.d.ts +13 -0
- package/views/dist/controls/views-list/looks.js +12 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +19 -0
- package/views/dist/controls/views-list/map-views-list-body.js +65 -0
- package/views/dist/controls/views-list/rules.d.ts +72 -0
- package/views/dist/controls/views-list/rules.js +4 -0
- package/views/dist/controls/views-list/tokens.d.ts +11 -0
- package/views/dist/controls/views-list/tokens.js +5 -0
- package/views/dist/controls/views-list/views-list.d.ts +44 -0
- package/views/dist/controls/views-list/views-list.js +57 -0
- package/views/dist/controls/views-list/words.d.ts +22 -0
- package/views/dist/controls/views-list/words.js +3 -0
- package/views/dist/controls/views-list.css +8 -0
- package/views/dist/editors/NumberEditor.js +3 -1
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridDateEditor.d.ts +3 -1
- package/views/dist/grid/chrome/GridDateEditor.js +2 -1
- package/views/dist/looks/index.d.ts +3 -0
- package/views/dist/looks/index.js +3 -0
- package/views/dist/looks/pieces.js +6 -0
- package/views/dist/provider/components.d.ts +4 -0
- package/views/dist/styles.css +432 -2
- package/views/dist/styles.unlayered.css +432 -2
- package/views/docs/contract.md +10 -8
- package/views/docs/controls/links-editor.md +25 -0
- package/views/docs/controls/number-editor.md +12 -0
- package/views/docs/controls/radio.md +39 -0
- package/views/docs/controls/values-editor.md +40 -0
- package/views/docs/controls/views-list.md +8 -0
- package/views/docs/reference/controls.md +117 -5
- package/views/docs/reference/looks.md +9 -2
- package/views/docs/reference/react.md +2 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { PickerWords } from "../picker/picker.js";
|
|
2
|
+
export interface LinksEditorWords {
|
|
3
|
+
/** The heading over the records to add, once linked records stand over them. */
|
|
4
|
+
add: string;
|
|
5
|
+
/** The phone's heading over the records to add, by the records' kind ("Add a company"). */
|
|
6
|
+
addKind: (kind: string) => string;
|
|
7
|
+
/** The records to add's name to a screen reader, by the field's. */
|
|
8
|
+
addTo: (label: string) => string;
|
|
9
|
+
/** A record to add's name to a screen reader, on a phone. */
|
|
10
|
+
linkName: (name: string) => string;
|
|
11
|
+
/** A link's Unlink, in its menu and on a phone's link's fields. */
|
|
12
|
+
unlink: string;
|
|
13
|
+
/** A row's ✕. */
|
|
14
|
+
unlinkName: (name: string) => string;
|
|
15
|
+
/** A link's menu row making it the lead, by the lead's word. */
|
|
16
|
+
setLead: (lead: string) => string;
|
|
17
|
+
/** A row's radio, and the phone's lead switch. */
|
|
18
|
+
isLead: (name: string, lead: string) => string;
|
|
19
|
+
/** A link's ⋯ on a phone. */
|
|
20
|
+
actionsFor: (name: string) => string;
|
|
21
|
+
/** The menu that ⋯ opens, by its record. */
|
|
22
|
+
linkMenu: (name: string) => string;
|
|
23
|
+
/** A link's settings button, with several fields. */
|
|
24
|
+
editLink: (name: string) => string;
|
|
25
|
+
/** A link's fields' ‹, back to the list. */
|
|
26
|
+
backTo: (label: string) => string;
|
|
27
|
+
/** A field's control on one link. */
|
|
28
|
+
fieldAt: (field: string, name: string) => string;
|
|
29
|
+
/** A field's list's search. */
|
|
30
|
+
searchField: (field: string) => string;
|
|
31
|
+
/** The search, before anything is typed, unless handed its own. */
|
|
32
|
+
search: string;
|
|
33
|
+
/** A list field holding nothing. */
|
|
34
|
+
none: string;
|
|
35
|
+
/** A link holding nothing, on a phone with several fields. */
|
|
36
|
+
noDetails: string;
|
|
37
|
+
yes: string;
|
|
38
|
+
no: string;
|
|
39
|
+
everythingLinked: string;
|
|
40
|
+
nothingMatches: string;
|
|
41
|
+
nothingMatchesTyped: (typed: string) => string;
|
|
42
|
+
/** The phone's link's fields' ✕ and ✓, and the Sheet head's ✕ and ✓ round the editor. */
|
|
43
|
+
close: string;
|
|
44
|
+
done: string;
|
|
45
|
+
save: string;
|
|
46
|
+
/** A list the editor finds: in flight, failed, its ask again, and more rows coming. */
|
|
47
|
+
searching: string;
|
|
48
|
+
failed: string;
|
|
49
|
+
retry: string;
|
|
50
|
+
loadingMore: string;
|
|
51
|
+
/** The roles list's own words (the Picker's). */
|
|
52
|
+
picker?: Partial<PickerWords>;
|
|
53
|
+
}
|
|
54
|
+
export declare const LINKS_EDITOR_WORDS: LinksEditorWords;
|
|
55
|
+
/** The words handed over the English. */
|
|
56
|
+
export declare const linksWords: (given?: Partial<LinksEditorWords>) => LinksEditorWords;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const a = (word) => (/^[aeiou]/i.test(word) ? "an" : "a");
|
|
2
|
+
export const LINKS_EDITOR_WORDS = {
|
|
3
|
+
add: "Add",
|
|
4
|
+
addKind: (kind) => `Add ${a(kind)} ${kind.toLowerCase()}`,
|
|
5
|
+
addTo: (label) => `Add to ${label}`,
|
|
6
|
+
linkName: (name) => `Link ${name}`,
|
|
7
|
+
unlink: "Unlink",
|
|
8
|
+
unlinkName: (name) => `Unlink ${name}`,
|
|
9
|
+
setLead: (lead) => `Set as ${lead.toLowerCase()}`,
|
|
10
|
+
isLead: (name, lead) => `${name} is the ${lead.toLowerCase()}`,
|
|
11
|
+
actionsFor: (name) => `Actions for ${name}`,
|
|
12
|
+
linkMenu: (name) => `the link to ${name}`,
|
|
13
|
+
editLink: (name) => `Edit the link to ${name}`,
|
|
14
|
+
backTo: (label) => `Back to ${label}`,
|
|
15
|
+
fieldAt: (field, name) => `${field} at ${name}`,
|
|
16
|
+
searchField: (field) => `Search ${field.toLowerCase()}…`,
|
|
17
|
+
search: "Search…",
|
|
18
|
+
none: "None",
|
|
19
|
+
noDetails: "No details",
|
|
20
|
+
yes: "Yes",
|
|
21
|
+
no: "No",
|
|
22
|
+
everythingLinked: "Everything is linked.",
|
|
23
|
+
nothingMatches: "Nothing matches.",
|
|
24
|
+
nothingMatchesTyped: (typed) => `Nothing matches “${typed}”.`,
|
|
25
|
+
close: "Close",
|
|
26
|
+
done: "Done",
|
|
27
|
+
save: "Save",
|
|
28
|
+
searching: "Searching…",
|
|
29
|
+
failed: "Couldn't search.",
|
|
30
|
+
retry: "Try again",
|
|
31
|
+
loadingMore: "Loading more…",
|
|
32
|
+
};
|
|
33
|
+
export const linksWords = (given) => (given ? { ...LINKS_EDITOR_WORDS, ...given } : LINKS_EDITOR_WORDS);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* The Links editor: what a record's links are edited in, in its Table form. Every value is a public name
|
|
2
|
+
(links-editor/tokens.ts). On a computer, what the Popover holds, as wide as the Popover is handed (480 with
|
|
3
|
+
one field on a link, 600 with several): the search across its top (popup-line.css), then one list scrolling as one, 10½ rows
|
|
4
|
+
of 32 at most: the columns' names in the smallest subtle words, standing while it scrolls; a row per linked record, 32 high (its
|
|
5
|
+
face 20 and its name, cut with "…", taking what is left and never under 152; a column per field, 12 apart: several 192, one 40,
|
|
6
|
+
yes or no 40; Lead 32; the last 24); a line, "Add" and the records to add on the list's rows (list.css). One field's short
|
|
7
|
+
button stands as wide as its words, its words where the column's name starts. A link's fields open as a step: a line on top
|
|
8
|
+
with ‹, the face and the name, a row per field (its name 64 wide, then its control), Unlink under them.
|
|
9
|
+
|
|
10
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
11
|
+
@layer components {
|
|
12
|
+
|
|
13
|
+
.o-links-editor { position: relative; display: flex; flex-direction: column; min-width: 0; color: var(--vk-fg); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
14
|
+
.o-links-editor:focus { outline: none; }
|
|
15
|
+
|
|
16
|
+
/* ── The search: the shared line across the popup's top, 6 above and below, 4 over the list ─ */
|
|
17
|
+
.o-links-editor-search { --popup-line-pad-block: calc(var(--vk-spacing) * 1.5); --popup-line-under: var(--vk-spacing); }
|
|
18
|
+
.o-links-editor-search > svg { flex: none; width: calc(var(--vk-spacing) * 3.75); height: calc(var(--vk-spacing) * 3.75); }
|
|
19
|
+
.o-input-control.o-links-editor-input { flex: 1; min-width: calc(var(--vk-spacing) * 16); font-size: var(--vk-font-size-sm); }
|
|
20
|
+
|
|
21
|
+
/* ── The one list: 10½ rows at most, scrolling as one ─ */
|
|
22
|
+
/* It scrolls with no bar at all (Mihai, 18 Nov 2026): the browser's own, which macOS draws taking room with a mouse plugged in, hidden. */
|
|
23
|
+
.o-links-editor-list { display: flex; flex-direction: column; min-height: 0; max-height: calc(10.5 * var(--vk-spacing) * 8); overflow-y: auto; overscroll-behavior: contain; outline: none; scrollbar-width: none; }
|
|
24
|
+
.o-links-editor-list::-webkit-scrollbar { display: none; }
|
|
25
|
+
/* A field's list, the Picker in its own Popover: its rows scroll with no bar too, as the editor's list does. */
|
|
26
|
+
.o-links-editor-pop .o-picker-rows, .o-links-editor-shown .o-picker-rows { scrollbar-width: none; }
|
|
27
|
+
.o-links-editor-pop .o-picker-rows::-webkit-scrollbar, .o-links-editor-shown .o-picker-rows::-webkit-scrollbar { display: none; }
|
|
28
|
+
.o-links-editor-list > *, .o-links-editor-adds > * { flex: none; }
|
|
29
|
+
.o-links-editor-list[data-head] { scroll-padding-top: calc(var(--vk-spacing) * 7); }
|
|
30
|
+
.o-links-editor-adds { display: flex; flex-direction: column; }
|
|
31
|
+
|
|
32
|
+
/* The columns' names and a linked record's row: the same columns, 12 apart. */
|
|
33
|
+
.o-links-editor-head, .o-links-editor-row { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); box-sizing: border-box; min-width: 0; padding: 0 calc(var(--vk-spacing) * 1) 0 calc(var(--vk-spacing) * 2); }
|
|
34
|
+
.o-links-editor-head {
|
|
35
|
+
position: sticky; top: 0; z-index: 1; min-height: calc(var(--vk-spacing) * 7);
|
|
36
|
+
background-color: var(--vk-overlay); color: var(--vk-fg-subtlest); font-size: var(--vk-font-size-xs); line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs));
|
|
37
|
+
}
|
|
38
|
+
.o-links-editor-row { min-height: calc(var(--vk-spacing) * 8); }
|
|
39
|
+
.o-radio-group.o-links-editor-rows, .o-links-editor-rows { display: flex; flex-direction: column; gap: 0; }
|
|
40
|
+
.o-links-editor-who { flex: 1 1 0; display: flex; align-items: center; gap: calc(var(--vk-spacing) * 2); min-width: calc(var(--vk-spacing) * 38); }
|
|
41
|
+
.o-links-editor-who > .o-avatar { flex: none; }
|
|
42
|
+
.o-links-editor-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
43
|
+
.o-links-editor-cell { flex: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
44
|
+
.o-links-editor-row > .o-links-editor-cell { color: var(--vk-fg-subtle); }
|
|
45
|
+
.o-links-editor-cell[data-kind="several"] { width: calc(var(--vk-spacing) * 48); }
|
|
46
|
+
.o-links-editor-cell:is([data-kind="one"], [data-kind="yes-no"]) { width: calc(var(--vk-spacing) * 10); }
|
|
47
|
+
/* With one field its column holds its short button, 192 whatever its kind. */
|
|
48
|
+
.o-links-editor[data-links-fields="one"] .o-links-editor-cell { width: calc(var(--vk-spacing) * 48); }
|
|
49
|
+
.o-links-editor-lead { flex: none; display: flex; justify-content: center; width: calc(var(--vk-spacing) * 8); }
|
|
50
|
+
.o-links-editor-head > .o-links-editor-lead { display: block; text-align: center; }
|
|
51
|
+
.o-links-editor-lead .o-radio-ring { margin-top: 0; }
|
|
52
|
+
.o-links-editor-end { flex: none; display: flex; justify-content: center; width: calc(var(--vk-spacing) * 6); }
|
|
53
|
+
|
|
54
|
+
/* One field: a short quiet button, as wide as its words and its chevron, its words where the column's name starts; none, the
|
|
55
|
+
field's name in the faintest words; its chevron turns while its list is open. */
|
|
56
|
+
.o-links-editor-cell:has(> .o-links-editor-short) { overflow: visible; }
|
|
57
|
+
.o-links-editor-short.o-button { max-width: calc(100% + var(--vk-spacing) * 2); margin-left: calc(var(--vk-spacing) * -2); font-weight: var(--vk-font-weight-normal); color: var(--vk-fg-subtle); }
|
|
58
|
+
.o-links-editor-short > [data-slot="vk-button-label"] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
59
|
+
.o-links-editor-short[data-none] { color: var(--vk-fg-subtlest); }
|
|
60
|
+
.o-links-editor-short > [data-slot="vk-button-icon"] { color: var(--vk-fg-subtlest); transition: rotate var(--vk-duration-fast) var(--vk-ease-out); }
|
|
61
|
+
.o-links-editor-short:is([data-popup-open], [aria-expanded="true"]) > [data-slot="vk-button-icon"] { rotate: 180deg; }
|
|
62
|
+
|
|
63
|
+
/* The records to add: the list's rows, the face before the name. */
|
|
64
|
+
.o-links-editor-add > .o-avatar { flex: none; }
|
|
65
|
+
.o-links-editor-add { cursor: pointer; }
|
|
66
|
+
/* Everything linked, or nothing found: what it says, quiet, in the list's middle. */
|
|
67
|
+
.o-links-editor-message { padding: calc(var(--vk-spacing) * 3) calc(var(--vk-spacing) * 2); color: var(--vk-fg-subtle); text-align: center; }
|
|
68
|
+
|
|
69
|
+
/* A list a page shows standing open: under its button, over the rows, as the Popover would stand it, as wide as its rows. */
|
|
70
|
+
.o-links-editor .o-links-editor-shown { position: absolute; z-index: var(--vk-layer-popup); width: max-content; min-width: calc(var(--vk-spacing) * 48); max-width: calc(var(--vk-spacing) * 72); }
|
|
71
|
+
|
|
72
|
+
/* ── A link's fields, a step inside the popup ─ */
|
|
73
|
+
.o-links-editor-step-head { --popup-line-under: var(--vk-spacing); --popup-line-pad: calc(var(--vk-spacing) * 2); }
|
|
74
|
+
.o-links-editor-step-head > .o-avatar { flex: none; }
|
|
75
|
+
.o-links-editor-step-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--vk-font-weight-medium); }
|
|
76
|
+
.o-links-editor-fields { display: grid; gap: calc(var(--vk-spacing) * 2); padding: calc(var(--vk-spacing) * 2) calc(var(--vk-spacing) * 2) 0; }
|
|
77
|
+
.o-links-editor-field { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); min-width: 0; min-height: calc(var(--vk-spacing) * 8); }
|
|
78
|
+
.o-links-editor-field-label { flex: none; width: calc(var(--vk-spacing) * 16); color: var(--vk-fg-subtle); }
|
|
79
|
+
.o-links-editor-field-control { flex: 1; display: flex; min-width: 0; }
|
|
80
|
+
.o-links-editor-field-control[data-kind="one"] { flex: none; width: calc(var(--vk-spacing) * 28); }
|
|
81
|
+
.o-links-editor-field-control > .o-select { width: 100%; }
|
|
82
|
+
.o-links-editor-step-foot { display: flex; padding: calc(var(--vk-spacing) * 2) 0 0; }
|
|
83
|
+
|
|
84
|
+
/* ── On a phone: what the Sheet holds, filling its body: a card per linked record, 12 apart (its head 56, its face 24 and its name,
|
|
85
|
+
"Lead" on the leading one, ⋯ or the settings button; then its field's row, or what it holds in quiet words); then "Add a
|
|
86
|
+
company" and the records to add, each its face 40, its name and +; then the search at the foot, over a fade to the ground. Every
|
|
87
|
+
target 44 at least. ─ */
|
|
88
|
+
.o-links-editor[data-links-form="phone"] { min-height: var(--links-room, auto); font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); }
|
|
89
|
+
.o-links-editor-cards { display: grid; gap: calc(var(--vk-spacing) * 3); }
|
|
90
|
+
.o-links-editor-card-head { padding-right: calc(var(--vk-spacing) * 1); }
|
|
91
|
+
.o-links-editor-card-head > .o-avatar { flex: none; }
|
|
92
|
+
.o-links-editor-card-name { flex: 1; display: flex; align-items: baseline; gap: calc(var(--vk-spacing) * 2); min-width: 0; font-weight: var(--vk-font-weight-medium); }
|
|
93
|
+
.o-links-editor-card-name > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
94
|
+
.o-links-editor-lead-word { flex: none; color: var(--vk-fg-subtle); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); font-weight: var(--vk-font-weight-normal); }
|
|
95
|
+
.o-links-editor-more, .o-links-editor[data-links-form="phone"] .o-links-editor-config { flex: none; }
|
|
96
|
+
.o-links-editor-card-line {
|
|
97
|
+
margin-top: calc(var(--vk-spacing) * -2); padding: 0 calc(var(--vk-spacing) * 4) calc(var(--vk-spacing) * 3.5) calc(var(--vk-spacing) * 13);
|
|
98
|
+
color: var(--vk-fg-subtle); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm));
|
|
99
|
+
}
|
|
100
|
+
.o-links-editor-card-line[data-none] { color: var(--vk-fg-subtlest); }
|
|
101
|
+
/* A field's row: its name, its words at its end, cut with "…", and ›. */
|
|
102
|
+
.o-links-editor-open-name { flex: none; }
|
|
103
|
+
.o-links-editor-open-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--vk-fg-subtle); }
|
|
104
|
+
.o-links-editor-open-mark { flex: none; width: calc(var(--vk-spacing) * 4.5); height: calc(var(--vk-spacing) * 4.5); margin-right: calc(var(--vk-spacing) * -1); color: var(--vk-fg-subtlest); }
|
|
105
|
+
.o-links-editor-label { margin: calc(var(--vk-spacing) * 6) var(--vk-spacing) calc(var(--vk-spacing) * 2); font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); color: var(--vk-fg-subtle); }
|
|
106
|
+
.o-links-editor-add-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
107
|
+
.o-links-editor-add-mark { flex: none; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); color: var(--vk-fg-subtlest); }
|
|
108
|
+
.o-links-editor-note { padding: calc(var(--vk-spacing) * 9) calc(var(--vk-spacing) * 4); text-align: center; color: var(--vk-fg-subtle); }
|
|
109
|
+
|
|
110
|
+
/* ── A list its editor finds: more records coming as its end comes into sight, the ask again after a failed search, and the create
|
|
111
|
+
rows after the records to add (a mark before the words where one is handed) ─ */
|
|
112
|
+
.o-links-editor-loading { display: flex; align-items: center; justify-content: center; gap: calc(var(--vk-spacing) * 2); min-height: calc(var(--vk-spacing) * 8); font-size: var(--vk-font-size-xs); color: var(--vk-fg-subtle); }
|
|
113
|
+
.o-links-editor[data-links-form="phone"] .o-links-editor-loading { min-height: calc(var(--vk-spacing) * 12); font-size: var(--vk-font-size-sm); }
|
|
114
|
+
.o-links-editor-retry { margin-inline-start: calc(var(--vk-spacing) * 2); }
|
|
115
|
+
.o-links-editor-action-mark { flex: none; display: grid; place-items: center; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); color: var(--vk-fg-subtle); }
|
|
116
|
+
.o-links-editor-action-mark > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
117
|
+
.o-links-editor-bar {
|
|
118
|
+
position: sticky; bottom: calc(-1 * var(--links-under, 0px)); z-index: 1; display: flex; align-items: center;
|
|
119
|
+
margin-top: auto; margin-bottom: calc(-1 * var(--links-under, 0px)); padding: calc(var(--vk-spacing) * 8) 0 calc(var(--vk-spacing) * 2 + var(--links-under, 0px));
|
|
120
|
+
background-image: linear-gradient(to bottom, transparent, var(--vk-overlay) calc(var(--vk-spacing) * 8));
|
|
121
|
+
}
|
|
122
|
+
.o-links-editor-pill { flex: 1; }
|
|
123
|
+
/* A link's fields, in the Modal's full Sheet: a field's words at its row's end; a switch at its end; Unlink its own card, in red. */
|
|
124
|
+
.o-links-editor-fields .o-links-editor-open-value { flex: 1; }
|
|
125
|
+
.o-links-editor-switch { flex: none; margin-left: auto; }
|
|
126
|
+
.o-links-editor-fields-foot { margin-top: calc(var(--vk-spacing) * 6); }
|
|
127
|
+
.o-links-editor-unlink.o-field-row { color: var(--vk-danger); }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* ── On the phone the search's words are 16px, so iOS never zooms in (KIT-369) ── */
|
|
131
|
+
/* On a phone (`data-vk-phone`, the body's own mark from the device): the search's words at the base size, so iOS never zooms. */
|
|
132
|
+
.o-input-control.o-links-editor-input:where([data-vk-phone], [data-vk-phone] *) { font-size: var(--vk-font-size-base); }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** What is typed: a number, money (its currency before it) or a percent (its % after it). A range is the Compound editor's. */
|
|
2
|
+
export type NumberKind = "number" | "money" | "percent";
|
|
3
|
+
/** A currency money may be in: its code (EUR), its sign (€) and its name (Euro). */
|
|
4
|
+
export interface Currency {
|
|
5
|
+
code: string;
|
|
6
|
+
sign: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/** A unit a number may be in, or a currency: its code (kg, EUR), its name, and the sign that stands for it where it has one (€);
|
|
10
|
+
* a unit with none is drawn by its code. */
|
|
11
|
+
export interface Unit {
|
|
12
|
+
code: string;
|
|
13
|
+
name: string;
|
|
14
|
+
sign?: string;
|
|
15
|
+
}
|
|
16
|
+
/** The locale the box reads what is typed with: the one handed, or, where the decimal separator handed isn't the one it writes, a
|
|
17
|
+
* locale that writes it (en for ".", de for ","). The box shows no grouping, so only the separator changes. */
|
|
18
|
+
export declare function boxLocale(locale: string | undefined, decimal?: "." | ","): string | undefined;
|
|
19
|
+
/** How money's currency and a percent's % stand in what a cell shows: Attio's code (EUR 84,000.00, 40%), or the sign
|
|
20
|
+
* (€ 84,000, 40 %). The Number editor's units option (looks.ts) picks it. */
|
|
21
|
+
export type Units = "code" | "sign";
|
|
22
|
+
/** What a cell shows of a number once it is kept; nothing for nothing held. In Attio's units (code, the default) a number
|
|
23
|
+
* keeps the field's decimals when it says them (else up to two), money is its code and the amount with two decimals
|
|
24
|
+
* unless the field says otherwise ("-EUR 1,500.00"), a percent stands against its number ("40%"), as Attio and ViewKit's
|
|
25
|
+
* own formatter draw them. In the sign's, today's: "1,250", "€ 84,000", "40 %". */
|
|
26
|
+
export declare function numberText(value: number | null, kind?: NumberKind, o?: {
|
|
27
|
+
currency?: Currency;
|
|
28
|
+
units?: Units;
|
|
29
|
+
decimals?: number;
|
|
30
|
+
}): string;
|
|
31
|
+
export declare function readTyped(text: string, decimal?: "." | ","): number | null;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const separators = new Map();
|
|
2
|
+
const separatorOf = (locale) => {
|
|
3
|
+
const key = locale ?? "";
|
|
4
|
+
if (!separators.has(key)) {
|
|
5
|
+
let at = ".";
|
|
6
|
+
try {
|
|
7
|
+
at = new Intl.NumberFormat(locale).formatToParts(1.5).find((p) => p.type === "decimal")?.value ?? ".";
|
|
8
|
+
}
|
|
9
|
+
catch { }
|
|
10
|
+
separators.set(key, at);
|
|
11
|
+
}
|
|
12
|
+
return separators.get(key);
|
|
13
|
+
};
|
|
14
|
+
export function boxLocale(locale, decimal) {
|
|
15
|
+
if (!decimal || separatorOf(locale) === decimal)
|
|
16
|
+
return locale;
|
|
17
|
+
return decimal === "," ? "de" : "en";
|
|
18
|
+
}
|
|
19
|
+
const formats = new Map();
|
|
20
|
+
const upToTwo = new Intl.NumberFormat("en", { maximumFractionDigits: 2 });
|
|
21
|
+
const n = (value) => upToTwo.format(value);
|
|
22
|
+
const exactly = (value, decimals) => {
|
|
23
|
+
if (!formats.has(decimals))
|
|
24
|
+
formats.set(decimals, new Intl.NumberFormat("en", { minimumFractionDigits: decimals, maximumFractionDigits: decimals }));
|
|
25
|
+
const out = formats.get(decimals).format(Math.abs(value));
|
|
26
|
+
return value < 0 && /[1-9]/.test(out) ? `-${out}` : out;
|
|
27
|
+
};
|
|
28
|
+
export function numberText(value, kind = "number", o = {}) {
|
|
29
|
+
if (value == null || Number.isNaN(value))
|
|
30
|
+
return "";
|
|
31
|
+
const { currency, units = "code", decimals } = o;
|
|
32
|
+
if (units === "sign")
|
|
33
|
+
return kind === "money" ? `${currency ? `${currency.sign} ` : ""}${n(value)}` : kind === "percent" ? `${n(value)} %` : n(value);
|
|
34
|
+
if (kind === "money") {
|
|
35
|
+
const amount = exactly(value, decimals ?? 2), minus = amount.startsWith("-");
|
|
36
|
+
return `${minus ? "-" : ""}${currency ? `${currency.code} ` : ""}${minus ? amount.slice(1) : amount}`;
|
|
37
|
+
}
|
|
38
|
+
if (kind === "percent")
|
|
39
|
+
return `${exactly(value, decimals ?? 0)}%`;
|
|
40
|
+
return decimals == null ? n(value) : exactly(value, decimals);
|
|
41
|
+
}
|
|
42
|
+
const exact = (body, decimal) => {
|
|
43
|
+
const group = decimal === "." ? "," : ".", at = body.indexOf(decimal);
|
|
44
|
+
if (at !== body.lastIndexOf(decimal))
|
|
45
|
+
return Number.NaN;
|
|
46
|
+
const head = at < 0 ? body : body.slice(0, at), fraction = at < 0 ? "" : body.slice(at + 1);
|
|
47
|
+
if (!/^\d*$/.test(fraction))
|
|
48
|
+
return Number.NaN;
|
|
49
|
+
const parts = head.split(group);
|
|
50
|
+
const digits = parts.length === 1 ? (/^\d*$/.test(head) ? head : null)
|
|
51
|
+
: /^[1-9]\d{0,2}$/.test(parts[0]) && parts.slice(1).every((x) => /^\d{3}$/.test(x)) ? parts.join("") : null;
|
|
52
|
+
if (digits == null || (digits === "" && fraction === ""))
|
|
53
|
+
return Number.NaN;
|
|
54
|
+
return Number(`${digits || "0"}.${fraction || "0"}`);
|
|
55
|
+
};
|
|
56
|
+
export function readTyped(text, decimal) {
|
|
57
|
+
const compact = text.replace(/[\s\u00a0\u202f]/g, "").replace(/[\u2212\u2012-\u2015]/g, "-");
|
|
58
|
+
if (!compact)
|
|
59
|
+
return null;
|
|
60
|
+
const m = /^([+-]?)([\d.,]+)$/.exec(compact);
|
|
61
|
+
if (!m)
|
|
62
|
+
return Number.NaN;
|
|
63
|
+
const body = m[2], dots = body.split(".").length - 1, commas = body.split(",").length - 1;
|
|
64
|
+
let sep;
|
|
65
|
+
if (decimal)
|
|
66
|
+
sep = decimal;
|
|
67
|
+
else if (dots && commas)
|
|
68
|
+
sep = body.lastIndexOf(".") > body.lastIndexOf(",") ? "." : ",";
|
|
69
|
+
else if (dots)
|
|
70
|
+
sep = dots === 1 ? "." : ",";
|
|
71
|
+
else if (commas !== 1)
|
|
72
|
+
sep = ".";
|
|
73
|
+
else {
|
|
74
|
+
const [head, tail] = body.split(",");
|
|
75
|
+
sep = /^[1-9]\d{0,2}$/.test(head) && /^\d{3}$/.test(tail) ? "." : ",";
|
|
76
|
+
}
|
|
77
|
+
const v = exact(body, sep);
|
|
78
|
+
return m[1] === "-" && v !== 0 ? -v : v;
|
|
79
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type PieceLooks } from "../../looks/looks.js";
|
|
2
|
+
export type NumberEditorOptionId = "arrows" | "units" | "sheet";
|
|
3
|
+
/** What the body reads from the frame round it. */
|
|
4
|
+
export interface NumberEditorWorn {
|
|
5
|
+
arrows: "editing" | "none";
|
|
6
|
+
units: "code" | "sign";
|
|
7
|
+
sheet: "line" | "field";
|
|
8
|
+
}
|
|
9
|
+
/** The Number editor's options and looks. */
|
|
10
|
+
export declare const NUMBER_EDITOR_LOOKS: PieceLooks<NumberEditorOptionId>;
|
|
11
|
+
/** The options worn round `el`, each from the nearest frame that picks it; outside any frame, Attio's. */
|
|
12
|
+
export declare const numberEditorWornOf: (el: Element | null) => NumberEditorWorn;
|
|
13
|
+
/** The attributes the body watches, so a look changed while it is open reaches it. */
|
|
14
|
+
export declare const NUMBER_EDITOR_ATTRS: string[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { lookWornOf } from "../../looks/looks.js";
|
|
2
|
+
const options = [
|
|
3
|
+
{ id: "arrows", name: "Arrows", device: "desktop", def: "editing", values: [{ id: "editing", name: "While editing" }, { id: "none", name: "None" }] },
|
|
4
|
+
{ id: "units", name: "Units", def: "code", values: [{ id: "code", name: "Code" }, { id: "sign", name: "Sign" }] },
|
|
5
|
+
{ id: "sheet", name: "In the Sheet", device: "phone", def: "line", values: [{ id: "line", name: "Line" }, { id: "field", name: "Number field" }] },
|
|
6
|
+
];
|
|
7
|
+
export const NUMBER_EDITOR_LOOKS = {
|
|
8
|
+
id: "number-editor",
|
|
9
|
+
name: "Number editor",
|
|
10
|
+
options,
|
|
11
|
+
looks: [
|
|
12
|
+
{ id: "attio", name: "Attio", picks: { arrows: "editing", units: "code", sheet: "line" } },
|
|
13
|
+
{ id: "mihai", name: "Mihai's", picks: { arrows: "none", units: "sign", sheet: "field" } },
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
export const numberEditorWornOf = (el) => lookWornOf(NUMBER_EDITOR_LOOKS, el, ["arrows", "units", "sheet"]);
|
|
17
|
+
export const NUMBER_EDITOR_ATTRS = NUMBER_EDITOR_LOOKS.options.map((o) => `data-number-editor-${o.id}`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ViewsMessageResolver } from "../../contract.js";
|
|
2
|
+
import type { ViewsNumberBodyProps } from "../../provider/components.js";
|
|
3
|
+
import type { Currency } from "./format.js";
|
|
4
|
+
import { type NumberEditorProps } from "./number-editor.js";
|
|
5
|
+
import type { NumberEditorWords } from "./words.js";
|
|
6
|
+
/** A currency's code as the editor's Currency: its sign (narrow, as € or £) in the locale and its name in the language, from
|
|
7
|
+
* Intl; a code Intl doesn't know is its own sign and name. */
|
|
8
|
+
export declare function currencyOf(code: string, locale: string, language?: string): Currency;
|
|
9
|
+
/** The Number editor's words in the app's messages: the number field's steps the old editors' keys, a currency's list the
|
|
10
|
+
* Currency menu's, the rest its own. */
|
|
11
|
+
export declare function numberEditorWordsOf(say: ViewsMessageResolver): NumberEditorWords;
|
|
12
|
+
/** ViewKit's number body's props as the Number editor's, held as a shell that keeps the draft. */
|
|
13
|
+
export declare function numberEditorPropsOf({ label, kind, value, unit, units, onValueChange, onDone, decimals, min, max, locale, decimal, align, typed, autoFocus, form }: ViewsNumberBodyProps, words?: NumberEditorWords, language?: string): NumberEditorProps;
|
|
14
|
+
/** ViewKit's number body, drawn as the Number editor in the app's words; on a phone, the currencies' step told to its sheet.
|
|
15
|
+
* Outside a provider (a page drawing the body alone), ViewKit's English. */
|
|
16
|
+
export declare function MapNumberBody(props: ViewsNumberBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { resolveViewsMessage } from "../../contract.js";
|
|
5
|
+
import { EDITOR_INNER_ESCAPE } from "../../editors/inner-escape.js";
|
|
6
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
7
|
+
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
8
|
+
import { useToldStep } from "../internal/told-step.js";
|
|
9
|
+
import { useNumberEditor } from "./number-editor.js";
|
|
10
|
+
const signs = new Map();
|
|
11
|
+
export function currencyOf(code, locale, language = locale) {
|
|
12
|
+
const key = `${locale}␟${language}␟${code}`;
|
|
13
|
+
if (!signs.has(key)) {
|
|
14
|
+
let sign = code, name = code;
|
|
15
|
+
try {
|
|
16
|
+
sign = new Intl.NumberFormat(locale, { style: "currency", currency: code, currencyDisplay: "narrowSymbol" }).formatToParts(0).find((p) => p.type === "currency")?.value ?? code;
|
|
17
|
+
}
|
|
18
|
+
catch { }
|
|
19
|
+
try {
|
|
20
|
+
name = new Intl.DisplayNames([language], { type: "currency" }).of(code) ?? code;
|
|
21
|
+
}
|
|
22
|
+
catch { }
|
|
23
|
+
signs.set(key, { code, sign, name });
|
|
24
|
+
}
|
|
25
|
+
return signs.get(key);
|
|
26
|
+
}
|
|
27
|
+
export function numberEditorWordsOf(say) {
|
|
28
|
+
return {
|
|
29
|
+
currency: say({ key: "views.menus.currency" }),
|
|
30
|
+
unit: say({ key: "views.editors.number-unit" }),
|
|
31
|
+
findCurrency: say({ key: "views.editors.number-find-currency" }),
|
|
32
|
+
searchCurrency: say({ key: "views.editors.number-search-currency" }),
|
|
33
|
+
findUnit: say({ key: "views.editors.number-find-unit" }),
|
|
34
|
+
searchUnit: say({ key: "views.editors.number-search-unit" }),
|
|
35
|
+
named: (unit, name) => say({ key: "views.editors.number-unit-named", values: { unit, name } }),
|
|
36
|
+
increase: say({ key: "views.editors.number-increase" }),
|
|
37
|
+
decrease: say({ key: "views.editors.number-decrease" }),
|
|
38
|
+
numberField: say({ key: "views.editors.number-field" }),
|
|
39
|
+
picker: pickerWordsOf(say),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function numberEditorPropsOf({ label, kind, value, unit, units, onValueChange, onDone, decimals, min, max, locale, decimal, align, typed, autoFocus, form }, words, language) {
|
|
43
|
+
const codes = units?.length ? [...units] : unit ? [unit] : [];
|
|
44
|
+
const props = { label, kind, value, onValueChange, onDone, decimals, locale, align, autoFocus, form, draft: "shell", popupData: { [EDITOR_INNER_ESCAPE]: "" }, ...(words ? { words } : {}) };
|
|
45
|
+
if (kind === "money")
|
|
46
|
+
Object.assign(props, { currency: unit, currencies: codes.map((c) => currencyOf(c, locale, language)) });
|
|
47
|
+
else if (kind === "number" && unit)
|
|
48
|
+
Object.assign(props, { unit, units: codes.map((c) => ({ code: c, name: c })) });
|
|
49
|
+
return { ...props, ...(min !== undefined && { min }), ...(max !== undefined && { max }), ...(decimal && { decimal }), ...(typed !== undefined && { typed }) };
|
|
50
|
+
}
|
|
51
|
+
export function MapNumberBody(props) {
|
|
52
|
+
const views = React.useContext(ViewsContext), messages = views?.messages ?? resolveViewsMessage;
|
|
53
|
+
const words = React.useMemo(() => numberEditorWordsOf(messages), [messages]);
|
|
54
|
+
const parts = useNumberEditor(numberEditorPropsOf(props, words, views?.conventions.language));
|
|
55
|
+
useToldStep(parts, props.onStepChange);
|
|
56
|
+
return _jsx(_Fragment, { children: parts.body });
|
|
57
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SheetHeadProps } from "../sheet/bottom-sheet.js";
|
|
3
|
+
import { type Currency, type NumberKind, type Unit } from "./format.js";
|
|
4
|
+
import { type NumberEditorWorn } from "./looks.js";
|
|
5
|
+
import { type NumberEditorWords } from "./words.js";
|
|
6
|
+
export type { Currency, NumberKind, Unit } from "./format.js";
|
|
7
|
+
/** The parts a shell pours in: the body, and on a phone the Sheet head's buttons, and its title while it is on a step of
|
|
8
|
+
* its own (money's currencies). */
|
|
9
|
+
export interface NumberEditorParts {
|
|
10
|
+
body: React.ReactNode;
|
|
11
|
+
head: Pick<SheetHeadProps, "left" | "right" | "onBack" | "close">;
|
|
12
|
+
title?: string;
|
|
13
|
+
}
|
|
14
|
+
interface Common {
|
|
15
|
+
/** The field's name: the Sheet's title, and the box's name to a screen reader. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** The job is done and what holds it closes: after a keep, and after ✕, which leaves it as it was; Escape leaves it as it was. */
|
|
18
|
+
onDone?: () => void;
|
|
19
|
+
/** Takes the focus as it opens; a page standing several still says false. */
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
/** Which form; by default the phone's in a phone's window or in a PhoneHost screen, else the computer's. */
|
|
22
|
+
form?: "computer" | "phone";
|
|
23
|
+
}
|
|
24
|
+
export interface NumberEditorProps extends Common {
|
|
25
|
+
/** A number, money or a percent. */
|
|
26
|
+
kind?: NumberKind;
|
|
27
|
+
/** What the field holds. */
|
|
28
|
+
value: number | null;
|
|
29
|
+
/** Money: the code of the currency it is in. */
|
|
30
|
+
currency?: string;
|
|
31
|
+
/** Money: the currencies it may be in. One, or none, shows its sign with nothing to press. */
|
|
32
|
+
currencies?: Currency[];
|
|
33
|
+
/** A number: the code of the unit it is in (kg). */
|
|
34
|
+
unit?: string;
|
|
35
|
+
/** A number: the units it may be in, drawn as money's currencies are: one, or none, has nothing to press (in Attio's look the
|
|
36
|
+
* bare number, in Mihai's its unit's words). */
|
|
37
|
+
units?: Unit[];
|
|
38
|
+
/** What it keeps when it changed: the number, and money's currency or a number's unit. Enter or a press elsewhere on a
|
|
39
|
+
* computer, ✓ on a phone. Held as a shell, every change as it is made: null when its box is emptied, NaN for text that reads as
|
|
40
|
+
* no number, a unit picked with the value it holds. */
|
|
41
|
+
onValueChange: (value: number | null, unit?: string) => void;
|
|
42
|
+
min?: number;
|
|
43
|
+
max?: number;
|
|
44
|
+
/** What one arrow steps it by: 1 unless said; Shift and an arrow, ten times that. */
|
|
45
|
+
step?: number;
|
|
46
|
+
/** The most digits after the point its box takes: 2 unless said. */
|
|
47
|
+
decimals?: number;
|
|
48
|
+
/** How what is typed is read: the locale (BCP 47), and the decimal separator where it is stated: the box reads and steps with
|
|
49
|
+
* boxLocale's locale; held as a shell, what it hands is readTyped's reading, either separator where none is stated. */
|
|
50
|
+
locale?: string;
|
|
51
|
+
decimal?: "." | ",";
|
|
52
|
+
/** Where its value stands on a computer: at its end unless said (a cell), or at its start (a field row). */
|
|
53
|
+
align?: "start" | "end";
|
|
54
|
+
/** What was typed on what opened it (a key on a cell): the box starts with it. */
|
|
55
|
+
typed?: string;
|
|
56
|
+
/** What its own popups carry (the units' list on a computer), so what holds it knows them as its own. */
|
|
57
|
+
popupData?: Readonly<Record<`data-${string}`, string>>;
|
|
58
|
+
/** Where the draft, the close and a phone's ✕ and ✓ stand: `own` (the default), the Number editor's; `shell`, its holder's
|
|
59
|
+
* (ViewKit's number editor): `value` and money's `currency` or a number's `unit` are its holder's, every change is handed as it is made, Enter
|
|
60
|
+
* with any modifier only calls onDone, a press elsewhere and Escape keep nothing, and a phone hands no ✕ or ✓. As the Text
|
|
61
|
+
* editor's, the Picker's and the Date editor's. */
|
|
62
|
+
draft?: "own" | "shell";
|
|
63
|
+
/** Its words: its lists' names and searches, the code button's name and the number field's steps; English unless handed. */
|
|
64
|
+
words?: Partial<NumberEditorWords>;
|
|
65
|
+
}
|
|
66
|
+
/** The options worn round an element (looks.ts): a ref for it, and what it wears, Attio's until it stands, read again as
|
|
67
|
+
* Tweaks change them. */
|
|
68
|
+
export declare function useNumberEditorWorn(): [(el: Element | null) => void, NumberEditorWorn];
|
|
69
|
+
/** A number, money or a percent: its state and the parts a shell pours in. */
|
|
70
|
+
export declare function useNumberEditor(props: NumberEditorProps): NumberEditorParts;
|
|
71
|
+
/** The body alone: a number, money or a percent. */
|
|
72
|
+
export declare function NumberEditor(props: NumberEditorProps): import("react/jsx-runtime").JSX.Element;
|