viewkitjs 0.33.0 → 0.35.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 +139 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -14
- package/views/dist/contract.js +40 -4
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +29 -27
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +19 -20
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +15 -13
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- 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/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +4 -2
- package/views/dist/controls/filter-editor/parts.js +8 -7
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- 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 +1 -1
- package/views/dist/controls/input/input.js +2 -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.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +38 -6
- package/views/dist/controls/internal/panel-controls.js +191 -19
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +5 -1
- package/views/dist/controls/menu/menu.js +4 -3
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- 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/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +30 -2
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/picker.css +10 -1
- 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 +9 -4
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -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 +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +29 -14
- package/views/dist/controls/toolbar/toolbar.js +17 -22
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- 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 +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +51 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +17 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +15 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +24 -9
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +14 -6
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +21 -10
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +7 -6
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- 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.js +3 -2
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -3
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +59 -8
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +194 -100
- package/views/dist/styles.unlayered.css +194 -100
- package/views/docs/contract.md +96 -27
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +7 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +4 -2
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +3 -1
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +21 -17
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +7 -5
- package/views/docs/reference/looks.md +6 -6
- package/views/docs/reference/panels-react.md +17 -15
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +15 -12
- package/views/docs/reference/views.md +6 -4
- package/views/docs/reshaping.md +32 -5
- package/views/skills/views/SKILL.md +3 -3
package/views/dist/contract.js
CHANGED
|
@@ -40,6 +40,7 @@ export const GRID_STATES = [
|
|
|
40
40
|
"focused",
|
|
41
41
|
"selected",
|
|
42
42
|
"hovered",
|
|
43
|
+
"active",
|
|
43
44
|
"editing",
|
|
44
45
|
"in-range",
|
|
45
46
|
"range-edge",
|
|
@@ -173,6 +174,9 @@ export const VK_OPTIONAL_LAYOUT = [
|
|
|
173
174
|
"--vk-field-row-py",
|
|
174
175
|
"--vk-field-row-line-w",
|
|
175
176
|
"--vk-toolbar-foot",
|
|
177
|
+
"--vk-toolbar-line-py",
|
|
178
|
+
"--vk-toolbar-line-gap",
|
|
179
|
+
"--vk-toolbar-line-w",
|
|
176
180
|
"--vk-gutter",
|
|
177
181
|
"--vk-scroll-inset-bottom",
|
|
178
182
|
"--vk-panel-padding",
|
|
@@ -240,6 +244,7 @@ export const OPTIONAL_COMPONENT_NAMES = [
|
|
|
240
244
|
"PortsHost",
|
|
241
245
|
"SelectionBar",
|
|
242
246
|
"ViewMenu",
|
|
247
|
+
"Pane",
|
|
243
248
|
];
|
|
244
249
|
export const ATOM_NAMES = [
|
|
245
250
|
"Row",
|
|
@@ -252,6 +257,7 @@ export const ATOM_NAMES = [
|
|
|
252
257
|
"CommandMenu",
|
|
253
258
|
"RelationLink",
|
|
254
259
|
"RelationRoles",
|
|
260
|
+
"RelationChip",
|
|
255
261
|
"CellMore",
|
|
256
262
|
"Loading",
|
|
257
263
|
"LoadMore",
|
|
@@ -272,12 +278,15 @@ export const ATOM_NAMES = [
|
|
|
272
278
|
];
|
|
273
279
|
export const PANEL_SLOTS = {
|
|
274
280
|
sort: ["vk-sort", "vk-sort-rules", "vk-sort-rule", "vk-sort-grip", "vk-sort-field", "vk-sort-direction", "vk-sort-remove", "vk-sort-rule-open", "vk-sort-rule-more", "vk-sort-rule-action", "vk-sort-direction-option", "vk-sort-add", "vk-sort-clear", "vk-sort-foot", "vk-sort-none", "vk-sort-head"],
|
|
275
|
-
filter: ["vk-filter", "vk-filter-rules", "vk-filter-item", "vk-filter-rule", "vk-filter-where", "vk-filter-joined", "vk-filter-join", "vk-filter-field", "vk-filter-how", "vk-filter-value", "vk-filter-rule-more", "vk-filter-rule-action", "vk-filter-group", "vk-filter-group-head", "vk-filter-quantifier", "vk-filter-group-more", "vk-filter-group-action", "vk-filter-delete", "vk-filter-add", "vk-filter-clear", "vk-filter-foot", "vk-filter-none", "vk-filter-excluded", "vk-filter-head"
|
|
281
|
+
filter: ["vk-filter", "vk-filter-rules", "vk-filter-item", "vk-filter-rule", "vk-filter-where", "vk-filter-joined", "vk-filter-join", "vk-filter-field", "vk-filter-how", "vk-filter-value", "vk-filter-rule-more", "vk-filter-rule-action", "vk-filter-group", "vk-filter-group-head", "vk-filter-quantifier", "vk-filter-group-more", "vk-filter-group-action", "vk-filter-delete", "vk-filter-add", "vk-filter-clear", "vk-filter-foot", "vk-filter-none", "vk-filter-excluded", "vk-filter-head",
|
|
282
|
+
"vk-filter-part-value", "vk-filter-part-pair"],
|
|
276
283
|
group: ["vk-group", "vk-group-setting", "vk-group-choice", "vk-group-heading", "vk-group-value", "vk-group-hide-all", "vk-group-remove"],
|
|
277
|
-
customize: ["vk-customize", "vk-customize-head", "vk-customize-title", "vk-customize-back", "vk-customize-close", "vk-customize-layout-button", "vk-customize-name", "vk-customize-heading", "vk-customize-section", "vk-customize-field", "vk-customize-toggle", "vk-customize-
|
|
284
|
+
customize: ["vk-customize", "vk-customize-head", "vk-customize-title", "vk-customize-back", "vk-customize-close", "vk-customize-layout-button", "vk-customize-name", "vk-customize-heading", "vk-customize-section", "vk-customize-field", "vk-customize-toggle", "vk-customize-choice", "vk-customize-option", "vk-customize-layout", "vk-customize-column", "vk-customize-search", "vk-customize-columns-action", "vk-customize-foot", "vk-customize-changes", "vk-customize-action", "vk-customize-stale",
|
|
285
|
+
"vk-customize-none", "vk-customize-rows", "vk-customize-columns-foot"],
|
|
278
286
|
viewsList: ["vk-views-list", "vk-views-list-row", "vk-views-list-head"],
|
|
279
287
|
viewMenu: ["vk-view-menu", "vk-view-menu-row", "vk-view-menu-name", "vk-view-menu-layout", "vk-view-menu-columns", "vk-view-menu-act"],
|
|
280
|
-
quick: ["vk-quick", "vk-quick-field", "vk-quick-search", "vk-quick-value", "vk-quick-count", "vk-quick-clear", "vk-quick-none", "vk-quick-head"
|
|
288
|
+
quick: ["vk-quick", "vk-quick-field", "vk-quick-search", "vk-quick-value", "vk-quick-count", "vk-quick-clear", "vk-quick-none", "vk-quick-head",
|
|
289
|
+
"vk-quick-strip", "vk-quick-values"],
|
|
281
290
|
};
|
|
282
291
|
export const ATOM_SLOTS = [
|
|
283
292
|
"vk-row",
|
|
@@ -414,7 +423,6 @@ export const ATOM_SLOTS = [
|
|
|
414
423
|
"vk-customize-section",
|
|
415
424
|
"vk-customize-field",
|
|
416
425
|
"vk-customize-toggle",
|
|
417
|
-
"vk-customize-toggle-reset",
|
|
418
426
|
"vk-customize-choice",
|
|
419
427
|
"vk-customize-option",
|
|
420
428
|
"vk-customize-layout",
|
|
@@ -442,11 +450,38 @@ export const ATOM_SLOTS = [
|
|
|
442
450
|
"vk-quick-clear",
|
|
443
451
|
"vk-quick-none",
|
|
444
452
|
"vk-quick-head",
|
|
453
|
+
"vk-filter-part-value",
|
|
454
|
+
"vk-filter-part-pair",
|
|
455
|
+
"vk-customize-none",
|
|
456
|
+
"vk-customize-rows",
|
|
457
|
+
"vk-customize-columns-foot",
|
|
458
|
+
"vk-quick-strip",
|
|
459
|
+
"vk-quick-values",
|
|
460
|
+
];
|
|
461
|
+
export const BULK_BAR_SLOTS = [
|
|
462
|
+
"vk-bulk-bar",
|
|
463
|
+
"vk-bulk-count",
|
|
464
|
+
"vk-bulk-separator",
|
|
465
|
+
"vk-bulk-verb",
|
|
466
|
+
"vk-bulk-delete",
|
|
467
|
+
"vk-bulk-more",
|
|
468
|
+
"vk-bulk-clear",
|
|
469
|
+
"vk-bulk-actions",
|
|
470
|
+
"vk-bulk-menu",
|
|
471
|
+
"vk-bulk-menu-row",
|
|
472
|
+
"vk-bulk-group-menu",
|
|
473
|
+
"vk-bulk-group-row",
|
|
474
|
+
"vk-bulk-choice",
|
|
475
|
+
"vk-bulk-empty",
|
|
476
|
+
"vk-bulk-field",
|
|
477
|
+
"vk-bulk-field-sheet",
|
|
478
|
+
"vk-bulk-toasts",
|
|
445
479
|
];
|
|
446
480
|
export const SELECTION_SLOTS = [
|
|
447
481
|
"vk-selection-bar",
|
|
448
482
|
"vk-selection-pill",
|
|
449
483
|
"vk-selection-chip",
|
|
484
|
+
...BULK_BAR_SLOTS,
|
|
450
485
|
];
|
|
451
486
|
export const EDITOR_PART_SLOTS = {
|
|
452
487
|
shared: ["vk-editor-close", "vk-editor-save", "vk-editor-back", "vk-editor-cancel"],
|
|
@@ -466,6 +501,7 @@ export const EDITOR_PART_SLOTS = {
|
|
|
466
501
|
export const EDITOR_SLOTS = [
|
|
467
502
|
"vk-editor-panel",
|
|
468
503
|
"vk-editor-bar",
|
|
504
|
+
"vk-editor-title",
|
|
469
505
|
"vk-editor-refusal",
|
|
470
506
|
"vk-text-editor",
|
|
471
507
|
"vk-date-editor",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from "../../internal/cx.js";
|
|
3
|
-
import {
|
|
3
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
4
4
|
import { NOTICE_ICONS } from "../notice/notice.js";
|
|
5
5
|
const glyph = (paths) => _jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) });
|
|
6
6
|
export const ALERT_WORDS = { tryAgain: "Try again" };
|
|
7
7
|
const MARK = { primary: NOTICE_ICONS.information, information: NOTICE_ICONS.information, success: NOTICE_ICONS.success, warning: NOTICE_ICONS.warning, danger: NOTICE_ICONS.danger };
|
|
8
8
|
export function Alert({ title, line, action, kind = "primary", cancel = "Cancel", icon, onAnswer, state = "rest", failed, phone = false, shell = "panel", cancelRef, Title = "h2", Line = "p", words }) {
|
|
9
|
+
const { Button } = usePanelControls();
|
|
9
10
|
const working = state === "working", wrong = state === "failed", size = phone ? "lg" : undefined, says = wrong ? failed : line;
|
|
10
11
|
return (_jsxs("div", { className: "o-alert-body", "data-kind": kind, "data-screen": phone ? "phone" : "computer", "data-shell": shell, "data-kit": "alert", children: [_jsx("span", { className: "o-alert-mark", "aria-hidden": "true", children: icon ?? glyph(MARK[kind]) }), _jsx(Title, { className: "o-alert-title", children: title }), says != null && _jsx(Line, { className: cx("o-alert-line", wrong && "o-alert-wrong"), children: says }), _jsxs("div", { className: "o-alert-foot", children: [_jsx(Button, { ref: cancelRef, size: size, className: "o-alert-cancel", disabled: working, onClick: () => onAnswer(false), children: cancel }), _jsx(Button, { kind: kind, size: size, loading: working, onClick: () => onAnswer(true), children: wrong ? (words?.tryAgain ?? ALERT_WORDS.tryAgain) : action })] })] }));
|
|
11
12
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { AlertDialog as BaseAlert } from "@base-ui/react/alert-dialog";
|
|
4
4
|
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
5
5
|
import { Alert, ALERT_WORDS } from "../alert/alert.js";
|
|
6
6
|
import { Button } from "../button/button.js";
|
|
7
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
7
8
|
import { GlassButton } from "../glass-button/glass-button.js";
|
|
8
9
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
9
10
|
import { OutOfFieldRows } from "../../internal/field-rows.js";
|
|
@@ -14,7 +15,7 @@ export { confirm } from "./confirm.js";
|
|
|
14
15
|
const glyph = (paths) => _jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: paths.map((d) => _jsx("path", { d: d }, d)) });
|
|
15
16
|
const X = ["M18 6l-12 12", "M6 6l12 12"];
|
|
16
17
|
function Held({ phone, shell, disabled, onClose, close, children }) {
|
|
17
|
-
return (_jsxs("div", { className: "o-alert-held", "data-screen": phone ? "phone" : "computer", "data-shell": shell, "data-kit": "alert-dialog", children: [children, phone && (
|
|
18
|
+
return (_jsxs("div", { className: "o-alert-held", "data-screen": phone ? "phone" : "computer", "data-shell": shell, "data-kit": "alert-dialog", children: [children, phone && (_jsx("span", { className: "o-alert-x", children: _jsx(PanelHeadButton, { "aria-label": close, icon: glyph(X), disabled: disabled, onClick: onClose, own: _jsxs(_Fragment, { children: [_jsx(GlassButton, { "aria-label": close, className: "o-alert-x-glass", icon: glyph(X), disabled: disabled, onClick: onClose }), _jsx(Button, { kind: "quiet", shape: "icon", size: "sm", "aria-label": close, className: "o-alert-x-plain", icon: glyph(X), disabled: disabled, onClick: onClose })] }) }) }))] }));
|
|
18
19
|
}
|
|
19
20
|
const shellOf = (el) => (el?.closest("[data-alert-phone]")?.dataset.alertPhone === "sheet" ? "sheet" : "panel");
|
|
20
21
|
function useShell(frame) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The component itself, flagged as a picture that takes the Avatar's pixel sizes. */
|
|
2
|
+
export declare function markAvatar<C extends object>(component: C): C;
|
|
3
|
+
/** Whether a component is flagged as a picture that takes the Avatar's pixel sizes. */
|
|
4
|
+
export declare const isAvatarMark: (component: unknown) => boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const AVATAR_MARK = Symbol.for("viewkitjs.views.avatar-mark");
|
|
2
|
+
export function markAvatar(component) {
|
|
3
|
+
return Object.defineProperty(component, AVATAR_MARK, { value: true, enumerable: false });
|
|
4
|
+
}
|
|
5
|
+
export const isAvatarMark = (component) => (typeof component === "function" || (typeof component === "object" && component !== null)) && component[AVATAR_MARK] === true;
|
|
@@ -24,12 +24,15 @@ export interface AvatarProps {
|
|
|
24
24
|
id?: string;
|
|
25
25
|
/** The tone itself, where the app keeps it. */
|
|
26
26
|
tone?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
27
|
-
/** A square's own colour (a team's letter,
|
|
28
|
-
*
|
|
27
|
+
/** A square's own colour (a team's letter, the workspace's initials on the colour picked for it): the square on the hue's
|
|
28
|
+
* fill, its letter in the hue's strong ink, with no edge. A person keeps their tone. With an `icon`, a person's or a thing's,
|
|
29
|
+
* it is the object's colour, which the frame's Ground and Icon colour may draw it in (looks.ts). */
|
|
29
30
|
colour?: AvatarColour;
|
|
30
|
-
/** A photo or a logo, filling the same shape. */
|
|
31
|
+
/** A photo or a logo, filling the same shape; it always wins. */
|
|
31
32
|
src?: string;
|
|
32
|
-
/**
|
|
33
|
+
/** Its object's icon (a deal's, a company's, a person's), drawn when there is no picture: on a person or a thing, by the
|
|
34
|
+
* frame's With no picture, Ground and Icon colour (looks.ts), Quiet grey and a grey ink with nothing set; the workspace's and
|
|
35
|
+
* an agent's own mark. */
|
|
33
36
|
icon?: React.ReactNode;
|
|
34
37
|
/** Whether a person is here now: here, a green dot; away, a hollow ring; offline, leave it out. Wins over a badge. */
|
|
35
38
|
presence?: AvatarPresence;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Avatar as BaseAvatar } from "@base-ui/react/avatar";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
@@ -8,6 +8,7 @@ import { Menu } from "../menu/menu.js";
|
|
|
8
8
|
import { optionColours } from "../option/looks.js";
|
|
9
9
|
import { Icon } from "../internal/icons.js";
|
|
10
10
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
|
+
import { markAvatar } from "./avatar-mark.js";
|
|
11
12
|
const SIZE = { 16: "o-avatar-2xs", 20: "o-avatar-xs", 24: "o-avatar-sm", 32: "", 40: "o-avatar-lg", 56: "o-avatar-56", 64: "o-avatar-xl", 96: "o-avatar-96" };
|
|
12
13
|
export function initials(name) {
|
|
13
14
|
const words = name.split(/\s+/).filter((w) => /^\p{L}/u.test(w));
|
|
@@ -26,14 +27,19 @@ export function toneOf(id) {
|
|
|
26
27
|
}
|
|
27
28
|
export function Avatar({ name, kind = "person", size = 32, id, tone, colour, src, icon, presence, badge, className }) {
|
|
28
29
|
const person = kind === "person";
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const record = icon != null && icon !== false && (person || kind === "thing");
|
|
31
|
+
const coloured = (!person || record) && colour && optionColours.includes(colour) ? colour : undefined;
|
|
32
|
+
const letters = kind === "thing" || kind === "agent" ? initials(name).slice(0, 1) : initials(name);
|
|
33
|
+
const fallback = record
|
|
34
|
+
? _jsxs(_Fragment, { children: [_jsx("span", { className: "o-avatar-icon", children: icon }), letters && _jsx("span", { className: "o-avatar-initials", children: letters })] })
|
|
35
|
+
: icon ?? letters;
|
|
36
|
+
const avatar = (_jsxs(BaseAvatar.Root, { role: "img", "aria-label": presence ? `${name}, ${presence}` : name, "data-kit": "avatar", "data-tone": person ? tone ?? toneOf(id ?? name) : undefined, "data-colour": coloured, className: cx("o-avatar", SIZE[size], !person && "o-avatar-thing o-smooth o-smooth-ease", kind === "workspace" && "o-avatar-workspace", kind === "agent" && "o-avatar-agent", className), children: [src && _jsx(BaseAvatar.Image, { className: "o-avatar-image", src: src, alt: "" }), _jsx(BaseAvatar.Fallback, { className: "o-avatar-letters", "aria-hidden": "true", children: fallback })] }));
|
|
32
37
|
if (size === 16 || (!presence && (badge == null || badge === false)))
|
|
33
38
|
return avatar;
|
|
34
39
|
return (_jsxs("span", { className: "o-avatar-badged", "data-size": size, "data-thing": person ? undefined : "", children: [avatar, presence ? _jsx("span", { className: "o-avatar-badge", "data-presence": presence, "aria-hidden": "true" })
|
|
35
40
|
: _jsx("span", { className: "o-avatar-badge", "data-badge": "", "aria-hidden": "true", children: badge === true ? null : badge })] }));
|
|
36
41
|
}
|
|
42
|
+
markAvatar(Avatar);
|
|
37
43
|
const ADD_SIZE = { 20: "20", 24: "2xs", 32: "sm", 40: "md", 64: "lg" };
|
|
38
44
|
export function AvatarStack({ people, max = 3, size = 24, className, label, onPick, onAdd, addButton }) {
|
|
39
45
|
const screen = React.useContext(PhoneHost), phone = usePhone() || !!screen;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PieceLooks } from "../../looks/looks.js";
|
|
2
|
-
export type AvatarLookOptionId = "corners" | "smoothing";
|
|
2
|
+
export type AvatarLookOptionId = "corners" | "smoothing" | "mark" | "ground" | "icon-colour";
|
|
3
3
|
/** The Avatar's options; it has no looks. */
|
|
4
4
|
export declare const AVATAR_LOOKS: PieceLooks<AvatarLookOptionId>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const options = [
|
|
2
2
|
{ id: "corners", name: "Corners", def: "medium", kind: "steps", values: [{ id: "small", name: "Small" }, { id: "medium", name: "Medium" }, { id: "large", name: "Large" }, { id: "xlarge", name: "Extra large" }] },
|
|
3
3
|
{ id: "smoothing", name: "Corner smoothing", def: "smooth", values: [{ id: "round", name: "Round" }, { id: "smooth", name: "Smooth" }] },
|
|
4
|
+
{ id: "mark", name: "With no picture", def: "icon", values: [{ id: "icon", name: "Icon" }, { id: "initials", name: "Initials" }] },
|
|
5
|
+
{ id: "ground", name: "Ground", def: "quiet", values: [{ id: "quiet", name: "Quiet grey" }, { id: "grey", name: "Grey" }, { id: "outline", name: "Outline" }, { id: "colour", name: "Object's colour" }] },
|
|
6
|
+
{ id: "icon-colour", name: "Icon colour", def: "grey", values: [{ id: "grey", name: "Grey" }, { id: "colour", name: "Object's colour" }] },
|
|
4
7
|
];
|
|
5
8
|
export const AVATAR_LOOKS = { id: "avatar", name: "Avatar", options, looks: [] };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface RecordMarkProps {
|
|
2
|
+
/** The record's name: ViewKit's Avatar's initials and accessible name, the atom's `label`. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** ViewKit's own shape for it: a person's round, a thing's square. */
|
|
5
|
+
shape: "person" | "thing";
|
|
6
|
+
/** A stable id, for a person's tone. */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** The picture ViewKit's own Avatar draws (a panel that drew none leaves it out). */
|
|
9
|
+
src?: string;
|
|
10
|
+
/** The picture the app's atom is handed; left out, `src`. */
|
|
11
|
+
picture?: string;
|
|
12
|
+
/** The record's kind as the app names it (`deal`, `company`, `user`), handed to the app's atom. */
|
|
13
|
+
kind?: string;
|
|
14
|
+
size: 16 | 20 | 24 | 32 | 40;
|
|
15
|
+
}
|
|
16
|
+
export declare const RecordMark: ({ label, shape, id, src, picture, kind, size }: RecordMarkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { PanelControlsContext } from "../internal/panel-controls.js";
|
|
5
|
+
import { markAvatar } from "./avatar-mark.js";
|
|
6
|
+
import { Avatar } from "./avatar.js";
|
|
7
|
+
export const RecordMark = markAvatar(function RecordMark({ label, shape, id, src, picture, kind, size }) {
|
|
8
|
+
const App = React.useContext(PanelControlsContext).Avatar;
|
|
9
|
+
const own = _jsx(Avatar, { name: label, kind: shape, id: id, src: src, size: size });
|
|
10
|
+
if (!App)
|
|
11
|
+
return own;
|
|
12
|
+
return _jsx(App, { label: label, avatarUrl: picture ?? src ?? null, kind: kind, size: size === 16 ? "chip" : size, fallback: own });
|
|
13
|
+
});
|
|
@@ -114,6 +114,18 @@ export declare const AVATAR_TOKENS: readonly [{
|
|
|
114
114
|
readonly name: "--vk-neutral";
|
|
115
115
|
readonly kind: "colour";
|
|
116
116
|
readonly outright: "--background-neutral";
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "--vk-neutral-hovered";
|
|
119
|
+
readonly kind: "colour";
|
|
120
|
+
readonly outright: "--background-neutral-hovered";
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "--vk-neutral-bold";
|
|
123
|
+
readonly kind: "colour";
|
|
124
|
+
readonly outright: "--gray-400";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "--vk-border-input";
|
|
127
|
+
readonly kind: "colour";
|
|
128
|
+
readonly outright: "--border-input";
|
|
117
129
|
}, {
|
|
118
130
|
readonly name: "--vk-person-1";
|
|
119
131
|
readonly kind: "colour";
|
|
@@ -28,6 +28,9 @@ export const AVATAR_TOKENS = [
|
|
|
28
28
|
{ name: "--vk-label-pink", kind: "colour", outright: "--label-pink" },
|
|
29
29
|
{ name: "--vk-label-teal", kind: "colour", outright: "--label-teal" },
|
|
30
30
|
{ name: "--vk-neutral", kind: "colour", outright: "--background-neutral" },
|
|
31
|
+
{ name: "--vk-neutral-hovered", kind: "colour", outright: "--background-neutral-hovered" },
|
|
32
|
+
{ name: "--vk-neutral-bold", kind: "colour", outright: "--gray-400" },
|
|
33
|
+
{ name: "--vk-border-input", kind: "colour", outright: "--border-input" },
|
|
31
34
|
{ name: "--vk-person-1", kind: "colour", outright: "--person-1" },
|
|
32
35
|
{ name: "--vk-person-2", kind: "colour", outright: "--person-2" },
|
|
33
36
|
{ name: "--vk-person-3", kind: "colour", outright: "--person-3" },
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/* The Avatar. Every value it draws with is a
|
|
2
2
|
token (control tokens); this file only says which token each kind and size takes. People are circles on
|
|
3
3
|
their own tone (data-tone, 1 to 6); things are squares on a quiet ground; the workspace is the brand; an agent is a thing's
|
|
4
|
-
square holding its own icon; a square handed its own colour (data-colour, a label hue) stands on that hue instead.
|
|
4
|
+
square holding its own icon; a square handed its own colour (data-colour, a label hue) stands on that hue instead. A person or a
|
|
5
|
+
thing handed its object's icon draws it, with no picture, by the last three. Its options, on the frame around it (looks.ts):
|
|
5
6
|
|
|
6
|
-
data-avatar-corners small · medium · large · xlarge a radius token per size; nothing set is Medium
|
|
7
|
+
data-avatar-corners small · medium · large · xlarge a square's radius token per size; nothing set is Medium
|
|
7
8
|
data-avatar-smoothing round · smooth how a square's corners bend; nothing set is Smooth
|
|
9
|
+
data-avatar-mark icon · initials the object's icon, or its letters on today's look; nothing set is Icon
|
|
10
|
+
data-avatar-ground quiet · grey · outline · colour under the icon; nothing set is Quiet grey
|
|
11
|
+
data-avatar-icon-colour grey · colour the icon's ink; nothing set is Grey
|
|
8
12
|
|
|
9
13
|
The rules sit in the components layer, so a utility class on an avatar still wins. */
|
|
10
14
|
@layer components {
|
|
@@ -37,12 +41,12 @@
|
|
|
37
41
|
.o-avatar.o-avatar-96 { width: calc(var(--vk-spacing) * 24); height: calc(var(--vk-spacing) * 24); font-size: var(--vk-font-size-4xl); }
|
|
38
42
|
|
|
39
43
|
/* ── A thing: a square, its corners a step that grows with it, on the neutral ground, its edge inside ─ */
|
|
40
|
-
.o-avatar.o-avatar-thing { border-radius: var(--avatar-r); background-color: var(--vk-neutral); color: var(--vk-fg-subtle); box-shadow: inset 0 0 0 var(--vk-border-width) var(--
|
|
44
|
+
.o-avatar.o-avatar-thing { --avatar-edge: var(--vk-border-subtle); border-radius: var(--avatar-r); background-color: var(--vk-neutral); color: var(--vk-fg-subtle); box-shadow: inset 0 0 0 var(--vk-border-width) var(--avatar-edge); }
|
|
41
45
|
/* The workspace: the one square in the brand. */
|
|
42
|
-
.o-avatar.o-avatar-workspace { background-color: var(--vk-brand); color: var(--vk-fg-on-brand);
|
|
46
|
+
.o-avatar.o-avatar-workspace { --avatar-edge: transparent; background-color: var(--vk-brand); color: var(--vk-fg-on-brand); }
|
|
43
47
|
/* A square's own colour, the workspace's included: on the hue's fill, what it holds in the hue's strong ink, with no edge; grey
|
|
44
48
|
the neutral ground in the quieter ink. */
|
|
45
|
-
.o-avatar.o-avatar-thing[data-colour] {
|
|
49
|
+
.o-avatar.o-avatar-thing[data-colour] { --avatar-edge: transparent; }
|
|
46
50
|
.o-avatar.o-avatar-thing[data-colour="blue"] { background-color: var(--vk-label-blue-fill); color: var(--vk-label-blue-strong); }
|
|
47
51
|
.o-avatar.o-avatar-thing[data-colour="green"] { background-color: var(--vk-label-green-fill); color: var(--vk-label-green-strong); }
|
|
48
52
|
.o-avatar.o-avatar-thing[data-colour="amber"] { background-color: var(--vk-label-amber-fill); color: var(--vk-label-amber-strong); }
|
|
@@ -67,10 +71,43 @@
|
|
|
67
71
|
.o-avatar.o-avatar-agent[data-colour="teal"]:where([data-vk-phone] *) { background-color: var(--vk-label-teal); }
|
|
68
72
|
.o-avatar.o-avatar-agent[data-colour="grey"]:where([data-vk-phone] *) { background-color: var(--vk-fg-subtlest); }
|
|
69
73
|
|
|
70
|
-
/* ──
|
|
71
|
-
|
|
74
|
+
/* ── A record's mark, a person's or a thing's, when the app hands its object's icon (VK-1039, after Attio): with no picture
|
|
75
|
+
(the fallback holds the icon only while no photo or logo has loaded, so a src always wins) the icon, or under Initials its
|
|
76
|
+
letters on today's look. The icon stands on its Ground in its Icon colour, through the private properties below; a person
|
|
77
|
+
keeps its circle. The grey ink follows the ground, as the sketch drew it: the quietest on Quiet grey, the subtle one on the
|
|
78
|
+
rest. The object's colour is the hue handed (data-colour), its fill under the icon, its strong ink on it; handed none, the greys. */
|
|
79
|
+
.o-avatar-letters > :is(.o-avatar-icon, .o-avatar-initials) { display: contents; }
|
|
80
|
+
.o-avatar-letters > .o-avatar-initials { display: none; }
|
|
81
|
+
[data-avatar-mark="initials"] .o-avatar-letters > .o-avatar-initials { display: contents; }
|
|
82
|
+
[data-avatar-mark="initials"] .o-avatar-letters > .o-avatar-icon:has(+ .o-avatar-initials) { display: none; }
|
|
83
|
+
.o-avatar[data-colour="blue"] { --avatar-hue-fill: var(--vk-label-blue-fill); --avatar-hue-ink: var(--vk-label-blue-strong); }
|
|
84
|
+
.o-avatar[data-colour="green"] { --avatar-hue-fill: var(--vk-label-green-fill); --avatar-hue-ink: var(--vk-label-green-strong); }
|
|
85
|
+
.o-avatar[data-colour="amber"] { --avatar-hue-fill: var(--vk-label-amber-fill); --avatar-hue-ink: var(--vk-label-amber-strong); }
|
|
86
|
+
.o-avatar[data-colour="red"] { --avatar-hue-fill: var(--vk-label-red-fill); --avatar-hue-ink: var(--vk-label-red-strong); }
|
|
87
|
+
.o-avatar[data-colour="purple"] { --avatar-hue-fill: var(--vk-label-purple-fill); --avatar-hue-ink: var(--vk-label-purple-strong); }
|
|
88
|
+
.o-avatar[data-colour="pink"] { --avatar-hue-fill: var(--vk-label-pink-fill); --avatar-hue-ink: var(--vk-label-pink-strong); }
|
|
89
|
+
.o-avatar[data-colour="teal"] { --avatar-hue-fill: var(--vk-label-teal-fill); --avatar-hue-ink: var(--vk-label-teal-strong); }
|
|
90
|
+
.o-avatar[data-colour="grey"] { --avatar-hue-fill: var(--vk-neutral-hovered); --avatar-hue-ink: var(--vk-fg-subtle); }
|
|
91
|
+
/* Quiet grey, with nothing set: a step above background-neutral, so it shows on a drawer in dark; no edge. A person's circle
|
|
92
|
+
draws its edge inside, as a square's does without Smooth (a square's own rules draw its edge, the ring under Smooth too). */
|
|
93
|
+
.o-avatar:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) {
|
|
94
|
+
--avatar-ground: var(--vk-neutral-hovered); --avatar-grey-ink: var(--vk-fg-subtlest); --avatar-edge: transparent;
|
|
95
|
+
background-color: var(--avatar-ground); color: var(--avatar-ink, var(--avatar-grey-ink));
|
|
96
|
+
}
|
|
97
|
+
.o-avatar:not(.o-avatar-thing):has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { box-shadow: inset 0 0 0 var(--vk-border-width) var(--avatar-edge); }
|
|
98
|
+
/* Grey: two steps above. */
|
|
99
|
+
[data-avatar-ground="grey"] .o-avatar:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ground: var(--vk-neutral-bold); --avatar-grey-ink: var(--vk-fg-subtle); }
|
|
100
|
+
/* Outline: no ground, its edge a field's. */
|
|
101
|
+
[data-avatar-ground="outline"] .o-avatar:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ground: transparent; --avatar-grey-ink: var(--vk-fg-subtle); --avatar-edge: var(--vk-border-input); }
|
|
102
|
+
/* The object's colour: its hue's fill. */
|
|
103
|
+
[data-avatar-ground="colour"] .o-avatar[data-colour]:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ground: var(--avatar-hue-fill); --avatar-grey-ink: var(--vk-fg-subtle); }
|
|
104
|
+
/* Icon colour, the object's: its hue's strong ink. */
|
|
105
|
+
[data-avatar-icon-colour="colour"] .o-avatar[data-colour]:has(> .o-avatar-letters > .o-avatar-icon):not([data-avatar-mark="initials"] *) { --avatar-ink: var(--avatar-hue-ink); }
|
|
106
|
+
|
|
107
|
+
/* ── Corners: a radius token per size, in steps, 56 taking 64's and 16 taking 20's; Medium with nothing set: sm at 16, 20, 24 and 32,
|
|
108
|
+
md at 40, lg at 56 and 64, 2xl at 96 (two steps past 64's, as round 3's photo draws it), between Small and Large. At 16 and 20
|
|
109
|
+
each step sits one past 24's (VK-1045): Small xs, Medium sm, Large md, Extra large lg, so Medium is no longer Small there. ── */
|
|
72
110
|
.o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-sm); }
|
|
73
|
-
.o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs) { --avatar-r: var(--vk-radius-xs); }
|
|
74
111
|
.o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-md); }
|
|
75
112
|
.o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-lg); }
|
|
76
113
|
.o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-2xl); }
|
|
@@ -79,15 +116,15 @@
|
|
|
79
116
|
[data-avatar-corners="small"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-xs); }
|
|
80
117
|
[data-avatar-corners="small"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-md); }
|
|
81
118
|
[data-avatar-corners="small"] .o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-xl); }
|
|
82
|
-
/* Large, the radii before Medium came:
|
|
119
|
+
/* Large, the radii before Medium came (but 16 and 20's, VK-1045): md at 16 and 20, sm at 24, md at 32, lg at 40, xl at 56 and 64, 3xl at 96. */
|
|
83
120
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-md); }
|
|
84
|
-
[data-avatar-corners="large"] .o-avatar.o-avatar-thing
|
|
121
|
+
[data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-sm { --avatar-r: var(--vk-radius-sm); }
|
|
85
122
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-lg); }
|
|
86
123
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-xl); }
|
|
87
124
|
[data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-3xl); }
|
|
88
|
-
/* Extra large:
|
|
125
|
+
/* Extra large: lg at 16 and 20 (VK-1045), md at 24, lg at 32, xl at 40, 2xl at 56 and 64, 4xl at 96. */
|
|
89
126
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-lg); }
|
|
90
|
-
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing
|
|
127
|
+
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-sm { --avatar-r: var(--vk-radius-md); }
|
|
91
128
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-xl); }
|
|
92
129
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing:is(.o-avatar-56, .o-avatar-xl) { --avatar-r: var(--vk-radius-2xl); }
|
|
93
130
|
[data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-96 { --avatar-r: var(--vk-radius-4xl); }
|
|
@@ -97,7 +134,7 @@
|
|
|
97
134
|
smoothing eases off where a side is too short for 1.7 radii at each end, as the canvas drew it (o-smooth-ease, from its size and
|
|
98
135
|
its radius, both tokens, so it follows Corner radius). The outline would cut the edge drawn inside the square, so under it the
|
|
99
136
|
edge is a ring of its own (::before), between the outline and the same outline drawn a hairline in, under whatever the square
|
|
100
|
-
holds
|
|
137
|
+
holds, in --avatar-edge: the workspace and a square on its own colour draw it in none, a record's icon by its Ground. Its smoothing is its own Corner smoothing, never a host's: the outline's amount inherits, and a
|
|
101
138
|
crumb, a tab or a list's card that follows the token sets it on itself, so the square sets it back. ─────── */
|
|
102
139
|
@supports (clip-path: shape(evenodd from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close, move to 0 0, hline to 1px, close)) and (width: calc(tan(atan2(1px, 1px)) * 1px)) {
|
|
103
140
|
.o-avatar.o-avatar-thing { --smooth-amount: initial; }
|
|
@@ -105,11 +142,11 @@
|
|
|
105
142
|
--avatar-rr: min(var(--avatar-r), var(--avatar-size) / 2); --smooth-t: var(--avatar-rr); --smooth-side: var(--avatar-size);
|
|
106
143
|
position: relative; box-shadow: none; clip-path: shape(var(--smooth-outline));
|
|
107
144
|
}
|
|
108
|
-
/* Its edge, a hairline ring along the outline, under the picture or the letters it holds
|
|
109
|
-
own colour
|
|
110
|
-
.o-avatar.o-avatar-thing:not(
|
|
145
|
+
/* Its edge, a hairline ring along the outline, under the picture or the letters it holds, in --avatar-edge: the workspace and a
|
|
146
|
+
square on its own colour draw it in none. */
|
|
147
|
+
.o-avatar.o-avatar-thing:not([data-avatar-smoothing="round"] *)::before {
|
|
111
148
|
--smooth-t: calc(var(--avatar-rr) - var(--vk-border-width)); --smooth-in: var(--vk-border-width);
|
|
112
|
-
content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-color: var(--
|
|
149
|
+
content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-color: var(--avatar-edge);
|
|
113
150
|
clip-path: shape(var(--smooth-ring));
|
|
114
151
|
}
|
|
115
152
|
}
|
|
@@ -3,16 +3,14 @@ import * as React from "react";
|
|
|
3
3
|
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
4
4
|
import { cx as cn } from "../../internal/cx.js";
|
|
5
5
|
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
6
|
-
import {
|
|
7
|
-
import { Button } from "../button/button.js";
|
|
8
|
-
import { Menu } from "../menu/menu.js";
|
|
6
|
+
import { RecordMark } from "../avatar/record-mark.js";
|
|
9
7
|
import { Picker, usePicker } from "../picker/picker.js";
|
|
10
|
-
import { Popover } from "../popover/popover.js";
|
|
11
8
|
import { Sheet, SheetBody, SheetHead } from "../sheet/bottom-sheet.js";
|
|
12
9
|
import { StatusGlyph } from "../status/status.js";
|
|
13
10
|
import { Toast, createToastManager } from "../toast/toast.js";
|
|
14
11
|
import { ToolbarControl, ToolbarSeparatorControl } from "../toolbar/toolbar.js";
|
|
15
12
|
import { Icon } from "../internal/icons.js";
|
|
13
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
16
14
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
17
15
|
import { spacingPx } from "../internal/read-token.js";
|
|
18
16
|
import { fitOnBar, moreRows, wordsOf } from "./bulk-bar-of.js";
|
|
@@ -36,7 +34,7 @@ function markOf(as, label) {
|
|
|
36
34
|
if (!as)
|
|
37
35
|
return undefined;
|
|
38
36
|
if ("avatar" in as)
|
|
39
|
-
return _jsx(
|
|
37
|
+
return _jsx(RecordMark, { label: label, shape: as.avatar === "company" ? "thing" : "person", id: as.id, src: as.src, kind: as.kind, size: 20 });
|
|
40
38
|
if ("status" in as)
|
|
41
39
|
return _jsx(StatusGlyph, { place: as.status, quarters: as.quarters });
|
|
42
40
|
if ("mark" in as)
|
|
@@ -46,6 +44,7 @@ function markOf(as, label) {
|
|
|
46
44
|
const EMPTY = "\u0000empty", DIFFER = "\u0000differ";
|
|
47
45
|
export function BulkBar({ count, noun: given, onClear, verbs, onDelete, deleteLine, deleteLabel, busy = false, form, standing = false, className, words: said }) {
|
|
48
46
|
const w = React.useMemo(() => bulkBarWords(said), [said]);
|
|
47
|
+
const { Button, Menu, Popover } = usePanelControls();
|
|
49
48
|
const noun = given ?? w.noun;
|
|
50
49
|
const host = React.useContext(PhoneHost), narrow = usePhone();
|
|
51
50
|
const phone = form ? form === "phone" : host != null || narrow;
|
|
@@ -189,23 +188,25 @@ export function BulkBar({ count, noun: given, onClear, verbs, onDelete, deleteLi
|
|
|
189
188
|
hadFocus.current = false;
|
|
190
189
|
return giveBack();
|
|
191
190
|
}, [shown, root, giveBack]);
|
|
192
|
-
const itemEntry = (i) => ({ icon: i.icon ?? null, label: i.label, danger: i.destructive, disabled: i.disabled ? i.disabledReason ?? w.cantUse : undefined,
|
|
193
|
-
onSelect: () => { void after(i.onClick); } });
|
|
191
|
+
const itemEntry = (i, slot) => ({ icon: i.icon ?? null, label: i.label, danger: i.destructive, disabled: i.disabled ? i.disabledReason ?? w.cantUse : undefined,
|
|
192
|
+
onSelect: () => { void after(i.onClick); }, slot });
|
|
193
|
+
const groupRow = (at) => ({ slot: "vk-bulk-group-row", key: String(at) });
|
|
194
194
|
const entryOf = (v) => {
|
|
195
|
+
const slot = { slot: "vk-bulk-menu-row", key: String(verbs.indexOf(v)) };
|
|
195
196
|
if (v.disabled)
|
|
196
|
-
return { icon: v.icon ?? null, label: v.label, disabled: v.disabledReason ?? w.cantUse };
|
|
197
|
+
return { icon: v.icon ?? null, label: v.label, disabled: v.disabledReason ?? w.cantUse, slot };
|
|
197
198
|
if (v.kind === "action")
|
|
198
|
-
return itemEntry(v);
|
|
199
|
+
return itemEntry(v, slot);
|
|
199
200
|
if (v.kind === "group")
|
|
200
|
-
return { kind: "actions", icon: v.icon ?? null, label: v.label,
|
|
201
|
-
entries: v.items.map((i) => itemEntry(i.disabledReason == null && v.disabledReason ? { ...i, disabledReason: v.disabledReason } : i)) };
|
|
202
|
-
const choices = [...(v.empty ? [{ value: EMPTY, label: v.empty }] : []),
|
|
203
|
-
...v.options.map((o) => ({ value: o.value, label: o.label, mark: markOf(o.as, o.label) }))];
|
|
204
|
-
return { kind: "choices", icon: v.icon ?? null, label: v.label, value: v.value === undefined ? DIFFER : v.value === null ? EMPTY : v.value, choices,
|
|
201
|
+
return { kind: "actions", icon: v.icon ?? null, label: v.label, slot,
|
|
202
|
+
entries: v.items.map((i, at) => itemEntry(i.disabledReason == null && v.disabledReason ? { ...i, disabledReason: v.disabledReason } : i, groupRow(at))) };
|
|
203
|
+
const choices = [...(v.empty ? [{ value: EMPTY, label: v.empty, slot: { slot: "vk-bulk-empty" } }] : []),
|
|
204
|
+
...v.options.map((o) => ({ value: o.value, label: o.label, mark: markOf(o.as, o.label), slot: { slot: "vk-bulk-choice", key: o.value } }))];
|
|
205
|
+
return { kind: "choices", icon: v.icon ?? null, label: v.label, value: v.value === undefined ? DIFFER : v.value === null ? EMPTY : v.value, choices, slot,
|
|
205
206
|
onChoose: (value) => { void after(() => v.onSelect(value === EMPTY ? null : value)); } };
|
|
206
207
|
};
|
|
207
208
|
const trash = _jsx(Icon, { name: "trash" });
|
|
208
|
-
const delEntry = { icon: trash, label: words.del, danger: true, onSelect: ask };
|
|
209
|
+
const delEntry = { icon: trash, label: words.del, danger: true, onSelect: ask, slot: { slot: "vk-bulk-menu-row", key: "delete" } };
|
|
209
210
|
const separator = { kind: "separator" };
|
|
210
211
|
const press = (v, i) => (e) => {
|
|
211
212
|
if (v.kind === "action") {
|
|
@@ -217,21 +218,22 @@ export function BulkBar({ count, noun: given, onClear, verbs, onDelete, deleteLi
|
|
|
217
218
|
};
|
|
218
219
|
const expanded = (v, i) => (v.kind === "action" ? {} : { "aria-haspopup": (v.kind === "group" ? "menu" : "dialog"), "aria-expanded": opened?.what === i });
|
|
219
220
|
const index = (v) => verbs.indexOf(v);
|
|
221
|
+
const verbName = (v) => ({ "data-slot": "vk-bulk-verb", "data-key": String(index(v)) });
|
|
220
222
|
const toolbarItems = [];
|
|
221
223
|
const measured = [];
|
|
222
|
-
const outline = (v, size, key, extra) => (_jsx(Button, { kind: "outline", size: size, icon: v.icon, disabled: busy || v.disabled, onClick: press(v, index(v)), ...expanded(v, index(v)), ...extra, children: v.label }, key));
|
|
224
|
+
const outline = (v, size, key, extra) => (_jsx(Button, { kind: "outline", size: size, icon: v.icon, disabled: busy || v.disabled, onClick: press(v, index(v)), ...expanded(v, index(v)), ...verbName(v), ...extra, children: v.label }, key));
|
|
223
225
|
if (shape === "computer") {
|
|
224
226
|
const moreShown = kept.length > 0 || folded > 0 || delInMore;
|
|
225
|
-
toolbarItems.push(_jsxs(BaseToolbar.Button, { className: "o-bulk-bar-count", "aria-label": w.clear, disabled: busy, onClick: onClear, children: [_jsx("span", { className: "o-bulk-bar-number", children: last.current }), w.count, _jsx(Icon, { name: "x", size: 14 })] }, "count"), _jsx(ToolbarSeparatorControl, {}, "sep"), ...fits.map((v) => outline(v, "sm", `v-${index(v)}`)), ...(delOwn ? [_jsx(Button, { kind: "danger", shape: "icon", size: "sm", "aria-label": words.del, icon: trash, disabled: busy, onClick: ask }, "del")] : []), ...(moreShown ? [_jsx(Button, { kind: "outline", size: "sm", iconEnd: up, disabled: busy, "aria-haspopup": "menu", "aria-expanded": opened?.what === "more", onClick: open("more"), children: w.more }, "more")] : []));
|
|
226
|
-
measured.push(_jsxs("span", { "data-m": "count", className: "o-bulk-bar-count", children: [_jsx("span", { className: "o-bulk-bar-number", children: last.current }), w.count, _jsx(Icon, { name: "x", size: 14 })] }, "count"), _jsx("span", { "data-m": "sep", children: _jsx(ToolbarSeparatorControl, {}) }, "sep"), ...onBar.map((v) => _jsx(Button, { "data-m": "verb", kind: "outline", size: "sm", icon: v.icon, tabIndex: -1, children: v.label }, `v-${index(v)}`)), ...(delOwn ? [_jsx(Button, { "data-m": "del", kind: "danger", shape: "icon", size: "sm", "aria-label": words.del, icon: trash, tabIndex: -1 }, "del")] : []), _jsx(Button, { "data-m": "more", kind: "outline", size: "sm", iconEnd: up, tabIndex: -1, children: w.more }, "more"));
|
|
227
|
+
toolbarItems.push(_jsxs(BaseToolbar.Button, { className: "o-bulk-bar-count", "data-slot": "vk-bulk-count", "aria-label": w.clear, disabled: busy, onClick: onClear, children: [_jsx("span", { className: "o-bulk-bar-number", children: last.current }), w.count, _jsx(Icon, { name: "x", size: 14 })] }, "count"), _jsx(ToolbarSeparatorControl, { "data-slot": "vk-bulk-separator" }, "sep"), ...fits.map((v) => outline(v, "sm", `v-${index(v)}`)), ...(delOwn ? [_jsx(Button, { "data-slot": "vk-bulk-delete", kind: "danger", shape: "icon", size: "sm", "aria-label": words.del, icon: trash, disabled: busy, onClick: ask }, "del")] : []), ...(moreShown ? [_jsx(Button, { "data-slot": "vk-bulk-more", kind: "outline", size: "sm", iconEnd: up, disabled: busy, "aria-haspopup": "menu", "aria-expanded": opened?.what === "more", onClick: open("more"), children: w.more }, "more")] : []));
|
|
228
|
+
measured.push(_jsxs("span", { "data-m": "count", "data-slot": "vk-bulk-count", className: "o-bulk-bar-count", children: [_jsx("span", { className: "o-bulk-bar-number", children: last.current }), w.count, _jsx(Icon, { name: "x", size: 14 })] }, "count"), _jsx("span", { "data-m": "sep", children: _jsx(ToolbarSeparatorControl, { "data-slot": "vk-bulk-separator" }) }, "sep"), ...onBar.map((v) => _jsx(Button, { "data-m": "verb", ...verbName(v), kind: "outline", size: "sm", icon: v.icon, tabIndex: -1, children: v.label }, `v-${index(v)}`)), ...(delOwn ? [_jsx(Button, { "data-m": "del", "data-slot": "vk-bulk-delete", kind: "danger", shape: "icon", size: "sm", "aria-label": words.del, icon: trash, tabIndex: -1 }, "del")] : []), _jsx(Button, { "data-m": "more", "data-slot": "vk-bulk-more", kind: "outline", size: "sm", iconEnd: up, tabIndex: -1, children: w.more }, "more"));
|
|
227
229
|
}
|
|
228
230
|
else if (shape === "tray") {
|
|
229
231
|
const moreShown = kept.length > 0 || folded > 0;
|
|
230
|
-
toolbarItems.push(...fits.map((v) => outline(v, "44", `v-${index(v)}`)), ...(onDelete ? [_jsx(Button, { kind: "outline", size: "44", icon: trash, disabled: busy, onClick: ask, children: w.delete }, "del")] : []), ...(moreShown ? [_jsx(Button, { kind: "outline", size: "44", shape: "icon", "aria-label": w.more, icon: _jsx(Icon, { name: "dots" }), disabled: busy, "aria-haspopup": "menu", "aria-expanded": opened?.what === "more", onClick: open("more") }, "more")] : []));
|
|
231
|
-
measured.push(...onBar.map((v) => _jsx(Button, { "data-m": "verb", kind: "outline", size: "44", icon: v.icon, tabIndex: -1, children: v.label }, `v-${index(v)}`)), ...(onDelete ? [_jsx(Button, { "data-m": "del", kind: "outline", size: "44", icon: trash, tabIndex: -1, children: w.delete }, "del")] : []), _jsx(Button, { "data-m": "more", kind: "outline", size: "44", shape: "icon", "aria-label": w.more, icon: _jsx(Icon, { name: "dots" }), tabIndex: -1 }, "more"));
|
|
232
|
+
toolbarItems.push(...fits.map((v) => outline(v, "44", `v-${index(v)}`)), ...(onDelete ? [_jsx(Button, { "data-slot": "vk-bulk-delete", kind: "outline", size: "44", icon: trash, disabled: busy, onClick: ask, children: w.delete }, "del")] : []), ...(moreShown ? [_jsx(Button, { "data-slot": "vk-bulk-more", kind: "outline", size: "44", shape: "icon", "aria-label": w.more, icon: _jsx(Icon, { name: "dots" }), disabled: busy, "aria-haspopup": "menu", "aria-expanded": opened?.what === "more", onClick: open("more") }, "more")] : []));
|
|
233
|
+
measured.push(...onBar.map((v) => _jsx(Button, { "data-m": "verb", ...verbName(v), kind: "outline", size: "44", icon: v.icon, tabIndex: -1, children: v.label }, `v-${index(v)}`)), ...(onDelete ? [_jsx(Button, { "data-m": "del", "data-slot": "vk-bulk-delete", kind: "outline", size: "44", icon: trash, tabIndex: -1, children: w.delete }, "del")] : []), _jsx(Button, { "data-m": "more", "data-slot": "vk-bulk-more", kind: "outline", size: "44", shape: "icon", "aria-label": w.more, icon: _jsx(Icon, { name: "dots" }), tabIndex: -1 }, "more"));
|
|
232
234
|
}
|
|
233
235
|
else {
|
|
234
|
-
toolbarItems.push(_jsxs("span", { className: "o-bulk-bar-words", children: [_jsx("b", { className: "o-bulk-bar-number", children: last.current }), ` ${w.pill}`] }, "count"), _jsx(Button, { kind: "quiet", shape: "icon", size: "44", "aria-label": w.clear, icon: _jsx(Icon, { name: "x", size: 18 }), disabled: busy, onClick: onClear }, "clear"), _jsx(ToolbarSeparatorControl, {}, "sep"), _jsx(Button, { kind: "quiet", size: "44", iconEnd: up, disabled: busy, "aria-haspopup": "menu", "aria-expanded": opened?.what === "more", onClick: open("more"), children: w.actions }, "actions"));
|
|
236
|
+
toolbarItems.push(_jsxs("span", { className: "o-bulk-bar-words", "data-slot": "vk-bulk-count", children: [_jsx("b", { className: "o-bulk-bar-number", children: last.current }), ` ${w.pill}`] }, "count"), _jsx(Button, { "data-slot": "vk-bulk-clear", kind: "quiet", shape: "icon", size: "44", "aria-label": w.clear, icon: _jsx(Icon, { name: "x", size: 18 }), disabled: busy, onClick: onClear }, "clear"), _jsx(ToolbarSeparatorControl, { "data-slot": "vk-bulk-separator" }, "sep"), _jsx(Button, { "data-slot": "vk-bulk-actions", kind: "quiet", size: "44", iconEnd: up, disabled: busy, "aria-haspopup": "menu", "aria-expanded": opened?.what === "more", onClick: open("more"), children: w.actions }, "actions"));
|
|
235
237
|
}
|
|
236
238
|
const now = opened == null ? null : opened.what === "more" ? "more" : verbs[opened.what];
|
|
237
239
|
const menuLabel = `${words.many}: ${now === "more" ? (shape === "pill" ? w.actions : w.more) : now?.label ?? ""}`;
|
|
@@ -240,12 +242,12 @@ export function BulkBar({ count, noun: given, onClear, verbs, onDelete, deleteLi
|
|
|
240
242
|
: moreRows(onBar, kept, fitted, entryOf, delInMore ? delEntry : null, separator);
|
|
241
243
|
let popup = null;
|
|
242
244
|
if (opened && now === "more") {
|
|
243
|
-
popup = _jsx(Menu, { label: menuLabel, words: w.menu, anchor: opened.at, open: true, standing: standing, side: "top", align: "end", onOpenChange: (o, d) => { if (!o)
|
|
245
|
+
popup = _jsx(Menu, { "data-slot": "vk-bulk-menu", label: menuLabel, words: w.menu, anchor: opened.at, open: true, standing: standing, side: "top", align: "end", onOpenChange: (o, d) => { if (!o)
|
|
244
246
|
close(d.reason); }, entries: moreEntries }, "more");
|
|
245
247
|
}
|
|
246
248
|
else if (opened && now && now !== "more" && now.kind === "group") {
|
|
247
|
-
popup = _jsx(Menu, { label: menuLabel, words: w.menu, anchor: opened.at, open: true, standing: standing, side: "top", align: "start", onOpenChange: (o, d) => { if (!o)
|
|
248
|
-
close(d.reason); }, entries: now.items.map(itemEntry) }, `g-${opened.what}`);
|
|
249
|
+
popup = _jsx(Menu, { "data-slot": "vk-bulk-group-menu", label: menuLabel, words: w.menu, anchor: opened.at, open: true, standing: standing, side: "top", align: "start", onOpenChange: (o, d) => { if (!o)
|
|
250
|
+
close(d.reason); }, entries: now.items.map((i, at) => itemEntry(i, groupRow(at))) }, `g-${opened.what}`);
|
|
249
251
|
}
|
|
250
252
|
else if (opened && now && now !== "more" && now.kind === "options") {
|
|
251
253
|
const v = now;
|
|
@@ -253,10 +255,10 @@ export function BulkBar({ count, noun: given, onClear, verbs, onDelete, deleteLi
|
|
|
253
255
|
const pick = (value) => { setOpened(null); set(value); };
|
|
254
256
|
popup = phone
|
|
255
257
|
? _jsx(FieldSheet, { verb: v, many: words.many, words: w, onPick: set, onClose: () => setOpened(null), container: host ?? undefined, standing: standing || !!host }, `f-${opened.what}`)
|
|
256
|
-
: (_jsx(Popover, { open: true, anchor: opened.at, side: "top", align: "start", ...(standing ? { initialFocus: false } : {}), sideOffset: spacingPx(1, opened.at), "aria-label": v.label, onOpenChange: (o, d) => { if (!o)
|
|
258
|
+
: (_jsx(Popover, { open: true, anchor: opened.at, side: "top", align: "start", ...(standing ? { initialFocus: false } : {}), sideOffset: spacingPx(1, opened.at), "aria-label": v.label, popupData: { "data-slot": "vk-bulk-field" }, onOpenChange: (o, d) => { if (!o)
|
|
257
259
|
close(d.reason); }, style: { width: "fit-content", minWidth: "calc(var(--vk-spacing) * 48)" }, children: _jsx(Picker, { label: v.label, items: v.options, value: v.value ?? null, empty: v.empty, search: v.search, searchShown: !!v.search, form: "computer", ...(w.picker ? { words: w.picker } : {}), onValueChange: pick, onDone: () => setOpened(null) }) }, `f-${opened.what}`));
|
|
258
260
|
}
|
|
259
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: setRoot, className: cn("o-bulk-bar", className), "data-kit": "bulk-bar", "data-form": shape, "data-shown": shown ? "" : undefined, inert: !shown, children: [_jsx(ToolbarControl, { label: words.selected, size: "32", spacing: shape === "pill" ? 1 : shape === "tray" ? 2 : 1.5, fold: false, form: phone ? "phone" : "computer", children: toolbarItems }), measured.length > 0 && _jsx("div", { className: "o-bulk-bar-measure", "aria-hidden": "true", inert: true, children: _jsx("div", { ref: setMeasure, children: measured }) })] }), _jsx("div", { className: "o-bulk-bar-toasts", "data-form": shape, children: _jsx(Toast, { inside: true, manager: toasts, ...(w.toast ? { words: w.toast } : {}), children: null }) }), popup, onDelete && (_jsx(AlertDialog, { open: asking, title: words.ask, line: deleteLine, action: w.delete, cancel: w.cancel, kind: "danger", ...(w.dialog ? { words: w.dialog } : {}), run: async () => { deleted.current = (await onDelete()) ?? null; }, onAnswer: (yes) => {
|
|
261
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: setRoot, className: cn("o-bulk-bar", className), "data-slot": "vk-bulk-bar", "data-kit": "bulk-bar", "data-form": shape, "data-shown": shown ? "" : undefined, inert: !shown, children: [_jsx(ToolbarControl, { label: words.selected, size: "32", spacing: shape === "pill" ? 1 : shape === "tray" ? 2 : 1.5, fold: false, form: phone ? "phone" : "computer", children: toolbarItems }), measured.length > 0 && _jsx("div", { className: "o-bulk-bar-measure", "aria-hidden": "true", inert: true, children: _jsx("div", { ref: setMeasure, children: measured }) })] }), _jsx("div", { className: "o-bulk-bar-toasts", "data-slot": "vk-bulk-toasts", "data-form": shape, children: _jsx(Toast, { inside: true, manager: toasts, ...(w.toast ? { words: w.toast } : {}), children: null }) }), popup, onDelete && (_jsx(AlertDialog, { open: asking, title: words.ask, line: deleteLine, action: w.delete, cancel: w.cancel, kind: "danger", ...(w.dialog ? { words: w.dialog } : {}), run: async () => { deleted.current = (await onDelete()) ?? null; }, onAnswer: (yes) => {
|
|
260
262
|
setAsking(false);
|
|
261
263
|
if (!yes)
|
|
262
264
|
return;
|
|
@@ -272,7 +274,7 @@ function FieldSheet({ verb, many, words, onPick, onClose, container, standing })
|
|
|
272
274
|
const [open, setOpen] = React.useState(true);
|
|
273
275
|
const parts = usePicker({ label: verb.label, items: verb.options, value: verb.value ?? null, empty: verb.empty, search: verb.search, form: "phone", ...(words.picker ? { words: words.picker } : {}),
|
|
274
276
|
onValueChange: (v) => { setOpen(false); onPick(v); }, onDone: () => setOpen(false) });
|
|
275
|
-
return (_jsxs(Sheet, { open: open, onOpenChange: (o) => { if (!o)
|
|
277
|
+
return (_jsxs(Sheet, { "data-slot": "vk-bulk-field-sheet", open: open, onOpenChange: (o) => { if (!o)
|
|
276
278
|
setOpen(false); }, onOpenChangeComplete: (o) => { if (!o)
|
|
277
279
|
onClose(); }, label: verb.label, form: "full", container: container, standing: standing, children: [_jsx(SheetHead, { title: verb.label, description: many, ...parts.head, ...(words.sheet ? { words: words.sheet } : {}) }), _jsx(SheetBody, { children: parts.body })] }));
|
|
278
280
|
}
|