@lushly-dev/violet-elements 0.2.0-preview.1 → 0.2.0-preview.2
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/README.md +37 -9
- package/custom-elements.json +175 -12
- package/dist/accordion/violet-accordion.js +12 -0
- package/dist/accordion/violet-accordion.js.map +1 -1
- package/dist/accordion-item/violet-accordion-item.js +18 -21
- package/dist/accordion-item/violet-accordion-item.js.map +1 -1
- package/dist/alert/violet-alert.js +21 -23
- package/dist/alert/violet-alert.js.map +1 -1
- package/dist/badge/violet-badge.js +15 -18
- package/dist/badge/violet-badge.js.map +1 -1
- package/dist/button/violet-button.d.ts +2 -1
- package/dist/button/violet-button.js +10 -20
- package/dist/button/violet-button.js.map +1 -1
- package/dist/calendar/violet-calendar.js +30 -23
- package/dist/calendar/violet-calendar.js.map +1 -1
- package/dist/card/violet-card.js +15 -16
- package/dist/card/violet-card.js.map +1 -1
- package/dist/carousel/violet-carousel.js +3 -1
- package/dist/carousel/violet-carousel.js.map +1 -1
- package/dist/checkbox/violet-checkbox.d.ts +1 -0
- package/dist/checkbox/violet-checkbox.js +84 -21
- package/dist/checkbox/violet-checkbox.js.map +1 -1
- package/dist/color-picker/violet-color-picker.js +28 -23
- package/dist/color-picker/violet-color-picker.js.map +1 -1
- package/dist/combobox/violet-combobox.js +29 -22
- package/dist/combobox/violet-combobox.js.map +1 -1
- package/dist/conversation/violet-approval-card.js +64 -28
- package/dist/conversation/violet-approval-card.js.map +1 -1
- package/dist/conversation/violet-chat-composer.js +15 -7
- package/dist/conversation/violet-chat-composer.js.map +1 -1
- package/dist/conversation/violet-chat-suggestions.js +9 -7
- package/dist/conversation/violet-chat-suggestions.js.map +1 -1
- package/dist/conversation/violet-conversation-thread.js +2 -2
- package/dist/conversation/violet-conversation-thread.js.map +1 -1
- package/dist/conversation/violet-message-media.js +2 -2
- package/dist/conversation/violet-message-media.js.map +1 -1
- package/dist/conversation/violet-message-status.js +4 -3
- package/dist/conversation/violet-message-status.js.map +1 -1
- package/dist/conversation/violet-message.js +16 -8
- package/dist/conversation/violet-message.js.map +1 -1
- package/dist/conversation/violet-reasoning-block.js +17 -13
- package/dist/conversation/violet-reasoning-block.js.map +1 -1
- package/dist/conversation/violet-source-citation.js +8 -7
- package/dist/conversation/violet-source-citation.js.map +1 -1
- package/dist/conversation/violet-tool-call-card.js +50 -40
- package/dist/conversation/violet-tool-call-card.js.map +1 -1
- package/dist/conversation/violet-tool-result-card.js +49 -26
- package/dist/conversation/violet-tool-result-card.js.map +1 -1
- package/dist/data-grid/violet-data-grid-attachment-cell.js +13 -13
- package/dist/data-grid/violet-data-grid-attachment-cell.js.map +1 -1
- package/dist/data-grid/violet-data-grid-multi-picker.js +14 -14
- package/dist/data-grid/violet-data-grid-multi-picker.js.map +1 -1
- package/dist/data-grid/violet-data-grid-persona-picker.js +12 -12
- package/dist/data-grid/violet-data-grid-persona-picker.js.map +1 -1
- package/dist/data-grid/violet-data-grid-pill-select.js +15 -14
- package/dist/data-grid/violet-data-grid-pill-select.js.map +1 -1
- package/dist/data-grid/violet-data-grid-rating.js +7 -7
- package/dist/data-grid/violet-data-grid-rating.js.map +1 -1
- package/dist/data-grid/violet-data-grid-reference-picker.js +14 -14
- package/dist/data-grid/violet-data-grid-reference-picker.js.map +1 -1
- package/dist/data-grid/violet-data-grid.d.ts +5 -0
- package/dist/data-grid/violet-data-grid.js +56 -12
- package/dist/data-grid/violet-data-grid.js.map +1 -1
- package/dist/data-grid/violet-data-grid.styles.js +78 -31
- package/dist/data-grid/violet-data-grid.styles.js.map +1 -1
- package/dist/date-picker/violet-date-picker.js +21 -15
- package/dist/date-picker/violet-date-picker.js.map +1 -1
- package/dist/date-range-picker/violet-date-range-picker.js +20 -16
- package/dist/date-range-picker/violet-date-range-picker.js.map +1 -1
- package/dist/dialog/violet-dialog.js +28 -18
- package/dist/dialog/violet-dialog.js.map +1 -1
- package/dist/empty-state/violet-empty-state.js +8 -2
- package/dist/empty-state/violet-empty-state.js.map +1 -1
- package/dist/file-explorer/violet-file-explorer.js +1 -1
- package/dist/file-explorer/violet-file-explorer.js.map +1 -1
- package/dist/file-upload/violet-file-upload.d.ts +2 -0
- package/dist/file-upload/violet-file-upload.js +16 -6
- package/dist/file-upload/violet-file-upload.js.map +1 -1
- package/dist/gantt/violet-gantt.styles.js +1 -1
- package/dist/gantt/violet-gantt.styles.js.map +1 -1
- package/dist/icon-button/violet-icon-button.d.ts +2 -1
- package/dist/icon-button/violet-icon-button.js +7 -17
- package/dist/icon-button/violet-icon-button.js.map +1 -1
- package/dist/listbox/violet-listbox.js +15 -6
- package/dist/listbox/violet-listbox.js.map +1 -1
- package/dist/menu/violet-menu-item.js +6 -7
- package/dist/menu/violet-menu-item.js.map +1 -1
- package/dist/menu/violet-menu.js +13 -11
- package/dist/menu/violet-menu.js.map +1 -1
- package/dist/option/violet-option.js +34 -14
- package/dist/option/violet-option.js.map +1 -1
- package/dist/option-group/violet-option-group.js +1 -2
- package/dist/option-group/violet-option-group.js.map +1 -1
- package/dist/pagination/violet-pagination.js +16 -16
- package/dist/pagination/violet-pagination.js.map +1 -1
- package/dist/persona/violet-persona.js +9 -10
- package/dist/persona/violet-persona.js.map +1 -1
- package/dist/popover/violet-popover.js +4 -3
- package/dist/popover/violet-popover.js.map +1 -1
- package/dist/progress/violet-progress.js +7 -4
- package/dist/progress/violet-progress.js.map +1 -1
- package/dist/radio/violet-radio.js +36 -20
- package/dist/radio/violet-radio.js.map +1 -1
- package/dist/radio-group/violet-radio-group.js +3 -2
- package/dist/radio-group/violet-radio-group.js.map +1 -1
- package/dist/segment/violet-segment.d.ts +1 -1
- package/dist/segment/violet-segment.js +17 -13
- package/dist/segment/violet-segment.js.map +1 -1
- package/dist/segmented-control/violet-segmented-control.d.ts +2 -0
- package/dist/segmented-control/violet-segmented-control.js +25 -11
- package/dist/segmented-control/violet-segmented-control.js.map +1 -1
- package/dist/select/violet-select.d.ts +4 -0
- package/dist/select/violet-select.js +51 -23
- package/dist/select/violet-select.js.map +1 -1
- package/dist/skeleton/violet-skeleton.js +3 -3
- package/dist/skeleton/violet-skeleton.js.map +1 -1
- package/dist/slider/violet-range-slider.js +26 -20
- package/dist/slider/violet-range-slider.js.map +1 -1
- package/dist/slider/violet-slider.d.ts +4 -0
- package/dist/slider/violet-slider.js +25 -22
- package/dist/slider/violet-slider.js.map +1 -1
- package/dist/snackbar/violet-snackbar.js +14 -13
- package/dist/snackbar/violet-snackbar.js.map +1 -1
- package/dist/spinner/violet-spinner.d.ts +1 -1
- package/dist/spinner/violet-spinner.js +41 -24
- package/dist/spinner/violet-spinner.js.map +1 -1
- package/dist/switch/violet-switch.js +100 -35
- package/dist/switch/violet-switch.js.map +1 -1
- package/dist/tab/violet-tab.js +36 -12
- package/dist/tab/violet-tab.js.map +1 -1
- package/dist/tab-panel/violet-tab-panel.js +1 -1
- package/dist/tab-panel/violet-tab-panel.js.map +1 -1
- package/dist/tabs/violet-tabs.js +11 -4
- package/dist/tabs/violet-tabs.js.map +1 -1
- package/dist/teaching-tip/violet-teaching-tip.js +1 -1
- package/dist/teaching-tip/violet-teaching-tip.js.map +1 -1
- package/dist/text/violet-text.js +9 -2
- package/dist/text/violet-text.js.map +1 -1
- package/dist/text-area/violet-text-area.js +31 -16
- package/dist/text-area/violet-text-area.js.map +1 -1
- package/dist/text-field/violet-text-field.js +31 -16
- package/dist/text-field/violet-text-field.js.map +1 -1
- package/dist/theme/generated/violet-theme.generated.d.ts +161 -143
- package/dist/theme/generated/violet-theme.generated.js +149 -143
- package/dist/theme/generated/violet-theme.generated.js.map +1 -1
- package/dist/theme/violet-token-defaults.js +92 -87
- package/dist/theme/violet-token-defaults.js.map +1 -1
- package/dist/time-picker/violet-time-picker.js +18 -15
- package/dist/time-picker/violet-time-picker.js.map +1 -1
- package/dist/toast/violet-toast.js +16 -22
- package/dist/toast/violet-toast.js.map +1 -1
- package/dist/tooltip/violet-tooltip.js +13 -6
- package/dist/tooltip/violet-tooltip.js.map +1 -1
- package/dist/tree/violet-tree.js +4 -4
- package/dist/tree/violet-tree.js.map +1 -1
- package/dist/tree-item/violet-tree-item.js +8 -5
- package/dist/tree-item/violet-tree-item.js.map +1 -1
- package/package.json +3 -2
- package/tokens/interface.json +30 -3
- package/tokens/violet-theme.export.json +167 -143
|
@@ -21,7 +21,7 @@ import { clearedFillSession, clearedPointerSelectionSession, isFillPointerEventF
|
|
|
21
21
|
import { createPresentedColumn as buildPresentedColumn, createPresentedRow as buildPresentedRow, syncEditingState, syncActiveCell as syncPresentedActiveCell, syncCellSelection as syncPresentedCellSelection, syncFillPreview as syncPresentedFillPreview, } from "./violet-data-grid-presentation";
|
|
22
22
|
import { clearedColumnResizeSession, columnResizeKeyShortcut, isColumnResizeShortcut, keyboardResizedColumnWidth as computeKeyboardResizedColumnWidth, resizedColumnWidth as computeResizedColumnWidth, isColumnResizeEventForSession, beginColumnResize as startColumnResizeSession, } from "./violet-data-grid-resize";
|
|
23
23
|
import { nextTabLocation, selectedLocations, locationForIndices as selectionLocationForIndices, rangeFromBounds as selectionRangeFromBounds, } from "./violet-data-grid-selection";
|
|
24
|
-
import { autosizedColumnWidth as computeAutosizedColumnWidth, minimumColumnWidth as computeMinimumColumnWidth, renderedColumnWidth as computeRenderedColumnWidth, resolvedColumnWidth as resolveGridColumnWidth, } from "./violet-data-grid-sizing";
|
|
24
|
+
import { autosizedColumnWidth as computeAutosizedColumnWidth, cssLengthToPixels, minimumColumnWidth as computeMinimumColumnWidth, renderedColumnWidth as computeRenderedColumnWidth, resolvedColumnWidth as resolveGridColumnWidth, } from "./violet-data-grid-sizing";
|
|
25
25
|
import { isEditorElement as isGridEditorElement, isFillHandleTarget as isGridFillHandleTarget, isInteractiveCellWidgetTarget as isGridInteractiveCellWidgetTarget, } from "./violet-data-grid-targets";
|
|
26
26
|
import { opensOnSingleActiveClick as editorOpensOnSingleActiveClick, editStringForRawValue, booleanCellValue as normalizeBooleanCellValue, normalizedEditingValue as normalizeEditingValue, resolveEditingValue, } from "./violet-data-grid-values";
|
|
27
27
|
import { buildVirtualizerUpdateOptions, buildRenderedRows as computeRenderedRows, } from "./violet-data-grid-virtualization";
|
|
@@ -142,11 +142,12 @@ const fullTableTemplate = html `
|
|
|
142
142
|
aria-colcount="${(x) => String(x.logicalColumnCount)}"
|
|
143
143
|
>
|
|
144
144
|
<colgroup>
|
|
145
|
+
<!-- With selection off the selection cells are hidden, so the column is hidden too: a hidden <col>
|
|
146
|
+
creates no column slot, and a visible one would shift every cell one slot to the left. -->
|
|
145
147
|
<col
|
|
146
148
|
class="selection-column"
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
: "width:var(--_selection-column-size);inline-size:var(--_selection-column-size);min-inline-size:var(--_selection-column-size);max-inline-size:var(--_selection-column-size);"}"
|
|
149
|
+
?hidden="${(x) => x.selectionMode === "none"}"
|
|
150
|
+
style="width:var(--_selection-column-size);inline-size:var(--_selection-column-size);min-inline-size:var(--_selection-column-size);max-inline-size:var(--_selection-column-size);"
|
|
150
151
|
/>
|
|
151
152
|
${repeat((x) => x.presentedColumns, html `
|
|
152
153
|
<col data-column-id="${(x) => x.id}" style="${(x) => x.widthStyle}" />
|
|
@@ -268,6 +269,20 @@ const template = html `
|
|
|
268
269
|
></violet-text-field>
|
|
269
270
|
</div>
|
|
270
271
|
`)}
|
|
272
|
+
${when((x) => x.focusMode === "cell", html `
|
|
273
|
+
<div class="fill-actions" role="group" aria-label="Fill selection">
|
|
274
|
+
<button class="fill-action" type="button"
|
|
275
|
+
?disabled="${(x) => !x.canFillSelection("down")}"
|
|
276
|
+
@click="${(x) => x.handleFillAction("down")}"
|
|
277
|
+
>Fill down</button>
|
|
278
|
+
<button class="fill-action" type="button"
|
|
279
|
+
?disabled="${(x) => !x.canFillSelection("right")}"
|
|
280
|
+
@click="${(x) => x.handleFillAction("right")}"
|
|
281
|
+
>Fill right</button>
|
|
282
|
+
<span class="fill-status" role="status" aria-live="polite" aria-atomic="true"
|
|
283
|
+
>${(x) => x.fillAnnouncement}</span>
|
|
284
|
+
</div>
|
|
285
|
+
`)}
|
|
271
286
|
<div class="toolbar-meta">
|
|
272
287
|
<span>${(x) => x.rowSummary}</span>
|
|
273
288
|
<div class="toolbar-slot">
|
|
@@ -496,6 +511,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
496
511
|
this.editingError = "";
|
|
497
512
|
this.editAnnouncement = "";
|
|
498
513
|
this.fillPreview = null;
|
|
514
|
+
this.fillAnnouncement = "";
|
|
499
515
|
this.#settingAutomaticEstimatedRowHeight = true;
|
|
500
516
|
this.estimatedRowHeight = this.rowHeightForDensity(this.density);
|
|
501
517
|
this.#settingAutomaticEstimatedRowHeight = false;
|
|
@@ -695,7 +711,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
695
711
|
return this.presentedRows.length > 0;
|
|
696
712
|
}
|
|
697
713
|
get columnSpan() {
|
|
698
|
-
return this.
|
|
714
|
+
return this.logicalColumnCount;
|
|
699
715
|
}
|
|
700
716
|
get logicalRowCount() {
|
|
701
717
|
return this.presentedRows.length + 1;
|
|
@@ -716,7 +732,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
716
732
|
return this.showFilter;
|
|
717
733
|
}
|
|
718
734
|
get shouldShowToolbar() {
|
|
719
|
-
return this.showsBuiltInFilter || this.hasToolbarSlotContent;
|
|
735
|
+
return this.focusMode === "cell" || this.showsBuiltInFilter || this.hasToolbarSlotContent;
|
|
720
736
|
}
|
|
721
737
|
get activeCellLabelId() {
|
|
722
738
|
return `${this.localName}-active-cell-${this.instanceId}`;
|
|
@@ -1409,10 +1425,14 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1409
1425
|
this.handleColumnResizeDoubleClick(columnId, event);
|
|
1410
1426
|
return false;
|
|
1411
1427
|
}
|
|
1428
|
+
// Step from the column's own width when it is absolute: a table narrower than the grid stretches its
|
|
1429
|
+
// columns, so the drawn width is larger, and stepping from it would grow the column by more than a step.
|
|
1430
|
+
const declared = this.resolvedColumnWidth(columnId)?.trim();
|
|
1431
|
+
const declaredPixels = declared && /^\d+(\.\d+)?(px|rem)$/.test(declared) ? cssLengthToPixels(declared) : null;
|
|
1412
1432
|
const width = computeKeyboardResizedColumnWidth({
|
|
1413
1433
|
key: event.key,
|
|
1414
1434
|
shiftKey: event.shiftKey,
|
|
1415
|
-
currentWidth: this.renderedColumnWidth(columnId),
|
|
1435
|
+
currentWidth: declaredPixels ?? this.renderedColumnWidth(columnId),
|
|
1416
1436
|
minimumWidth: this.minimumColumnWidth(columnId),
|
|
1417
1437
|
rtl: getComputedStyle(this).direction === "rtl",
|
|
1418
1438
|
});
|
|
@@ -1576,6 +1596,7 @@ export class VioletDataGrid extends FASTElement {
|
|
|
1576
1596
|
return;
|
|
1577
1597
|
}
|
|
1578
1598
|
this.editAnnouncement = "";
|
|
1599
|
+
this.fillAnnouncement = "";
|
|
1579
1600
|
this.setActiveCell({ rowId, columnId }, { extendRange });
|
|
1580
1601
|
this.getScrollContainer()?.focus({ preventScroll: true });
|
|
1581
1602
|
}
|
|
@@ -2032,6 +2053,28 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2032
2053
|
* @returns The emitted `cell-fill` detail, or `null` when nothing was filled.
|
|
2033
2054
|
*/
|
|
2034
2055
|
fillSelection(direction, count = 1) {
|
|
2056
|
+
const ranges = this.fillSelectionRanges(direction, count);
|
|
2057
|
+
const detail = ranges ? this.fillDetailFor(ranges.source, ranges.target) : null;
|
|
2058
|
+
if (detail) {
|
|
2059
|
+
this.$emit("cell-fill", detail);
|
|
2060
|
+
this.cellSelection = this.createCellSelection(detail.target.anchor, detail.target.focus);
|
|
2061
|
+
}
|
|
2062
|
+
return detail;
|
|
2063
|
+
}
|
|
2064
|
+
canFillSelection(direction) {
|
|
2065
|
+
return this.fillSelectionRanges(direction, 1) !== null;
|
|
2066
|
+
}
|
|
2067
|
+
handleFillAction(direction) {
|
|
2068
|
+
const detail = this.fillSelection(direction);
|
|
2069
|
+
if (detail) {
|
|
2070
|
+
const end = this.cellIndicesFor(detail.target.focus);
|
|
2071
|
+
const destination = end
|
|
2072
|
+
? `row ${end.rowIndex + 1}, column ${this.presentedColumns[end.columnIndex]?.label ?? detail.target.focus.columnId}`
|
|
2073
|
+
: `row ${detail.target.focus.rowId}, column ${detail.target.focus.columnId}`;
|
|
2074
|
+
this.fillAnnouncement = `Filled ${detail.changes.length} cell${detail.changes.length === 1 ? "" : "s"} ${direction}. Selection ends at ${destination}.`;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
fillSelectionRanges(direction, count) {
|
|
2035
2078
|
if (this.focusMode !== "cell" || this.editingCell) {
|
|
2036
2079
|
return null;
|
|
2037
2080
|
}
|
|
@@ -2058,12 +2101,12 @@ export class VioletDataGrid extends FASTElement {
|
|
|
2058
2101
|
if (!target) {
|
|
2059
2102
|
return null;
|
|
2060
2103
|
}
|
|
2061
|
-
const
|
|
2062
|
-
if (
|
|
2063
|
-
|
|
2104
|
+
const targetBounds = this.boundsForRange(target);
|
|
2105
|
+
if (!targetBounds || (targetBounds.rowStart === sourceBounds.rowStart && targetBounds.rowEnd === sourceBounds.rowEnd &&
|
|
2106
|
+
targetBounds.columnStart === sourceBounds.columnStart && targetBounds.columnEnd === sourceBounds.columnEnd)) {
|
|
2107
|
+
return null;
|
|
2064
2108
|
}
|
|
2065
|
-
|
|
2066
|
-
return detail;
|
|
2109
|
+
return { source, target };
|
|
2067
2110
|
}
|
|
2068
2111
|
currentEditingSession() {
|
|
2069
2112
|
if (!this.editingCell) {
|
|
@@ -2978,6 +3021,7 @@ observable(VioletDataGrid.prototype, "editingValue");
|
|
|
2978
3021
|
observable(VioletDataGrid.prototype, "editingError");
|
|
2979
3022
|
observable(VioletDataGrid.prototype, "editAnnouncement");
|
|
2980
3023
|
observable(VioletDataGrid.prototype, "fillPreview");
|
|
3024
|
+
observable(VioletDataGrid.prototype, "fillAnnouncement");
|
|
2981
3025
|
observable(VioletDataGrid.prototype, "estimatedRowHeight");
|
|
2982
3026
|
observable(VioletDataGrid.prototype, "overscanCount");
|
|
2983
3027
|
observable(VioletDataGrid.prototype, "virtualPaddingStart");
|