viewkitjs 0.30.1 → 0.32.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 +143 -0
- package/MIGRATION.md +40 -6
- package/README.md +1 -1
- package/fields/dist/query/index.d.ts +2 -0
- package/fields/dist/query/index.js +2 -0
- package/fields/dist/query/list-request.d.ts +148 -0
- package/fields/dist/query/list-request.js +125 -0
- package/fields/dist/query/saved-view.d.ts +15 -0
- package/fields/dist/query/saved-view.js +11 -0
- package/fields/dist/query/settings.d.ts +9 -0
- package/fields/dist/query/settings.js +9 -0
- package/fields/docs/reference/query.md +66 -0
- package/package.json +8 -2
- package/postgres/README.md +1 -0
- package/postgres/dist/handler.d.ts +53 -0
- package/postgres/dist/handler.js +211 -0
- package/postgres/dist/ids.d.ts +1 -1
- package/postgres/dist/ids.js +19 -1
- package/postgres/dist/index.d.ts +1 -0
- package/postgres/dist/index.js +1 -0
- package/postgres/dist/limits.d.ts +3 -1
- package/postgres/dist/limits.js +1 -1
- package/postgres/dist/list-fields.d.ts +10 -0
- package/postgres/dist/list-fields.js +36 -0
- package/postgres/dist/readable.d.ts +4 -0
- package/postgres/dist/readable.js +4 -0
- package/postgres/dist/refusals.d.ts +9 -2
- package/postgres/dist/refusals.js +6 -0
- package/postgres/docs/guides/field-map.md +2 -2
- package/postgres/docs/guides/list-handler.md +99 -0
- package/postgres/docs/index.md +1 -0
- package/postgres/docs/reference/postgres.md +11 -3
- package/views/README.md +2 -2
- package/views/dist/atoms/RowMenu.d.ts +7 -0
- package/views/dist/atoms/RowMenu.js +18 -16
- package/views/dist/atoms/carried.d.ts +5 -0
- package/views/dist/atoms/carried.js +7 -0
- package/views/dist/atoms/types.d.ts +3 -0
- package/views/dist/contract.d.ts +26 -6
- package/views/dist/contract.js +25 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
- package/views/dist/controls/atoms.d.ts +2 -0
- package/views/dist/controls/atoms.js +2 -0
- package/views/dist/controls/avatar/avatar.d.ts +10 -4
- package/views/dist/controls/avatar/avatar.js +5 -3
- package/views/dist/controls/avatar/tokens.d.ts +104 -0
- package/views/dist/controls/avatar/tokens.js +26 -0
- package/views/dist/controls/avatar.css +46 -15
- package/views/dist/controls/choice/tokens.d.ts +0 -4
- package/views/dist/controls/choice/tokens.js +0 -1
- package/views/dist/controls/choice.css +3 -3
- package/views/dist/controls/controls.d.ts +6 -0
- package/views/dist/controls/controls.js +10 -2
- package/views/dist/controls/customize/map-customize-body.js +1 -1
- package/views/dist/controls/field/field.d.ts +19 -4
- package/views/dist/controls/field/field.js +63 -5
- package/views/dist/controls/field/tokens.d.ts +4 -0
- package/views/dist/controls/field/tokens.js +1 -0
- package/views/dist/controls/field.css +41 -16
- package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
- package/views/dist/controls/glyphs/glyphs.js +173 -0
- package/views/dist/controls/index.d.ts +4 -2
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/input/input.d.ts +12 -1
- package/views/dist/controls/input/input.js +10 -6
- package/views/dist/controls/input/save-mark.d.ts +8 -0
- package/views/dist/controls/input/save-mark.js +26 -0
- package/views/dist/controls/input/tokens.d.ts +20 -0
- package/views/dist/controls/input/tokens.js +5 -0
- package/views/dist/controls/input.css +49 -3
- package/views/dist/controls/internal/icons.js +10 -0
- package/views/dist/controls/internal/keep-focus.d.ts +2 -0
- package/views/dist/controls/internal/keep-focus.js +17 -0
- package/views/dist/controls/internal/watch-frame.d.ts +2 -0
- package/views/dist/controls/internal/watch-frame.js +33 -0
- package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
- package/views/dist/controls/markdown/map-markdown.js +5 -0
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/menu-list/menu-list.d.ts +3 -0
- package/views/dist/controls/menu-list/menu-list.js +5 -4
- package/views/dist/controls/modal/modal.js +5 -1
- package/views/dist/controls/pane/pane.js +2 -1
- package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
- package/views/dist/controls/phone-header/header-bar.js +2 -2
- package/views/dist/controls/phone-header.css +11 -1
- package/views/dist/controls/picker/map-picker.js +3 -0
- package/views/dist/controls/picker/picker.d.ts +14 -0
- package/views/dist/controls/picker/picker.js +30 -10
- package/views/dist/controls/picker.css +2 -0
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/radio/radio.d.ts +12 -3
- package/views/dist/controls/radio/radio.js +25 -5
- package/views/dist/controls/radio/tokens.d.ts +84 -0
- package/views/dist/controls/radio/tokens.js +21 -0
- package/views/dist/controls/radio.css +130 -3
- package/views/dist/controls/select/select.d.ts +12 -2
- package/views/dist/controls/select/select.js +15 -7
- package/views/dist/controls/select/tokens.d.ts +8 -0
- package/views/dist/controls/select/tokens.js +2 -0
- package/views/dist/controls/select.css +17 -0
- package/views/dist/controls/setting-row/looks.d.ts +10 -0
- package/views/dist/controls/setting-row/looks.js +22 -0
- package/views/dist/controls/setting-row/setting-row.d.ts +100 -0
- package/views/dist/controls/setting-row/setting-row.js +133 -0
- package/views/dist/controls/setting-row/tokens.d.ts +156 -0
- package/views/dist/controls/setting-row/tokens.js +41 -0
- package/views/dist/controls/setting-row.css +215 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +10 -2
- package/views/dist/controls/sheet/bottom-sheet.js +6 -3
- package/views/dist/controls/sheet.css +4 -1
- package/views/dist/controls/sort-editor/sort-editor.js +3 -2
- package/views/dist/controls/sort-editor.css +8 -2
- package/views/dist/controls/switch-row/switch-row.d.ts +1 -15
- package/views/dist/controls/switch-row/switch-row.js +1 -9
- package/views/dist/controls/switch-row/tokens.d.ts +0 -12
- package/views/dist/controls/switch-row/tokens.js +0 -3
- package/views/dist/controls/switch-row.css +3 -7
- package/views/dist/controls/switch.css +17 -7
- package/views/dist/controls/tag/tag.d.ts +3 -1
- package/views/dist/controls/tag/tag.js +2 -2
- package/views/dist/controls/tag/tokens.d.ts +4 -0
- package/views/dist/controls/tag/tokens.js +1 -0
- package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
- package/views/dist/controls/tag-field/tag-field.js +11 -5
- package/views/dist/controls/tag-field/tokens.d.ts +16 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +19 -0
- package/views/dist/controls/tag.css +2 -0
- package/views/dist/controls/tokens.js +2 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
- package/views/dist/controls/toolbar/toolbar.js +22 -15
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
- package/views/dist/controls/toolbar-button.css +4 -0
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
- package/views/dist/controls/views-list/map-view-menu.js +25 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
- package/views/dist/controls/views-list/map-views-list-body.js +39 -21
- package/views/dist/controls/views-list/rules.d.ts +2 -0
- package/views/dist/controls/views-list/view-menu.d.ts +7 -0
- package/views/dist/controls/views-list/view-menu.js +28 -24
- package/views/dist/controls/views-list/words.d.ts +2 -0
- package/views/dist/controls/views-list/words.js +1 -1
- package/views/dist/editors/EditorPanel.js +2 -1
- package/views/dist/editors/edit-session.js +2 -5
- package/views/dist/field-row/FieldRow.d.ts +4 -2
- package/views/dist/field-row/FieldRow.js +67 -20
- package/views/dist/field-row/FieldRowLane.d.ts +7 -2
- package/views/dist/field-row/FieldRowLane.js +4 -3
- package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
- package/views/dist/field-row/editors/RowEditor.js +31 -1
- package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
- package/views/dist/field-row/field-row-button.d.ts +5 -0
- package/views/dist/field-row/field-row-button.js +2 -0
- package/views/dist/fields/binding.d.ts +3 -2
- package/views/dist/fields/binding.js +38 -5
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
- package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
- package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +6 -5
- package/views/dist/grid/chrome/GridRowCells.js +6 -9
- package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
- package/views/dist/grid/chrome/GridStructure.js +4 -4
- package/views/dist/grid/chrome/GridTable.js +5 -2
- package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
- package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
- package/views/dist/grid/chrome/grid-row-menu-items.js +92 -6
- package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
- package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
- package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
- package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
- package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -2
- package/views/dist/grid/chrome/useGridKeyboard.js +15 -9
- package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +11 -5
- package/views/dist/grid/core/commit-model.d.ts +20 -2
- package/views/dist/grid/core/editing-controller.d.ts +18 -0
- package/views/dist/grid/core/editing-controller.js +188 -42
- package/views/dist/grid/core/editing-model.d.ts +3 -0
- package/views/dist/grid/core/editing-model.js +3 -0
- package/views/dist/grid/core/save-path.d.ts +24 -0
- package/views/dist/grid/core/save-path.js +122 -0
- package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
- package/views/dist/grid/core/spreadsheet-operations.js +23 -0
- package/views/dist/grid/index.d.ts +3 -2
- package/views/dist/grid/index.js +1 -0
- package/views/dist/internal/field-rows.d.ts +26 -0
- package/views/dist/internal/field-rows.js +8 -0
- package/views/dist/internal/page-close.d.ts +7 -0
- package/views/dist/internal/page-close.js +43 -0
- package/views/dist/list/browser-views-store.d.ts +10 -0
- package/views/dist/list/browser-views-store.js +182 -0
- package/views/dist/list/index.d.ts +23 -0
- package/views/dist/list/index.js +8 -0
- package/views/dist/list/menu.d.ts +31 -0
- package/views/dist/list/menu.js +76 -0
- package/views/dist/list/parts.d.ts +6 -0
- package/views/dist/list/parts.js +59 -0
- package/views/dist/list/registry.d.ts +11 -0
- package/views/dist/list/registry.js +31 -0
- package/views/dist/list/root.d.ts +40 -0
- package/views/dist/list/root.js +128 -0
- package/views/dist/list/slot.d.ts +14 -0
- package/views/dist/list/slot.js +22 -0
- package/views/dist/list/source.d.ts +11 -0
- package/views/dist/list/source.js +31 -0
- package/views/dist/list/store.d.ts +87 -0
- package/views/dist/list/store.js +115 -0
- package/views/dist/list/toolbar.d.ts +6 -0
- package/views/dist/list/toolbar.js +359 -0
- package/views/dist/list/views-axis.d.ts +5 -0
- package/views/dist/list/views-axis.js +96 -0
- package/views/dist/list/views-store.d.ts +41 -0
- package/views/dist/list/views-store.js +1 -0
- package/views/dist/list/views.d.ts +67 -0
- package/views/dist/list/views.js +400 -0
- package/views/dist/looks/index.d.ts +1 -0
- package/views/dist/looks/index.js +1 -0
- package/views/dist/looks/pieces.js +2 -0
- package/views/dist/model/preferences.js +1 -1
- package/views/dist/model/prefs-buckets.js +1 -1
- package/views/dist/panels/index.d.ts +3 -1
- package/views/dist/panels/index.js +1 -0
- package/views/dist/panels/react/customize-body.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +41 -4
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +9 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +34 -23
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/context.d.ts +10 -2
- package/views/dist/panels/react/toolbar/context.js +3 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
- package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
- package/views/dist/panels/react/views-row/PillGroup.js +16 -7
- package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
- package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
- package/views/dist/panels/toolbar/edit-view.js +14 -0
- package/views/dist/panels/toolbar/model.d.ts +5 -0
- package/views/dist/panels/toolbar/model.js +7 -3
- package/views/dist/panels/view-state.d.ts +5 -3
- package/views/dist/panels/views-row/model.d.ts +19 -2
- package/views/dist/panels/views-row/model.js +14 -0
- package/views/dist/provider/ViewsProvider.d.ts +16 -7
- package/views/dist/provider/ViewsProvider.js +23 -5
- package/views/dist/provider/components.d.ts +43 -2
- package/views/dist/provider/context.d.ts +2 -1
- package/views/dist/provider/context.js +1 -1
- package/views/dist/provider/ports.d.ts +19 -12
- package/views/dist/provider/ports.js +69 -1
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +583 -61
- package/views/dist/styles.unlayered.css +583 -61
- package/views/docs/contract.md +42 -31
- package/views/docs/controls/avatar.md +26 -0
- package/views/docs/controls/choice.md +0 -1
- package/views/docs/controls/field.md +3 -0
- package/views/docs/controls/input.md +9 -0
- package/views/docs/controls/radio.md +33 -0
- package/views/docs/controls/select.md +6 -0
- package/views/docs/controls/setting-row.md +44 -0
- package/views/docs/controls/switch-row.md +0 -3
- package/views/docs/controls/tag-field.md +4 -0
- package/views/docs/controls/tag.md +1 -0
- package/views/docs/getting-started.md +2 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/columns.md +1 -1
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/the-grid.md +34 -7
- package/views/docs/guides/the-provider.md +4 -2
- package/views/docs/index.md +1 -0
- package/views/docs/reference/controls.md +54 -27
- package/views/docs/reference/editors-session.md +1 -1
- package/views/docs/reference/field-row.md +9 -1
- package/views/docs/reference/grid.md +14 -8
- package/views/docs/reference/list.md +227 -0
- package/views/docs/reference/looks.md +3 -0
- package/views/docs/reference/panels-react.md +17 -12
- package/views/docs/reference/panels.md +8 -5
- package/views/docs/reference/react.md +11 -9
- package/views/docs/reference/views.md +2 -2
- package/views/skills/views/SKILL.md +9 -6
|
@@ -38,10 +38,18 @@ export declare const INPUT_TOKENS: readonly [{
|
|
|
38
38
|
readonly name: "--vk-danger-subtlest";
|
|
39
39
|
readonly kind: "colour";
|
|
40
40
|
readonly outright: "--background-danger-subtlest";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "--vk-duration-base";
|
|
43
|
+
readonly kind: "motion";
|
|
44
|
+
readonly outright: "--duration-base";
|
|
41
45
|
}, {
|
|
42
46
|
readonly name: "--vk-duration-fast";
|
|
43
47
|
readonly kind: "motion";
|
|
44
48
|
readonly outright: "--duration-fast";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "--vk-ease-in";
|
|
51
|
+
readonly kind: "motion";
|
|
52
|
+
readonly outright: "--ease-in";
|
|
45
53
|
}, {
|
|
46
54
|
readonly name: "--vk-ease-out";
|
|
47
55
|
readonly kind: "motion";
|
|
@@ -50,6 +58,10 @@ export declare const INPUT_TOKENS: readonly [{
|
|
|
50
58
|
readonly name: "--vk-fg";
|
|
51
59
|
readonly kind: "colour";
|
|
52
60
|
readonly outright: "--text";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "--vk-fg-brand";
|
|
63
|
+
readonly kind: "colour";
|
|
64
|
+
readonly outright: "--link";
|
|
53
65
|
}, {
|
|
54
66
|
readonly name: "--vk-fg-disabled";
|
|
55
67
|
readonly kind: "colour";
|
|
@@ -138,6 +150,10 @@ export declare const INPUT_TOKENS: readonly [{
|
|
|
138
150
|
readonly name: "--vk-radius-xs";
|
|
139
151
|
readonly kind: "size";
|
|
140
152
|
readonly outright: "--radius-xs";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "--vk-saved-hold";
|
|
155
|
+
readonly kind: "motion";
|
|
156
|
+
readonly outright: "--saved-hold";
|
|
141
157
|
}, {
|
|
142
158
|
readonly name: "--vk-shadow-field";
|
|
143
159
|
readonly kind: "shadow";
|
|
@@ -162,6 +178,10 @@ export declare const INPUT_TOKENS: readonly [{
|
|
|
162
178
|
readonly name: "--vk-spacing";
|
|
163
179
|
readonly kind: "size";
|
|
164
180
|
readonly outright: "--spacing";
|
|
181
|
+
}, {
|
|
182
|
+
readonly name: "--vk-success";
|
|
183
|
+
readonly kind: "colour";
|
|
184
|
+
readonly outright: "--text-success";
|
|
165
185
|
}, {
|
|
166
186
|
readonly name: "--vk-sunken";
|
|
167
187
|
readonly kind: "colour";
|
|
@@ -9,9 +9,12 @@ export const INPUT_TOKENS = [
|
|
|
9
9
|
{ name: "--vk-brand-subtler", kind: "colour", outright: "--background-brand-subtler" },
|
|
10
10
|
{ name: "--vk-corner-smoothing", kind: "size", outright: "--corner-smoothing" },
|
|
11
11
|
{ name: "--vk-danger-subtlest", kind: "colour", outright: "--background-danger-subtlest" },
|
|
12
|
+
{ name: "--vk-duration-base", kind: "motion", outright: "--duration-base" },
|
|
12
13
|
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
14
|
+
{ name: "--vk-ease-in", kind: "motion", outright: "--ease-in" },
|
|
13
15
|
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
14
16
|
{ name: "--vk-fg", kind: "colour", outright: "--text" },
|
|
17
|
+
{ name: "--vk-fg-brand", kind: "colour", outright: "--link" },
|
|
15
18
|
{ name: "--vk-fg-disabled", kind: "colour", outright: "--text-disabled" },
|
|
16
19
|
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
17
20
|
{ name: "--vk-fg-subtlest", kind: "colour", outright: "--text-subtlest" },
|
|
@@ -34,12 +37,14 @@ export const INPUT_TOKENS = [
|
|
|
34
37
|
{ name: "--vk-radius-sm", kind: "size", outright: "--radius-sm" },
|
|
35
38
|
{ name: "--vk-radius-xl", kind: "size", outright: "--radius-xl" },
|
|
36
39
|
{ name: "--vk-radius-xs", kind: "size", outright: "--radius-xs" },
|
|
40
|
+
{ name: "--vk-saved-hold", kind: "motion", outright: "--saved-hold" },
|
|
37
41
|
{ name: "--vk-shadow-field", kind: "shadow", outright: "--shadow-field" },
|
|
38
42
|
{ name: "--vk-shadow-field-focus", kind: "shadow", outright: "--shadow-field-focus" },
|
|
39
43
|
{ name: "--vk-shadow-field-focus-danger", kind: "shadow", outright: "--shadow-field-focus-danger" },
|
|
40
44
|
{ name: "--vk-shadow-field-hover", kind: "shadow", outright: "--shadow-field-hover" },
|
|
41
45
|
{ name: "--vk-shadow-key-pressed", kind: "shadow", outright: "--shadow-key-pressed" },
|
|
42
46
|
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
47
|
+
{ name: "--vk-success", kind: "colour", outright: "--text-success" },
|
|
43
48
|
{ name: "--vk-sunken", kind: "colour", outright: "--surface-sunken" },
|
|
44
49
|
];
|
|
45
50
|
export const INPUT_PRIVATE = ["--input-"];
|
|
@@ -65,10 +65,11 @@
|
|
|
65
65
|
/* Disabled: a softer edge, a grey fill, no lift. */
|
|
66
66
|
.o-input:is(:disabled, [data-disabled], :where(:has(.o-input-control:is(:disabled, [data-disabled])))) { --input-edge: var(--vk-border-subtle); --input-ground: var(--vk-neutral); box-shadow: none; color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
67
67
|
|
|
68
|
-
/* Read-only: what it holds can be read, chosen and copied, not changed:
|
|
69
|
-
takes the focus, and the pointer changes nothing. One that opens
|
|
70
|
-
box to press, not words to copy, and keeps a resting field's edge and lift. */
|
|
68
|
+
/* Read-only: what it holds can be read, chosen and copied, not changed: it stands sunken, its words subtle (KIT-938), in
|
|
69
|
+
focus too, with a soft edge and no lift at rest; it still takes the focus, and the pointer changes nothing. One that opens
|
|
70
|
+
something is a box to press, not words to copy, and keeps a resting field's ground, edge and lift. */
|
|
71
71
|
.o-input:is([readonly], :where(:has(.o-input-control[readonly]))) { cursor: default; }
|
|
72
|
+
.o-input:is([readonly], :where(:has(.o-input-control[readonly]))):where(:not([aria-haspopup], :has(.o-input-control[aria-haspopup]))) { --input-ground: var(--vk-sunken); color: var(--vk-fg-subtle); }
|
|
72
73
|
.o-input:is([readonly], :where(:has(.o-input-control[readonly]))):where(:not(:focus-visible, [data-force="focus"], [data-popup-open], [aria-haspopup], :has(:is(.o-input-control:focus-visible, .o-input-segment:focus, .o-input-control[aria-haspopup])))) { --input-edge: var(--vk-border-subtle); box-shadow: none; }
|
|
73
74
|
|
|
74
75
|
/* ── The options a design picks (input/looks.ts) ─────────────────────────────────────────────────────
|
|
@@ -349,4 +350,49 @@ textarea.o-input-control.o-input-lines { flex: none; min-height: 0; max-height:
|
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
@media (prefers-reduced-motion: reduce) { .o-input { transition: none; } .o-input.o-smooth::before, .o-input.o-smooth::after { transition: none; } }
|
|
353
|
+
|
|
354
|
+
/* ── Saving and Saved (VK-921; the settings canvas, round 2, Every part: Saving): at the field's end, where its sides stand,
|
|
355
|
+
while the app saves what was typed or picked and just after. Saving, the Spinner in the quietest words; saved, a check and
|
|
356
|
+
Saved, small, in the success colour, announced, fading after --vk-saved-hold, after which save-mark.tsx takes it out of
|
|
357
|
+
the field. In its field it keeps the box's padding at its end; in a group it stands after the end side; in a Select's
|
|
358
|
+
field, just before the chevron. A page holds Saved with data-force="saved". ─────────────────────────────────────── */
|
|
359
|
+
.o-input-save {
|
|
360
|
+
flex: none; display: inline-flex; align-items: center; gap: calc(var(--vk-spacing) * 1.5);
|
|
361
|
+
font-size: var(--vk-font-size-xs); line-height: var(--vk-line-height-xs); color: var(--vk-fg-subtlest); white-space: nowrap; user-select: none;
|
|
362
|
+
}
|
|
363
|
+
.o-input-lone > .o-input-save { padding-inline-end: var(--input-pad-inline); }
|
|
364
|
+
.o-input-group:not(.o-select-field) > .o-input-save { order: 1; }
|
|
365
|
+
.o-input-save > svg { flex: none; width: calc(var(--vk-spacing) * 3.5); height: calc(var(--vk-spacing) * 3.5); }
|
|
366
|
+
.o-input-save[data-save="saved"] { color: var(--vk-success); animation: o-input-saved-leave var(--vk-duration-base) var(--vk-ease-in) var(--vk-saved-hold) forwards; }
|
|
367
|
+
[data-force="saved"] .o-input-save { animation: none; }
|
|
368
|
+
@keyframes o-input-saved-leave { to { opacity: 0; } }
|
|
369
|
+
@media (prefers-reduced-motion: reduce) { .o-input-save[data-save="saved"] { animation-duration: 1ms; } }
|
|
370
|
+
|
|
371
|
+
/* ── In a row of Field rows (VK-960; the settings canvas, round 3: look-ios.mjs .fv, .caret, .saved, .act): a Field placed in
|
|
372
|
+
Field rows is the card's row, and its Input or InputGroup stands typed in place there, as iOS's Settings draws a value beside
|
|
373
|
+
its label. No box in any state: no edge, ground, ring, lift or smooth outline, nor a size's height or padding; its words the
|
|
374
|
+
row's, in the text colour, the caret in the brand, a value wider than it cut with "…" at rest. Read-only, in the quietest text
|
|
375
|
+
with no caret. An InputGroup's start words are the value's prefix, in the quietest text and right against it; its end button
|
|
376
|
+
(copy) in the brand, 12 after the value, out of the way while the save mark stands there. The save mark (Saving, Saved) 12
|
|
377
|
+
after the value: its words 14, its check 16, the Spinner 18. The row lays it out (field.css): the value takes what the label
|
|
378
|
+
leaves, and the save mark and the end button never leave the row. Three classes, so no state or look of the box reaches it. */
|
|
379
|
+
.o-input.o-input-inrow.o-input-inrow {
|
|
380
|
+
flex: 1; align-self: stretch; height: auto; min-width: 0; padding: 0; border: 0 none; border-radius: 0; background: none; box-shadow: none; outline: none;
|
|
381
|
+
--input-pad-block: 0px; --input-pad-inline: 0px; --input-group-gap: 0px;
|
|
382
|
+
color: var(--vk-fg); font: inherit; caret-color: var(--vk-fg-brand); transition: none;
|
|
383
|
+
}
|
|
384
|
+
.o-input-inrow > .o-input-control { text-overflow: ellipsis; }
|
|
385
|
+
.o-input-inrow:has(> .o-input-control[readonly]) { color: var(--vk-fg-subtlest); caret-color: transparent; }
|
|
386
|
+
.o-input-inrow:is([data-disabled], :has(> .o-input-control:is(:disabled, [data-disabled]))) { color: var(--vk-fg-disabled); }
|
|
387
|
+
.o-input-inrow > .o-input-addon[data-side="start"] { color: var(--vk-fg-subtlest); }
|
|
388
|
+
.o-input-inrow > .o-input-addon[data-side="end"] { margin-inline-start: calc(var(--vk-spacing) * 3); }
|
|
389
|
+
.o-input-inrow > .o-input-addon[data-side="end"] .o-button.o-button { color: var(--vk-fg-brand); }
|
|
390
|
+
.o-input-inrow:has(> .o-input-save) > .o-input-addon[data-side="end"] { display: none; }
|
|
391
|
+
.o-input-inrow > .o-input-save.o-input-save {
|
|
392
|
+
margin-inline-start: calc(var(--vk-spacing) * 3); padding-inline-end: 0; gap: var(--vk-spacing);
|
|
393
|
+
font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm));
|
|
394
|
+
}
|
|
395
|
+
.o-input-inrow > .o-input-save[data-save="saved"] > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
396
|
+
.o-input-inrow > .o-input-save[data-save="saving"] svg { width: calc(var(--vk-spacing) * 4.5); height: calc(var(--vk-spacing) * 4.5); }
|
|
397
|
+
|
|
352
398
|
}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
const PATHS = {
|
|
3
3
|
plus: ["M12 5l0 14", "M5 12l14 0"],
|
|
4
4
|
down: ["M6 9l6 6l6 -6"],
|
|
5
|
+
"arrow-down": ["M12 5l0 14", "M18 13l-6 6", "M6 13l6 6"],
|
|
5
6
|
trash: ["M4 7l16 0", "M10 11l0 6", "M14 11l0 6", "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12", "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"],
|
|
6
7
|
dots: ["M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"],
|
|
7
8
|
x: ["M18 6l-12 12", "M6 6l12 12"],
|
|
@@ -48,6 +49,15 @@ const PATHS = {
|
|
|
48
49
|
list: ["M9 6l11 0", "M9 12l11 0", "M9 18l11 0", "M5 6l0 .01", "M5 12l0 .01", "M5 18l0 .01"],
|
|
49
50
|
pin: ["M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4", "M9 15l-4.5 4.5", "M14.5 4l5.5 5.5"],
|
|
50
51
|
bell: ["M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6", "M9 17v1a3 3 0 0 0 6 0v-1"],
|
|
52
|
+
archive: ["M3 4m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z", "M5 8v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-10", "M10 12l4 0"],
|
|
53
|
+
"user-plus": ["M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0", "M16 19h6", "M19 16v6", "M6 21v-2a4 4 0 0 1 4 -4h4"],
|
|
54
|
+
share: ["M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1", "M12 14v-11", "M9 6l3 -3l3 3"],
|
|
55
|
+
key: ["M16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1 -4.069 0l-.301 -.301l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.877 2.877 0 0 1 0 -4.069l2.643 -2.643a2.877 2.877 0 0 1 4.069 0z", "M15 9h.01"],
|
|
56
|
+
bot: ["M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z", "M12 2v2", "M9 12v9", "M15 12v9", "M5 16l4 -2", "M15 14l4 2", "M9 18h6", "M10 8v.01", "M14 8v.01"],
|
|
57
|
+
layers: ["M12 4l-8 4l8 4l8 -4l-8 -4", "M4 12l8 4l8 -4", "M4 16l8 4l8 -4"],
|
|
58
|
+
sliders: ["M4 6l8 0", "M16 6l4 0", "M14 4v4", "M4 12l2 0", "M10 12l10 0", "M8 10v4", "M4 18l11 0", "M19 18l1 0", "M17 16v4"],
|
|
59
|
+
lock: ["M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z", "M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0", "M8 11v-4a4 4 0 1 1 8 0v4"],
|
|
60
|
+
"dots-vertical": ["M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"],
|
|
51
61
|
"star-filled": ["M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z"],
|
|
52
62
|
"pin-filled": ["M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z"],
|
|
53
63
|
"bell-filled": ["M14.235 19c.865 0 1.322 1.024 .745 1.668a3.992 3.992 0 0 1 -2.98 1.332a3.992 3.992 0 0 1 -2.98 -1.332c-.552 -.616 -.158 -1.579 .634 -1.661l.11 -.006h4.471z", "M12 2c1.358 0 2.506 .903 2.875 2.141l.046 .171l.008 .043a8.013 8.013 0 0 1 4.024 6.069l.028 .287l.019 .289v2.931l.021 .136a3 3 0 0 0 1.143 1.847l.167 .117l.162 .099c.86 .487 .56 1.766 -.377 1.864l-.116 .006h-16c-1.028 0 -1.387 -1.364 -.493 -1.87a3 3 0 0 0 1.472 -2.063l.021 -.143l.001 -2.97a8 8 0 0 1 3.821 -6.454l.248 -.146l.01 -.043a3.003 3.003 0 0 1 2.562 -2.29l.182 -.017l.176 -.004z"],
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export function useKeptFocus(popup) {
|
|
3
|
+
React.useLayoutEffect(() => {
|
|
4
|
+
if (!popup)
|
|
5
|
+
return;
|
|
6
|
+
const doc = popup.ownerDocument;
|
|
7
|
+
const keep = (e) => {
|
|
8
|
+
const left = e.target;
|
|
9
|
+
if (e.relatedTarget || !left || typeof left.focus !== "function" || left === popup || !popup.contains(left) || !doc.hasFocus())
|
|
10
|
+
return;
|
|
11
|
+
queueMicrotask(() => { if (!left.isConnected && doc.activeElement === doc.body && popup.isConnected)
|
|
12
|
+
popup.focus({ preventScroll: true }); });
|
|
13
|
+
};
|
|
14
|
+
popup.addEventListener("focusout", keep, true);
|
|
15
|
+
return () => popup.removeEventListener("focusout", keep, true);
|
|
16
|
+
}, [popup]);
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const readers = new Set();
|
|
2
|
+
let watch = null;
|
|
3
|
+
let watched = new Set();
|
|
4
|
+
function tell(changes) {
|
|
5
|
+
for (const r of [...readers])
|
|
6
|
+
if (changes.some((c) => c.attributeName != null && r.attrs.includes(c.attributeName)))
|
|
7
|
+
r.read();
|
|
8
|
+
}
|
|
9
|
+
function connect() {
|
|
10
|
+
const pending = watch?.takeRecords() ?? [];
|
|
11
|
+
watch?.disconnect();
|
|
12
|
+
watch = null;
|
|
13
|
+
if (pending.length)
|
|
14
|
+
tell(pending);
|
|
15
|
+
if (!readers.size) {
|
|
16
|
+
watched = new Set();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
watched = new Set([...readers].flatMap((r) => r.attrs));
|
|
20
|
+
watch = new MutationObserver(tell);
|
|
21
|
+
watch.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: [...watched] });
|
|
22
|
+
}
|
|
23
|
+
export function watchFrame(attrs, read) {
|
|
24
|
+
const reader = { attrs, read };
|
|
25
|
+
readers.add(reader);
|
|
26
|
+
if (!watch || attrs.some((a) => !watched.has(a)))
|
|
27
|
+
connect();
|
|
28
|
+
return () => {
|
|
29
|
+
readers.delete(reader);
|
|
30
|
+
if (!readers.size)
|
|
31
|
+
connect();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -37,12 +37,12 @@ export function menuEntries(items, notNow = NO_REASON) {
|
|
|
37
37
|
else if (item.children)
|
|
38
38
|
out.push(ticks ? { kind: "pick", heading: item.label, ...choiceOf(ticks) } : { kind: "group", heading: item.label, entries: menuEntries(item.children, notNow) });
|
|
39
39
|
else if (item.checked !== undefined)
|
|
40
|
-
out.push({ kind: "check", label: item.label, checked: item.checked, onCheckedChange: () => item.onSelect?.(), disabled: item.disabled ? item.disabledReason ?? notNow : undefined });
|
|
40
|
+
out.push({ kind: "check", label: item.label, ...(item.icon != null && { icon: item.icon }), checked: item.checked, onCheckedChange: () => item.onSelect?.(), disabled: item.disabled ? item.disabledReason ?? notNow : undefined });
|
|
41
41
|
else if (item.href)
|
|
42
42
|
out.push({ kind: "link", icon: item.icon ?? null, label: item.label, href: item.href, onSelect: () => item.onSelect?.() });
|
|
43
43
|
else
|
|
44
44
|
out.push({ icon: item.icon ?? null, label: item.label, onSelect: item.onSelect, danger: item.destructive, disabled: item.disabled ? item.disabledReason ?? notNow : undefined,
|
|
45
|
-
keys: item.shortcut ? [item.shortcut] : undefined });
|
|
45
|
+
keys: item.shortcut ? [item.shortcut] : undefined, ...(item.render && { body: item.render() }) });
|
|
46
46
|
}
|
|
47
47
|
return out;
|
|
48
48
|
}
|
|
@@ -101,6 +101,9 @@ type MenuAction = {
|
|
|
101
101
|
onSelect?: () => void;
|
|
102
102
|
/** How many it holds, at its end in the quietest colour (a tab's count under More), or a Spinner while that loads. */
|
|
103
103
|
count?: React.ReactNode;
|
|
104
|
+
/** The row's inside drawn by the app, in place of its icon, name, keys and count; `label` stays its name to a screen reader
|
|
105
|
+
* and to typing. Never a phone's tile. */
|
|
106
|
+
body?: React.ReactNode;
|
|
104
107
|
};
|
|
105
108
|
/** What its rows stand on, as worn around `el`. */
|
|
106
109
|
export declare const menuListRowsOf: (el: Element | null) => string;
|
|
@@ -53,7 +53,7 @@ const rowToggle = (t) => t ? (_jsx(Toggle, { kind: "quiet", shape: "icon", size:
|
|
|
53
53
|
const rowOpen = (name, glyphOf, onOpen) => name ? (_jsx(Button, { kind: "quiet", shape: "icon", size: "xs", className: "o-menu-open", tabIndex: -1, "aria-label": name, icon: glyphOf, onMouseDown: keepRow, onClick: (ev) => { ev.stopPropagation(); onOpen?.(); } })) : null;
|
|
54
54
|
const part = (id, p) => (id ? `${id}-${p}` : undefined);
|
|
55
55
|
const named = (id) => ["n", "v", "k", "c"].map((p) => `${id}-${p}`).join(" ");
|
|
56
|
-
const actionBody = (e, id) => (_jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), e.keys && _jsx("span", { className: "o-menu-keys", id: part(id, "k"), children: e.keys.map((k) => _jsx("kbd", { children: k }, k)) }), e.count != null && _jsx("span", { className: "o-menu-count", id: part(id, "c"), children: e.count })] }));
|
|
56
|
+
const actionBody = (e, id) => e.body !== undefined ? _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.body }) : (_jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), e.keys && _jsx("span", { className: "o-menu-keys", id: part(id, "k"), children: e.keys.map((k) => _jsx("kbd", { children: k }, k)) }), e.count != null && _jsx("span", { className: "o-menu-count", id: part(id, "c"), children: e.count })] }));
|
|
57
57
|
const linkBody = (e, id) => _jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), e.external && strokeGlyph(AWAY, "o-menu-away")] });
|
|
58
58
|
const checkBody = (e, id) => _jsxs(_Fragment, { children: [_jsx(CheckboxMark, {}), _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label })] });
|
|
59
59
|
const actionsBody = (e, id) => _jsxs(_Fragment, { children: [e.icon, _jsx("span", { className: "o-menu-name", id: part(id, "n"), children: e.label }), e.detail != null && _jsx("span", { className: "o-menu-value", id: part(id, "v"), "data-on": e.inForce ? "" : undefined, children: e.detail }), strokeGlyph(MORE, "o-menu-more")] });
|
|
@@ -103,7 +103,7 @@ export function MenuListRows({ entries, host }) {
|
|
|
103
103
|
return (_jsxs(BaseMenu.Group, { children: [e.heading && _jsx(BaseMenu.GroupLabel, { className: "o-list-heading", children: e.heading }), _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: choiceBody(c) }, c.value)) })] }, i));
|
|
104
104
|
if (e.kind === "choices")
|
|
105
105
|
return (_jsx(Sub, { trigger: choicesBody(e), host: host, children: _jsx(BaseMenu.RadioGroup, { value: e.value, onValueChange: (v) => e.onChoose?.(v), children: e.choices.map((c) => _jsx(BaseMenu.RadioItem, { value: c.value, label: c.label, closeOnClick: true, className: "o-list-row o-smooth o-smooth-ease o-menu-row", children: choiceBody(c) }, c.value)) }) }, i));
|
|
106
|
-
return _jsx(BaseMenu.Item, { label: e.label, className: rowClass(e), disabled: !!e.disabled, title: e.disabled, onClick: e.onSelect, children: actionBody(e) }, i);
|
|
106
|
+
return _jsx(BaseMenu.Item, { label: e.label, "aria-label": e.body !== undefined ? e.label : undefined, className: rowClass(e), disabled: !!e.disabled, title: e.disabled, onClick: e.onSelect, children: actionBody(e) }, i);
|
|
107
107
|
}) });
|
|
108
108
|
}
|
|
109
109
|
export function MenuListShown({ entries, label, open, on = [], className }) {
|
|
@@ -292,7 +292,7 @@ export function MenuListPanelRows({ label, entries, onOpen, ticks = "box", onMov
|
|
|
292
292
|
export function tilesOf(entries, allRows) {
|
|
293
293
|
if (allRows)
|
|
294
294
|
return { entries };
|
|
295
|
-
const plain = entries.filter((e) => (e.kind === undefined || e.kind === "action") && !e.danger && !e.disabled && e.count == null).slice(0, 4);
|
|
295
|
+
const plain = entries.filter((e) => (e.kind === undefined || e.kind === "action") && !e.danger && !e.disabled && e.count == null && e.body === undefined).slice(0, 4);
|
|
296
296
|
if (plain.length < 3)
|
|
297
297
|
return { entries };
|
|
298
298
|
return { tiles: plain.map((e) => ({ icon: e.icon, label: e.label, onSelect: e.onSelect })), entries: entries.filter((e) => !plain.includes(e)) };
|
|
@@ -347,7 +347,8 @@ function PhoneRow({ row, onOpen, move, room, ticks = "switch", words = MENU_LIST
|
|
|
347
347
|
return _jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, onClick: () => onOpen?.(row), children: [lead, body(row), endOf(row), glyph(MORE, "o-menu-list-more")] });
|
|
348
348
|
if (row.kind === "choices")
|
|
349
349
|
return (_jsxs(BaseButton, { className: "o-menu-list-row", ...mv, ...how, onClick: () => onOpen?.(row), children: [lead, body(row), endOf(row), _jsx("span", { className: "o-menu-list-value", children: row.detail ?? row.choices.find((c) => c.value === row.value)?.label }), glyph(MORE, "o-menu-list-more")] }));
|
|
350
|
-
|
|
350
|
+
const own = "body" in row && row.body !== undefined ? _jsxs("span", { className: "o-menu-list-name", children: [row.body, row.disabled != null && _jsx("span", { className: "o-menu-list-note", children: row.disabled })] }) : null;
|
|
351
|
+
return _jsxs(BaseButton, { className: cx("o-menu-list-row", row.danger && "o-menu-list-danger"), ...mv, ...how, disabled: !!row.disabled, onClick: row.onSelect, "aria-label": own ? row.label : undefined, children: [lead, own ?? body(row, row.disabled), own ? null : endOf(row)] });
|
|
351
352
|
}
|
|
352
353
|
export function MenuListRow({ label, value, onSelect, className }) {
|
|
353
354
|
return _jsxs(BaseButton, { className: cx("o-menu-list-row", className), onClick: onSelect, children: [_jsx("span", { className: "o-menu-list-name", children: _jsx("span", { children: label }) }), _jsx("span", { className: "o-menu-list-value", children: value })] });
|
|
@@ -3,7 +3,9 @@ import * as React from "react";
|
|
|
3
3
|
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
4
4
|
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
5
5
|
import { Button } from "../button/button.js";
|
|
6
|
+
import { useKeptFocus } from "../internal/keep-focus.js";
|
|
6
7
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
8
|
+
import { OutOfFieldRows } from "../../internal/field-rows.js";
|
|
7
9
|
import { usePopupHost } from "../internal/popup-host.js";
|
|
8
10
|
import { Notice } from "../notice/notice.js";
|
|
9
11
|
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
@@ -38,6 +40,8 @@ export function Modal({ open, onOpenChange, title, mark, path, onOpenAsPage, siz
|
|
|
38
40
|
const [overPopup, setOverPopup] = React.useState(false);
|
|
39
41
|
React.useLayoutEffect(() => { setOverPopup(!!ref.current?.closest('[data-kit="popover"]')); }, []);
|
|
40
42
|
const over = overPopup ? "" : undefined;
|
|
43
|
+
const [popup, setPopup] = React.useState(null);
|
|
44
|
+
useKeptFocus(popup);
|
|
41
45
|
const leave = () => { if (saving)
|
|
42
46
|
return; if (dirty)
|
|
43
47
|
setAsking(true);
|
|
@@ -58,5 +62,5 @@ export function Modal({ open, onOpenChange, title, mark, path, onOpenAsPage, siz
|
|
|
58
62
|
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: ref, hidden: true }), _jsxs(Sheet, { open: open, onOpenChange: (o) => { if (!o)
|
|
59
63
|
leave(); }, label: title, form: "full", container: where, standing: standing, children: [_jsx(SheetHead, { title: title, left: _jsx(SheetButton, { "aria-label": cancel, icon: glyph(X), onClick: leave, disabled: saving }), right: foot !== "none" && action ? _jsx(SheetButton, { kind: "primary", "aria-label": action.label, icon: glyph(CHECK), onClick: act, disabled: saving || action.disabled }) : _jsx("span", {}) }), _jsxs(SheetBody, { children: [notice, children] }), guard] })] }));
|
|
60
64
|
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: ref, hidden: true }), _jsx(BaseDialog.Root, { open: open, onOpenChange: (o) => { if (!o)
|
|
61
|
-
leave(); }, ...(standing ? { modal: false, disablePointerDismissal: true } : {}), children: _jsxs(BaseDialog.Portal, { container: where, children: [_jsx(BaseDialog.Backdrop, { className: "o-modal-backdrop", "data-over-popup": over }), _jsx(BaseDialog.Viewport, { className: "o-modal-viewport", "data-over-popup": over, children: _jsxs(BaseDialog.Popup, { className: "o-modal", "data-kit": "modal", "data-width": size, "aria-busy": saving || undefined, initialFocus: standing ? false : () => body.current?.querySelector("input:not([type=hidden]), textarea, [role='combobox'], .o-select-field") ?? true, children: [_jsxs("div", { className: "o-modal-cut o-smooth", children: [_jsxs("header", { className: "o-modal-head", children: [mark != null && _jsx("span", { className: "o-modal-mark", "aria-hidden": "true", children: mark }), path && _jsxs("span", { className: "o-modal-path", children: [_jsxs("span", { className: "o-modal-chip", children: [path.icon, _jsx("span", { className: "o-modal-chip-word", children: path.label })] }), glyph(NEXT)] }), _jsx(BaseDialog.Title, { className: "o-modal-title", children: title }), _jsxs("span", { className: "o-modal-tools", children: [onOpenAsPage && _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.openAsPage, icon: glyph(EXPAND), onClick: onOpenAsPage }), _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.close, icon: glyph(X), disabled: saving, onClick: leave })] })] }),
|
|
65
|
+
leave(); }, ...(standing ? { modal: false, disablePointerDismissal: true } : {}), children: _jsxs(BaseDialog.Portal, { container: where, children: [_jsx(BaseDialog.Backdrop, { className: "o-modal-backdrop", "data-over-popup": over }), _jsx(BaseDialog.Viewport, { className: "o-modal-viewport", "data-over-popup": over, children: _jsxs(BaseDialog.Popup, { ref: setPopup, className: "o-modal", "data-kit": "modal", "data-width": size, "aria-busy": saving || undefined, initialFocus: standing ? false : () => body.current?.querySelector("input:not([type=hidden]), textarea, [role='combobox'], .o-select-field") ?? true, children: [_jsxs("div", { className: "o-modal-cut o-smooth", children: [_jsxs("header", { className: "o-modal-head", children: [mark != null && _jsx("span", { className: "o-modal-mark", "aria-hidden": "true", children: mark }), path && _jsxs("span", { className: "o-modal-path", children: [_jsxs("span", { className: "o-modal-chip", children: [path.icon, _jsx("span", { className: "o-modal-chip-word", children: path.label })] }), glyph(NEXT)] }), _jsx(BaseDialog.Title, { className: "o-modal-title", children: title }), _jsxs("span", { className: "o-modal-tools", children: [onOpenAsPage && _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.openAsPage, icon: glyph(EXPAND), onClick: onOpenAsPage }), _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", "aria-label": said.close, icon: glyph(X), disabled: saving, onClick: leave })] })] }), _jsx("div", { ref: body, className: "o-modal-body", children: _jsxs(OutOfFieldRows, { children: [notice, children] }) }), _jsx(Scrollbar, { drawn: true }), foot !== "none" && (_jsxs("footer", { className: "o-modal-foot", children: [footStart != null && _jsx("span", { className: "o-modal-start", children: footStart }), _jsxs("span", { className: "o-modal-end", children: [foot === "both" && _jsx(Button, { className: "o-modal-cancel", disabled: saving, onClick: leave, children: cancel }), action && _jsx(Button, { kind: action.kind ?? "primary", loading: saving, disabled: action.disabled, onClick: act, children: action.label })] })] }))] }), guard] }) })] }) })] }));
|
|
62
66
|
}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Dialog } from "@base-ui/react/dialog";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { OutOfFieldRows } from "../../internal/field-rows.js";
|
|
5
6
|
import { closeReasonOf } from "../internal/close-reason.js";
|
|
6
7
|
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
7
8
|
import { paneAfter } from "./state.js";
|
|
@@ -61,7 +62,7 @@ export function Pane({ open, onOpenChange, container, opener, initialFocus = tru
|
|
|
61
62
|
};
|
|
62
63
|
if (!container)
|
|
63
64
|
return null;
|
|
64
|
-
return (_jsx(Dialog.Root, { open: open, onOpenChange: change, modal: false, disablePointerDismissal: true, children: _jsx(Dialog.Portal, { container: container, className: "o-pane-portal", children: _jsx(Dialog.Popup, { ref: popup, className: cx("o-pane", className), "data-kit": "pane", "aria-label": label, initialFocus: initialFocus ? popup : false, finalFocus: backTo, children: _jsx("div", { className: "o-pane-cut o-smooth", children: _jsx(InPane.Provider, { value: true, children: children }) }) }) }) }));
|
|
65
|
+
return (_jsx(Dialog.Root, { open: open, onOpenChange: change, modal: false, disablePointerDismissal: true, children: _jsx(Dialog.Portal, { container: container, className: "o-pane-portal", children: _jsx(Dialog.Popup, { ref: popup, className: cx("o-pane", className), "data-kit": "pane", "aria-label": label, initialFocus: initialFocus ? popup : false, finalFocus: backTo, children: _jsx("div", { className: "o-pane-cut o-smooth", children: _jsx(InPane.Provider, { value: true, children: _jsx(OutOfFieldRows, { children: children }) }) }) }) }) }));
|
|
65
66
|
}
|
|
66
67
|
export const InPane = React.createContext(false);
|
|
67
68
|
export function PaneHead({ children, className }) {
|
|
@@ -4,6 +4,10 @@ export interface HeaderBarProps extends Omit<React.HTMLAttributes<HTMLDivElement
|
|
|
4
4
|
left?: React.ReactNode;
|
|
5
5
|
/** What stands in its middle: the title. */
|
|
6
6
|
title: React.ReactNode;
|
|
7
|
+
/** A record's mark (a company's square, a person's face: the Avatar at 24), standing before the title and never shrinking, the
|
|
8
|
+
* title cut with … beside it; the two stand together, centred or at the left as `titleAt` says. Hidden from a screen reader:
|
|
9
|
+
* the title says the name. */
|
|
10
|
+
mark?: React.ReactNode;
|
|
7
11
|
/** A quieter second line under the title: a page's or a sheet's description. */
|
|
8
12
|
description?: React.ReactNode;
|
|
9
13
|
/** The element that draws the description when it must be the caller's own (a sheet's Base UI Dialog.Description); a span by
|
|
@@ -15,4 +19,4 @@ export interface HeaderBarProps extends Omit<React.HTMLAttributes<HTMLDivElement
|
|
|
15
19
|
right?: React.ReactNode;
|
|
16
20
|
}
|
|
17
21
|
/** The phone's header: a left place, the title and a right place, on the soft edge, over what scrolls. */
|
|
18
|
-
export declare function HeaderBar({ left, title, description, descriptionRender, titleAt, right, className, ...props }: HeaderBarProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function HeaderBar({ left, title, mark, description, descriptionRender, titleAt, right, className, ...props }: HeaderBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
3
3
|
import { cx } from "../../internal/cx.js";
|
|
4
4
|
import { GlassButtonGroup } from "../glass-button/glass-button.js";
|
|
5
5
|
import { SoftEdge } from "./soft-edge.js";
|
|
6
|
-
export function HeaderBar({ left, title, description, descriptionRender, titleAt = "center", right, className, ...props }) {
|
|
6
|
+
export function HeaderBar({ left, title, mark, description, descriptionRender, titleAt = "center", right, className, ...props }) {
|
|
7
7
|
const shown = useRender({ defaultTagName: "span", render: descriptionRender, props: { className: "o-hd-bar-description", children: description } });
|
|
8
|
-
return (_jsxs("div", { className: cx("o-hd-bar", className), "data-title-at": titleAt === "left" ? "left" : undefined, ...props, children: [_jsx(SoftEdge, { className: "o-hd-bar-edge" }), _jsx("span", { className: "o-hd-bar-side", children: left }), _jsxs("span", { className: "o-hd-bar-title", children: [title, description != null && shown] }), _jsx(GlassButtonGroup, { className: "o-hd-bar-side", children: right })] }));
|
|
8
|
+
return (_jsxs("div", { className: cx("o-hd-bar", className), "data-title-at": titleAt === "left" ? "left" : undefined, "data-mark": mark != null ? "" : undefined, ...props, children: [_jsx(SoftEdge, { className: "o-hd-bar-edge" }), _jsx("span", { className: "o-hd-bar-side", children: left }), _jsxs("span", { className: "o-hd-bar-title", children: [mark != null && _jsx("span", { className: "o-hd-bar-mark", "aria-hidden": "true", children: mark }), title, description != null && shown] }), _jsx(GlassButtonGroup, { className: "o-hd-bar-side", children: right })] }));
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* The phone's header bar, the one row a page and a sheet's head both draw, and the soft edge it stands on. Every value it draws
|
|
2
2
|
with is a public name (controls/phone-header/tokens.ts); this file only says which name each part takes: 44 tall on the page's
|
|
3
3
|
padding (--page-padding; in a sheet, the sheet's), its title centred between its two places, whatever stands in them, and cut
|
|
4
|
-
before it reaches them. --hd-bar-room is the room standing over it: the soft edge starts that far above it and ends just past
|
|
4
|
+
before it reaches them; a record's mark, when it has one, beside its title. --hd-bar-room is the room standing over it: the soft edge starts that far above it and ends just past
|
|
5
5
|
it, so it always reaches the top of what it stands in. What an app sets once is a data attribute on the frame around it
|
|
6
6
|
(looks.ts):
|
|
7
7
|
|
|
@@ -44,6 +44,16 @@
|
|
|
44
44
|
/* Its title at the left: after what stands on its left, taking the room there is. */
|
|
45
45
|
.o-hd-bar[data-title-at="left"] { grid-template-columns: auto minmax(0, 1fr) auto; }
|
|
46
46
|
.o-hd-bar[data-title-at="left"] > .o-hd-bar-title { text-align: start; }
|
|
47
|
+
/* A record's mark beside its title (data-mark): its own column, as wide as the mark, so it never shrinks while the words cut with
|
|
48
|
+
… beside it, 8 apart; the two stand together, centred, or at the left after what stands there. With a description the mark
|
|
49
|
+
stands beside both lines. */
|
|
50
|
+
.o-hd-bar[data-mark] > .o-hd-bar-title {
|
|
51
|
+
grid-template-columns: max-content minmax(0, max-content); column-gap: calc(var(--vk-spacing) * 2);
|
|
52
|
+
justify-content: center; align-items: center; text-align: start;
|
|
53
|
+
}
|
|
54
|
+
.o-hd-bar[data-mark][data-title-at="left"] > .o-hd-bar-title { justify-content: start; }
|
|
55
|
+
.o-hd-bar-mark { display: flex; overflow: visible; }
|
|
56
|
+
.o-hd-bar-mark:has(~ .o-hd-bar-description) { grid-row: span 2; }
|
|
47
57
|
/* Flat: no soft edge, and a smaller title. What it stands on is its place's: the page's header on a page, the Sheet's in a sheet. */
|
|
48
58
|
[data-phone-header-surface="flat"] .o-hd-bar > .o-hd-bar-edge { display: none; }
|
|
49
59
|
[data-phone-header-surface="flat"] .o-hd-bar > .o-hd-bar-title { font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
@@ -41,6 +41,9 @@ export function pickerWordsOf(say) {
|
|
|
41
41
|
noneTyped: (typed) => say({ key: "views.picker.none-typed", values: { typed } }),
|
|
42
42
|
create: (typed) => say({ key: "views.picker.create", values: { typed } }),
|
|
43
43
|
createButton: say({ key: "views.picker.create-button" }),
|
|
44
|
+
add: (value) => say({ key: "views.editors.add-option", values: { value } }),
|
|
45
|
+
adding: (value) => say({ key: "views.editors.adding-option", values: { value } }),
|
|
46
|
+
addButton: say({ key: "views.editors.values-add" }),
|
|
44
47
|
loadingMore: say({ key: "views.picker.loading-more" }),
|
|
45
48
|
chosen: (count) => say({ key: "views.picker.chosen", values: { count } }),
|
|
46
49
|
clearAll: say({ key: "views.picker.clear-all" }),
|
|
@@ -21,6 +21,12 @@ export interface PickerWords {
|
|
|
21
21
|
create: (typed: string) => string;
|
|
22
22
|
/** A phone's bar's Create. */
|
|
23
23
|
createButton: string;
|
|
24
|
+
/** + Add's row, after the matches (`onAdd`). */
|
|
25
|
+
add: (typed: string) => string;
|
|
26
|
+
/** + Add's row while the app answers. */
|
|
27
|
+
adding: (typed: string) => string;
|
|
28
|
+
/** A phone's bar's + Add. */
|
|
29
|
+
addButton: string;
|
|
24
30
|
loadingMore: string;
|
|
25
31
|
chosen: (count: number) => string;
|
|
26
32
|
clearAll: string;
|
|
@@ -69,6 +75,14 @@ export interface PickerProps {
|
|
|
69
75
|
search?: string;
|
|
70
76
|
/** Takes new values: handed what was typed, it makes the value and returns it, which is then picked. */
|
|
71
77
|
onCreate?: (typed: string) => string;
|
|
78
|
+
/** Asks the app to add what was typed (ViewKit's + Add): offered where Create is, a row after the matches reading Add “word”
|
|
79
|
+
* (on a phone the bar's Add), which picks nothing: the app's option comes back in `items` and is picked by its holder.
|
|
80
|
+
* Handed instead of `onCreate`. */
|
|
81
|
+
onAdd?: (typed: string) => void;
|
|
82
|
+
/** The add in flight, its word: its row reads Adding “word”… and can't be pressed, whatever is typed. */
|
|
83
|
+
adding?: string;
|
|
84
|
+
/** The last add refused, or failed: the app's words, shown where its row was until something else is typed. */
|
|
85
|
+
addRefused?: string;
|
|
72
86
|
/** The values come from the server: handed each query; `items` are its answer, shown as they are. */
|
|
73
87
|
onSearch?: (query: string) => void;
|
|
74
88
|
/** What the list is doing besides showing its rows. */
|
|
@@ -47,6 +47,9 @@ export const PICKER_WORDS = {
|
|
|
47
47
|
noneTyped: (typed) => `Nothing matches “${typed}”.`,
|
|
48
48
|
create: (typed) => `Create “${typed}”`,
|
|
49
49
|
createButton: "Create",
|
|
50
|
+
add: (typed) => `Add “${typed}”`,
|
|
51
|
+
adding: (typed) => `Adding “${typed}”…`,
|
|
52
|
+
addButton: "Add",
|
|
50
53
|
loadingMore: "Loading more…",
|
|
51
54
|
chosen: (count) => `${count} chosen`,
|
|
52
55
|
clearAll: "Clear all",
|
|
@@ -182,6 +185,7 @@ function usePickerAt(props, under) {
|
|
|
182
185
|
const w = { ...PICKER_WORDS, ...props.words };
|
|
183
186
|
const menuWords = { ...props.menuWords, ...(props.words ? { picker: props.words } : {}) };
|
|
184
187
|
const onValueChange = readOnly ? () => { } : props.onValueChange, onCreate = readOnly ? undefined : props.onCreate;
|
|
188
|
+
const onAdd = readOnly ? undefined : props.onAdd, add = !!onAdd, adding = onAdd ? props.adding : undefined;
|
|
185
189
|
const host = React.useContext(PhoneHost), small = usePhone();
|
|
186
190
|
const form = props.form ?? (host || small ? "phone" : "computer");
|
|
187
191
|
const inBox = under?.searchIn === "box", inBoxNow = React.useRef(inBox);
|
|
@@ -313,10 +317,18 @@ function usePickerAt(props, under) {
|
|
|
313
317
|
setAhead(heldNow.current); }, [props.firstFollows, heldKey]);
|
|
314
318
|
const listFirst = !!multiple && worn.picked === "first" && form === "computer";
|
|
315
319
|
const firstOnes = new Set(listFirst && !find.trim() ? ahead : []);
|
|
316
|
-
const server = !!onSearch, create = !!onCreate, own = (props.draft ?? "own") === "own";
|
|
320
|
+
const server = !!onSearch, create = !!onCreate || add, own = (props.draft ?? "own") === "own";
|
|
317
321
|
const openPath = openLevels(items, opened);
|
|
318
322
|
const level = openPath[openPath.length - 1];
|
|
319
|
-
const
|
|
323
|
+
const found = doing ? [] : pickerRows({ items: listed, known: items, query: find, picked: held, empty: multiple ? undefined : empty, create, server, more: !!onMore, first: listFirst ? ahead : undefined, open: level ? openPath : undefined, levelRow: !byHolder });
|
|
324
|
+
const rows = adding === undefined ? found : (() => {
|
|
325
|
+
const out = found.filter((r) => r.kind !== "create"), at = out.findIndex((r) => r.kind === "more");
|
|
326
|
+
out.splice(at < 0 ? out.length : at, 0, { kind: "create", typed: adding });
|
|
327
|
+
return out;
|
|
328
|
+
})();
|
|
329
|
+
const [refusal, setRefusal] = React.useState(null);
|
|
330
|
+
React.useLayoutEffect(() => { setRefusal(onAdd && props.addRefused !== undefined ? { words: props.addRefused, typed: find.trim() } : null); }, [props.addRefused]);
|
|
331
|
+
const refused = refusal && adding === undefined && fold(refusal.typed) === fold(find.trim()) ? refusal.words : undefined;
|
|
320
332
|
const shown = inBox || !!level || (props.searchShown ?? (worn.search === "always" || searchShown({ count: items.length, create, server, query })));
|
|
321
333
|
const none = !items.length && !find && !!nothingYet;
|
|
322
334
|
typedNow.current = query;
|
|
@@ -349,7 +361,7 @@ function usePickerAt(props, under) {
|
|
|
349
361
|
if (added?.kind === "action")
|
|
350
362
|
return added.action.onSelect();
|
|
351
363
|
if (added?.kind === "create")
|
|
352
|
-
return onValueChange([...held, make(added.typed)]);
|
|
364
|
+
return onAdd ? onAdd(added.typed) : onValueChange([...held, make(added.typed)]);
|
|
353
365
|
onValueChange(next.filter((e) => e.kind === "item").map((e) => e.item.value));
|
|
354
366
|
if (inBox)
|
|
355
367
|
ask("");
|
|
@@ -369,6 +381,8 @@ function usePickerAt(props, under) {
|
|
|
369
381
|
return next.action.onSelect();
|
|
370
382
|
if (next.kind === "item" && next.item.disabled)
|
|
371
383
|
return;
|
|
384
|
+
if (next.kind === "create" && onAdd)
|
|
385
|
+
return onAdd(next.typed);
|
|
372
386
|
onValueChange(next.kind === "item" ? next.item.value : next.kind === "create" ? make(next.typed) : null);
|
|
373
387
|
onDone?.();
|
|
374
388
|
};
|
|
@@ -576,8 +590,12 @@ function usePickerAt(props, under) {
|
|
|
576
590
|
return (_jsxs("div", { className: "o-list-row o-smooth o-smooth-ease o-picker-parent", "data-parent": "", "aria-hidden": "true", children: [_jsx(Face, { item: r.item }), _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: _jsx(Name, { item: r.item }) }) })] }, "parent"));
|
|
577
591
|
if (r.kind === "empty")
|
|
578
592
|
return (_jsx(BaseCombobox.Item, { ref: keepsToItsList, value: { key: "empty", kind: "empty", label: r.label }, className: "o-list-row o-smooth o-smooth-ease o-list-clear o-picker-empty", "data-name": r.label, children: _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: r.label }) }) }, "empty"));
|
|
579
|
-
if (r.kind === "create")
|
|
580
|
-
return (
|
|
593
|
+
if (r.kind === "create" && refused !== undefined)
|
|
594
|
+
return (_jsx("div", { className: "o-picker-message", role: "alert", children: _jsx("span", { className: "o-picker-message-text", children: refused }) }, "create"));
|
|
595
|
+
if (r.kind === "create") {
|
|
596
|
+
const busy = adding !== undefined;
|
|
597
|
+
return (_jsxs(BaseCombobox.Item, { ref: foot ? staysInView : keepsToItsList, value: { key: "create", kind: "create", typed: r.typed }, disabled: busy, className: cx("o-list-row o-smooth o-smooth-ease o-list-clear o-picker-create", worn.create === "apart" && "o-picker-create-apart"), children: [busy ? _jsx(Spinner, { size: 16, label: "" }) : glyph(PLUS, "o-list-plus"), _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: around(add ? (busy ? w.adding(r.typed) : w.add(r.typed)) : w.create(r.typed), r.typed) }) })] }, "create"));
|
|
598
|
+
}
|
|
581
599
|
return _jsx(React.Fragment, {}, i);
|
|
582
600
|
};
|
|
583
601
|
const action = (a, foot = false) => (_jsxs(BaseCombobox.Item, { ref: foot ? staysInView : keepsToItsList, value: { key: `action:${a.id}`, kind: "action", action: a }, className: "o-list-row o-smooth o-smooth-ease o-picker-action", children: [_jsx("span", { className: "o-picker-icon", children: a.icon }), _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: a.label }) }), a.keys?.length ? _jsx(Kbd, { keys: a.keys }) : null] }, a.id));
|
|
@@ -722,6 +740,7 @@ function usePickerAt(props, under) {
|
|
|
722
740
|
const parent = listRows[0]?.kind === "parent" ? listRows[0] : undefined;
|
|
723
741
|
const rest = listRows.filter((r) => r.kind === "item" && !isKept(r.item.value));
|
|
724
742
|
const creatable = create && !!typed && !exactMatch(level?.level ?? items, query);
|
|
743
|
+
const addable = add && (adding !== undefined || (creatable && refused === undefined));
|
|
725
744
|
const leave = () => { setDraft(holdingNow.current); ask(""); onDone?.(); };
|
|
726
745
|
const createTyped = () => {
|
|
727
746
|
const v = make(typed);
|
|
@@ -786,10 +805,11 @@ function usePickerAt(props, under) {
|
|
|
786
805
|
const under = !!props.actionsUnder && !none;
|
|
787
806
|
const menu = under ? [] : actions.map((a) => ({ icon: a.icon, label: a.label, onSelect: a.onSelect }));
|
|
788
807
|
const underActions = under && !typed && actions.length > 0 && (_jsx("div", { className: "o-picker-under", children: actions.map((a) => _jsx(Button, { kind: "outline", size: "44", icon: a.icon, onClick: a.onSelect, children: a.label }, a.id)) }));
|
|
789
|
-
const showBar = !none && (pill || creatable || menu.length > 0 || (!!level && !byHolder));
|
|
808
|
+
const showBar = !none && (pill || creatable || addable || menu.length > 0 || (!!level && !byHolder));
|
|
790
809
|
const bar = showBar && (_jsxs("div", { className: "o-picker-bar", children: [level && !byHolder && _jsx(GlassButton, { "aria-label": w.back(level.label), icon: glyph(BACK), className: "o-picker-round", "data-back": "", onMouseDown: (e) => e.preventDefault(), onClick: () => back() }), pill && (_jsxs(InputGroup, { size: "lg", className: "o-picker-pill", ...pillTap, children: [_jsx(InputGroupAddon, { side: "start", children: glyph(SEARCH) }), _jsx(Input, { combobox: true, autofill: false, ref: pillInput, placeholder: search, "aria-label": search ?? label, onKeyDown: (e) => { if (!backKey(e))
|
|
791
|
-
enter(e); } })] })),
|
|
792
|
-
:
|
|
810
|
+
enter(e); } })] })), addable ? _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), loading: adding !== undefined, className: "o-picker-create-button", onClick: () => onAdd(typed), children: w.addButton })
|
|
811
|
+
: creatable && !add ? _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), className: "o-picker-create-button", onClick: createTyped, children: w.createButton })
|
|
812
|
+
: menu.length > 0 && _jsx(Menu, { label: label, entries: menu, words: menuWords, trigger: _jsx(GlassButton, { "aria-label": w.actions, icon: glyph(DOTS), className: "o-picker-round" }) })] }));
|
|
793
813
|
const menuOpen = (item) => (menuOpenFor(item.value) ? { "data-menu-open": "" } : {});
|
|
794
814
|
const heldHere = (v) => inPlace && kept.includes(v);
|
|
795
815
|
const rowValue = (item) => (heldHere(item.value) && !changing ? { key: `unpick:${item.value}`, kind: "unpick", item } : itemEntry(item));
|
|
@@ -804,7 +824,7 @@ function usePickerAt(props, under) {
|
|
|
804
824
|
return (_jsxs(BaseCombobox.Group, { className: "o-picker-group", children: [g.name && _jsx(BaseCombobox.GroupLabel, { className: "o-picker-label", children: g.name }), _jsx("div", { className: "o-picker-card o-picker-list", "data-heading": g.name || undefined, children: rows })] }, g.name || "-"));
|
|
805
825
|
});
|
|
806
826
|
})() : null;
|
|
807
|
-
const body = (_jsxs(BaseCombobox.Root, { inline: true, open: true, multiple: changing, value: (changing ? kept.map((v) => itemEntry(itemOf(v))) : held[0] != null ? { key: `unpick:${held[0]}`, kind: "unpick", item: itemOf(held[0]) } : null), onValueChange: (v, d) => tap(v, d), inputValue: query, onInputValueChange: ask, autoHighlight: true, itemToStringValue: (e) => e.key, itemToStringLabel: (e) => entryLabel(e), isItemEqualToValue: (a, b) => a.key === b.key, children: [_jsxs("div", { ref: placeRoot, className: "o-picker", "data-kit": "picker", "data-picker-form": "phone", ...phoneMark(!!host || small), "data-typed": typed ? "" : undefined, style: room ? { "--picker-room": `${room.height}px`, "--picker-under": `${room.under}px` } : undefined, children: [none ? (_jsxs("div", { className: "o-picker-note o-picker-first", children: [_jsxs("span", { children: [_jsx("b", { children: nothingYet.text }), nothingYet.line && _jsxs(_Fragment, { children: [_jsx("br", {}), nothingYet.line] })] }), _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), onClick: nothingYet.onAction, children: nothingYet.action })] })) : (_jsxs(_Fragment, { children: [_jsxs(BaseCombobox.List, { className: "o-picker-phone", "aria-label": label, children: [keptItems.length > 0 && (_jsxs(BaseCombobox.Group, { className: "o-picker-group", children: [_jsx(BaseCombobox.GroupLabel, { className: "o-picker-label", children: label_ }), _jsx("div", { className: "o-picker-card o-picker-selected", children: keptItems.map((item, i) => (_jsx(BaseCombobox.Item, { ref: keepsToItsList, index: at(i, false), value: changing ? itemEntry(item) : { key: `unpick:${item.value}`, kind: "unpick", item }, className: "o-picker-row", ...menuOpen(item), children: _jsx(PhoneRow, { item: item, kind: worn.kind, you: w.you, circle: fixed ? "fixed" : "on", box: boxes, lead: changing && !own && props.lead ? _jsx(LeadMark, { lead: props.lead, value: item.value }) : undefined, menu: hasMenu(item) ? rowTrigger(item) : undefined }) }, item.value))) })] })), headed && !note && cards, !headed && (parent || (!note && rest.length > 0)) && (_jsxs("div", { className: "o-picker-card o-picker-list", children: [parent && _jsx("div", { className: "o-picker-row o-picker-parent", "data-parent": "", "aria-hidden": "true", children: _jsx(PhoneRow, { item: parent.item, kind: worn.kind, you: w.you, circle: null }) }), !note && rest.length > 0 && (parent ? _jsx("div", { className: "o-picker-level", children: listed }) : listed)] }))] }), note, underActions, onMore && !doing && _jsxs("div", { ref: more, className: "o-picker-more", children: [_jsx(Spinner, { size: 16, label: "" }), w.loadingMore] })] })), bar] }), rowMenuEl] }));
|
|
827
|
+
const body = (_jsxs(BaseCombobox.Root, { inline: true, open: true, multiple: changing, value: (changing ? kept.map((v) => itemEntry(itemOf(v))) : held[0] != null ? { key: `unpick:${held[0]}`, kind: "unpick", item: itemOf(held[0]) } : null), onValueChange: (v, d) => tap(v, d), inputValue: query, onInputValueChange: ask, autoHighlight: true, itemToStringValue: (e) => e.key, itemToStringLabel: (e) => entryLabel(e), isItemEqualToValue: (a, b) => a.key === b.key, children: [_jsxs("div", { ref: placeRoot, className: "o-picker", "data-kit": "picker", "data-picker-form": "phone", ...phoneMark(!!host || small), "data-typed": typed ? "" : undefined, style: room ? { "--picker-room": `${room.height}px`, "--picker-under": `${room.under}px` } : undefined, children: [none ? (_jsxs("div", { className: "o-picker-note o-picker-first", children: [_jsxs("span", { children: [_jsx("b", { children: nothingYet.text }), nothingYet.line && _jsxs(_Fragment, { children: [_jsx("br", {}), nothingYet.line] })] }), _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), onClick: nothingYet.onAction, children: nothingYet.action })] })) : (_jsxs(_Fragment, { children: [_jsxs(BaseCombobox.List, { className: "o-picker-phone", "aria-label": label, children: [keptItems.length > 0 && (_jsxs(BaseCombobox.Group, { className: "o-picker-group", children: [_jsx(BaseCombobox.GroupLabel, { className: "o-picker-label", children: label_ }), _jsx("div", { className: "o-picker-card o-picker-selected", children: keptItems.map((item, i) => (_jsx(BaseCombobox.Item, { ref: keepsToItsList, index: at(i, false), value: changing ? itemEntry(item) : { key: `unpick:${item.value}`, kind: "unpick", item }, className: "o-picker-row", ...menuOpen(item), children: _jsx(PhoneRow, { item: item, kind: worn.kind, you: w.you, circle: fixed ? "fixed" : "on", box: boxes, lead: changing && !own && props.lead ? _jsx(LeadMark, { lead: props.lead, value: item.value }) : undefined, menu: hasMenu(item) ? rowTrigger(item) : undefined }) }, item.value))) })] })), headed && !note && cards, !headed && (parent || (!note && rest.length > 0)) && (_jsxs("div", { className: "o-picker-card o-picker-list", children: [parent && _jsx("div", { className: "o-picker-row o-picker-parent", "data-parent": "", "aria-hidden": "true", children: _jsx(PhoneRow, { item: parent.item, kind: worn.kind, you: w.you, circle: null }) }), !note && rest.length > 0 && (parent ? _jsx("div", { className: "o-picker-level", children: listed }) : listed)] }))] }), note, refused !== undefined && !doing && _jsx("div", { className: "o-picker-note", role: "alert", children: refused }), underActions, onMore && !doing && _jsxs("div", { ref: more, className: "o-picker-more", children: [_jsx(Spinner, { size: 16, label: "" }), w.loadingMore] })] })), bar] }), rowMenuEl] }));
|
|
808
828
|
const head = changing && own ? { left: _jsx(SheetButton, { onClick: leave, children: w.cancel }), right: _jsx(SheetButton, { kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: () => { onValueChange(draft); ask(""); onDone?.(); } }) }
|
|
809
829
|
: {};
|
|
810
830
|
return { body, head, step: changing && own ? "change" : null };
|
|
@@ -835,7 +855,7 @@ function usePickerAt(props, under) {
|
|
|
835
855
|
setListLit(byList);
|
|
836
856
|
};
|
|
837
857
|
const body = under ? (_jsxs(BaseCombobox.Root, { open: under.open, onOpenChange: (o, d) => {
|
|
838
|
-
if (!o && d.reason === "item-press" && litRow.current?.kind === "action") {
|
|
858
|
+
if (!o && d.reason === "item-press" && (litRow.current?.kind === "action" || (litRow.current?.kind === "create" && onAdd))) {
|
|
839
859
|
d.cancel();
|
|
840
860
|
return;
|
|
841
861
|
}
|