viewkitjs 0.32.0 → 0.33.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 +69 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/package.json +1 -1
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +16 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +31 -6
- package/views/dist/contract.js +123 -0
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +4 -0
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +3 -0
- package/views/dist/controls/field/field.js +6 -6
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +2 -2
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
- package/views/dist/controls/menu-list/menu-list.js +23 -22
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/picker.d.ts +2 -0
- package/views/dist/controls/picker/picker.js +37 -36
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +3 -0
- package/views/dist/controls/radio/radio.js +4 -3
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +3 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +5 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
- package/views/dist/controls/sort-editor/sort-editor.js +24 -26
- package/views/dist/controls/sort-editor.css +5 -0
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.js +1 -1
- package/views/dist/controls/views-list/view-menu.js +6 -6
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +13 -0
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridTable.js +4 -1
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/editing-controller.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.js +6 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/spreadsheet-operations.js +1 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +14 -1
- package/views/dist/list/index.js +4 -1
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/parts.js +10 -3
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +35 -34
- package/views/dist/list/root.js +153 -113
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/store.d.ts +37 -5
- package/views/dist/list/store.js +31 -0
- package/views/dist/list/toolbar.d.ts +3 -2
- package/views/dist/list/toolbar.js +14 -2
- package/views/dist/list/views-axis.js +4 -2
- package/views/dist/list/views.d.ts +7 -2
- package/views/dist/list/views.js +16 -5
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +8 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +12 -3
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +10 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +6 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +59 -0
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +4 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +86 -78
- package/views/dist/styles.unlayered.css +86 -78
- package/views/docs/contract.md +252 -5
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -0
- package/views/docs/controls/field.md +4 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +6 -0
- package/views/docs/controls/input.md +4 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -0
- package/views/docs/controls/radio.md +4 -0
- package/views/docs/controls/select.md +8 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/text-editor.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -0
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +19 -2
- package/views/docs/reference/controls.md +7 -5
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +141 -11
- package/views/docs/reference/panels-react.md +2 -2
- package/views/docs/reference/react.md +15 -9
- package/views/docs/reference/views.md +8 -4
- package/views/docs/reshaping.md +6 -1
|
@@ -162,20 +162,20 @@ export function useNumberEditor(props) {
|
|
|
162
162
|
} };
|
|
163
163
|
const sign = now?.sign ?? now?.code;
|
|
164
164
|
const fieldStart = now ? (pickable
|
|
165
|
-
? _jsx(InputGroupButton, { "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
|
|
166
|
-
: codes ? _jsx("span", { className: "o-number-editor-code", children: now.code }) : _jsx("span", { className: "o-number-editor-sign", children: sign })) : undefined;
|
|
165
|
+
? _jsx(InputGroupButton, { "data-slot": "vk-number-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
|
|
166
|
+
: codes ? _jsx("span", { className: "o-number-editor-code", "data-slot": "vk-number-unit", "data-key": "code", children: now.code }) : _jsx("span", { className: "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": "sign", children: sign })) : undefined;
|
|
167
167
|
const boxStart = now ? (pickable
|
|
168
|
-
? _jsx(Button, { kind: "quiet", size: "sm", className: "o-number-editor-code", look: SHEET_CODE, "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
|
|
169
|
-
: _jsx("span", { className: codes ? "o-number-editor-code" : "o-number-editor-sign", children: codes ? now.code : sign })) : undefined;
|
|
168
|
+
? _jsx(Button, { kind: "quiet", size: "sm", className: "o-number-editor-code", "data-slot": "vk-number-currency", look: SHEET_CODE, "aria-label": named, iconEnd: glyph(DOWN), onClick: choose, children: codes || !now.sign ? now.code : `${now.sign} ${now.code}` })
|
|
169
|
+
: _jsx("span", { className: codes ? "o-number-editor-code" : "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": codes ? "code" : "sign", children: codes ? now.code : sign })) : undefined;
|
|
170
170
|
const amount = worn.sheet === "field"
|
|
171
|
-
? _jsx(PhoneField, { ...shared, words: steps, label: label, before: fieldStart, after: kind === "percent" ? "%" : undefined, onKeyDown: enter, box: refs })
|
|
172
|
-
: _jsx(NumberField, { ref: field, size: "lg", steppers: false, words: steps, className: "o-number-editor-sheet", before: boxStart, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: enter });
|
|
173
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-number-editor", "data-kit": "number-editor", ...device, "data-number-form": "phone", onChange: readChange, "data-number-kind": kind, "data-number-step": choosing ? "currency" : undefined, children: choosing ? picker.body : amount }));
|
|
171
|
+
? _jsx(PhoneField, { ...shared, "data-slot": "vk-number-box", words: steps, label: label, before: fieldStart, after: kind === "percent" ? "%" : undefined, onKeyDown: enter, box: refs })
|
|
172
|
+
: _jsx(NumberField, { ref: field, size: "lg", steppers: false, words: steps, className: "o-number-editor-sheet", "data-slot": "vk-number-box", before: boxStart, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", "data-slot": "vk-number-unit", "data-key": "percent", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: enter });
|
|
173
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-number-editor", "data-slot": "vk-number", "data-kit": "number-editor", ...device, "data-number-form": "phone", onChange: readChange, "data-number-kind": kind, "data-number-step": choosing ? "currency" : undefined, children: choosing ? picker.body : amount }));
|
|
174
174
|
if (choosing)
|
|
175
|
-
return { body, head: { onBack: () => setChoosing(false), close: false }, title: words.name };
|
|
175
|
+
return { body, head: { onBack: () => setChoosing(false), backSlot: "vk-editor-back", close: false }, title: words.name };
|
|
176
176
|
if (shell)
|
|
177
177
|
return { body, head: {} };
|
|
178
|
-
return { body, head: { left: _jsx(SheetButton, { "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
|
|
178
|
+
return { body, head: { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": "Close", icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": "Save", icon: glyph(TICK), onClick: keep }) } };
|
|
179
179
|
}
|
|
180
180
|
const onBlur = (e) => {
|
|
181
181
|
if (shell || settled.current || choosing || (e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget)))
|
|
@@ -183,10 +183,10 @@ export function useNumberEditor(props) {
|
|
|
183
183
|
keep();
|
|
184
184
|
};
|
|
185
185
|
const start = !now ? null : worn.units === "code"
|
|
186
|
-
? (pickable ? _jsx(Button, { ref: setChip, kind: "quiet", size: "xs", className: "o-number-editor-code", "aria-label": named, "aria-expanded": choosing, iconEnd: glyph(DOWN), onClick: () => setChoosing(true), children: now.code }) : null)
|
|
187
|
-
: (pickable ? _jsx(Button, { ref: setChip, kind: "soft", size: "2xs", className: "o-number-editor-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: () => setChoosing(true), children: now.sign ?? now.code })
|
|
188
|
-
: _jsx("span", { className: "o-number-editor-sign", children: now.sign ?? now.code }));
|
|
189
|
-
const body = (_jsxs("div", { ref: wornAt, className: "o-number-editor", "data-kit": "number-editor", ...device, "data-number-form": "computer", "data-number-kind": kind, onChange: readChange, onBlur: onBlur, onFocus: () => { settled.current = false; }, children: [_jsx(NumberField, { ref: field, chrome: "inline", align: align, words: steps, steppers: worn.arrows === "editing" ? "arrows" : false, before: start ?? undefined, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: onKeyDown, className: "o-number-editor-field" }), pickable && chip && (_jsx(Popover, { open: choosing, onOpenChange: (o) => { if (!o)
|
|
186
|
+
? (pickable ? _jsx(Button, { ref: setChip, kind: "quiet", size: "xs", className: "o-number-editor-code", "data-slot": "vk-number-currency", "aria-label": named, "aria-expanded": choosing, iconEnd: glyph(DOWN), onClick: () => setChoosing(true), children: now.code }) : null)
|
|
187
|
+
: (pickable ? _jsx(Button, { ref: setChip, kind: "soft", size: "2xs", className: "o-number-editor-currency", "data-slot": "vk-number-currency", "aria-label": named, iconEnd: glyph(DOWN), onClick: () => setChoosing(true), children: now.sign ?? now.code })
|
|
188
|
+
: _jsx("span", { className: "o-number-editor-sign", "data-slot": "vk-number-unit", "data-key": "sign", children: now.sign ?? now.code }));
|
|
189
|
+
const body = (_jsxs("div", { ref: wornAt, className: "o-number-editor", "data-slot": "vk-number", "data-kit": "number-editor", ...device, "data-number-form": "computer", "data-number-kind": kind, onChange: readChange, onBlur: onBlur, onFocus: () => { settled.current = false; }, children: [_jsx(NumberField, { ref: field, chrome: "inline", align: align, words: steps, steppers: worn.arrows === "editing" ? "arrows" : false, before: start ?? undefined, after: kind === "percent" ? _jsx("span", { className: "o-number-editor-unit", "data-slot": "vk-number-unit", "data-key": "percent", children: "%" }) : undefined, ...shared, "aria-label": label, autofill: false, onKeyDown: onKeyDown, className: "o-number-editor-field", "data-slot": "vk-number-box" }), pickable && chip && (_jsx(Popover, { open: choosing, onOpenChange: (o) => { if (!o)
|
|
190
190
|
back(); }, anchor: chip, "aria-label": words.name, popupData: popupData, children: _jsx(Picker, { label: words.name, items: items, value: code ?? null, onValueChange: (c) => { if (typeof c === "string")
|
|
191
191
|
pick(c); }, onDone: back, search: words.find, form: "computer", fromHeld: true, ...(w.picker ? { words: w.picker } : {}) }) }))] }));
|
|
192
192
|
return { body, head: {} };
|
|
@@ -81,7 +81,9 @@ export const NumberField = React.forwardRef(function NumberField({ size = "md",
|
|
|
81
81
|
pageKeys(e, !disabled && !readOnly); }, onFocus: (e) => { typed.focus(); onFocus?.(e); }, onBlur: (e) => { typed.leave(); onBlur?.(e); } }));
|
|
82
82
|
if (chrome === "bare")
|
|
83
83
|
return (_jsx(BaseNumberField.Root, { ref: ref, className: cx("o-number o-number-bare", className), style: style, disabled: disabled, readOnly: readOnly, "data-kit": "number-field", ...phoneMark(phone), ...root, ...values, children: input }));
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const { "data-slot": slot, "data-key": key, ...rest } = root;
|
|
85
|
+
const part = { ...(slot != null ? { "data-slot": slot } : {}), ...(key != null ? { "data-key": key } : {}) };
|
|
86
|
+
return (_jsx(BaseNumberField.Root, { ref: ref, className: cx("o-number", className), style: style, disabled: disabled, readOnly: readOnly, "data-kit": "number-field", ...phoneMark(phone), ...rest, ...values, children: _jsxs(BaseNumberField.Group, { render: (props) => chrome === "inline"
|
|
87
|
+
? _jsx(InlineInputGroup, { ...props, ...part, children: props.children })
|
|
88
|
+
: _jsx(InputGroup, { size: size, look: look, chrome: chrome === "soft" ? "soft" : undefined, ...props, ...part, children: props.children }), children: [side("start", before), input, side("end", after), stepped && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-steps", children: [_jsx(BaseNumberField.Decrement, { ...(words?.decrease ? { "aria-label": words.decrease } : {}), render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: MINUS }) }) }), _jsx(BaseNumberField.Increment, { ...(words?.increase ? { "aria-label": words.increase } : {}), render: _jsx(InputGroupButton, { icon: _jsx(Mark, { paths: PLUS }) }) })] })), arrows && (_jsxs(InputGroupAddon, { side: "end", className: "o-number-arrows", children: [_jsx(BaseNumberField.Increment, { className: "o-number-arrow", "aria-label": words?.increase ?? "Increase", children: UP_MARK }), _jsx(BaseNumberField.Decrement, { className: "o-number-arrow", "aria-label": words?.decrease ?? "Decrease", children: DOWN_MARK })] }))] }) }));
|
|
87
89
|
});
|
|
@@ -32,16 +32,18 @@ export declare function Pane({ open, onOpenChange, container, opener, initialFoc
|
|
|
32
32
|
* popover) draws plain instead (Customize, VK-840). A Popover opened from inside a Pane sets it back to false round what it holds.
|
|
33
33
|
* The package's own; no entry point exports it. */
|
|
34
34
|
export declare const InPane: React.Context<boolean>;
|
|
35
|
+
/** A part of the Pane: what it holds, its class, and the public name a panel gives it (VK-988). */
|
|
35
36
|
type Slot = {
|
|
36
37
|
children: React.ReactNode;
|
|
37
38
|
className?: string;
|
|
39
|
+
"data-slot"?: string;
|
|
38
40
|
};
|
|
39
41
|
/** Its head, which what stands in it fills: its title, its ✕. It stays at its top. */
|
|
40
|
-
export declare function PaneHead({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function PaneHead({ children, className, "data-slot": slot }: Slot): import("react/jsx-runtime").JSX.Element;
|
|
41
43
|
/** What it holds, scrolling between its head and its foot. */
|
|
42
44
|
export declare function PaneBody({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
|
|
43
45
|
/** Its foot, under a line across the whole Pane, always at its foot. */
|
|
44
|
-
export declare function PaneFoot({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare function PaneFoot({ children, className, "data-slot": slot }: Slot): import("react/jsx-runtime").JSX.Element;
|
|
45
47
|
/** Its title, which names it to a screen reader too. */
|
|
46
48
|
export declare function PaneTitle({ children, className }: Slot): import("react/jsx-runtime").JSX.Element;
|
|
47
49
|
/** What closes it from inside (a Button: `render`), with the reason close-press: what stands in it draws its own ✕. */
|
|
@@ -65,14 +65,14 @@ export function Pane({ open, onOpenChange, container, opener, initialFocus = tru
|
|
|
65
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 }) }) }) }) }) }));
|
|
66
66
|
}
|
|
67
67
|
export const InPane = React.createContext(false);
|
|
68
|
-
export function PaneHead({ children, className }) {
|
|
69
|
-
return _jsx("div", { className: cx("o-pane-head", className), children: children });
|
|
68
|
+
export function PaneHead({ children, className, "data-slot": slot }) {
|
|
69
|
+
return _jsx("div", { className: cx("o-pane-head", className), "data-slot": slot, children: children });
|
|
70
70
|
}
|
|
71
71
|
export function PaneBody({ children, className }) {
|
|
72
72
|
return _jsxs(_Fragment, { children: [_jsx("div", { className: cx("o-pane-body", className), children: children }), _jsx(Scrollbar, {})] });
|
|
73
73
|
}
|
|
74
|
-
export function PaneFoot({ children, className }) {
|
|
75
|
-
return _jsx("div", { className: cx("o-pane-foot", className), children: children });
|
|
74
|
+
export function PaneFoot({ children, className, "data-slot": slot }) {
|
|
75
|
+
return _jsx("div", { className: cx("o-pane-foot", className), "data-slot": slot, children: children });
|
|
76
76
|
}
|
|
77
77
|
export function PaneTitle({ children, className }) {
|
|
78
78
|
return _jsx(Dialog.Title, { className: cx("o-pane-title", className), children: children });
|
|
@@ -150,6 +150,8 @@ export interface PickerProps {
|
|
|
150
150
|
/** On a phone, a frame of their own round its rows' menus' rows (the Menu's `frame`, MENU_LIST_CARD_FRAME): what a list whose
|
|
151
151
|
* rows' menus are no menu's own sheet (a list of views) keeps, whatever the app picked round it. */
|
|
152
152
|
menuFrame?: Readonly<Record<string, string>>;
|
|
153
|
+
/** The public name of its rows' menus where a panel names them (VK-988: the views list's `vk-view-menu`), on each one's popup. */
|
|
154
|
+
menuSlot?: string;
|
|
153
155
|
/** On a phone, a row's ⋯ hands its value here and opens no Menu of its own: its holder turns its Sheet into the row's menu (a
|
|
154
156
|
* list of views; one sheet, never a sheet on top). On a computer it changes nothing. */
|
|
155
157
|
onRowMenu?: (value: string) => void;
|
|
@@ -12,6 +12,7 @@ import { Option } from "../option/option.js";
|
|
|
12
12
|
import { Spinner } from "../spinner/spinner.js";
|
|
13
13
|
import { StatusGlyph } from "../status/status.js";
|
|
14
14
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
15
|
+
import { partAttrs } from "../internal/part-slot.js";
|
|
15
16
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
16
17
|
import { cx } from "../../internal/cx.js";
|
|
17
18
|
import { Icon } from "../internal/icons.js";
|
|
@@ -66,11 +67,11 @@ export const PICKER_WORDS = {
|
|
|
66
67
|
};
|
|
67
68
|
function LeadMark({ lead, value }) {
|
|
68
69
|
if (lead.value === value)
|
|
69
|
-
return _jsx("span", { className: "o-picker-lead", children: lead.label });
|
|
70
|
+
return _jsx("span", { className: "o-picker-lead", "data-slot": "vk-picker-lead", children: lead.label });
|
|
70
71
|
const stop = (e) => e.stopPropagation();
|
|
71
|
-
return (_jsx(Button, { kind: "text", size: "2xs", className: "o-picker-lead-make", onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onPointerDown: stop, onClick: (e) => { e.preventDefault(); e.stopPropagation(); lead.onLead(value); }, children: lead.makeLabel }));
|
|
72
|
+
return (_jsx(Button, { kind: "text", size: "2xs", className: "o-picker-lead-make", "data-slot": "vk-picker-lead-make", onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); }, onPointerDown: stop, onClick: (e) => { e.preventDefault(); e.stopPropagation(); lead.onLead(value); }, children: lead.makeLabel }));
|
|
72
73
|
}
|
|
73
|
-
const glyph = (paths, className, strokeWidth = 2) => (_jsx("svg", { className: className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
74
|
+
const glyph = (paths, className, strokeWidth = 2, slot) => (_jsx("svg", { className: className, "data-slot": slot, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) }));
|
|
74
75
|
const TICK = ["M5 12l5 5l10 -10"], PLUS = ["M12 5v14", "M5 12h14"], SEARCH = ["M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0", "M21 21l-6 -6"];
|
|
75
76
|
const BACK = ["M15 6l-6 6l6 6"], MORE = ["M9 6l6 6l-6 6"];
|
|
76
77
|
const DOTS_V = ["M12 4a1 1 0 1 0 0 2a1 1 0 1 0 0 -2", "M12 11a1 1 0 1 0 0 2a1 1 0 1 0 0 -2", "M12 18a1 1 0 1 0 0 2a1 1 0 1 0 0 -2"];
|
|
@@ -119,7 +120,7 @@ function KindMark({ item, kind }) {
|
|
|
119
120
|
}
|
|
120
121
|
function ItemBody({ item, multiple, worn, lead, count, menu, you }) {
|
|
121
122
|
const mark = worn.mark, line = lineOf(item, worn.kind), opens = count !== undefined;
|
|
122
|
-
return (_jsxs(_Fragment, { children: [multiple && mark === "tick" && !opens && _jsx(CheckboxMark, {}), _jsx(Face, { item: item, size: line && worn.line === "below" ? Number(worn.face) : 20 }), _jsxs("span", { className: "o-list-text", children: [_jsxs("span", { className: "o-list-main", children: [_jsx(Name, { item: item }), item.you && _jsx("span", { className: "o-list-you", children: you }), _jsx(After, { item: item })] }), line && _jsx("span", { className: "o-list-line", children: line })] }), _jsx(KindMark, { item: item, kind: worn.kind }), lead, opens ? _jsx(Opens, { count: count }) : _jsxs(_Fragment, { children: [_jsx(RowCount, { item: item }), multiple && mark === "check" && _jsx(CheckboxMark, {}), !multiple && (mark === "check" ? _jsx("span", { className: "o-picker-check", children: glyph(TICK, undefined, 3) }) : glyph(TICK, "o-list-tick", 2.25))] }), menu] }));
|
|
123
|
+
return (_jsxs(_Fragment, { children: [multiple && mark === "tick" && !opens && _jsx(CheckboxMark, { "data-slot": "vk-picker-tick" }), _jsx(Face, { item: item, size: line && worn.line === "below" ? Number(worn.face) : 20 }), _jsxs("span", { className: "o-list-text", children: [_jsxs("span", { className: "o-list-main", children: [_jsx(Name, { item: item }), item.you && _jsx("span", { className: "o-list-you", children: you }), _jsx(After, { item: item })] }), line && _jsx("span", { className: "o-list-line", children: line })] }), _jsx(KindMark, { item: item, kind: worn.kind }), lead, opens ? _jsx(Opens, { count: count }) : _jsxs(_Fragment, { children: [_jsx(RowCount, { item: item }), multiple && mark === "check" && _jsx(CheckboxMark, { "data-slot": "vk-picker-tick" }), !multiple && (mark === "check" ? _jsx("span", { className: "o-picker-check", "data-slot": "vk-picker-tick", children: glyph(TICK, undefined, 3) }) : glyph(TICK, "o-list-tick", 2.25, "vk-picker-tick"))] }), menu] }));
|
|
123
124
|
}
|
|
124
125
|
function grouped(rows, apart) {
|
|
125
126
|
const out = [{ rows: [] }];
|
|
@@ -152,7 +153,7 @@ function PhoneRow({ item, circle, box, lead, kind, count, menu, you }) {
|
|
|
152
153
|
circle = null;
|
|
153
154
|
box = false;
|
|
154
155
|
}
|
|
155
|
-
return (_jsxs(_Fragment, { children: [_jsx(Face, { item: item, phone: true }), _jsxs("span", { className: "o-list-text", children: [_jsxs("span", { className: "o-list-main", children: [_jsx(Name, { item: item, phone: true }), item.you && _jsx("span", { className: "o-list-you", children: you }), _jsx(After, { item: item })] }), line && _jsx("span", { className: "o-list-line", children: line })] }), _jsx(KindMark, { item: item, kind: kind }), lead, count !== undefined && _jsx(Opens, { count: count }), count === undefined && _jsx(RowCount, { item: item }), box && _jsx(CheckboxMark, {}), !box && circle && _jsx("span", { className: cx("o-picker-circle", circle === "off" && "o-picker-circle-off", circle === "fixed" && "o-picker-circle-fixed"), children: circle !== "off" && glyph(TICK, undefined, 3) }), menu] }));
|
|
156
|
+
return (_jsxs(_Fragment, { children: [_jsx(Face, { item: item, phone: true }), _jsxs("span", { className: "o-list-text", children: [_jsxs("span", { className: "o-list-main", children: [_jsx(Name, { item: item, phone: true }), item.you && _jsx("span", { className: "o-list-you", children: you }), _jsx(After, { item: item })] }), line && _jsx("span", { className: "o-list-line", children: line })] }), _jsx(KindMark, { item: item, kind: kind }), lead, count !== undefined && _jsx(Opens, { count: count }), count === undefined && _jsx(RowCount, { item: item }), box && _jsx(CheckboxMark, { "data-slot": "vk-picker-tick" }), !box && circle && _jsx("span", { className: cx("o-picker-circle", circle === "off" && "o-picker-circle-off", circle === "fixed" && "o-picker-circle-fixed"), "data-slot": "vk-picker-tick", children: circle !== "off" && glyph(TICK, undefined, 3) }), menu] }));
|
|
156
157
|
}
|
|
157
158
|
function usePillTap(input) {
|
|
158
159
|
const start = React.useRef(null);
|
|
@@ -584,28 +585,28 @@ function usePickerAt(props, under) {
|
|
|
584
585
|
"data-menu-open": menuOpenFor(item.value) ? "" : undefined,
|
|
585
586
|
onContextMenu: (e) => { e.preventDefault(); lightRow(e.currentTarget); setRowMenu({ value: item.value, anchor: { x: e.clientX, y: e.clientY } }); },
|
|
586
587
|
} : {};
|
|
587
|
-
return (_jsx(BaseCombobox.Item, { ref: keepsToItsList, value: itemEntry(r.item), disabled: r.item.disabled, className: "o-list-row o-smooth o-smooth-ease", "data-first": firstOnes.has(r.item.value) ? "" : undefined, "data-held": held.includes(r.item.value) ? "" : undefined, "data-indent": r.indent ? "" : undefined, "data-opens": r.opens ? "" : undefined, "data-name": r.item.label, ...more, ...orderProps(item.value), children: _jsx(ItemBody, { item: r.item, multiple: multiple, worn: worn, you: w.you, count: r.opens ? r.count : undefined, lead: multiple && !chips && props.lead && held.includes(r.item.value) ? _jsx(LeadMark, { lead: props.lead, value: r.item.value }) : undefined, menu: withMenu ? rowTrigger(item) : undefined }) }, r.item.value));
|
|
588
|
+
return (_jsx(BaseCombobox.Item, { ref: keepsToItsList, value: itemEntry(r.item), disabled: r.item.disabled, className: "o-list-row o-smooth o-smooth-ease", "data-first": firstOnes.has(r.item.value) ? "" : undefined, "data-held": held.includes(r.item.value) ? "" : undefined, "data-indent": r.indent ? "" : undefined, "data-opens": r.opens ? "" : undefined, "data-name": r.item.label, ...partAttrs(r.item.slot ?? { slot: "vk-picker-option", key: r.item.value }), ...more, ...orderProps(item.value), children: _jsx(ItemBody, { item: r.item, multiple: multiple, worn: worn, you: w.you, count: r.opens ? r.count : undefined, lead: multiple && !chips && props.lead && held.includes(r.item.value) ? _jsx(LeadMark, { lead: props.lead, value: r.item.value }) : undefined, menu: withMenu ? rowTrigger(item) : undefined }) }, r.item.value));
|
|
588
589
|
}
|
|
589
590
|
if (r.kind === "parent")
|
|
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"));
|
|
591
|
+
return (_jsxs("div", { className: "o-list-row o-smooth o-smooth-ease o-picker-parent", "data-slot": "vk-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"));
|
|
591
592
|
if (r.kind === "empty")
|
|
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"));
|
|
593
|
+
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-slot": "vk-picker-empty", "data-name": r.label, children: _jsx("span", { className: "o-list-text", children: _jsx("span", { className: "o-list-main", children: r.label }) }) }, "empty"));
|
|
593
594
|
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
|
+
return (_jsx("div", { className: "o-picker-message", "data-slot": "vk-picker-message", role: "alert", children: _jsx("span", { className: "o-picker-message-text", children: refused }) }, "create"));
|
|
595
596
|
if (r.kind === "create") {
|
|
596
597
|
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
|
+
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"), "data-slot": add ? "vk-picker-add" : "vk-picker-create", 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
599
|
}
|
|
599
600
|
return _jsx(React.Fragment, {}, i);
|
|
600
601
|
};
|
|
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));
|
|
602
|
+
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", "data-slot": "vk-picker-action", "data-key": a.id, 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));
|
|
602
603
|
const typed = find.trim();
|
|
603
604
|
const matches = rows.some((r) => r.kind === "item");
|
|
604
|
-
const message = doing === "searching" ? _jsxs("div", { className: "o-picker-message", children: [_jsx(Spinner, { size: 16, label: "" }), _jsx("span", { className: "o-picker-message-text", children: w.searching })] })
|
|
605
|
-
: doing === "failed" ? _jsxs("div", { className: "o-picker-message", children: [_jsx("span", { className: "o-picker-message-text", children: w.failed }), onRetry && _jsx(Button, { kind: "text", size: "2xs", onClick: onRetry, children: w.retry })] })
|
|
606
|
-
: typed && !matches ? _jsx("div", { className: "o-picker-message", children: _jsx("span", { className: "o-picker-message-text", children: noneWords ?? w.nothingMatches }) })
|
|
607
|
-
: none ? _jsx("div", { className: "o-picker-message", children: _jsx("span", { className: "o-picker-message-text", children: nothingYet.text }) })
|
|
608
|
-
: server && !typed && !items.length ? _jsx("div", { className: "o-picker-message", children: _jsx("span", { className: "o-picker-message-text", children: w.typeToSearch }) })
|
|
605
|
+
const message = doing === "searching" ? _jsxs("div", { className: "o-picker-message", "data-slot": "vk-picker-message", children: [_jsx(Spinner, { size: 16, label: "" }), _jsx("span", { className: "o-picker-message-text", children: w.searching })] })
|
|
606
|
+
: doing === "failed" ? _jsxs("div", { className: "o-picker-message", "data-slot": "vk-picker-message", children: [_jsx("span", { className: "o-picker-message-text", children: w.failed }), onRetry && _jsx(Button, { kind: "text", size: "2xs", "data-slot": "vk-picker-retry", onClick: onRetry, children: w.retry })] })
|
|
607
|
+
: typed && !matches ? _jsx("div", { className: "o-picker-message", "data-slot": "vk-picker-message", children: _jsx("span", { className: "o-picker-message-text", children: noneWords ?? w.nothingMatches }) })
|
|
608
|
+
: none ? _jsx("div", { className: "o-picker-message", "data-slot": "vk-picker-message", children: _jsx("span", { className: "o-picker-message-text", children: nothingYet.text }) })
|
|
609
|
+
: server && !typed && !items.length ? _jsx("div", { className: "o-picker-message", "data-slot": "vk-picker-message", children: _jsx("span", { className: "o-picker-message-text", children: w.typeToSearch }) })
|
|
609
610
|
: null;
|
|
610
611
|
const first = none ? { id: "first", label: nothingYet.action, icon: glyph(PLUS), onSelect: nothingYet.onAction } : null;
|
|
611
612
|
const [rowMenu, setMenuAt] = React.useState(null);
|
|
@@ -622,14 +623,14 @@ function usePickerAt(props, under) {
|
|
|
622
623
|
setRowMenu({ value: item.value, anchor: e.currentTarget });
|
|
623
624
|
};
|
|
624
625
|
return form === "phone"
|
|
625
|
-
? _jsx(MenuDots, { label: w.rowActions(item.label), className: "o-picker-row-menu", onClick: open, onKeyDown: stopKeys })
|
|
626
|
-
: _jsx(Button, { kind: "quiet", shape: "icon", size: "20", tabIndex: -1, className: "o-picker-row-menu", "data-shown": props.rowMenus ?? "always", "aria-label": w.rowActions(item.label), icon: glyph(DOTS_V), onClick: open, onKeyDown: stopKeys });
|
|
626
|
+
? _jsx(MenuDots, { label: w.rowActions(item.label), className: "o-picker-row-menu", "data-slot": "vk-picker-row-more", "data-key": item.value, onClick: open, onKeyDown: stopKeys })
|
|
627
|
+
: _jsx(Button, { kind: "quiet", shape: "icon", size: "20", tabIndex: -1, className: "o-picker-row-menu", "data-slot": "vk-picker-row-more", "data-key": item.value, "data-shown": props.rowMenus ?? "always", "aria-label": w.rowActions(item.label), icon: glyph(DOTS_V), onClick: open, onKeyDown: stopKeys });
|
|
627
628
|
};
|
|
628
629
|
const hasMenu = (item) => !!item.menu?.length;
|
|
629
630
|
const menuItem = rowMenu ? itemOf(rowMenu.value) : undefined;
|
|
630
631
|
const rowMenuEl = items.some(hasMenu)
|
|
631
632
|
? _jsx(Menu, { label: menuItem?.label ?? label, entries: menuItem?.menu ?? [], anchor: rowMenu?.anchor ?? null, align: rowMenu?.anchor instanceof HTMLElement ? "end" : "start", open: !!rowMenu?.open, onOpenChange: (o) => { if (!o)
|
|
632
|
-
setMenuAt((m) => m && { ...m, open: false }); }, frame: props.menuFrame, words: menuWords })
|
|
633
|
+
setMenuAt((m) => m && { ...m, open: false }); }, frame: props.menuFrame, words: menuWords, "data-slot": props.menuSlot })
|
|
633
634
|
: null;
|
|
634
635
|
const ordering = !!props.onOrderChange && !find.trim() && !level;
|
|
635
636
|
const keptNow = multiple && own ? draft : held;
|
|
@@ -790,9 +791,9 @@ function usePickerAt(props, under) {
|
|
|
790
791
|
}
|
|
791
792
|
};
|
|
792
793
|
const label_ = changing ? w.selectedCount(kept.length) : fixed ? w.selectedFixed : w.selected;
|
|
793
|
-
const note = doing === "searching" ? _jsxs("div", { className: "o-picker-note", children: [_jsx(Spinner, { size: 20, label: "" }), w.searching] })
|
|
794
|
-
: doing === "failed" ? _jsxs("div", { className: "o-picker-note", children: [_jsxs("span", { children: [_jsx("b", { children: w.failed }), _jsx("br", {}), w.failedLine] }), onRetry && _jsx(Button, { kind: "soft", size: "lg", icon: glyph(REFRESH), onClick: onRetry, children: w.retry })] })
|
|
795
|
-
: typed && !rest.length ? _jsx("div", { className: "o-picker-note", children: noneWords ?? around(w.noneTyped(typed), typed) })
|
|
794
|
+
const note = doing === "searching" ? _jsxs("div", { className: "o-picker-note", "data-slot": "vk-picker-message", children: [_jsx(Spinner, { size: 20, label: "" }), w.searching] })
|
|
795
|
+
: doing === "failed" ? _jsxs("div", { className: "o-picker-note", "data-slot": "vk-picker-message", children: [_jsxs("span", { children: [_jsx("b", { children: w.failed }), _jsx("br", {}), w.failedLine] }), onRetry && _jsx(Button, { kind: "soft", size: "lg", icon: glyph(REFRESH), "data-slot": "vk-picker-retry", onClick: onRetry, children: w.retry })] })
|
|
796
|
+
: typed && !rest.length ? _jsx("div", { className: "o-picker-note", "data-slot": "vk-picker-message", children: noneWords ?? around(w.noneTyped(typed), typed) })
|
|
796
797
|
: null;
|
|
797
798
|
const pill = props.searchShown ?? (worn.search === "always" || searchShown({ count: items.length, create, server, query }));
|
|
798
799
|
const at = (i, matching) => (typed ? (matching ? i : rest.length + i) : (matching ? keptItems.length + i : i));
|
|
@@ -803,29 +804,29 @@ function usePickerAt(props, under) {
|
|
|
803
804
|
e.preventBaseUIHandler?.();
|
|
804
805
|
};
|
|
805
806
|
const under = !!props.actionsUnder && !none;
|
|
806
|
-
const menu = under ? [] : actions.map((a) => ({ icon: a.icon, label: a.label, onSelect: a.onSelect }));
|
|
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)) }));
|
|
807
|
+
const menu = under ? [] : actions.map((a) => ({ icon: a.icon, label: a.label, onSelect: a.onSelect, slot: { slot: "vk-picker-action", key: a.id } }));
|
|
808
|
+
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, "data-slot": "vk-picker-action", "data-key": a.id, onClick: a.onSelect, children: a.label }, a.id)) }));
|
|
808
809
|
const showBar = !none && (pill || creatable || addable || menu.length > 0 || (!!level && !byHolder));
|
|
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))
|
|
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" }) })] }));
|
|
810
|
+
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-slot": "vk-picker-back", "data-back": "", onMouseDown: (e) => e.preventDefault(), onClick: () => back() }), pill && (_jsxs(InputGroup, { size: "lg", className: "o-picker-pill", "data-slot": "vk-picker-search", ...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))
|
|
811
|
+
enter(e); } })] })), addable ? _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), loading: adding !== undefined, className: "o-picker-create-button", "data-slot": "vk-picker-add", onClick: () => onAdd(typed), children: w.addButton })
|
|
812
|
+
: creatable && !add ? _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), className: "o-picker-create-button", "data-slot": "vk-picker-create", onClick: createTyped, children: w.createButton })
|
|
813
|
+
: 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", "data-slot": "vk-picker-more" }) })] }));
|
|
813
814
|
const menuOpen = (item) => (menuOpenFor(item.value) ? { "data-menu-open": "" } : {});
|
|
814
815
|
const heldHere = (v) => inPlace && kept.includes(v);
|
|
815
816
|
const rowValue = (item) => (heldHere(item.value) && !changing ? { key: `unpick:${item.value}`, kind: "unpick", item } : itemEntry(item));
|
|
816
817
|
const circleOf = (v) => (changing ? (heldHere(v) ? "on" : "off") : heldHere(v) ? "on" : null);
|
|
817
|
-
const rowOf = (r, i) => _jsx(BaseCombobox.Item, { ref: keepsToItsList, index: at(i, true), value: rowValue(r.item), disabled: r.item.disabled, className: "o-picker-row", "data-indent": r.indent ? "" : undefined, "data-opens": r.opens ? "" : undefined, "data-name": r.item.label, ...menuOpen(r.item), ...orderProps(r.item.value), children: _jsx(PhoneRow, { item: r.item, kind: worn.kind, you: w.you, circle: circleOf(r.item.value), box: boxes, count: r.opens ? r.count : undefined, menu: hasMenu(r.item) ? rowTrigger(r.item) : undefined }) }, r.item.value);
|
|
818
|
+
const rowOf = (r, i) => _jsx(BaseCombobox.Item, { ref: keepsToItsList, index: at(i, true), value: rowValue(r.item), disabled: r.item.disabled, className: "o-picker-row", "data-indent": r.indent ? "" : undefined, "data-opens": r.opens ? "" : undefined, "data-name": r.item.label, ...partAttrs(r.item.slot ?? { slot: "vk-picker-option", key: r.item.value }), ...menuOpen(r.item), ...orderProps(r.item.value), children: _jsx(PhoneRow, { item: r.item, kind: worn.kind, you: w.you, circle: circleOf(r.item.value), box: boxes, count: r.opens ? r.count : undefined, menu: hasMenu(r.item) ? rowTrigger(r.item) : undefined }) }, r.item.value);
|
|
818
819
|
const listed = rest.map(rowOf);
|
|
819
820
|
const headed = inPlace && !parent && !typed && rest.some((r) => r.item.group);
|
|
820
821
|
const cards = headed ? (() => {
|
|
821
822
|
let k = 0;
|
|
822
823
|
return phoneGroups(rest.map((r) => r.item)).map((g) => {
|
|
823
824
|
const rows = g.items.map(() => { const r = rest[k]; return rowOf(r, k++); });
|
|
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 || "-"));
|
|
825
|
+
return (_jsxs(BaseCombobox.Group, { className: "o-picker-group", "data-slot": "vk-picker-group", children: [g.name && _jsx(BaseCombobox.GroupLabel, { className: "o-picker-label", "data-slot": "vk-picker-heading", children: g.name }), _jsx("div", { className: "o-picker-card o-picker-list", "data-slot": "vk-picker-card", "data-heading": g.name || undefined, children: rows })] }, g.name || "-"));
|
|
825
826
|
});
|
|
826
827
|
})() : null;
|
|
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] }));
|
|
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?.(); } }) }
|
|
828
|
+
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-slot": "vk-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", "data-slot": "vk-picker-message", "data-key": "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), "data-slot": "vk-picker-action", "data-key": "first", onClick: nothingYet.onAction, children: nothingYet.action })] })) : (_jsxs(_Fragment, { children: [_jsxs(BaseCombobox.List, { className: "o-picker-phone", "data-slot": "vk-picker-list", "aria-label": label, children: [keptItems.length > 0 && (_jsxs(BaseCombobox.Group, { className: "o-picker-group", "data-slot": "vk-picker-group", children: [_jsx(BaseCombobox.GroupLabel, { className: "o-picker-label", "data-slot": "vk-picker-heading", children: label_ }), _jsx("div", { className: "o-picker-card o-picker-selected", "data-slot": "vk-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", ...partAttrs(item.slot ?? { slot: "vk-picker-option", key: item.value }), ...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", "data-slot": "vk-picker-card", children: [parent && _jsx("div", { className: "o-picker-row o-picker-parent", "data-slot": "vk-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", "data-slot": "vk-picker-message", role: "alert", children: refused }), underActions, onMore && !doing && _jsxs("div", { ref: more, className: "o-picker-more", "data-slot": "vk-picker-loading", children: [_jsx(Spinner, { size: 16, label: "" }), w.loadingMore] })] })), bar] }), rowMenuEl] }));
|
|
829
|
+
const head = changing && own ? { left: _jsx(SheetButton, { "data-slot": "vk-editor-cancel", onClick: leave, children: w.cancel }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: () => { onValueChange(draft); ask(""); onDone?.(); } }) }
|
|
829
830
|
: {};
|
|
830
831
|
return { body, head, step: changing && own ? "change" : null };
|
|
831
832
|
}
|
|
@@ -835,15 +836,15 @@ function usePickerAt(props, under) {
|
|
|
835
836
|
const groups = grouped((parent ? rows.slice(1) : rows).filter((r) => r !== footCreate), worn.create === "apart").map((g, gi) => {
|
|
836
837
|
const line = g.line && _jsx(BaseCombobox.Separator, { className: "o-list-sep" });
|
|
837
838
|
return g.heading
|
|
838
|
-
? _jsxs(BaseCombobox.Group, { children: [line, _jsx(BaseCombobox.GroupLabel, { className: "o-list-heading", children: g.heading }), g.rows.map((r, i) => row(r, i))] }, `g${gi}`)
|
|
839
|
+
? _jsxs(BaseCombobox.Group, { "data-slot": "vk-picker-group", children: [line, _jsx(BaseCombobox.GroupLabel, { className: "o-list-heading", "data-slot": "vk-picker-heading", children: g.heading }), g.rows.map((r, i) => row(r, i))] }, `g${gi}`)
|
|
839
840
|
: _jsxs(React.Fragment, { children: [line, g.rows.map((r, i) => row(r, i))] }, `g${gi}`);
|
|
840
841
|
});
|
|
841
842
|
const soft = props.searchLook === "soft" && !chips;
|
|
842
|
-
const backButton = level && !byHolder && _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", className: "o-picker-back", "aria-label": w.back(level.label), icon: glyph(BACK), onMouseDown: (e) => e.preventDefault(), onClick: (e) => back(e.detail === 0), children: null });
|
|
843
|
-
const list = (_jsxs("div", { ref: under ? placeRoot : root, className: "o-picker o-smooth o-smooth-ease", "data-kit": "picker", "data-picker-form": form, ...phoneMark(!!host || small), "data-standing": props.standing ? "" : undefined, "data-rest": atRest ? "" : undefined, onKeyDown: keys, children: [inBox && level && _jsx("div", { className: "o-picker-search o-popup-line", children: backButton }), !inBox && soft && (_jsx("div", { className: cx("o-picker-search o-picker-search-soft", !shown && "sr-only"), "data-hidden": shown ? undefined : "", children: _jsxs(InputGroup, { size: "sm", chrome: "soft", children: [_jsx(InputGroupAddon, { children: backButton || glyph(SEARCH) }), _jsx(Input, { combobox: true, autofill: false, ref: searchBox, className: "o-picker-input", placeholder: search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] }) })), !inBox && !soft && (_jsxs("div", { className: cx("o-picker-search o-popup-line", !shown && !chips && "sr-only"), "data-hidden": shown || chips ? undefined : "", children: [backButton || glyph(SEARCH), chips ? (_jsxs(BaseCombobox.Chips, { className: "o-picker-chips", onMouseDown: (e) => { if (e.target.closest(".o-tag-remove")) {
|
|
843
|
+
const backButton = level && !byHolder && _jsx(Button, { kind: "quiet", shape: "icon", size: "2xs", className: "o-picker-back", "data-slot": "vk-picker-back", "aria-label": w.back(level.label), icon: glyph(BACK), onMouseDown: (e) => e.preventDefault(), onClick: (e) => back(e.detail === 0), children: null });
|
|
844
|
+
const list = (_jsxs("div", { ref: under ? placeRoot : root, className: "o-picker o-smooth o-smooth-ease", "data-slot": "vk-picker", "data-kit": "picker", "data-picker-form": form, ...phoneMark(!!host || small), "data-standing": props.standing ? "" : undefined, "data-rest": atRest ? "" : undefined, onKeyDown: keys, children: [inBox && level && _jsx("div", { className: "o-picker-search o-popup-line", children: backButton }), !inBox && soft && (_jsx("div", { className: cx("o-picker-search o-picker-search-soft", !shown && "sr-only"), "data-hidden": shown ? undefined : "", children: _jsxs(InputGroup, { size: "sm", chrome: "soft", "data-slot": "vk-picker-search", children: [_jsx(InputGroupAddon, { children: backButton || glyph(SEARCH) }), _jsx(Input, { combobox: true, autofill: false, ref: searchBox, className: "o-picker-input", placeholder: search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] }) })), !inBox && !soft && (_jsxs("div", { className: cx("o-picker-search o-popup-line", !shown && !chips && "sr-only"), "data-slot": "vk-picker-search", "data-hidden": shown || chips ? undefined : "", children: [backButton || glyph(SEARCH), chips ? (_jsxs(BaseCombobox.Chips, { className: "o-picker-chips", "data-slot": "vk-picker-chips", onMouseDown: (e) => { if (e.target.closest(".o-tag-remove")) {
|
|
844
845
|
e.preventDefault();
|
|
845
846
|
input.current?.focus();
|
|
846
|
-
} }, children: [heldEntries.map((e) => _jsx(BaseCombobox.Chip, { render: _jsx(Option, { onRemove: () => onValueChange(held.filter((v) => `item:${v}` !== e.key)) }), children: entryLabel(e) }, e.key)), _jsx(Input, { combobox: true, chrome: "bare", autofill: false, ref: searchBox, className: "o-picker-input", placeholder: held.length ? undefined : search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] })) : _jsx(Input, { combobox: true, chrome: "bare", autofill: false, ref: searchBox, className: "o-picker-input", placeholder: search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] })), multiple && worn.picked === "count" && held.length > 0 && _jsxs("div", { className: "o-picker-count", children: [_jsx("span", { children: around(w.chosen(held.length), String(held.length)) }), _jsx(Button, { ref: focusesInPlace, kind: "text", size: "2xs", onClick: () => onValueChange([]), children: w.clearAll })] }), message, _jsxs(BaseCombobox.List, { className: "o-picker-listbox", "aria-label": label, children: [_jsxs("div", { className: "o-picker-rows", children: [parent ? _jsxs(_Fragment, { children: [row(parent, -1), _jsx("div", { className: "o-picker-level", children: groups })] }) : groups, rows.some((r) => r.kind === "more") && _jsxs("div", { ref: more, className: "o-picker-more", children: [_jsx(Spinner, { size: 14, label: "" }), w.loadingMore] }), first && action(first)] }), _jsx(Scrollbar, {}), (footCreate || actionsShown) && (_jsxs("div", { className: "o-picker-foot o-popup-line", "data-at": "foot", children: [footCreate && row(footCreate, -1, true), actionsShown && (_jsxs(BaseCombobox.Group, { children: [worn.heading === "shown" && _jsx(BaseCombobox.GroupLabel, { className: "o-list-heading", children: w.actions }), actions.map((a) => action(a, true))] }))] }))] })] }));
|
|
847
|
+
} }, children: [heldEntries.map((e) => _jsx(BaseCombobox.Chip, { "data-slot": "vk-picker-chip", "data-key": e.key.replace(/^item:/, ""), render: _jsx(Option, { onRemove: () => onValueChange(held.filter((v) => `item:${v}` !== e.key)) }), children: entryLabel(e) }, e.key)), _jsx(Input, { combobox: true, chrome: "bare", autofill: false, ref: searchBox, className: "o-picker-input", placeholder: held.length ? undefined : search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] })) : _jsx(Input, { combobox: true, chrome: "bare", autofill: false, ref: searchBox, className: "o-picker-input", placeholder: search, "aria-label": search ?? label, onKeyDown: ends, ...restAttrs })] })), multiple && worn.picked === "count" && held.length > 0 && _jsxs("div", { className: "o-picker-count", "data-slot": "vk-picker-count", children: [_jsx("span", { children: around(w.chosen(held.length), String(held.length)) }), _jsx(Button, { ref: focusesInPlace, kind: "text", size: "2xs", "data-slot": "vk-picker-clear", onClick: () => onValueChange([]), children: w.clearAll })] }), message, _jsxs(BaseCombobox.List, { className: "o-picker-listbox", "data-slot": "vk-picker-list", "aria-label": label, children: [_jsxs("div", { className: "o-picker-rows", children: [parent ? _jsxs(_Fragment, { children: [row(parent, -1), _jsx("div", { className: "o-picker-level", children: groups })] }) : groups, rows.some((r) => r.kind === "more") && _jsxs("div", { ref: more, className: "o-picker-more", "data-slot": "vk-picker-loading", children: [_jsx(Spinner, { size: 14, label: "" }), w.loadingMore] }), first && action(first)] }), _jsx(Scrollbar, {}), (footCreate || actionsShown) && (_jsxs("div", { className: "o-picker-foot o-popup-line", "data-slot": "vk-picker-foot", "data-at": "foot", children: [footCreate && row(footCreate, -1, true), actionsShown && (_jsxs(BaseCombobox.Group, { children: [worn.heading === "shown" && _jsx(BaseCombobox.GroupLabel, { className: "o-list-heading", "data-slot": "vk-picker-heading", children: w.actions }), actions.map((a) => action(a, true))] }))] }))] })] }));
|
|
847
848
|
const value_ = (multiple ? heldEntries : heldEntries[0] ?? null);
|
|
848
849
|
const highlighted = (v, d) => {
|
|
849
850
|
lit.current = d.index;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PartSlot } from "../internal/part-slot.js";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import type { StatusPlace } from "../status/status.js";
|
|
3
4
|
import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
@@ -41,6 +42,9 @@ export interface PickerItem {
|
|
|
41
42
|
menu?: MenuEntry[];
|
|
42
43
|
count?: number;
|
|
43
44
|
after?: ReactNode;
|
|
45
|
+
/** Its public name and which one it is (VK-988), drawn on its row as `data-slot` and `data-key`: a panel's own row (a view in the
|
|
46
|
+
* views list). A name a panel hands wins over any the Picker draws by default. */
|
|
47
|
+
slot?: PartSlot;
|
|
44
48
|
}
|
|
45
49
|
export type PickerRow = {
|
|
46
50
|
kind: "empty";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViewsPopoverProps } from "../../provider/components.js";
|
|
2
2
|
/** ViewKit's popup, drawn as the kit's Popover. */
|
|
3
|
-
export declare function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, children }: ViewsPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, label, children }: ViewsPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Popover } from "./popover.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { markOwnControl } from "../../provider/own-control.js";
|
|
4
|
+
export function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, label, children }) {
|
|
5
|
+
return (_jsx(Popover, { open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, initialFocus: initialFocus, onOutsidePress: onOutsidePress, onEscape: onEscape, style: style, onPopupClick: onPanelClick, popupData: chrome === "menu" ? { ...panelData, "data-popover-chrome": "menu" } : panelData, className: className, "aria-label": label, children: children }));
|
|
5
6
|
}
|
|
7
|
+
markOwnControl(MapPopover);
|
|
@@ -52,7 +52,7 @@ function Values({ field, values, held, several, onPress, search, phone, clear })
|
|
|
52
52
|
};
|
|
53
53
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-quick-filters-values", role: "listbox", "aria-label": field.name, "aria-multiselectable": several || undefined, "data-quiet": held.length ? "" : undefined, children: values.map((v, i) => {
|
|
54
54
|
const on = held.includes(v.value);
|
|
55
|
-
return (_jsxs("div", { ref: (el) => { rows.current[i] = el; }, role: "option", "aria-selected": on, tabIndex: i === here ? 0 : -1, className: "o-quick-filters-value", "data-held": on ? "" : undefined, onClick: () => { setAt(i); onPress(v.value); }, onKeyDown: (e) => keys(e, i), children: [_jsx(Mark, { value: v, phone: phone }), _jsx("span", { className: "o-quick-filters-name", children: v.label }), on && _jsx("span", { className: "o-quick-filters-clear", "aria-hidden": "true", children: clear }), v.count !== undefined && _jsx("span", { className: "o-quick-filters-count", children: v.count.toLocaleString("en-GB") })] }, v.value));
|
|
55
|
+
return (_jsxs("div", { ref: (el) => { rows.current[i] = el; }, role: "option", "aria-selected": on, tabIndex: i === here ? 0 : -1, className: "o-quick-filters-value", "data-slot": "vk-quick-value", "data-key": v.value, "data-held": on ? "" : undefined, onClick: () => { setAt(i); onPress(v.value); }, onKeyDown: (e) => keys(e, i), children: [_jsx(Mark, { value: v, phone: phone }), _jsx("span", { className: "o-quick-filters-name", children: v.label }), on && _jsx("span", { className: "o-quick-filters-clear", "data-slot": "vk-quick-clear", "aria-hidden": "true", children: clear }), v.count !== undefined && _jsx("span", { className: "o-quick-filters-count", "data-slot": "vk-quick-count", children: v.count.toLocaleString("en-GB") })] }, v.value));
|
|
56
56
|
}) }), _jsx(Scrollbar, {})] }));
|
|
57
57
|
}
|
|
58
58
|
export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, onOpenChange, counts = true, form: given, onDone, words, className }) {
|
|
@@ -82,8 +82,8 @@ export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, on
|
|
|
82
82
|
e.preventDefault();
|
|
83
83
|
root.current?.querySelector(".o-quick-filters-value")?.focus();
|
|
84
84
|
};
|
|
85
|
-
return (_jsxs("div", { ref: root, className: cx("o-quick-filters", className), "data-kit": "quick-filters", "data-form": form, children: [_jsxs("div", { className: "o-quick-filters-top", children: [_jsx(ToggleGroup, { "aria-label": w.fields, kind: "pill", size: phone ? "sm" : "xs", spacing: phone ? 2 : 1.5, value: [field.id], onValueChange: (v) => { if (v[0])
|
|
86
|
-
show(v[0]); }, className: "o-quick-filters-strip", children: fields.map((f) => _jsx(Toggle, { value: f.id, children: f.name }, f.id)) }), searching && (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { ref: searchBox, value: query, onValueChange: setQuery, placeholder: field.search, "aria-label": field.search ?? w.search(field.name), onKeyDown: toFirst })] }))] }), values.length || !query
|
|
85
|
+
return (_jsxs("div", { ref: root, className: cx("o-quick-filters", className), "data-slot": "vk-quick", "data-kit": "quick-filters", "data-form": form, children: [_jsxs("div", { className: "o-quick-filters-top", children: [_jsx(ToggleGroup, { "aria-label": w.fields, kind: "pill", size: phone ? "sm" : "xs", spacing: phone ? 2 : 1.5, value: [field.id], onValueChange: (v) => { if (v[0])
|
|
86
|
+
show(v[0]); }, className: "o-quick-filters-strip", children: fields.map((f) => _jsx(Toggle, { value: f.id, "data-slot": "vk-quick-field", "data-key": f.id, children: f.name }, f.id)) }), searching && (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", "data-slot": "vk-quick-search", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { ref: searchBox, value: query, onValueChange: setQuery, placeholder: field.search, "aria-label": field.search ?? w.search(field.name), onKeyDown: toFirst })] }))] }), values.length || !query
|
|
87
87
|
? _jsx(Values, { field: field, values: values, held: heldIn(holds, field.id), several: holding === "several", onPress: press, search: searchBox, phone: phone, clear: w.clear }, `${field.id}:${query}`)
|
|
88
|
-
: _jsx("p", { className: "o-quick-filters-none", role: "status", children: w.none })] }));
|
|
88
|
+
: _jsx("p", { className: "o-quick-filters-none", "data-slot": "vk-quick-none", role: "status", children: w.none })] }));
|
|
89
89
|
}
|
|
@@ -18,6 +18,9 @@ export interface RadioGroupProps extends Omit<React.ComponentProps<typeof BaseRa
|
|
|
18
18
|
* FieldSet, its name the legend (Base UI names the radio group by it). */
|
|
19
19
|
export declare function RadioGroup(props: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export interface RadioProps extends Omit<React.ComponentProps<typeof BaseRadio.Root>, "className"> {
|
|
21
|
+
/** Its public name where a panel names it (VK-988), drawn on its label with `data-key`: `vk-customize-layout`, say. */
|
|
22
|
+
"data-slot"?: string;
|
|
23
|
+
"data-key"?: string;
|
|
21
24
|
/** The choice. Without one, give it an aria-label. */
|
|
22
25
|
label?: React.ReactNode;
|
|
23
26
|
/** A line under the label that explains it, or says why it is locked. */
|
|
@@ -27,13 +27,14 @@ function RadioChoices({ label, row = false, tiles = false, className, children,
|
|
|
27
27
|
return label != null ? _jsx(FieldSet, { legend: label, disabled: props.disabled, className: className, children: group }) : group;
|
|
28
28
|
}
|
|
29
29
|
const CHECK = (_jsx("svg", { className: "o-radio-check", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M5 12l5 5l10 -10" }) }));
|
|
30
|
-
export const Radio = React.forwardRef(function Radio({ label, note, card = false, mark, swatch, picture, className, ...props }, ref) {
|
|
30
|
+
export const Radio = React.forwardRef(function Radio({ label, note, card = false, mark, swatch, picture, className, "data-slot": slot, "data-key": key, ...props }, ref) {
|
|
31
|
+
const named = { "data-slot": slot, "data-key": key };
|
|
31
32
|
const text = (label != null || note != null) && (_jsxs("span", { className: "o-choice-text", children: [label != null && _jsx("span", { className: "o-choice-label", children: label }), note != null && _jsx("span", { className: "o-choice-note", children: note })] }));
|
|
32
33
|
if (swatch != null) {
|
|
33
|
-
return (_jsxs("label", { className: cx("o-radio", "o-radio-swatched", className), "data-kit": "radio", children: [_jsx(BaseRadio.Root, { ref: ref, className: "o-radio-swatch", "data-colour": swatch, ...props }), text] }));
|
|
34
|
+
return (_jsxs("label", { className: cx("o-radio", "o-radio-swatched", className), "data-kit": "radio", ...named, children: [_jsx(BaseRadio.Root, { ref: ref, className: "o-radio-swatch", "data-colour": swatch, ...props }), text] }));
|
|
34
35
|
}
|
|
35
36
|
const pictured = picture != null, marked = mark != null || pictured;
|
|
36
|
-
return (_jsxs("label", { className: cx("o-radio", (card || marked) && "o-choice-card", marked && "o-radio-marked", pictured && "o-radio-pictured", className), "data-kit": "radio", children: [pictured && _jsx("span", { className: "o-radio-picture", "aria-hidden": "true", children: picture }), marked
|
|
37
|
+
return (_jsxs("label", { className: cx("o-radio", (card || marked) && "o-choice-card", marked && "o-radio-marked", pictured && "o-radio-pictured", className), "data-kit": "radio", ...named, children: [pictured && _jsx("span", { className: "o-radio-picture", "aria-hidden": "true", children: picture }), marked
|
|
37
38
|
? _jsx(BaseRadio.Root, { ref: ref, className: "o-radio-mark", ...props, children: mark })
|
|
38
39
|
: _jsx(BaseRadio.Root, { ref: ref, className: "o-radio-ring", ...props, children: _jsx(BaseRadio.Indicator, { keepMounted: true, className: "o-radio-dot", children: card && CHECK }) }), text] }));
|
|
39
40
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { markOwnControl } from "../../provider/own-control.js";
|
|
3
|
+
import { Select } from "./select.js";
|
|
4
|
+
const asItems = (items) => items.map(({ icon, level, ...row }) => ({ ...row, ...(icon != null ? { mark: icon } : {}), ...(level ? { level: asItems(level) } : {}) }));
|
|
5
|
+
export function MapSelect({ items, size, ...rest }) {
|
|
6
|
+
return _jsx(Select, { listWidth: "rows", size: size === "default" ? "md" : "sm", items: asItems(items), ...rest });
|
|
7
|
+
}
|
|
8
|
+
markOwnControl(MapSelect);
|
|
@@ -42,6 +42,9 @@ interface SelectFieldProps {
|
|
|
42
42
|
className?: string;
|
|
43
43
|
/** The field drawn as under the pointer or in focus, as a page that shows it draws it; saved, its Saved held. */
|
|
44
44
|
"data-force"?: "hover" | "focus" | "saved";
|
|
45
|
+
/** Its public name where a panel names it (VK-988), drawn on its box with `data-key`: `vk-sort-field`, say. */
|
|
46
|
+
"data-slot"?: string;
|
|
47
|
+
"data-key"?: string;
|
|
45
48
|
/** The app saving what was picked (VK-921): the Spinner at the field's end, before its chevron, the field busy. It wins
|
|
46
49
|
* over saved. */
|
|
47
50
|
saving?: boolean;
|
|
@@ -81,7 +81,7 @@ function PickerSelect(p) {
|
|
|
81
81
|
if (placed.open !== open)
|
|
82
82
|
setPlaced({ open, side: open ? sideAsItOpens(p, f, box) : p.side ?? "bottom" });
|
|
83
83
|
const side = placed.side;
|
|
84
|
-
return (_jsxs(Labelled, { ...p, id: f.id, typed: typed, children: [_jsx(PickerUnder, { ...picker.props, empty: typed ? undefined : picker.props.empty, search: picker.words ?? p.search ?? (p.create || p.onSearch || p.footer ? "Search" : undefined), searchShown: typed || !!(p.search || p.create || p.onSearch || p.footer), searchIn: typed ? "box" : "list", open: open, onOpenChange: setOpen, disabled: disabled, box: typed ? (search) => _jsx(TypedBox, { p: p, f: f, trigger: trigger, field: field, hint: picker.words ?? p.search ?? placeholder, search: search }) : (_jsxs(BaseCombobox.Trigger, { ref: trigger, className: boxClass(p), "data-force": p["data-force"], "data-kit": "select", ...mark, ...fieldAria(p, f.id), ...busy(p), children: [inside(p) && _jsx("span", { id: `${f.id}-label`, className: "o-select-label-in", children: p.label }), _jsx("span", { id: `${f.id}-value`, className: "contents", children: _jsx(Value, { chosen: f.chosen, multiple: multiple, chips: chips, placeholder: placeholder }) }), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Icon, { className: "o-select-chevron", children: glyph(CHEVRON, "") })] })), panel: (list) => (_jsx(BaseCombobox.Portal, { container: host, children: _jsx(BaseCombobox.Positioner, { className: "o-list-positioner", side: side, sideOffset: gapOf(box ?? host), collisionPadding: edgeOf(box ?? host), align: p.align ?? "start", collisionAvoidance: { side: "none" }, anchor: typed ? field : undefined, children: _jsx(BaseCombobox.Popup, { ref: popup, className: "o-list o-select-list o-smooth o-smooth-ease", ...mark, "data-list-width": p.listWidth === "rows" ? "rows" : undefined, "aria-label": titleOf(p), children: list }) }, side) })) }), _jsx(FormValue, { p: p, f: f, focusBox: () => (typed ? field.current?.querySelector("input") : trigger.current)?.focus() })] }));
|
|
84
|
+
return (_jsxs(Labelled, { ...p, id: f.id, typed: typed, children: [_jsx(PickerUnder, { ...picker.props, empty: typed ? undefined : picker.props.empty, search: picker.words ?? p.search ?? (p.create || p.onSearch || p.footer ? "Search" : undefined), searchShown: typed || !!(p.search || p.create || p.onSearch || p.footer), searchIn: typed ? "box" : "list", open: open, onOpenChange: setOpen, disabled: disabled, box: typed ? (search) => _jsx(TypedBox, { p: p, f: f, trigger: trigger, field: field, hint: picker.words ?? p.search ?? placeholder, search: search }) : (_jsxs(BaseCombobox.Trigger, { ref: trigger, className: boxClass(p), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...fieldAria(p, f.id), ...busy(p), children: [inside(p) && _jsx("span", { id: `${f.id}-label`, className: "o-select-label-in", children: p.label }), _jsx("span", { id: `${f.id}-value`, className: "contents", children: _jsx(Value, { chosen: f.chosen, multiple: multiple, chips: chips, placeholder: placeholder }) }), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Icon, { className: "o-select-chevron", children: glyph(CHEVRON, "") })] })), panel: (list) => (_jsx(BaseCombobox.Portal, { container: host, children: _jsx(BaseCombobox.Positioner, { className: "o-list-positioner", side: side, sideOffset: gapOf(box ?? host), collisionPadding: edgeOf(box ?? host), align: p.align ?? "start", collisionAvoidance: { side: "none" }, anchor: typed ? field : undefined, children: _jsx(BaseCombobox.Popup, { ref: popup, className: "o-list o-select-list o-smooth o-smooth-ease", ...mark, "data-list-width": p.listWidth === "rows" ? "rows" : undefined, "aria-label": titleOf(p), children: list }) }, side) })) }), _jsx(FormValue, { p: p, f: f, focusBox: () => (typed ? field.current?.querySelector("input") : trigger.current)?.focus() })] }));
|
|
85
85
|
}
|
|
86
86
|
function TypedBox({ p, f, trigger, field, hint, search }) {
|
|
87
87
|
const { multiple, disabled } = p, q = search.typed, mark = phoneMark(usePhoneForm());
|
|
@@ -110,7 +110,7 @@ function TypedBox({ p, f, trigger, field, hint, search }) {
|
|
|
110
110
|
const one = !multiple && f.chosen.length === 1 ? f.chosen[0] : undefined;
|
|
111
111
|
const slot = one?.mark != null && (_jsxs(InputGroupAddon, { side: "start", className: "o-select-mark", "aria-hidden": "true", "data-searching": q !== one.label ? "" : undefined, children: [_jsx("span", { className: "o-select-mark-own", children: one.mark }), glyph(SEARCH, "o-select-mark-search")] }));
|
|
112
112
|
const box = (_jsx(Input, { combobox: true, chrome: "bare", ref: input, className: "o-select-typed-input", placeholder: multiple && f.chosen.length ? undefined : hint, onKeyDown: search.onKeyDown, ...search.attrs, ...(p.label != null ? {} : { "aria-label": p["aria-label"] }) }));
|
|
113
|
-
return (_jsxs(BaseCombobox.InputGroup, { ref: field, className: cx("o-input o-input-group o-select-field o-select-typed o-smooth o-smooth-ease", sized(p.size)), "data-force": p["data-force"], "data-kit": "select", ...mark, ...busy(p), onMouseDown: keep, children: [slot, multiple ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "o-select-measure", "aria-hidden": "true", inert: true, children: _jsxs("span", { ref: measure, children: [f.chosen.map((i) => _jsx(Option, { icon: chipMark(i.mark), onRemove: () => { }, children: i.label }, i.value)), _jsx(Option, { count: n }), _jsx("span", { className: "o-select-measure-words", children: q })] }) }), _jsxs(BaseCombobox.Chips, { ref: chipsBox, className: "o-select-chips", children: [f.chosen.map((i, at) => _jsx(BaseCombobox.Chip, { "data-over": at >= fit ? "" : undefined, render: _jsx(Option, { icon: chipMark(i.mark), onRemove: () => f.setValue(f.value.filter((v) => v !== i.value)) }), children: i.label }, i.value)), fit < n && _jsx(Option, { count: n - fit }), box] })] })) : box, !small && !disabled && !p.readOnly && f.chosen.length > 0 && (_jsx(BaseCombobox.Clear, { render: (props) => _jsx(Button, { ...props, kind: "quiet", size: "2xs", shape: "icon", className: "o-select-clear", "aria-label": "Clear", icon: glyph(X, ""), children: null }) })), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Trigger, { ref: trigger, className: "o-select-chevron o-select-typed-trigger", tabIndex: -1, "aria-label": `Show every ${typeof p.label === "string" ? p.label.toLowerCase() : "choice"}`, children: glyph(CHEVRON, "") })] }));
|
|
113
|
+
return (_jsxs(BaseCombobox.InputGroup, { ref: field, className: cx("o-input o-input-group o-select-field o-select-typed o-smooth o-smooth-ease", sized(p.size)), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...busy(p), onMouseDown: keep, children: [slot, multiple ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "o-select-measure", "aria-hidden": "true", inert: true, children: _jsxs("span", { ref: measure, children: [f.chosen.map((i) => _jsx(Option, { icon: chipMark(i.mark), onRemove: () => { }, children: i.label }, i.value)), _jsx(Option, { count: n }), _jsx("span", { className: "o-select-measure-words", children: q })] }) }), _jsxs(BaseCombobox.Chips, { ref: chipsBox, className: "o-select-chips", children: [f.chosen.map((i, at) => _jsx(BaseCombobox.Chip, { "data-over": at >= fit ? "" : undefined, render: _jsx(Option, { icon: chipMark(i.mark), onRemove: () => f.setValue(f.value.filter((v) => v !== i.value)) }), children: i.label }, i.value)), fit < n && _jsx(Option, { count: n - fit }), box] })] })) : box, !small && !disabled && !p.readOnly && f.chosen.length > 0 && (_jsx(BaseCombobox.Clear, { render: (props) => _jsx(Button, { ...props, kind: "quiet", size: "2xs", shape: "icon", className: "o-select-clear", "aria-label": "Clear", icon: glyph(X, ""), children: null }) })), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Trigger, { ref: trigger, className: "o-select-chevron o-select-typed-trigger", tabIndex: -1, "aria-label": `Show every ${typeof p.label === "string" ? p.label.toLowerCase() : "choice"}`, children: glyph(CHEVRON, "") })] }));
|
|
114
114
|
}
|
|
115
115
|
const gapOf = (at) => spacingPx(1, at), edgeOf = (at) => spacingPx(1.25, at);
|
|
116
116
|
function listNeed(at, rows, lines) {
|
|
@@ -227,7 +227,7 @@ function AloneSelect({ opens, shown, open = false, onOpenChange, placeholder = "
|
|
|
227
227
|
onOpenChange?.(true);
|
|
228
228
|
} };
|
|
229
229
|
const empty = shown == null || shown === "" || shown === false;
|
|
230
|
-
return (_jsx(Labelled, { ...p, id: id, children: _jsxs(BaseField.Control, { render: _jsx("button", { type: "button" }), ref: own, disabled: p.disabled, className: boxClass(p, !!mark), "data-force": p["data-force"], "data-kit": "select", ...mark, ...fieldAria(p, id), ...busy(p), "aria-haspopup": opens, "aria-expanded": open, "data-popup-open": open ? "" : undefined, onClick: press, onKeyDown: keys, children: [inside(p) && _jsx("span", { id: `${id}-label`, className: "o-select-label-in", children: p.label }), _jsx("span", { id: `${id}-value`, className: "contents", children: empty ? _jsx("span", { className: "o-select-value o-select-placeholder", children: placeholder })
|
|
230
|
+
return (_jsx(Labelled, { ...p, id: id, children: _jsxs(BaseField.Control, { render: _jsx("button", { type: "button" }), ref: own, disabled: p.disabled, className: boxClass(p, !!mark), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...fieldAria(p, id), ...busy(p), "aria-haspopup": opens, "aria-expanded": open, "data-popup-open": open ? "" : undefined, onClick: press, onKeyDown: keys, children: [inside(p) && _jsx("span", { id: `${id}-label`, className: "o-select-label-in", children: p.label }), _jsx("span", { id: `${id}-value`, className: "contents", children: empty ? _jsx("span", { className: "o-select-value o-select-placeholder", children: placeholder })
|
|
231
231
|
: _jsx("span", { className: "o-select-value", children: typeof shown === "string" ? _jsx("span", { className: "o-list-main", children: shown }) : shown }) }), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), arrow !== "none" && _jsx("span", { className: "o-select-chevron", "data-arrow": arrow, "aria-hidden": "true", children: glyph(ARROWS[arrow], "") })] }) }));
|
|
232
232
|
}
|
|
233
233
|
export function SelectShown({ items, defaultValue, multiple, chips, search, none, placeholder = "Choose", "aria-label": name }) {
|
|
@@ -25,6 +25,8 @@ export interface SheetHeadProps {
|
|
|
25
25
|
close?: boolean;
|
|
26
26
|
/** Back: to the step before, or out of the sheet. In Glass it takes the X's place, and the sheet closes by a drag or the dim. */
|
|
27
27
|
onBack?: () => void;
|
|
28
|
+
/** Back's public name (VK-989): a field editor's step hands `vk-editor-back`, drawn on its ‹ as `data-slot`. */
|
|
29
|
+
backSlot?: string;
|
|
28
30
|
/** The X's and Back's names to a screen reader; English unless handed. */
|
|
29
31
|
words?: {
|
|
30
32
|
close?: string;
|
|
@@ -53,11 +55,13 @@ export declare function SheetButton({ className, kind, children, ...props }: {
|
|
|
53
55
|
className?: string;
|
|
54
56
|
kind?: "primary";
|
|
55
57
|
disabled?: boolean;
|
|
58
|
+
/** Its public name (VK-989), drawn on both its forms: the editors' ✕ and ✓ hand `vk-editor-close` and `vk-editor-save`. */
|
|
59
|
+
"data-slot"?: string;
|
|
56
60
|
}): import("react/jsx-runtime").JSX.Element;
|
|
57
61
|
/** Its head, one of its kinds: the one header (HeaderBar), under its handle. Glass has on its left the X, or Back in its place, and on its right one action, or two, as the phone header's Two buttons says.
|
|
58
62
|
* Flat has Back on its left, if there is one, and its action and the X on its right. Or Decide, a button either side of its
|
|
59
63
|
* title. A sheet with no head is its handle alone. */
|
|
60
|
-
export declare function SheetHead({ title, mark, titleLabel, titleAt, description, close, onBack, left, right, children, words, step }: SheetHeadProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export declare function SheetHead({ title, mark, titleLabel, titleAt, description, close, onBack, backSlot, left, right, children, words, step }: SheetHeadProps): import("react/jsx-runtime").JSX.Element;
|
|
61
65
|
/** Its foot: stays at the foot of the screen at every stop, and leaves with the sheet. */
|
|
62
66
|
export declare const SheetFoot: ({ children }: {
|
|
63
67
|
children: React.ReactNode;
|