viewkitjs 0.32.0 → 0.34.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 +98 -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 +46 -11
- package/views/dist/contract.js +157 -0
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/bulk-bar/bulk-bar.js +25 -22
- 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 +4 -0
- package/views/dist/controls/controls.js +4 -0
- package/views/dist/controls/customize/customize.js +43 -39
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +7 -2
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +27 -21
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- 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 +3 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +11 -4
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.d.ts +3 -1
- package/views/dist/controls/filter-editor/parts.js +8 -6
- package/views/dist/controls/group-editor/group-editor.js +17 -14
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +4 -3
- 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/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- 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 +58 -0
- package/views/dist/controls/internal/panel-controls.js +240 -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 +3 -0
- package/views/dist/controls/menu/menu.js +5 -5
- 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/modal/modal.js +5 -3
- 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/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +16 -16
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/map-fields-body.js +25 -1
- 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/picker.css +10 -1
- 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/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +7 -3
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- 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/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +8 -2
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- 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 +8 -4
- 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/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +11 -10
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +2 -2
- 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.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +7 -3
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +9 -10
- package/views/dist/controls/views-list/views-list.js +6 -6
- package/views/dist/editors/EditorPanel.js +4 -4
- 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 +74 -0
- package/views/dist/list/list.js +18 -0
- package/views/dist/list/parts.js +11 -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 +23 -5
- 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 +21 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +20 -6
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +4 -3
- 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 +4 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +5 -4
- 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 +8 -5
- package/views/dist/panels/react/toolbar/context.d.ts +31 -1
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +7 -4
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +7 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +90 -2
- 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 +107 -80
- package/views/dist/styles.unlayered.css +107 -80
- package/views/docs/contract.md +310 -7
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/bulk-bar.md +4 -0
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +8 -0
- package/views/docs/controls/date-editor.md +6 -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 +8 -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 +6 -0
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +6 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +8 -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 +6 -0
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +8 -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 +11 -7
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +143 -11
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +6 -5
- package/views/docs/reference/react.md +19 -12
- package/views/docs/reference/views.md +11 -5
- package/views/docs/reshaping.md +17 -1
- package/views/skills/views/SKILL.md +1 -1
|
@@ -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 });
|
|
@@ -39,5 +39,29 @@ export function MapFieldsBody({ label, search, fields, own, form, onPick, onDone
|
|
|
39
39
|
const { messages } = useViews();
|
|
40
40
|
const picked = React.useRef(false);
|
|
41
41
|
const on = () => fieldsBodyHandlers({ onPick, onDone }, picked);
|
|
42
|
-
|
|
42
|
+
const box = React.useRef(null);
|
|
43
|
+
React.useLayoutEffect(() => {
|
|
44
|
+
const at = box.current;
|
|
45
|
+
let gone = false;
|
|
46
|
+
const hold = () => {
|
|
47
|
+
const list = at?.querySelector('.o-picker[data-picker-form="computer"]'), input = list?.querySelector(".o-picker-search input");
|
|
48
|
+
if (gone || !at || !list || !input)
|
|
49
|
+
return;
|
|
50
|
+
at.style.removeProperty("--picker-floor");
|
|
51
|
+
const s = getComputedStyle(input), line = input.closest(".o-picker-search"), pen = document.createElement("canvas").getContext("2d");
|
|
52
|
+
const px = (v) => parseFloat(v) || 0, edge = list.getBoundingClientRect(), field = input.getBoundingClientRect();
|
|
53
|
+
const round = field.left + px(s.borderLeftWidth) + px(s.paddingLeft) - edge.left
|
|
54
|
+
+ px(s.paddingRight) + px(s.borderRightWidth) + px(getComputedStyle(line).paddingRight) + (edge.right - line.getBoundingClientRect().right);
|
|
55
|
+
let words = 0;
|
|
56
|
+
if (pen && input.placeholder) {
|
|
57
|
+
pen.font = `${s.fontStyle} ${s.fontWeight} ${s.fontSize} ${s.fontFamily}`;
|
|
58
|
+
words = pen.measureText(input.placeholder).width;
|
|
59
|
+
}
|
|
60
|
+
at.style.setProperty("--picker-floor", `${Math.ceil(Math.max(edge.width, round + words))}px`);
|
|
61
|
+
};
|
|
62
|
+
hold();
|
|
63
|
+
void document.fonts?.ready.then(hold);
|
|
64
|
+
return () => { gone = true; };
|
|
65
|
+
}, []);
|
|
66
|
+
return _jsx("span", { ref: box, className: "o-fields-body", children: _jsx(Picker, { label: label, items: fieldItemsOf(fields, messages({ key: "views.panels.related-records" })), value: own ?? null, search: search, searchShown: true, form: form, words: pickerWordsOf(messages), onValueChange: (v) => on().onValueChange(v), onDone: () => on().onDone() }) });
|
|
43
67
|
}
|
|
@@ -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";
|
|
@@ -68,8 +68,17 @@
|
|
|
68
68
|
.o-picker[data-picker-form="computer"] .o-list-row { --list-row-rad: var(--list-row-corners, var(--list-row-r, var(--list-box-r, var(--vk-radius-lg))));
|
|
69
69
|
--list-row-pill-in: var(--list-row-corners-pill, var(--list-row-pill, var(--list-box-pill, 0))); }
|
|
70
70
|
.o-picker[data-picker-form="computer"] .o-picker-rows {
|
|
71
|
-
max-height: calc(var(--list-rows) * var(--list-row-h, calc(var(--vk-spacing) * 8))); scroll-padding-block: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
71
|
+
max-height: calc(var(--list-rows, 8.5) * var(--list-row-h, calc(var(--vk-spacing) * 8))); scroll-padding-block: var(--list-row-h, calc(var(--vk-spacing) * 8));
|
|
72
72
|
}
|
|
73
|
+
/* ViewKit's field list (CONTROLS.FieldsBody, wrapped in .o-fields-body, which draws no box) stands as wide as its widest row:
|
|
74
|
+
its search fills that width and never sets it, though its placeholder reads whole, a row's check takes room only on the row the field holds, and ViewKit's
|
|
75
|
+
Popover holding it fits it, never past the 288 it stands at otherwise nor the room on screen, at least what opened it. */
|
|
76
|
+
.o-fields-body { display: contents; }
|
|
77
|
+
.o-fields-body .o-picker[data-picker-form="computer"] .o-picker-search { contain: inline-size; }
|
|
78
|
+
/* Never narrower than it opened nor than its search's placeholder (map-fields-body.tsx measures both as it opens). */
|
|
79
|
+
.o-fields-body .o-picker[data-picker-form="computer"] { min-width: var(--picker-floor, 0px); }
|
|
80
|
+
.o-fields-body .o-picker[data-picker-form="computer"] .o-list-row:not([data-selected], [aria-selected="true"]) > .o-picker-check { display: none; }
|
|
81
|
+
.o-popover:has(> .o-popover-cut > .o-fields-body .o-picker[data-picker-form="computer"]) { width: fit-content; max-width: min(calc(var(--vk-spacing) * 72), var(--available-width, 100%)); }
|
|
73
82
|
.o-popover:has(.o-picker[data-picker-form="computer"]):not(:has([data-kit$="-editor"])) {
|
|
74
83
|
--popover-edge: var(--list-edge, var(--vk-border)); --divider-colour: var(--list-sep-colour, var(--vk-border)); --popover-shadow: var(--list-shadow, var(--vk-shadow-xl)); --popover-pad: var(--list-pad, calc(var(--vk-spacing) * 1.5));
|
|
75
84
|
--popover-corners: calc(min(var(--list-box-r, var(--vk-radius-lg)), var(--vk-radius-2xl)) + var(--list-pad, calc(var(--vk-spacing) * 1.5)));
|
|
@@ -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);
|
|
@@ -27,5 +27,6 @@ export type QuickFiltersFieldIn = {
|
|
|
27
27
|
export declare function quickFiltersFieldsOf(fields: readonly QuickFiltersFieldIn[]): QuickField[];
|
|
28
28
|
/** The quick filters' words in the app's messages. */
|
|
29
29
|
export declare const quickFiltersWordsOf: (say: ViewsMessageResolver) => QuickFiltersWords;
|
|
30
|
-
|
|
30
|
+
/** ViewKit's quick filters, drawing the app's controls where the provider's `panelControls` names them (VK-1014). */
|
|
31
|
+
export declare function MapQuickFiltersBody(props: ViewsQuickFiltersBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
export {};
|
|
@@ -6,7 +6,8 @@ import { ViewsContext } from "../../provider/context.js";
|
|
|
6
6
|
import { glyph, X } from "../internal/editor-parts.js";
|
|
7
7
|
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
8
8
|
import { pickerItemsOf } from "../picker/map-picker.js";
|
|
9
|
-
import {
|
|
9
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
10
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
10
11
|
import { QuickFilters } from "./quick-filters.js";
|
|
11
12
|
export function quickHoldsOf(hold) {
|
|
12
13
|
return Object.fromEntries(hold.filter((h) => h.values.length).map((h) => [h.fieldKey, [...h.values]]));
|
|
@@ -50,10 +51,13 @@ export const quickFiltersWordsOf = (say) => ({
|
|
|
50
51
|
clear: say({ key: "views.panels.quick-clear-value" }),
|
|
51
52
|
none: say({ key: "views.panels.quick-none" }),
|
|
52
53
|
});
|
|
53
|
-
export function MapQuickFiltersBody(
|
|
54
|
+
export function MapQuickFiltersBody(props) {
|
|
55
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(QuickFiltersBodyInner, { ...props }) });
|
|
56
|
+
}
|
|
57
|
+
function QuickFiltersBodyInner({ label, fields, hold, several, showCounts, form, onHoldChange, onDone, actions }) {
|
|
54
58
|
const views = React.useContext(ViewsContext);
|
|
55
59
|
const messages = views?.messages ?? resolveViewsMessage;
|
|
56
60
|
const words = React.useMemo(() => quickFiltersWordsOf(messages), [messages]);
|
|
57
61
|
const quick = React.useMemo(() => quickFiltersFieldsOf(fields), [fields]);
|
|
58
|
-
return (_jsxs(_Fragment, { children: [actions && (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-quick-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: label }), right: _jsx("span", {}), left: _jsx(
|
|
62
|
+
return (_jsxs(_Fragment, { children: [actions && (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-quick-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: label }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-close", "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }) }) })), _jsx("div", { "data-quick-filters-holds": several ? "several" : "one", style: { display: "contents" }, children: _jsx(QuickFilters, { fields: quick, holds: quickHoldsOf(hold), onHoldsChange: (next) => onHoldChange(quickListHoldOf(next, hold)), counts: showCounts, form: form, onDone: onDone, words: words }) })] }));
|
|
59
63
|
}
|
|
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
5
|
import { Avatar } from "../avatar/avatar.js";
|
|
6
|
-
import {
|
|
6
|
+
import { InputGroup, InputGroupAddon } from "../input/input.js";
|
|
7
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
7
8
|
import { Icon } from "../internal/icons.js";
|
|
8
9
|
import { usePhoneForm } from "../internal/phone.js";
|
|
9
10
|
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
@@ -50,13 +51,14 @@ function Values({ field, values, held, several, onPress, search, phone, clear })
|
|
|
50
51
|
onPress(values[i].value);
|
|
51
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
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-quick-filters-values", "data-slot": "vk-quick-values", "data-key": field.id, role: "listbox", "aria-label": field.name, "aria-multiselectable": several || undefined, "data-quiet": held.length ? "" : undefined, children: values.map((v, i) => {
|
|
54
55
|
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));
|
|
56
|
+
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
57
|
}) }), _jsx(Scrollbar, {})] }));
|
|
57
58
|
}
|
|
58
59
|
export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, onOpenChange, counts = true, form: given, onDone, words, className }) {
|
|
59
60
|
const phone = usePhoneForm(given), form = phone ? "phone" : "computer", w = quickFiltersWords(words);
|
|
61
|
+
const { Input } = usePanelControls();
|
|
60
62
|
const root = React.useRef(null), searchBox = React.useRef(null), holding = useHolding(root);
|
|
61
63
|
const [own, setOwn] = React.useState(() => firstOpen(fields, holds)), [query, setQuery] = React.useState("");
|
|
62
64
|
const open = openGiven ?? own;
|
|
@@ -82,8 +84,8 @@ export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, on
|
|
|
82
84
|
e.preventDefault();
|
|
83
85
|
root.current?.querySelector(".o-quick-filters-value")?.focus();
|
|
84
86
|
};
|
|
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
|
|
87
|
+
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])
|
|
88
|
+
show(v[0]); }, className: "o-quick-filters-strip", "data-slot": "vk-quick-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
89
|
? _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 })] }));
|
|
90
|
+
: _jsx("p", { className: "o-quick-filters-none", "data-slot": "vk-quick-none", role: "status", children: w.none })] }));
|
|
89
91
|
}
|
|
@@ -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 }) {
|
|
@@ -3,11 +3,11 @@ const OUTRIGHT = { card: "outlined", rows: "snug", end: "buttons", fields: "boxe
|
|
|
3
3
|
const ATTIO = { card: "raised", rows: "roomy", end: "buttons", fields: "boxes", icon: "line" };
|
|
4
4
|
const LINEAR = { card: "edged", rows: "inset", end: "words", fields: "end", icon: "line" };
|
|
5
5
|
const options = [
|
|
6
|
-
{ id: "card", name: "Card", device: "desktop", def:
|
|
7
|
-
{ id: "rows", name: "Rows", device: "desktop", def:
|
|
8
|
-
{ id: "end", name: "End", device: "desktop", def:
|
|
9
|
-
{ id: "fields", name: "Fields", device: "desktop", def:
|
|
10
|
-
{ id: "icon", name: "Icon", device: "phone", def:
|
|
6
|
+
{ id: "card", name: "Card", device: "desktop", def: ATTIO.card, values: [{ id: "outlined", name: "Outlined" }, { id: "raised", name: "Raised" }, { id: "edged", name: "Edged" }] },
|
|
7
|
+
{ id: "rows", name: "Rows", device: "desktop", def: ATTIO.rows, values: [{ id: "snug", name: "Snug" }, { id: "roomy", name: "Roomy" }, { id: "inset", name: "Inset" }] },
|
|
8
|
+
{ id: "end", name: "End", device: "desktop", def: ATTIO.end, values: [{ id: "buttons", name: "Buttons" }, { id: "words", name: "Words" }] },
|
|
9
|
+
{ id: "fields", name: "Fields", device: "desktop", def: ATTIO.fields, values: [{ id: "boxes", name: "Boxes" }, { id: "end", name: "At the end" }] },
|
|
10
|
+
{ id: "icon", name: "Icon", device: "phone", def: ATTIO.icon, values: [{ id: "line", name: "Line" }, { id: "tile", name: "Tile" }] },
|
|
11
11
|
];
|
|
12
12
|
const looks = [
|
|
13
13
|
{ id: "outright", name: "Outright", picks: OUTRIGHT },
|