ropav 0.3.1 → 0.5.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/dist/components/autocomplete/autocomplete-root.js +3 -1
- package/dist/components/autocomplete/index.d.ts +3 -0
- package/dist/components/avatar/avatar-image.js +13 -2
- package/dist/components/avatar/avatar.types.d.ts +7 -1
- package/dist/components/breadcrumbs/breadcrumbs-item.js +1 -0
- package/dist/components/breadcrumbs/index.d.ts +1 -0
- package/dist/components/calendar/calendar-header.js +1 -1
- package/dist/components/calendar/index.d.ts +5 -3
- package/dist/components/calendar-year-picker/index.d.ts +4 -2
- package/dist/components/checkbox/checkbox-content.js +1 -1
- package/dist/components/color-field/index.d.ts +3 -2
- package/dist/components/color-input-group/color-input-group-root.js +2 -0
- package/dist/components/color-input-group/color-input-group.types.d.ts +2 -0
- package/dist/components/color-input-group/index.d.ts +2 -0
- package/dist/components/combo-box/combo-box-root.js +9 -2
- package/dist/components/combo-box/combo-box.types.d.ts +3 -0
- package/dist/components/combo-box/index.d.ts +3 -0
- package/dist/components/date-field/index.d.ts +1 -0
- package/dist/components/date-input-group/date-input-group-root.js +2 -0
- package/dist/components/date-input-group/date-input-group-segment.js +1 -1
- package/dist/components/date-input-group/date-input-group.types.d.ts +2 -0
- package/dist/{composables → components/date-input-group}/use-date-segment.d.ts +2 -2
- package/dist/{composables → components/date-input-group}/use-date-segment.js +9 -9
- package/dist/components/date-picker/index.d.ts +3 -2
- package/dist/components/date-picker/index.js +2 -2
- package/dist/components/date-range-picker/date-range-picker-root.js +1 -1
- package/dist/components/date-range-picker/index.d.ts +18 -16
- package/dist/components/date-range-picker/index.js +2 -2
- package/dist/{composables → components/date-range-picker}/use-date-range-picker.d.ts +7 -7
- package/dist/{composables → components/date-range-picker}/use-date-range-picker.js +10 -10
- package/dist/components/drawer/drawer-dialog.js +1 -1
- package/dist/{composables → components/drawer}/use-drawer-drag.d.ts +1 -1
- package/dist/{composables → components/drawer}/use-drawer-drag.js +1 -1
- package/dist/components/dropdown/dropdown-menu.js +3 -1
- package/dist/components/dropdown/dropdown-submenu-trigger.js +1 -1
- package/dist/components/dropdown/dropdown.types.d.ts +3 -3
- package/dist/components/dropdown/index.d.ts +4 -2
- package/dist/{composables → components/dropdown}/use-safely-mouse-to-submenu.js +1 -1
- package/dist/components/icons/icon-overlay-arrow.js +1 -1
- package/dist/components/index.d.ts +5 -0
- package/dist/components/input/index.d.ts +12 -4
- package/dist/components/input/input-root.d.ts +5 -2
- package/dist/components/input/input-root.js +46 -5
- package/dist/components/input/input.types.d.ts +11 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/input-group-root.js +3 -0
- package/dist/components/input-group/input-group.types.d.ts +5 -0
- package/dist/components/input-otp/index.d.ts +6 -4
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/link/link-root.js +22 -5
- package/dist/components/link/link.types.d.ts +14 -3
- package/dist/{composables → components/list-box}/drag-collection.d.ts +2 -2
- package/dist/{composables → components/list-box}/drag-collection.js +1 -1
- package/dist/components/list-box/index.d.ts +4 -0
- package/dist/components/list-box/list-box-root.js +60 -35
- package/dist/components/list-box/list-box.types.d.ts +2 -0
- package/dist/components/menu/index.d.ts +4 -0
- package/dist/components/menu/menu-root.js +9 -2
- package/dist/components/menu/menu.types.d.ts +5 -0
- package/dist/components/number-field/index.d.ts +3 -0
- package/dist/components/number-field/number-field-root.js +2 -0
- package/dist/components/number-field/number-field.types.d.ts +2 -0
- package/dist/components/overlay/overlay-arrow.js +64 -11
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/pagination-root.js +8 -3
- package/dist/components/pagination/pagination.types.d.ts +8 -0
- package/dist/components/popover/popover-trigger.js +14 -7
- package/dist/components/radio/radio-content.js +1 -1
- package/dist/components/range-calendar/index.d.ts +18 -15
- package/dist/components/range-calendar/range-calendar-header.js +1 -1
- package/dist/components/router-provider/index.d.ts +5 -0
- package/dist/components/router-provider/index.js +3 -0
- package/dist/components/router-provider/router-provider.context.d.ts +40 -0
- package/dist/components/router-provider/router-provider.context.js +16 -0
- package/dist/components/router-provider/router-provider.d.ts +21 -0
- package/dist/components/router-provider/router-provider.js +22 -0
- package/dist/components/router-provider/router-provider.types.d.ts +23 -0
- package/dist/components/scroll-shadow/scroll-shadow-root.js +7 -1
- package/dist/components/scroll-shadow/use-scroll-shadow.js +25 -1
- package/dist/components/search-field/index.d.ts +2 -0
- package/dist/components/search-field/search-field-root.js +3 -1
- package/dist/components/search-field/search-field.types.d.ts +2 -0
- package/dist/{composables → components/search-field}/use-search-field.d.ts +2 -2
- package/dist/{composables → components/search-field}/use-search-field.js +3 -3
- package/dist/components/segmented-control/index.d.ts +134 -0
- package/dist/components/segmented-control/index.js +15 -0
- package/dist/components/segmented-control/segmented-control-indicator.d.ts +19 -0
- package/dist/components/segmented-control/segmented-control-indicator.js +36 -0
- package/dist/components/segmented-control/segmented-control-item.d.ts +21 -0
- package/dist/components/segmented-control/segmented-control-item.js +96 -0
- package/dist/components/segmented-control/segmented-control-root.d.ts +25 -0
- package/dist/components/segmented-control/segmented-control-root.js +112 -0
- package/dist/components/segmented-control/segmented-control-separator.d.ts +19 -0
- package/dist/components/segmented-control/segmented-control-separator.js +18 -0
- package/dist/components/segmented-control/segmented-control.context.d.ts +17 -0
- package/dist/components/segmented-control/segmented-control.context.js +12 -0
- package/dist/components/segmented-control/segmented-control.types.d.ts +67 -0
- package/dist/components/select/index.d.ts +3 -0
- package/dist/components/select/select-hidden-select.js +1 -1
- package/dist/components/select/select-root.js +2 -0
- package/dist/components/select/select.types.d.ts +2 -0
- package/dist/components/separator/separator-root.js +11 -5
- package/dist/components/separator/separator.context.d.ts +7 -0
- package/dist/components/sidebar/index.d.ts +544 -0
- package/dist/components/sidebar/index.js +47 -0
- package/dist/components/sidebar/sidebar-collapsible-trigger.d.ts +21 -0
- package/dist/components/sidebar/sidebar-collapsible-trigger.js +70 -0
- package/dist/components/sidebar/sidebar-collapsible.d.ts +24 -0
- package/dist/components/sidebar/sidebar-collapsible.js +78 -0
- package/dist/components/sidebar/sidebar-content.d.ts +21 -0
- package/dist/components/sidebar/sidebar-content.js +37 -0
- package/dist/components/sidebar/sidebar-footer.d.ts +21 -0
- package/dist/components/sidebar/sidebar-footer.js +24 -0
- package/dist/components/sidebar/sidebar-group-label.d.ts +21 -0
- package/dist/components/sidebar/sidebar-group-label.js +32 -0
- package/dist/components/sidebar/sidebar-group.d.ts +21 -0
- package/dist/components/sidebar/sidebar-group.js +48 -0
- package/dist/components/sidebar/sidebar-header.d.ts +21 -0
- package/dist/components/sidebar/sidebar-header.js +24 -0
- package/dist/components/sidebar/sidebar-inset.d.ts +21 -0
- package/dist/components/sidebar/sidebar-inset.js +24 -0
- package/dist/components/sidebar/sidebar-item-icon.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-icon.js +20 -0
- package/dist/components/sidebar/sidebar-item-indicator.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-indicator.js +48 -0
- package/dist/components/sidebar/sidebar-item-label.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-label.js +28 -0
- package/dist/components/sidebar/sidebar-item-tooltip.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-tooltip.js +38 -0
- package/dist/components/sidebar/sidebar-item-trailing.d.ts +21 -0
- package/dist/components/sidebar/sidebar-item-trailing.js +28 -0
- package/dist/components/sidebar/sidebar-item.d.ts +23 -0
- package/dist/components/sidebar/sidebar-item.js +160 -0
- package/dist/components/sidebar/sidebar-panel.d.ts +21 -0
- package/dist/components/sidebar/sidebar-panel.js +88 -0
- package/dist/components/sidebar/sidebar-rail.d.ts +21 -0
- package/dist/components/sidebar/sidebar-rail.js +210 -0
- package/dist/components/sidebar/sidebar-root.d.ts +31 -0
- package/dist/components/sidebar/sidebar-root.js +138 -0
- package/dist/components/sidebar/sidebar-separator.d.ts +19 -0
- package/dist/components/sidebar/sidebar-separator.js +16 -0
- package/dist/components/sidebar/sidebar-sub-menu.d.ts +23 -0
- package/dist/components/sidebar/sidebar-sub-menu.js +40 -0
- package/dist/components/sidebar/sidebar-trigger.d.ts +21 -0
- package/dist/components/sidebar/sidebar-trigger.js +69 -0
- package/dist/components/sidebar/sidebar.context.d.ts +75 -0
- package/dist/components/sidebar/sidebar.context.js +30 -0
- package/dist/components/sidebar/sidebar.state.d.ts +73 -0
- package/dist/components/sidebar/sidebar.state.js +76 -0
- package/dist/components/sidebar/sidebar.storage.d.ts +8 -0
- package/dist/components/sidebar/sidebar.storage.js +45 -0
- package/dist/components/sidebar/sidebar.types.d.ts +259 -0
- package/dist/components/splitter/index.d.ts +143 -0
- package/dist/components/splitter/index.js +13 -0
- package/dist/components/splitter/splitter-handle.d.ts +21 -0
- package/dist/components/splitter/splitter-handle.js +209 -0
- package/dist/components/splitter/splitter-panel.d.ts +21 -0
- package/dist/components/splitter/splitter-panel.js +70 -0
- package/dist/components/splitter/splitter-root.d.ts +31 -0
- package/dist/components/splitter/splitter-root.js +152 -0
- package/dist/components/splitter/splitter.context.d.ts +15 -0
- package/dist/components/splitter/splitter.context.js +5 -0
- package/dist/components/splitter/splitter.state.d.ts +87 -0
- package/dist/components/splitter/splitter.state.js +322 -0
- package/dist/components/splitter/splitter.storage.d.ts +15 -0
- package/dist/components/splitter/splitter.storage.js +56 -0
- package/dist/components/splitter/splitter.types.d.ts +98 -0
- package/dist/components/switch/switch-content.js +1 -1
- package/dist/components/table/index.d.ts +10 -9
- package/dist/components/table/table-body.js +13 -13
- package/dist/components/table/table-cell.js +49 -46
- package/dist/components/table/table-column-resizer.js +1 -1
- package/dist/components/table/table-column.js +1 -1
- package/dist/components/table/table-content.js +37 -18
- package/dist/{composables → components/table}/table-drag-collection.d.ts +1 -1
- package/dist/{composables → components/table}/table-drag-collection.js +1 -1
- package/dist/components/table/table-drop-indicator.js +3 -1
- package/dist/components/table/table-resizable-container.d.ts +4 -5
- package/dist/components/table/table-row.js +45 -14
- package/dist/components/table/table-virtualizer-item.d.ts +2 -7
- package/dist/components/table/table-virtualizer-item.js +20 -9
- package/dist/components/table/table.context.d.ts +11 -3
- package/dist/components/table/table.types.d.ts +1 -1
- package/dist/{composables → components/table}/use-grid-keyboard.d.ts +3 -3
- package/dist/{composables → components/table}/use-grid-keyboard.js +57 -55
- package/dist/{composables → components/table}/use-grid-selection-announcement.d.ts +2 -2
- package/dist/{composables → components/table}/use-grid-selection-announcement.js +2 -2
- package/dist/{composables → components/table}/use-table-collection.d.ts +2 -2
- package/dist/{composables → components/table}/use-table-collection.js +4 -4
- package/dist/{composables → components/table}/use-table-column-layout.d.ts +13 -20
- package/dist/components/table/use-table-column-layout.js +115 -0
- package/dist/components/tabs/tabs-panel.js +5 -1
- package/dist/components/tabs/tabs-tab.js +1 -1
- package/dist/components/textarea/index.d.ts +12 -4
- package/dist/components/textarea/textarea-root.d.ts +5 -2
- package/dist/components/textarea/textarea-root.js +40 -5
- package/dist/components/textarea/textarea.types.d.ts +11 -0
- package/dist/components/textfield/index.d.ts +2 -0
- package/dist/components/textfield/textfield-root.js +5 -1
- package/dist/components/textfield/textfield.context.d.ts +2 -0
- package/dist/components/textfield/textfield.types.d.ts +5 -0
- package/dist/components/time-field/index.d.ts +1 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/toast-default-content.js +1 -1
- package/dist/components/toggle-button-group/toggle-button-group-root.js +3 -3
- package/dist/components/toolbar/index.d.ts +3 -2
- package/dist/components/toolbar/toolbar-root.js +3 -3
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip-root.js +1 -1
- package/dist/components/tooltip/tooltip-trigger.js +13 -5
- package/dist/components/virtualizer/index.d.ts +3 -1
- package/dist/components/virtualizer/index.js +2 -1
- package/dist/components/virtualizer/use-virtualizer-item.d.ts +23 -0
- package/dist/components/virtualizer/use-virtualizer-item.js +45 -0
- package/dist/components/virtualizer/virtualizer-item.js +7 -41
- package/dist/components/virtualizer/virtualizer-scrollbar-track.d.ts +20 -0
- package/dist/components/virtualizer/virtualizer-scrollbar-track.js +141 -0
- package/dist/components/virtualizer/virtualizer-scrollbar.d.ts +18 -0
- package/dist/components/virtualizer/virtualizer-scrollbar.js +55 -0
- package/dist/components/virtualizer/virtualizer.context.d.ts +17 -1
- package/dist/composables/drag-manager.js +1 -13
- package/dist/composables/index.d.ts +3 -71
- package/dist/composables/use-collection.d.ts +22 -3
- package/dist/composables/use-collection.js +67 -14
- package/dist/composables/use-color-area.js +2 -2
- package/dist/composables/use-color-field.js +1 -1
- package/dist/composables/use-combo-box.js +1 -1
- package/dist/composables/use-date-field.js +1 -1
- package/dist/composables/use-drag-and-drop.js +1 -1
- package/dist/composables/use-drag.d.ts +6 -5
- package/dist/composables/use-draggable-item.d.ts +2 -2
- package/dist/composables/use-droppable-collection.js +2 -2
- package/dist/composables/use-droppable-item.js +1 -1
- package/dist/composables/use-form-reset.d.ts +6 -2
- package/dist/composables/use-form-reset.js +9 -5
- package/dist/composables/use-list-keyboard.js +64 -62
- package/dist/composables/use-menu.d.ts +10 -0
- package/dist/composables/use-menu.js +22 -0
- package/dist/composables/use-number-field.js +1 -1
- package/dist/composables/use-select.js +2 -3
- package/dist/composables/use-selection-manager.js +4 -4
- package/dist/composables/use-single-select-list-state.d.ts +37 -0
- package/dist/composables/use-single-select-list-state.js +110 -0
- package/dist/composables/use-slider-thumb.js +2 -2
- package/dist/composables/use-slider.js +1 -1
- package/dist/composables/use-tab-list-state.d.ts +20 -29
- package/dist/composables/use-tab-list-state.js +20 -99
- package/dist/composables/use-text-field.js +1 -1
- package/dist/composables/use-virtualizer-scroll.d.ts +52 -2
- package/dist/composables/use-virtualizer-scroll.js +79 -13
- package/dist/composables/use-virtualizer.d.ts +24 -4
- package/dist/composables/use-virtualizer.js +40 -6
- package/dist/index.js +58 -80
- package/dist/utils/document-order.d.ts +14 -0
- package/dist/utils/document-order.js +17 -0
- package/dist/utils/flex-sizing.d.ts +41 -0
- package/dist/utils/flex-sizing.js +140 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/open-link.d.ts +31 -0
- package/dist/utils/open-link.js +32 -0
- package/dist/utils/story-truncation.d.ts +20 -0
- package/dist/utils/story-users.d.ts +11 -0
- package/dist/utils/virtualizer-collection.d.ts +14 -4
- package/dist/utils/virtualizer-collection.js +9 -14
- package/dist/utils/virtualizer-layout-info.js +3 -2
- package/dist/utils/virtualizer-list-layout.d.ts +75 -29
- package/dist/utils/virtualizer-list-layout.js +182 -99
- package/dist/utils/virtualizer-offsets.d.ts +111 -0
- package/dist/utils/virtualizer-offsets.js +159 -0
- package/dist/utils/virtualizer-overscan.d.ts +9 -15
- package/dist/utils/virtualizer-overscan.js +14 -33
- package/dist/utils/virtualizer-table-layout.d.ts +50 -21
- package/dist/utils/virtualizer-table-layout.js +130 -89
- package/dist/version.js +1 -1
- package/package.json +19 -3
- package/dist/composables/use-table-column-layout.js +0 -214
- /package/dist/{composables → components/dropdown}/use-safely-mouse-to-submenu.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { focusableIn, getScrollParent, isScrollable } from "
|
|
1
|
+
import { focusableIn, getScrollParent, isScrollable } from "../../utils/focus.js";
|
|
2
2
|
import { isTableCellControl } from "./use-table-collection.js";
|
|
3
3
|
import { computed, nextTick, shallowRef, toValue, watch } from "vue";
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/components/table/use-grid-keyboard.ts
|
|
5
5
|
var NO_FOCUS = {
|
|
6
6
|
columnKey: null,
|
|
7
7
|
rowKey: null
|
|
@@ -317,60 +317,62 @@ var useGridKeyboard = (options) => {
|
|
|
317
317
|
event.stopPropagation();
|
|
318
318
|
if (event.shiftKey && next.rowKey != null && selection.selectionMode.value === "multiple") selection.extendSelection(next.rowKey);
|
|
319
319
|
};
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
320
|
+
collection.rows.withOrder(() => {
|
|
321
|
+
switch (event.key) {
|
|
322
|
+
case "ArrowDown":
|
|
323
|
+
move(from.rowKey == null && from.columnKey == null ? firstKey(from, true) : keyBelow(from));
|
|
324
|
+
return;
|
|
325
|
+
case "ArrowUp":
|
|
326
|
+
move(from.rowKey == null && from.columnKey == null ? lastKey(from, true) : keyAbove(from));
|
|
327
|
+
return;
|
|
328
|
+
case "ArrowRight":
|
|
329
|
+
if (handleExpansion(event, from, isReversed() ? "collapse" : "expand")) return;
|
|
330
|
+
move(keyRightOf(from));
|
|
331
|
+
return;
|
|
332
|
+
case "ArrowLeft":
|
|
333
|
+
if (handleExpansion(event, from, isReversed() ? "expand" : "collapse")) return;
|
|
334
|
+
move(keyLeftOf(from));
|
|
335
|
+
return;
|
|
336
|
+
case "Home":
|
|
337
|
+
if (from.rowKey == null && from.columnKey == null && event.shiftKey) return;
|
|
338
|
+
move(firstKey(from, isModified));
|
|
339
|
+
return;
|
|
340
|
+
case "End":
|
|
341
|
+
if (from.rowKey == null && from.columnKey == null && event.shiftKey) return;
|
|
342
|
+
move(lastKey(from, isModified));
|
|
343
|
+
return;
|
|
344
|
+
case "PageUp":
|
|
345
|
+
move(pageStep(from, -1));
|
|
346
|
+
return;
|
|
347
|
+
case "PageDown":
|
|
348
|
+
move(pageStep(from, 1));
|
|
349
|
+
return;
|
|
350
|
+
case "a":
|
|
351
|
+
if (!isModified || toValue(options.disallowSelectAll)) return;
|
|
352
|
+
if (selection.selectionMode.value !== "multiple") return;
|
|
353
|
+
selection.selectAll();
|
|
354
|
+
event.preventDefault();
|
|
355
|
+
event.stopPropagation();
|
|
356
|
+
return;
|
|
357
|
+
case "Escape":
|
|
358
|
+
if (escapeKeyBehavior.value !== "clearSelection" || selection.isEmpty.value) return;
|
|
359
|
+
selection.clearSelection();
|
|
360
|
+
event.preventDefault();
|
|
361
|
+
event.stopPropagation();
|
|
362
|
+
return;
|
|
363
|
+
case " ":
|
|
364
|
+
if (from.rowKey == null || selection.selectionMode.value === "none") return;
|
|
365
|
+
selection.select(from.rowKey, { isShiftPressed: event.shiftKey });
|
|
366
|
+
event.preventDefault();
|
|
367
|
+
return;
|
|
368
|
+
case "Tab": {
|
|
369
|
+
const focusable = focusableIn(element);
|
|
370
|
+
(event.shiftKey ? element : focusable.at(-1))?.focus();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
default: return;
|
|
371
374
|
}
|
|
372
|
-
|
|
373
|
-
}
|
|
375
|
+
});
|
|
374
376
|
};
|
|
375
377
|
/** Where focus should land when it first enters the grid. */
|
|
376
378
|
const entryTarget = (fromLater) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { UseCollectionReturn } from "
|
|
2
|
-
import type { UseSelectionManagerReturn } from "
|
|
1
|
+
import type { UseCollectionReturn } from "../../composables/use-collection.js";
|
|
2
|
+
import type { UseSelectionManagerReturn } from "../../composables/use-selection-manager.js";
|
|
3
3
|
export interface UseGridSelectionAnnouncementOptions {
|
|
4
4
|
collection: UseCollectionReturn;
|
|
5
5
|
selection: UseSelectionManagerReturn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { announce } from "
|
|
1
|
+
import { announce } from "../../utils/live-announcer.js";
|
|
2
2
|
import { watch } from "vue";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/components/table/use-grid-selection-announcement.ts
|
|
4
4
|
/** The keys in `a` that `b` does not have. A select-all is not a diff anyone can name. */
|
|
5
5
|
var diffSelection = (a, b) => {
|
|
6
6
|
if (a === "all" || b === "all") return /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { CollectionKey, UseCollectionReturn } from "../../composables/use-collection.js";
|
|
2
|
+
import type { VirtualizerTableCollection } from "../../utils/virtualizer-collection.js";
|
|
3
3
|
import type { TableColumnSize } from "./use-table-column-layout.js";
|
|
4
4
|
import type { ComputedRef } from "vue";
|
|
5
5
|
/** The least a registry needs from an entry: where it sits in the document. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FOCUSABLE_SELECTOR } from "
|
|
2
|
-
import { useCollection } from "
|
|
3
|
-
import { createTableCollection } from "
|
|
1
|
+
import { FOCUSABLE_SELECTOR } from "../../utils/focus.js";
|
|
2
|
+
import { useCollection } from "../../composables/use-collection.js";
|
|
3
|
+
import { createTableCollection } from "../../utils/virtualizer-collection.js";
|
|
4
4
|
import { computed, shallowRef } from "vue";
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/components/table/use-table-collection.ts
|
|
6
6
|
/**
|
|
7
7
|
* A registry of table parts that need to know **where they sit**, not just that they exist.
|
|
8
8
|
*
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { CollectionKey } from "
|
|
1
|
+
import type { CollectionKey } from "../../composables/use-collection.js";
|
|
2
|
+
import type { FlexSize } from "../../utils/flex-sizing.js";
|
|
2
3
|
import type { ComputedRef, MaybeRefOrGetter } from "vue";
|
|
3
|
-
/**
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A column width: pixels as a number, a percentage of the table, or a fraction of what is left.
|
|
6
|
+
*
|
|
7
|
+
* The one name from the sizing vocabulary this package still publishes, because
|
|
8
|
+
* `TableColumnProps.width` names it.
|
|
9
|
+
*/
|
|
10
|
+
export type TableColumnSize = FlexSize;
|
|
5
11
|
export interface TableColumnDefinition {
|
|
6
12
|
key: CollectionKey;
|
|
7
13
|
/** A width the caller controls. Set, it is never changed by a resize. */
|
|
@@ -11,25 +17,12 @@ export interface TableColumnDefinition {
|
|
|
11
17
|
minWidth?: TableColumnSize | null;
|
|
12
18
|
maxWidth?: TableColumnSize | null;
|
|
13
19
|
}
|
|
14
|
-
/** Pixels and percentages are fixed; `fr` units and anything unrecognised flex. */
|
|
15
|
-
export declare const isStaticWidth: (width?: TableColumnSize | null) => boolean;
|
|
16
|
-
/** The number in front of `fr`. Anything else counts as `1fr`, as React Aria has it. */
|
|
17
|
-
export declare const parseFractionalUnit: (width?: TableColumnSize | null) => number;
|
|
18
|
-
export declare const parseStaticWidth: (width: TableColumnSize, tableWidth: number) => number;
|
|
19
|
-
export declare const getMaxWidth: (maxWidth: TableColumnSize | null | undefined, tableWidth: number) => number;
|
|
20
|
-
/**
|
|
21
|
-
* A minimum cannot be given in `fr`: knowing what a fraction comes to would need every other
|
|
22
|
-
* column's width, which is the very thing being solved for.
|
|
23
|
-
*/
|
|
24
|
-
export declare const getMinWidth: (minWidth: TableColumnSize | null | undefined, tableWidth: number) => number;
|
|
25
20
|
/**
|
|
26
|
-
* Column widths for one table width
|
|
21
|
+
* Column widths for one table width.
|
|
27
22
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* the static and percentage columns leave over, and a minimum or maximum on any one of them
|
|
32
|
-
* redistributes the rest.
|
|
23
|
+
* The sizing itself is `calculateFlexSizes`; what this adds is the table's own precedence — a
|
|
24
|
+
* width changed by a resize in flight outranks the declared one — and the mapping from the
|
|
25
|
+
* table's `width` vocabulary onto the solver's `size` one.
|
|
33
26
|
*/
|
|
34
27
|
export declare const calculateColumnSizes: (availableWidth: number, columns: TableColumnDefinition[], changedColumns: Map<CollectionKey, TableColumnSize>, getDefaultWidth?: (index: number) => TableColumnSize | null | undefined, getDefaultMinWidth?: (index: number) => TableColumnSize | null | undefined) => number[];
|
|
35
28
|
export interface BuildColumnWidthsOptions {
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { calculateFlexSizes, getMaxSize, getMinSize } from "../../utils/flex-sizing.js";
|
|
2
|
+
import { computed, shallowRef, toValue, watch } from "vue";
|
|
3
|
+
//#region src/components/table/use-table-column-layout.ts
|
|
4
|
+
/**
|
|
5
|
+
* Column widths for one table width.
|
|
6
|
+
*
|
|
7
|
+
* The sizing itself is `calculateFlexSizes`; what this adds is the table's own precedence — a
|
|
8
|
+
* width changed by a resize in flight outranks the declared one — and the mapping from the
|
|
9
|
+
* table's `width` vocabulary onto the solver's `size` one.
|
|
10
|
+
*/
|
|
11
|
+
var calculateColumnSizes = (availableWidth, columns, changedColumns, getDefaultWidth, getDefaultMinWidth) => {
|
|
12
|
+
const definitions = columns.map((column) => ({
|
|
13
|
+
defaultSize: column.defaultWidth,
|
|
14
|
+
maxSize: column.maxWidth,
|
|
15
|
+
minSize: column.minWidth,
|
|
16
|
+
size: changedColumns.get(column.key) ?? column.width
|
|
17
|
+
}));
|
|
18
|
+
return calculateFlexSizes(availableWidth, definitions, getDefaultWidth, getDefaultMinWidth);
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Every column's width in pixels, keyed by column, ported from react-stately's
|
|
22
|
+
* `TableColumnLayout.buildColumnWidths`.
|
|
23
|
+
*
|
|
24
|
+
* The sizing itself is `calculateColumnSizes` above; what this adds is the pair of defaults a
|
|
25
|
+
* table falls back to — `1fr` for a width nobody declared, and a 75px floor — and the mapping back
|
|
26
|
+
* onto keys. Both the resizable container and the virtualizer's table layout need exactly that,
|
|
27
|
+
* and the two must agree: a column laid out at one width by the browser and at another by the
|
|
28
|
+
* layout would put every cell in the wrong place.
|
|
29
|
+
*
|
|
30
|
+
* @param changedWidths Widths that override what the columns declare, as a resize in flight does.
|
|
31
|
+
*/
|
|
32
|
+
var buildColumnWidths = (availableWidth, columns, changedWidths = /* @__PURE__ */ new Map(), options = {}) => {
|
|
33
|
+
const getDefaultWidth = options.getDefaultWidth ?? (() => "1fr");
|
|
34
|
+
const getDefaultMinWidth = options.getDefaultMinWidth ?? (() => 75);
|
|
35
|
+
const sizes = calculateColumnSizes(availableWidth, columns, changedWidths, (index) => getDefaultWidth(columns[index]), (index) => getDefaultMinWidth(columns[index]));
|
|
36
|
+
return new Map(columns.map((column, index) => [column.key, sizes[index] ?? 0]));
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Column widths for a resizable table, ported from react-stately's `TableColumnLayout` and
|
|
40
|
+
* `useTableColumnResizeState`.
|
|
41
|
+
*
|
|
42
|
+
* Two things are worth knowing before changing any of it. A column whose `width` the caller set is
|
|
43
|
+
* **controlled**: a resize never writes to it. And dragging one column's edge freezes every column
|
|
44
|
+
* to its **left** at the pixel width it currently has, which is what stops the whole table from
|
|
45
|
+
* reflowing while the pointer moves — the columns to the right keep their declared sizes and
|
|
46
|
+
* absorb the difference.
|
|
47
|
+
*/
|
|
48
|
+
var useTableColumnLayout = (options) => {
|
|
49
|
+
const getDefaultWidth = options.getDefaultWidth ?? (() => "1fr");
|
|
50
|
+
const getDefaultMinWidth = options.getDefaultMinWidth ?? (() => 75);
|
|
51
|
+
const resizingColumn = shallowRef(null);
|
|
52
|
+
const uncontrolledColumns = () => options.columns().filter((column) => column.width == null);
|
|
53
|
+
const initialUncontrolledWidths = () => new Map(uncontrolledColumns().map((column) => [column.key, column.defaultWidth ?? getDefaultWidth(column) ?? "1fr"]));
|
|
54
|
+
const uncontrolledWidths = shallowRef(initialUncontrolledWidths());
|
|
55
|
+
watch(() => options.columns().map((column) => column.key).join(" "), () => {
|
|
56
|
+
uncontrolledWidths.value = initialUncontrolledWidths();
|
|
57
|
+
});
|
|
58
|
+
/** The declared width of every column, with the uncontrolled ones taken from state. */
|
|
59
|
+
const combinedWidths = () => new Map(options.columns().map((column) => [column.key, uncontrolledWidths.value.get(column.key) ?? column.width ?? "1fr"]));
|
|
60
|
+
const layout = computed(() => {
|
|
61
|
+
const columns = options.columns();
|
|
62
|
+
const tableWidth = toValue(options.tableWidth);
|
|
63
|
+
const widths = buildColumnWidths(tableWidth, columns, combinedWidths(), {
|
|
64
|
+
getDefaultMinWidth,
|
|
65
|
+
getDefaultWidth
|
|
66
|
+
});
|
|
67
|
+
const minWidths = /* @__PURE__ */ new Map();
|
|
68
|
+
const maxWidths = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const column of columns) {
|
|
70
|
+
minWidths.set(column.key, getMinSize(column.minWidth ?? getDefaultMinWidth(column), tableWidth));
|
|
71
|
+
maxWidths.set(column.key, getMaxSize(column.maxWidth, tableWidth));
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
maxWidths,
|
|
75
|
+
minWidths,
|
|
76
|
+
widths
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
const getColumnWidth = (key) => layout.value.widths.get(key) ?? 0;
|
|
80
|
+
const getColumnMinWidth = (key) => layout.value.minWidths.get(key) ?? 0;
|
|
81
|
+
const getColumnMaxWidth = (key) => layout.value.maxWidths.get(key) ?? 0;
|
|
82
|
+
const updateResizedColumns = (key, width) => {
|
|
83
|
+
const previous = layout.value.widths;
|
|
84
|
+
const declared = combinedWidths();
|
|
85
|
+
const clamped = Math.max(getColumnMinWidth(key), Math.min(getColumnMaxWidth(key), Math.floor(width)));
|
|
86
|
+
const next = /* @__PURE__ */ new Map();
|
|
87
|
+
let freeze = true;
|
|
88
|
+
for (const column of options.columns()) if (column.key === key) {
|
|
89
|
+
next.set(column.key, clamped);
|
|
90
|
+
freeze = false;
|
|
91
|
+
} else if (freeze) next.set(column.key, previous.get(column.key) ?? 0);
|
|
92
|
+
else next.set(column.key, column.width ?? declared.get(column.key) ?? "1fr");
|
|
93
|
+
const committed = /* @__PURE__ */ new Map();
|
|
94
|
+
for (const column of uncontrolledColumns()) committed.set(column.key, next.get(column.key) ?? "1fr");
|
|
95
|
+
committed.set(key, clamped);
|
|
96
|
+
uncontrolledWidths.value = committed;
|
|
97
|
+
return next;
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
columnWidths: computed(() => layout.value.widths),
|
|
101
|
+
endResize: () => {
|
|
102
|
+
resizingColumn.value = null;
|
|
103
|
+
},
|
|
104
|
+
getColumnMaxWidth,
|
|
105
|
+
getColumnMinWidth,
|
|
106
|
+
getColumnWidth,
|
|
107
|
+
resizingColumn: computed(() => resizingColumn.value),
|
|
108
|
+
startResize: (key) => {
|
|
109
|
+
resizingColumn.value = key;
|
|
110
|
+
},
|
|
111
|
+
updateResizedColumns
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { buildColumnWidths, calculateColumnSizes, useTableColumnLayout };
|
|
@@ -2,7 +2,7 @@ import { dataAttr } from "../../utils/assertion.js";
|
|
|
2
2
|
import { useInteractionStates } from "../../composables/use-interaction-states.js";
|
|
3
3
|
import { useEnterExit } from "../../composables/use-enter-exit.js";
|
|
4
4
|
import { useTabsContext } from "./tabs.context.js";
|
|
5
|
-
import { computed, createIf, createSlot, defineVaporComponent, on, renderEffect, setAttr, setClass, setInsertionState, setProp, setStaticTemplateRef, shallowRef, template, unref } from "vue";
|
|
5
|
+
import { computed, createIf, createSlot, defineVaporComponent, on, renderEffect, setAttr, setClass, setInsertionState, setProp, setStaticTemplateRef, shallowRef, template, unref, watch } from "vue";
|
|
6
6
|
//#region src/components/tabs/tabs-panel.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
7
7
|
var t0 = template("<div data-slot=tabs-panel role=tabpanel>", 1);
|
|
8
8
|
var tabs_panel_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE__*/ defineVaporComponent({
|
|
@@ -20,6 +20,10 @@ var tabs_panel_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PUR
|
|
|
20
20
|
const { slots, state } = useTabsContext();
|
|
21
21
|
const panelKey = computed(() => props.id);
|
|
22
22
|
const isSelected = computed(() => state.selectedKey.value === panelKey.value);
|
|
23
|
+
watch(panelKey, (key, _previous, onCleanup) => {
|
|
24
|
+
if (key == null) return;
|
|
25
|
+
onCleanup(state.registerPanel(key));
|
|
26
|
+
}, { immediate: true });
|
|
23
27
|
const element = shallowRef(null);
|
|
24
28
|
const { isEntering, isExiting, isPresent } = useEnterExit({
|
|
25
29
|
elementRef: element,
|
|
@@ -60,7 +60,7 @@ var tabs_tab_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__PURE_
|
|
|
60
60
|
const _isDisabled = isDisabled.value;
|
|
61
61
|
const _dataAttr = unref(dataAttr);
|
|
62
62
|
setProp(n1, "id", _state.tabId(_tabKey));
|
|
63
|
-
setAttr(n1, "aria-controls", _isSelected ? _state.tabPanelId(_tabKey) : void 0);
|
|
63
|
+
setAttr(n1, "aria-controls", _isSelected && _state.hasPanel(_tabKey) ? _state.tabPanelId(_tabKey) : void 0);
|
|
64
64
|
setAttr(n1, "aria-disabled", _isDisabled || void 0);
|
|
65
65
|
setAttr(n1, "aria-selected", _isSelected);
|
|
66
66
|
setClass(n1, unref(slots).tab({ class: props.class }));
|
|
@@ -2,40 +2,48 @@ import TextAreaRoot from "./textarea-root.js";
|
|
|
2
2
|
export declare const TextArea: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: {
|
|
3
3
|
attrs: any;
|
|
4
4
|
slots: {};
|
|
5
|
-
emit:
|
|
5
|
+
emit: ((evt: "change", value: string) => void) & ((evt: "update:value", value: string) => void);
|
|
6
6
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
|
|
7
7
|
props: import('vue').PublicProps & {
|
|
8
8
|
class?: string;
|
|
9
|
+
value?: string;
|
|
9
10
|
variant?: import("@ropav/styles").TextAreaVariants["variant"];
|
|
11
|
+
size?: import("@ropav/styles").TextAreaVariants["size"];
|
|
10
12
|
fullWidth?: boolean;
|
|
11
13
|
placeholder?: string;
|
|
14
|
+
onChange?: ((value: string) => any) | undefined;
|
|
15
|
+
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
12
16
|
} & (typeof globalThis extends {
|
|
13
17
|
__VLS_PROPS_FALLBACK: infer P;
|
|
14
18
|
} ? P : {});
|
|
15
19
|
expose: (exposed: {}) => void;
|
|
16
20
|
attrs: any;
|
|
17
21
|
slots: {};
|
|
18
|
-
emit:
|
|
22
|
+
emit: ((evt: "change", value: string) => void) & ((evt: "update:value", value: string) => void);
|
|
19
23
|
}>) => import('vue').VNode & {
|
|
20
24
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
21
25
|
}) & {
|
|
22
26
|
Root: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: {
|
|
23
27
|
attrs: any;
|
|
24
28
|
slots: {};
|
|
25
|
-
emit:
|
|
29
|
+
emit: ((evt: "change", value: string) => void) & ((evt: "update:value", value: string) => void);
|
|
26
30
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
|
|
27
31
|
props: import('vue').PublicProps & {
|
|
28
32
|
class?: string;
|
|
33
|
+
value?: string;
|
|
29
34
|
variant?: import("@ropav/styles").TextAreaVariants["variant"];
|
|
35
|
+
size?: import("@ropav/styles").TextAreaVariants["size"];
|
|
30
36
|
fullWidth?: boolean;
|
|
31
37
|
placeholder?: string;
|
|
38
|
+
onChange?: ((value: string) => any) | undefined;
|
|
39
|
+
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
32
40
|
} & (typeof globalThis extends {
|
|
33
41
|
__VLS_PROPS_FALLBACK: infer P;
|
|
34
42
|
} ? P : {});
|
|
35
43
|
expose: (exposed: {}) => void;
|
|
36
44
|
attrs: any;
|
|
37
45
|
slots: {};
|
|
38
|
-
emit:
|
|
46
|
+
emit: ((evt: "change", value: string) => void) & ((evt: "update:value", value: string) => void);
|
|
39
47
|
}>) => import('vue').VNode & {
|
|
40
48
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
41
49
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { TextAreaRootProps } from "./textarea.types.js";
|
|
2
2
|
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, 'attrs' | 'emit' | 'slots'>>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
|
|
3
|
-
props: import('vue').PublicProps & __VLS_PrettifyLocal<TextAreaRootProps
|
|
3
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<TextAreaRootProps & {
|
|
4
|
+
onChange?: ((value: string) => any) | undefined;
|
|
5
|
+
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
6
|
+
}> & (typeof globalThis extends {
|
|
4
7
|
__VLS_PROPS_FALLBACK: infer P;
|
|
5
8
|
} ? P : {});
|
|
6
9
|
expose: (exposed: {}) => void;
|
|
7
10
|
attrs: any;
|
|
8
11
|
slots: {};
|
|
9
|
-
emit:
|
|
12
|
+
emit: ((evt: "change", value: string) => void) & ((evt: "update:value", value: string) => void);
|
|
10
13
|
}>) => import('vue').VNode & {
|
|
11
14
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
12
15
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { dataAttr } from "../../utils/assertion.js";
|
|
2
2
|
import { useInteractionStates } from "../../composables/use-interaction-states.js";
|
|
3
|
+
import { setFormValue } from "../../utils/form-value.js";
|
|
3
4
|
import { useTextFieldControlContext } from "../../composables/use-text-field.js";
|
|
4
5
|
import { useTextFieldContext } from "../textfield/textfield.context.js";
|
|
5
|
-
import { computed, createTemplateRefSetter, defineVaporComponent, on, renderEffect, setDynamicProps, template, unref } from "vue";
|
|
6
|
+
import { computed, createTemplateRefSetter, defineVaporComponent, on, renderEffect, setDynamicProps, shallowRef, template, unref, watch } from "vue";
|
|
6
7
|
import { textAreaVariants } from "@ropav/styles";
|
|
7
8
|
//#region src/components/textarea/textarea-root.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
8
9
|
var t0 = template("<textarea>", 1);
|
|
@@ -10,32 +11,66 @@ var textarea_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__
|
|
|
10
11
|
__name: "textarea-root",
|
|
11
12
|
props: {
|
|
12
13
|
class: {},
|
|
14
|
+
value: {},
|
|
13
15
|
variant: { default: void 0 },
|
|
16
|
+
size: {},
|
|
14
17
|
fullWidth: {
|
|
15
18
|
type: Boolean,
|
|
16
19
|
default: void 0
|
|
17
20
|
},
|
|
18
21
|
placeholder: {}
|
|
19
22
|
},
|
|
20
|
-
|
|
23
|
+
emits: ["change", "update:value"],
|
|
24
|
+
setup(__props, { emit: __emit }) {
|
|
21
25
|
const props = __props;
|
|
26
|
+
const emit = __emit;
|
|
22
27
|
const control = useTextFieldControlContext();
|
|
23
28
|
const textField = useTextFieldContext();
|
|
24
|
-
const
|
|
25
|
-
|
|
29
|
+
const element = shallowRef(null);
|
|
30
|
+
const setElement = (next) => {
|
|
31
|
+
element.value = next instanceof HTMLTextAreaElement ? next : null;
|
|
32
|
+
control?.registerElement(element.value);
|
|
26
33
|
};
|
|
27
34
|
const resolvedVariant = computed(() => props.variant ?? textField?.variant.value);
|
|
35
|
+
const resolvedSize = computed(() => props.size ?? textField?.size.value);
|
|
28
36
|
const styles = computed(() => textAreaVariants({
|
|
29
37
|
class: props.class,
|
|
30
38
|
fullWidth: props.fullWidth,
|
|
39
|
+
size: resolvedSize.value,
|
|
31
40
|
variant: resolvedVariant.value
|
|
32
41
|
}));
|
|
33
42
|
const attrs = computed(() => {
|
|
34
43
|
const merged = { ...control?.attrs.value };
|
|
35
44
|
if (props.placeholder !== void 0) merged["placeholder"] = props.placeholder;
|
|
45
|
+
if (props.value !== void 0) merged["value"] = props.value;
|
|
36
46
|
return merged;
|
|
37
47
|
});
|
|
38
48
|
const interaction = useInteractionStates({ isDisabled: () => control?.isDisabled.value });
|
|
49
|
+
const inputCount = shallowRef(0);
|
|
50
|
+
const onInput = (event) => {
|
|
51
|
+
control?.handlers.onInput(event);
|
|
52
|
+
const next = event.currentTarget.value;
|
|
53
|
+
emit("change", next);
|
|
54
|
+
emit("update:value", next);
|
|
55
|
+
if (props.value !== void 0) inputCount.value++;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Put the text back to what the caller holds, reset source included. See the same watch in
|
|
59
|
+
* `input-root.vue`, and {@link setFormValue}, for why this cannot be left to the binding — and note
|
|
60
|
+
* that a textarea keeps its reset source in its children rather than in a `value` attribute.
|
|
61
|
+
*/
|
|
62
|
+
watch([
|
|
63
|
+
element,
|
|
64
|
+
() => props.value,
|
|
65
|
+
inputCount
|
|
66
|
+
], ([el, pinned]) => {
|
|
67
|
+
if (pinned === void 0) return;
|
|
68
|
+
setFormValue(el, pinned);
|
|
69
|
+
}, {
|
|
70
|
+
flush: "post",
|
|
71
|
+
immediate: true
|
|
72
|
+
});
|
|
73
|
+
watch(() => props.value !== void 0, (owned) => control?.setValueOwned(owned), { immediate: true });
|
|
39
74
|
const onFocus = (event) => {
|
|
40
75
|
interaction.onFocus();
|
|
41
76
|
control?.handlers.onFocus(event);
|
|
@@ -48,7 +83,7 @@ var textarea_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@__
|
|
|
48
83
|
const n0 = t0();
|
|
49
84
|
on(n0, "blur", onBlur);
|
|
50
85
|
on(n0, "focus", onFocus);
|
|
51
|
-
on(n0, "input",
|
|
86
|
+
on(n0, "input", onInput);
|
|
52
87
|
on(n0, "keydown", (e) => unref(control)?.handlers.onKeydown(e));
|
|
53
88
|
on(n0, "keyup", (e) => unref(control)?.handlers.onKeyup(e));
|
|
54
89
|
on(n0, "pointerdown", (e) => unref(interaction).onPointerdown(e));
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import type { TextAreaVariants } from "@ropav/styles";
|
|
2
2
|
export interface TextAreaRootProps {
|
|
3
3
|
class?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Text in the control. Set here it takes the control over from the surrounding field, so the
|
|
6
|
+
* caller owns the value even inside a `TextField` — exactly as a `value` prop does in React.
|
|
7
|
+
* Without a listener to go with it the text is pinned.
|
|
8
|
+
*/
|
|
9
|
+
value?: string;
|
|
4
10
|
/** Visual variant. Taken from the surrounding field when unset. @default "primary" */
|
|
5
11
|
variant?: TextAreaVariants["variant"];
|
|
12
|
+
/**
|
|
13
|
+
* How much room the text is given, matching a field of the same size. Taken from the
|
|
14
|
+
* surrounding field when unset. @default "md"
|
|
15
|
+
*/
|
|
16
|
+
size?: TextAreaVariants["size"];
|
|
6
17
|
/** Whether the control stretches to fill its container. */
|
|
7
18
|
fullWidth?: boolean;
|
|
8
19
|
/**
|
|
@@ -9,6 +9,7 @@ export declare const TextField: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
9
9
|
props: import('vue').PublicProps & {
|
|
10
10
|
class?: string;
|
|
11
11
|
variant?: "primary" | "secondary";
|
|
12
|
+
size?: "sm" | "md" | "lg";
|
|
12
13
|
fullWidth?: boolean;
|
|
13
14
|
value?: string;
|
|
14
15
|
defaultValue?: string;
|
|
@@ -61,6 +62,7 @@ export declare const TextField: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
61
62
|
props: import('vue').PublicProps & {
|
|
62
63
|
class?: string;
|
|
63
64
|
variant?: "primary" | "secondary";
|
|
65
|
+
size?: "sm" | "md" | "lg";
|
|
64
66
|
fullWidth?: boolean;
|
|
65
67
|
value?: string;
|
|
66
68
|
defaultValue?: string;
|
|
@@ -12,6 +12,7 @@ var textfield_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
|
|
|
12
12
|
props: {
|
|
13
13
|
class: {},
|
|
14
14
|
variant: { default: void 0 },
|
|
15
|
+
size: {},
|
|
15
16
|
fullWidth: {
|
|
16
17
|
type: Boolean,
|
|
17
18
|
default: void 0
|
|
@@ -101,7 +102,10 @@ var textfield_root_vue_vue_type_script_setup_true_vapor_true_lang_default = /*@_
|
|
|
101
102
|
});
|
|
102
103
|
provideFieldIdsContext(field.fieldIds);
|
|
103
104
|
provideTextFieldControlContext(field);
|
|
104
|
-
provideTextFieldContext({
|
|
105
|
+
provideTextFieldContext({
|
|
106
|
+
size: computed(() => props.size),
|
|
107
|
+
variant: computed(() => props.variant)
|
|
108
|
+
});
|
|
105
109
|
provideFieldErrorContext({ validation: field.validation.displayValidation });
|
|
106
110
|
const styles = computed(() => textFieldVariants({
|
|
107
111
|
class: props.class,
|
|
@@ -2,6 +2,8 @@ import type { ComputedRef } from "vue";
|
|
|
2
2
|
export interface TextFieldContext {
|
|
3
3
|
/** Visual variant the control inside picks up when it declares none of its own. */
|
|
4
4
|
variant: ComputedRef<"primary" | "secondary" | undefined>;
|
|
5
|
+
/** Size the control inside picks up when it declares none of its own. */
|
|
6
|
+
size: ComputedRef<"sm" | "md" | "lg" | undefined>;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Carries the variant alone, kept apart from the control context that carries the behaviour.
|
|
@@ -3,6 +3,11 @@ export interface TextFieldRootProps {
|
|
|
3
3
|
class?: string;
|
|
4
4
|
/** Visual variant handed down to the control inside. @default "primary" */
|
|
5
5
|
variant?: "primary" | "secondary";
|
|
6
|
+
/**
|
|
7
|
+
* How tall the control inside stands, matching a button of the same size. Handed to the control
|
|
8
|
+
* unless it declares one of its own. @default "md"
|
|
9
|
+
*/
|
|
10
|
+
size?: "sm" | "md" | "lg";
|
|
6
11
|
/** Whether the field stretches to fill its container. */
|
|
7
12
|
fullWidth?: boolean;
|
|
8
13
|
/** Text in the field. Makes it controlled. */
|
|
@@ -58,6 +58,7 @@ export declare const TimeField: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
58
58
|
props: import('vue').PublicProps & {
|
|
59
59
|
class?: string;
|
|
60
60
|
variant?: import("@ropav/styles").DateInputGroupVariants["variant"];
|
|
61
|
+
size?: import("@ropav/styles").DateInputGroupVariants["size"];
|
|
61
62
|
fullWidth?: boolean;
|
|
62
63
|
isDisabled?: boolean;
|
|
63
64
|
isInvalid?: boolean;
|
|
@@ -223,6 +223,7 @@ export declare const Toast: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
223
223
|
export { ToastActionButton, ToastCloseButton, ToastContent, ToastDescription, ToastIndicator, ToastProvider, ToastRoot, ToastTitle, };
|
|
224
224
|
export type { ToastActionButtonProps, ToastActionValue, ToastAddOptions, ToastCloseButtonProps, ToastContentProps, ToastContentValue, ToastDescriptionProps, ToastIndicatorProps, ToastOptions, ToastPromiseOptions, ToastProviderProps, ToastProviderSlotProps, ToastQueueOptions, ToastRenderable, ToastRootProps, ToastRootProps as ToastProps, ToastTitleProps, QueuedToast, } from "./toast.types.js";
|
|
225
225
|
export { ToastQueue, createToastFunction, getQueuedToastCount, resetToastQueue, toast, toastQueue, useToastQueue, } from "./toast-queue.js";
|
|
226
|
+
export type { Timer } from "./toast-queue.js";
|
|
226
227
|
export type { ToastFunction, UseToastQueueReturn } from "./toast-queue.js";
|
|
227
228
|
export { DEFAULT_GAP, DEFAULT_MAX_VISIBLE_TOAST, DEFAULT_SCALE_FACTOR, DEFAULT_TOAST_TIMEOUT, DEFAULT_TOAST_WIDTH, } from "./toast.constants.js";
|
|
228
229
|
export { useToastItemContext, useToastRegionContext } from "./toast.context.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useMediaQuery } from "../../composables/use-media-query.js";
|
|
1
2
|
import spinner_root_default from "../spinner/spinner-root.js";
|
|
2
3
|
import toast_action_button_default from "./toast-action-button.js";
|
|
3
4
|
import toast_close_button_default from "./toast-close-button.js";
|
|
4
5
|
import toast_content_default from "./toast-content.js";
|
|
5
6
|
import toast_description_default from "./toast-description.js";
|
|
6
7
|
import toast_indicator_default from "./toast-indicator.js";
|
|
7
|
-
import { useMediaQuery } from "../../composables/use-media-query.js";
|
|
8
8
|
import toast_renderable_default from "./toast-renderable.js";
|
|
9
9
|
import toast_root_default from "./toast-root.js";
|
|
10
10
|
import toast_title_default from "./toast-title.js";
|