@lushly-dev/violet-elements 0.0.0-stage → 0.2.0-preview.1
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/LICENSE +21 -0
- package/README.md +262 -2
- package/custom-elements.json +42309 -0
- package/dist/accordion/violet-accordion.d.ts +24 -0
- package/dist/accordion/violet-accordion.js +133 -0
- package/dist/accordion/violet-accordion.js.map +1 -0
- package/dist/accordion-item/violet-accordion-item.d.ts +27 -0
- package/dist/accordion-item/violet-accordion-item.js +228 -0
- package/dist/accordion-item/violet-accordion-item.js.map +1 -0
- package/dist/alert/violet-alert.d.ts +44 -0
- package/dist/alert/violet-alert.js +346 -0
- package/dist/alert/violet-alert.js.map +1 -0
- package/dist/badge/violet-badge.d.ts +27 -0
- package/dist/badge/violet-badge.js +179 -0
- package/dist/badge/violet-badge.js.map +1 -0
- package/dist/breadcrumb/violet-breadcrumb.d.ts +20 -0
- package/dist/breadcrumb/violet-breadcrumb.js +88 -0
- package/dist/breadcrumb/violet-breadcrumb.js.map +1 -0
- package/dist/breadcrumb-item/violet-breadcrumb-item.d.ts +20 -0
- package/dist/breadcrumb-item/violet-breadcrumb-item.js +130 -0
- package/dist/breadcrumb-item/violet-breadcrumb-item.js.map +1 -0
- package/dist/button/violet-button.d.ts +76 -0
- package/dist/button/violet-button.js +281 -0
- package/dist/button/violet-button.js.map +1 -0
- package/dist/calendar/violet-calendar.d.ts +59 -0
- package/dist/calendar/violet-calendar.js +485 -0
- package/dist/calendar/violet-calendar.js.map +1 -0
- package/dist/card/violet-card.d.ts +30 -0
- package/dist/card/violet-card.js +249 -0
- package/dist/card/violet-card.js.map +1 -0
- package/dist/carousel/violet-carousel.d.ts +56 -0
- package/dist/carousel/violet-carousel.js +600 -0
- package/dist/carousel/violet-carousel.js.map +1 -0
- package/dist/checkbox/violet-checkbox.d.ts +82 -0
- package/dist/checkbox/violet-checkbox.js +465 -0
- package/dist/checkbox/violet-checkbox.js.map +1 -0
- package/dist/color-picker/violet-color-picker.d.ts +111 -0
- package/dist/color-picker/violet-color-picker.js +997 -0
- package/dist/color-picker/violet-color-picker.js.map +1 -0
- package/dist/color-picker/violet-color-utils.d.ts +21 -0
- package/dist/color-picker/violet-color-utils.js +126 -0
- package/dist/color-picker/violet-color-utils.js.map +1 -0
- package/dist/color-swatch/violet-color-swatch.d.ts +19 -0
- package/dist/color-swatch/violet-color-swatch.js +93 -0
- package/dist/color-swatch/violet-color-swatch.js.map +1 -0
- package/dist/combobox/violet-combobox.d.ts +86 -0
- package/dist/combobox/violet-combobox.js +669 -0
- package/dist/combobox/violet-combobox.js.map +1 -0
- package/dist/conversation/violet-approval-card.d.ts +34 -0
- package/dist/conversation/violet-approval-card.js +289 -0
- package/dist/conversation/violet-approval-card.js.map +1 -0
- package/dist/conversation/violet-chat-composer.d.ts +47 -0
- package/dist/conversation/violet-chat-composer.js +308 -0
- package/dist/conversation/violet-chat-composer.js.map +1 -0
- package/dist/conversation/violet-chat-suggestions.d.ts +21 -0
- package/dist/conversation/violet-chat-suggestions.js +159 -0
- package/dist/conversation/violet-chat-suggestions.js.map +1 -0
- package/dist/conversation/violet-conversation-thread.d.ts +26 -0
- package/dist/conversation/violet-conversation-thread.js +207 -0
- package/dist/conversation/violet-conversation-thread.js.map +1 -0
- package/dist/conversation/violet-message-media.d.ts +38 -0
- package/dist/conversation/violet-message-media.js +230 -0
- package/dist/conversation/violet-message-media.js.map +1 -0
- package/dist/conversation/violet-message-status.d.ts +17 -0
- package/dist/conversation/violet-message-status.js +168 -0
- package/dist/conversation/violet-message-status.js.map +1 -0
- package/dist/conversation/violet-message-text.d.ts +15 -0
- package/dist/conversation/violet-message-text.js +83 -0
- package/dist/conversation/violet-message-text.js.map +1 -0
- package/dist/conversation/violet-message.d.ts +28 -0
- package/dist/conversation/violet-message.js +189 -0
- package/dist/conversation/violet-message.js.map +1 -0
- package/dist/conversation/violet-reasoning-block.d.ts +22 -0
- package/dist/conversation/violet-reasoning-block.js +171 -0
- package/dist/conversation/violet-reasoning-block.js.map +1 -0
- package/dist/conversation/violet-source-citation.d.ts +25 -0
- package/dist/conversation/violet-source-citation.js +155 -0
- package/dist/conversation/violet-source-citation.js.map +1 -0
- package/dist/conversation/violet-tool-call-card.d.ts +37 -0
- package/dist/conversation/violet-tool-call-card.js +370 -0
- package/dist/conversation/violet-tool-call-card.js.map +1 -0
- package/dist/conversation/violet-tool-result-card.d.ts +27 -0
- package/dist/conversation/violet-tool-result-card.js +264 -0
- package/dist/conversation/violet-tool-result-card.js.map +1 -0
- package/dist/data-grid/violet-data-grid-attachment-cell-values.d.ts +15 -0
- package/dist/data-grid/violet-data-grid-attachment-cell-values.js +122 -0
- package/dist/data-grid/violet-data-grid-attachment-cell-values.js.map +1 -0
- package/dist/data-grid/violet-data-grid-attachment-cell.d.ts +79 -0
- package/dist/data-grid/violet-data-grid-attachment-cell.js +812 -0
- package/dist/data-grid/violet-data-grid-attachment-cell.js.map +1 -0
- package/dist/data-grid/violet-data-grid-cell-state.d.ts +20 -0
- package/dist/data-grid/violet-data-grid-cell-state.js +68 -0
- package/dist/data-grid/violet-data-grid-cell-state.js.map +1 -0
- package/dist/data-grid/violet-data-grid-cell-templates.d.ts +28 -0
- package/dist/data-grid/violet-data-grid-cell-templates.js +36 -0
- package/dist/data-grid/violet-data-grid-cell-templates.js.map +1 -0
- package/dist/data-grid/violet-data-grid-clipboard.d.ts +44 -0
- package/dist/data-grid/violet-data-grid-clipboard.js +127 -0
- package/dist/data-grid/violet-data-grid-clipboard.js.map +1 -0
- package/dist/data-grid/violet-data-grid-css.d.ts +7 -0
- package/dist/data-grid/violet-data-grid-css.js +20 -0
- package/dist/data-grid/violet-data-grid-css.js.map +1 -0
- package/dist/data-grid/violet-data-grid-data.d.ts +34 -0
- package/dist/data-grid/violet-data-grid-data.js +93 -0
- package/dist/data-grid/violet-data-grid-data.js.map +1 -0
- package/dist/data-grid/violet-data-grid-editing.d.ts +46 -0
- package/dist/data-grid/violet-data-grid-editing.js +75 -0
- package/dist/data-grid/violet-data-grid-editing.js.map +1 -0
- package/dist/data-grid/violet-data-grid-editor-option-helpers.d.ts +10 -0
- package/dist/data-grid/violet-data-grid-editor-option-helpers.js +84 -0
- package/dist/data-grid/violet-data-grid-editor-option-helpers.js.map +1 -0
- package/dist/data-grid/violet-data-grid-events.d.ts +4 -0
- package/dist/data-grid/violet-data-grid-events.js +46 -0
- package/dist/data-grid/violet-data-grid-events.js.map +1 -0
- package/dist/data-grid/violet-data-grid-fill.d.ts +37 -0
- package/dist/data-grid/violet-data-grid-fill.js +155 -0
- package/dist/data-grid/violet-data-grid-fill.js.map +1 -0
- package/dist/data-grid/violet-data-grid-geometry.d.ts +13 -0
- package/dist/data-grid/violet-data-grid-geometry.js +59 -0
- package/dist/data-grid/violet-data-grid-geometry.js.map +1 -0
- package/dist/data-grid/violet-data-grid-multi-picker-values.d.ts +3 -0
- package/dist/data-grid/violet-data-grid-multi-picker-values.js +40 -0
- package/dist/data-grid/violet-data-grid-multi-picker-values.js.map +1 -0
- package/dist/data-grid/violet-data-grid-multi-picker.d.ts +87 -0
- package/dist/data-grid/violet-data-grid-multi-picker.js +789 -0
- package/dist/data-grid/violet-data-grid-multi-picker.js.map +1 -0
- package/dist/data-grid/violet-data-grid-navigation.d.ts +29 -0
- package/dist/data-grid/violet-data-grid-navigation.js +63 -0
- package/dist/data-grid/violet-data-grid-navigation.js.map +1 -0
- package/dist/data-grid/violet-data-grid-persona-picker-values.d.ts +3 -0
- package/dist/data-grid/violet-data-grid-persona-picker-values.js +40 -0
- package/dist/data-grid/violet-data-grid-persona-picker-values.js.map +1 -0
- package/dist/data-grid/violet-data-grid-persona-picker.d.ts +86 -0
- package/dist/data-grid/violet-data-grid-persona-picker.js +840 -0
- package/dist/data-grid/violet-data-grid-persona-picker.js.map +1 -0
- package/dist/data-grid/violet-data-grid-pill-select.d.ts +65 -0
- package/dist/data-grid/violet-data-grid-pill-select.js +635 -0
- package/dist/data-grid/violet-data-grid-pill-select.js.map +1 -0
- package/dist/data-grid/violet-data-grid-pointer.d.ts +17 -0
- package/dist/data-grid/violet-data-grid-pointer.js +45 -0
- package/dist/data-grid/violet-data-grid-pointer.js.map +1 -0
- package/dist/data-grid/violet-data-grid-presentation.d.ts +142 -0
- package/dist/data-grid/violet-data-grid-presentation.js +152 -0
- package/dist/data-grid/violet-data-grid-presentation.js.map +1 -0
- package/dist/data-grid/violet-data-grid-rating-values.d.ts +3 -0
- package/dist/data-grid/violet-data-grid-rating-values.js +30 -0
- package/dist/data-grid/violet-data-grid-rating-values.js.map +1 -0
- package/dist/data-grid/violet-data-grid-rating.d.ts +39 -0
- package/dist/data-grid/violet-data-grid-rating.js +346 -0
- package/dist/data-grid/violet-data-grid-rating.js.map +1 -0
- package/dist/data-grid/violet-data-grid-reference-picker-values.d.ts +3 -0
- package/dist/data-grid/violet-data-grid-reference-picker-values.js +40 -0
- package/dist/data-grid/violet-data-grid-reference-picker-values.js.map +1 -0
- package/dist/data-grid/violet-data-grid-reference-picker.d.ts +98 -0
- package/dist/data-grid/violet-data-grid-reference-picker.js +933 -0
- package/dist/data-grid/violet-data-grid-reference-picker.js.map +1 -0
- package/dist/data-grid/violet-data-grid-resize.d.ts +36 -0
- package/dist/data-grid/violet-data-grid-resize.js +47 -0
- package/dist/data-grid/violet-data-grid-resize.js.map +1 -0
- package/dist/data-grid/violet-data-grid-selection.d.ts +27 -0
- package/dist/data-grid/violet-data-grid-selection.js +88 -0
- package/dist/data-grid/violet-data-grid-selection.js.map +1 -0
- package/dist/data-grid/violet-data-grid-sizing.d.ts +38 -0
- package/dist/data-grid/violet-data-grid-sizing.js +82 -0
- package/dist/data-grid/violet-data-grid-sizing.js.map +1 -0
- package/dist/data-grid/violet-data-grid-targets.d.ts +5 -0
- package/dist/data-grid/violet-data-grid-targets.js +41 -0
- package/dist/data-grid/violet-data-grid-targets.js.map +1 -0
- package/dist/data-grid/violet-data-grid-values.d.ts +19 -0
- package/dist/data-grid/violet-data-grid-values.js +60 -0
- package/dist/data-grid/violet-data-grid-values.js.map +1 -0
- package/dist/data-grid/violet-data-grid-virtualization.d.ts +31 -0
- package/dist/data-grid/violet-data-grid-virtualization.js +41 -0
- package/dist/data-grid/violet-data-grid-virtualization.js.map +1 -0
- package/dist/data-grid/violet-data-grid.d.ts +590 -0
- package/dist/data-grid/violet-data-grid.js +2998 -0
- package/dist/data-grid/violet-data-grid.js.map +1 -0
- package/dist/data-grid/violet-data-grid.styles.d.ts +1 -0
- package/dist/data-grid/violet-data-grid.styles.js +638 -0
- package/dist/data-grid/violet-data-grid.styles.js.map +1 -0
- package/dist/date-picker/violet-date-picker.d.ts +90 -0
- package/dist/date-picker/violet-date-picker.js +624 -0
- package/dist/date-picker/violet-date-picker.js.map +1 -0
- package/dist/date-range-picker/violet-date-range-picker.d.ts +64 -0
- package/dist/date-range-picker/violet-date-range-picker.js +470 -0
- package/dist/date-range-picker/violet-date-range-picker.js.map +1 -0
- package/dist/date-time/violet-date-utils.d.ts +50 -0
- package/dist/date-time/violet-date-utils.js +176 -0
- package/dist/date-time/violet-date-utils.js.map +1 -0
- package/dist/dialog/violet-dialog.d.ts +53 -0
- package/dist/dialog/violet-dialog.js +439 -0
- package/dist/dialog/violet-dialog.js.map +1 -0
- package/dist/divider/violet-divider.d.ts +15 -0
- package/dist/divider/violet-divider.js +88 -0
- package/dist/divider/violet-divider.js.map +1 -0
- package/dist/empty-state/violet-empty-state.d.ts +31 -0
- package/dist/empty-state/violet-empty-state.js +182 -0
- package/dist/empty-state/violet-empty-state.js.map +1 -0
- package/dist/file-explorer/violet-file-explorer.d.ts +164 -0
- package/dist/file-explorer/violet-file-explorer.js +1094 -0
- package/dist/file-explorer/violet-file-explorer.js.map +1 -0
- package/dist/file-upload/violet-file-upload.d.ts +109 -0
- package/dist/file-upload/violet-file-upload.js +950 -0
- package/dist/file-upload/violet-file-upload.js.map +1 -0
- package/dist/foundations/reference-component-set.d.ts +9 -0
- package/dist/foundations/reference-component-set.js +107 -0
- package/dist/foundations/reference-component-set.js.map +1 -0
- package/dist/foundations/token-registry.d.ts +38 -0
- package/dist/foundations/token-registry.js +203 -0
- package/dist/foundations/token-registry.js.map +1 -0
- package/dist/foundations/violet-direction.d.ts +11 -0
- package/dist/foundations/violet-direction.js +22 -0
- package/dist/foundations/violet-direction.js.map +1 -0
- package/dist/foundations/violet-form-disabled.d.ts +25 -0
- package/dist/foundations/violet-form-disabled.js +79 -0
- package/dist/foundations/violet-form-disabled.js.map +1 -0
- package/dist/foundations/violet-safe-url.d.ts +8 -0
- package/dist/foundations/violet-safe-url.js +21 -0
- package/dist/foundations/violet-safe-url.js.map +1 -0
- package/dist/gantt/violet-gantt-geometry.d.ts +18 -0
- package/dist/gantt/violet-gantt-geometry.js +78 -0
- package/dist/gantt/violet-gantt-geometry.js.map +1 -0
- package/dist/gantt/violet-gantt.d.ts +239 -0
- package/dist/gantt/violet-gantt.js +1627 -0
- package/dist/gantt/violet-gantt.js.map +1 -0
- package/dist/gantt/violet-gantt.styles.d.ts +1 -0
- package/dist/gantt/violet-gantt.styles.js +580 -0
- package/dist/gantt/violet-gantt.styles.js.map +1 -0
- package/dist/icon/generated/icon-sources.d.ts +9 -0
- package/dist/icon/generated/icon-sources.js +15 -0
- package/dist/icon/generated/icon-sources.js.map +1 -0
- package/dist/icon/generated/icons/system-arrow-up.d.ts +8 -0
- package/dist/icon/generated/icons/system-arrow-up.js +15 -0
- package/dist/icon/generated/icons/system-arrow-up.js.map +1 -0
- package/dist/icon/generated/icons/system-attach.d.ts +8 -0
- package/dist/icon/generated/icons/system-attach.js +15 -0
- package/dist/icon/generated/icons/system-attach.js.map +1 -0
- package/dist/icon/generated/icons/system-calendar.d.ts +8 -0
- package/dist/icon/generated/icons/system-calendar.js +15 -0
- package/dist/icon/generated/icons/system-calendar.js.map +1 -0
- package/dist/icon/generated/icons/system-checkmark.d.ts +8 -0
- package/dist/icon/generated/icons/system-checkmark.js +15 -0
- package/dist/icon/generated/icons/system-checkmark.js.map +1 -0
- package/dist/icon/generated/icons/system-chevron-right.d.ts +8 -0
- package/dist/icon/generated/icons/system-chevron-right.js +15 -0
- package/dist/icon/generated/icons/system-chevron-right.js.map +1 -0
- package/dist/icon/generated/icons/system-clock.d.ts +8 -0
- package/dist/icon/generated/icons/system-clock.js +15 -0
- package/dist/icon/generated/icons/system-clock.js.map +1 -0
- package/dist/icon/generated/icons/system-close.d.ts +8 -0
- package/dist/icon/generated/icons/system-close.js +15 -0
- package/dist/icon/generated/icons/system-close.js.map +1 -0
- package/dist/icon/generated/icons/system-dismiss.d.ts +8 -0
- package/dist/icon/generated/icons/system-dismiss.js +15 -0
- package/dist/icon/generated/icons/system-dismiss.js.map +1 -0
- package/dist/icon/generated/icons/system-document.d.ts +8 -0
- package/dist/icon/generated/icons/system-document.js +15 -0
- package/dist/icon/generated/icons/system-document.js.map +1 -0
- package/dist/icon/generated/icons/system-folder.d.ts +8 -0
- package/dist/icon/generated/icons/system-folder.js +15 -0
- package/dist/icon/generated/icons/system-folder.js.map +1 -0
- package/dist/icon/generated/icons/system-search.d.ts +8 -0
- package/dist/icon/generated/icons/system-search.js +15 -0
- package/dist/icon/generated/icons/system-search.js.map +1 -0
- package/dist/icon/generated/icons/system-settings.d.ts +8 -0
- package/dist/icon/generated/icons/system-settings.js +15 -0
- package/dist/icon/generated/icons/system-settings.js.map +1 -0
- package/dist/icon/generated/icons/system-sort-ascending.d.ts +8 -0
- package/dist/icon/generated/icons/system-sort-ascending.js +15 -0
- package/dist/icon/generated/icons/system-sort-ascending.js.map +1 -0
- package/dist/icon/generated/icons/system-sort-descending.d.ts +8 -0
- package/dist/icon/generated/icons/system-sort-descending.js +15 -0
- package/dist/icon/generated/icons/system-sort-descending.js.map +1 -0
- package/dist/icon/generated/icons/system-stop.d.ts +8 -0
- package/dist/icon/generated/icons/system-stop.js +15 -0
- package/dist/icon/generated/icons/system-stop.js.map +1 -0
- package/dist/icon/generated/icons/system-warning.d.ts +8 -0
- package/dist/icon/generated/icons/system-warning.js +15 -0
- package/dist/icon/generated/icons/system-warning.js.map +1 -0
- package/dist/icon/generated/index.d.ts +17 -0
- package/dist/icon/generated/index.js +22 -0
- package/dist/icon/generated/index.js.map +1 -0
- package/dist/icon/icon-registry.d.ts +20 -0
- package/dist/icon/icon-registry.js +22 -0
- package/dist/icon/icon-registry.js.map +1 -0
- package/dist/icon/violet-icon.d.ts +22 -0
- package/dist/icon/violet-icon.js +75 -0
- package/dist/icon/violet-icon.js.map +1 -0
- package/dist/icon-button/violet-icon-button.d.ts +29 -0
- package/dist/icon-button/violet-icon-button.js +193 -0
- package/dist/icon-button/violet-icon-button.js.map +1 -0
- package/dist/image/violet-image.d.ts +33 -0
- package/dist/image/violet-image.js +215 -0
- package/dist/image/violet-image.js.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -0
- package/dist/listbox/violet-listbox.d.ts +41 -0
- package/dist/listbox/violet-listbox.js +323 -0
- package/dist/listbox/violet-listbox.js.map +1 -0
- package/dist/listbox/violet-selection-helpers.d.ts +9 -0
- package/dist/listbox/violet-selection-helpers.js +52 -0
- package/dist/listbox/violet-selection-helpers.js.map +1 -0
- package/dist/menu/violet-menu-item.d.ts +30 -0
- package/dist/menu/violet-menu-item.js +148 -0
- package/dist/menu/violet-menu-item.js.map +1 -0
- package/dist/menu/violet-menu.d.ts +70 -0
- package/dist/menu/violet-menu.js +480 -0
- package/dist/menu/violet-menu.js.map +1 -0
- package/dist/option/violet-option.d.ts +38 -0
- package/dist/option/violet-option.js +258 -0
- package/dist/option/violet-option.js.map +1 -0
- package/dist/option-group/violet-option-group.d.ts +20 -0
- package/dist/option-group/violet-option-group.js +100 -0
- package/dist/option-group/violet-option-group.js.map +1 -0
- package/dist/pagination/violet-pagination.d.ts +36 -0
- package/dist/pagination/violet-pagination.js +356 -0
- package/dist/pagination/violet-pagination.js.map +1 -0
- package/dist/persona/violet-persona.d.ts +28 -0
- package/dist/persona/violet-persona.js +250 -0
- package/dist/persona/violet-persona.js.map +1 -0
- package/dist/popover/violet-popover.d.ts +32 -0
- package/dist/popover/violet-popover.js +225 -0
- package/dist/popover/violet-popover.js.map +1 -0
- package/dist/progress/violet-progress.d.ts +22 -0
- package/dist/progress/violet-progress.js +197 -0
- package/dist/progress/violet-progress.js.map +1 -0
- package/dist/radio/violet-radio.d.ts +59 -0
- package/dist/radio/violet-radio.js +402 -0
- package/dist/radio/violet-radio.js.map +1 -0
- package/dist/radio-group/violet-radio-group.d.ts +89 -0
- package/dist/radio-group/violet-radio-group.js +388 -0
- package/dist/radio-group/violet-radio-group.js.map +1 -0
- package/dist/segment/violet-segment.d.ts +29 -0
- package/dist/segment/violet-segment.js +166 -0
- package/dist/segment/violet-segment.js.map +1 -0
- package/dist/segmented-control/violet-segmented-control.d.ts +64 -0
- package/dist/segmented-control/violet-segmented-control.js +349 -0
- package/dist/segmented-control/violet-segmented-control.js.map +1 -0
- package/dist/select/violet-select.d.ts +84 -0
- package/dist/select/violet-select.js +690 -0
- package/dist/select/violet-select.js.map +1 -0
- package/dist/skeleton/violet-skeleton.d.ts +18 -0
- package/dist/skeleton/violet-skeleton.js +150 -0
- package/dist/skeleton/violet-skeleton.js.map +1 -0
- package/dist/slider/violet-range-slider.d.ts +96 -0
- package/dist/slider/violet-range-slider.js +833 -0
- package/dist/slider/violet-range-slider.js.map +1 -0
- package/dist/slider/violet-slider.d.ts +80 -0
- package/dist/slider/violet-slider.js +666 -0
- package/dist/slider/violet-slider.js.map +1 -0
- package/dist/snackbar/violet-snackbar.d.ts +39 -0
- package/dist/snackbar/violet-snackbar.js +310 -0
- package/dist/snackbar/violet-snackbar.js.map +1 -0
- package/dist/spinner/violet-spinner.d.ts +15 -0
- package/dist/spinner/violet-spinner.js +99 -0
- package/dist/spinner/violet-spinner.js.map +1 -0
- package/dist/switch/violet-switch.d.ts +59 -0
- package/dist/switch/violet-switch.js +459 -0
- package/dist/switch/violet-switch.js.map +1 -0
- package/dist/tab/violet-tab.d.ts +23 -0
- package/dist/tab/violet-tab.js +245 -0
- package/dist/tab/violet-tab.js.map +1 -0
- package/dist/tab-panel/violet-tab-panel.d.ts +10 -0
- package/dist/tab-panel/violet-tab-panel.js +46 -0
- package/dist/tab-panel/violet-tab-panel.js.map +1 -0
- package/dist/tabs/violet-tabs.d.ts +48 -0
- package/dist/tabs/violet-tabs.js +398 -0
- package/dist/tabs/violet-tabs.js.map +1 -0
- package/dist/teaching-tip/violet-teaching-tip.d.ts +48 -0
- package/dist/teaching-tip/violet-teaching-tip.js +418 -0
- package/dist/teaching-tip/violet-teaching-tip.js.map +1 -0
- package/dist/text/violet-text.d.ts +18 -0
- package/dist/text/violet-text.js +128 -0
- package/dist/text/violet-text.js.map +1 -0
- package/dist/text-area/violet-text-area.d.ts +93 -0
- package/dist/text-area/violet-text-area.js +323 -0
- package/dist/text-area/violet-text-area.js.map +1 -0
- package/dist/text-field/violet-text-field.d.ts +132 -0
- package/dist/text-field/violet-text-field.js +445 -0
- package/dist/text-field/violet-text-field.js.map +1 -0
- package/dist/theme/generated/violet-theme-presets.generated.d.ts +9 -0
- package/dist/theme/generated/violet-theme-presets.generated.js +9 -0
- package/dist/theme/generated/violet-theme-presets.generated.js.map +1 -0
- package/dist/theme/generated/violet-theme.generated.d.ts +1048 -0
- package/dist/theme/generated/violet-theme.generated.js +362 -0
- package/dist/theme/generated/violet-theme.generated.js.map +1 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +7 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/violet-theme-builtin.d.ts +14 -0
- package/dist/theme/violet-theme-builtin.js +19 -0
- package/dist/theme/violet-theme-builtin.js.map +1 -0
- package/dist/theme/violet-theme-css.d.ts +77 -0
- package/dist/theme/violet-theme-css.js +154 -0
- package/dist/theme/violet-theme-css.js.map +1 -0
- package/dist/theme/violet-theme-runtime.d.ts +72 -0
- package/dist/theme/violet-theme-runtime.js +221 -0
- package/dist/theme/violet-theme-runtime.js.map +1 -0
- package/dist/theme/violet-theme.d.ts +22 -0
- package/dist/theme/violet-theme.js +60 -0
- package/dist/theme/violet-theme.js.map +1 -0
- package/dist/theme/violet-token-defaults.d.ts +4 -0
- package/dist/theme/violet-token-defaults.js +198 -0
- package/dist/theme/violet-token-defaults.js.map +1 -0
- package/dist/time-picker/violet-time-picker.d.ts +59 -0
- package/dist/time-picker/violet-time-picker.js +369 -0
- package/dist/time-picker/violet-time-picker.js.map +1 -0
- package/dist/toast/violet-toast.d.ts +50 -0
- package/dist/toast/violet-toast.js +395 -0
- package/dist/toast/violet-toast.js.map +1 -0
- package/dist/tooltip/violet-tooltip.d.ts +34 -0
- package/dist/tooltip/violet-tooltip.js +387 -0
- package/dist/tooltip/violet-tooltip.js.map +1 -0
- package/dist/tree/violet-tree.d.ts +44 -0
- package/dist/tree/violet-tree.js +451 -0
- package/dist/tree/violet-tree.js.map +1 -0
- package/dist/tree-item/violet-tree-item.d.ts +49 -0
- package/dist/tree-item/violet-tree-item.js +359 -0
- package/dist/tree-item/violet-tree-item.js.map +1 -0
- package/package.json +78 -3
- package/tokens/interface.json +364 -0
- package/tokens/master-semantic.tokens.jsonc +7 -0
- package/tokens/raw-palette.proposal.jsonc +159 -0
- package/tokens/theme-presets.jsonc +7 -0
- package/tokens/violet-theme.export.json +1392 -0
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
import { attr, css, FASTElement, html, observable, repeat, Updates, when, } from "@lushly-dev/fast-element";
|
|
2
|
+
import { registerSystemDismissIcon } from "../icon/generated/icons/system-dismiss";
|
|
3
|
+
import { registerSystemDocumentIcon } from "../icon/generated/icons/system-document";
|
|
4
|
+
import "../file-upload/violet-file-upload";
|
|
5
|
+
import "../icon-button/violet-icon-button";
|
|
6
|
+
import "../icon/violet-icon";
|
|
7
|
+
import "../image/violet-image";
|
|
8
|
+
import { violetFieldTokenDefaults } from "../theme/violet-token-defaults";
|
|
9
|
+
import { attachmentItemsFromFiles, clearOwnedAttachmentPreview, getOwnedAttachmentPreviewUrl, isImageAttachment, normalizeAttachmentItems, parseAttachmentCellValue, serializeAttachmentCellValue, } from "./violet-data-grid-attachment-cell-values";
|
|
10
|
+
let violetDataGridAttachmentCellInstanceCount = 0;
|
|
11
|
+
const MAX_VISIBLE_ATTACHMENTS = 2;
|
|
12
|
+
registerSystemDocumentIcon();
|
|
13
|
+
registerSystemDismissIcon();
|
|
14
|
+
function isImageFallbackAttachment(item) {
|
|
15
|
+
return item.kind === "image" && !isImageAttachment(item);
|
|
16
|
+
}
|
|
17
|
+
const styles = css `
|
|
18
|
+
${violetFieldTokenDefaults}
|
|
19
|
+
|
|
20
|
+
:host {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: inline-grid;
|
|
23
|
+
inline-size: fit-content;
|
|
24
|
+
min-inline-size: 0;
|
|
25
|
+
max-inline-size: 100%;
|
|
26
|
+
color: var(--_text-primary);
|
|
27
|
+
font-family: var(--violet-data-grid-font-family, var(--font-family-body, "Montserrat", "Segoe UI", sans-serif));
|
|
28
|
+
|
|
29
|
+
--_surface-page: var(--color-surface-page, #fffefa);
|
|
30
|
+
--_surface-floating: var(--color-surface-floating, #f0efe6);
|
|
31
|
+
--_surface-subtle: var(--color-surface-subtle, #f0efe6);
|
|
32
|
+
--_border-subtle: var(--color-border-subtle, rgba(28, 26, 13, 0.10));
|
|
33
|
+
--_border-strong: var(--color-border-strong, rgba(28, 26, 13, 0.48));
|
|
34
|
+
--_text-primary: var(--color-text-primary, #18181b);
|
|
35
|
+
--_text-secondary: var(--color-text-secondary, #414651);
|
|
36
|
+
--_text-muted: var(--color-text-muted, #616775);
|
|
37
|
+
--_focus-ring: var(--color-focus-ring, rgba(24, 24, 27, 0.5));
|
|
38
|
+
--_radius-md: var(--radius-md, 4px);
|
|
39
|
+
--_shadow-floating: var(--shadow-floating, 0 2px 5px rgba(28, 26, 13, 0.22), 0 18px 34px rgba(28, 26, 13, 0.08));
|
|
40
|
+
--_size-font-md: var(--size-font-md, 14px);
|
|
41
|
+
--_size-font-sm: var(--size-font-sm, 12px);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([disabled]) {
|
|
45
|
+
opacity: 0.7;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.root {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: grid;
|
|
51
|
+
inline-size: fit-content;
|
|
52
|
+
min-inline-size: 0;
|
|
53
|
+
max-inline-size: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.trigger {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: flex-start;
|
|
60
|
+
inline-size: fit-content;
|
|
61
|
+
min-inline-size: 0;
|
|
62
|
+
max-inline-size: 100%;
|
|
63
|
+
min-block-size: 1.75rem;
|
|
64
|
+
padding: 0;
|
|
65
|
+
border: none;
|
|
66
|
+
background: transparent;
|
|
67
|
+
color: inherit;
|
|
68
|
+
font: inherit;
|
|
69
|
+
text-align: start;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.trigger:focus-visible {
|
|
74
|
+
outline: 2px solid var(--_focus-ring);
|
|
75
|
+
outline-offset: 2px;
|
|
76
|
+
border-radius: var(--_radius-md);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.trigger:disabled {
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.selection {
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 0.5rem;
|
|
87
|
+
inline-size: fit-content;
|
|
88
|
+
min-inline-size: 0;
|
|
89
|
+
max-inline-size: 100%;
|
|
90
|
+
min-block-size: 1.5rem;
|
|
91
|
+
padding-inline: 0.25rem 0.5625rem;
|
|
92
|
+
border: 1px solid transparent;
|
|
93
|
+
border-radius: 999px;
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
font-size: 0.8125rem;
|
|
96
|
+
font-weight: 400;
|
|
97
|
+
line-height: 1.15;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.selection[data-empty="true"] {
|
|
101
|
+
background: var(--_surface-subtle);
|
|
102
|
+
border-color: color-mix(in srgb, var(--_border-subtle) 85%, transparent);
|
|
103
|
+
color: var(--_text-secondary);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.preview-stack {
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: 0.25rem;
|
|
110
|
+
min-inline-size: 0;
|
|
111
|
+
max-inline-size: 100%;
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
violet-image.preview-thumb {
|
|
116
|
+
inline-size: 1.625rem;
|
|
117
|
+
block-size: 1.625rem;
|
|
118
|
+
flex: 0 0 auto;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.preview-thumb-fallback {
|
|
122
|
+
inline-size: 1.625rem;
|
|
123
|
+
block-size: 1.625rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.file-chip,
|
|
127
|
+
.overflow-chip {
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: 0.3125rem;
|
|
131
|
+
min-inline-size: 0;
|
|
132
|
+
max-inline-size: 100%;
|
|
133
|
+
min-block-size: 1.5rem;
|
|
134
|
+
padding-inline: 0.625rem;
|
|
135
|
+
border: 1px solid color-mix(in srgb, var(--_border-subtle) 80%, transparent);
|
|
136
|
+
border-radius: 999px;
|
|
137
|
+
background: color-mix(in srgb, var(--_surface-subtle) 82%, white);
|
|
138
|
+
color: var(--_text-primary);
|
|
139
|
+
box-sizing: border-box;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.overflow-chip {
|
|
144
|
+
color: var(--_text-secondary);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.chip-label,
|
|
148
|
+
.placeholder,
|
|
149
|
+
.summary {
|
|
150
|
+
min-inline-size: 0;
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
text-overflow: ellipsis;
|
|
153
|
+
white-space: nowrap;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
violet-icon.file-icon {
|
|
157
|
+
--violet-icon-size: 0.875rem;
|
|
158
|
+
color: var(--_text-secondary);
|
|
159
|
+
flex: 0 0 auto;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.preview-thumb-fallback,
|
|
163
|
+
.row-thumb-fallback {
|
|
164
|
+
display: inline-flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
flex: 0 0 auto;
|
|
168
|
+
border-radius: calc(var(--_radius-md) - 2px);
|
|
169
|
+
background: color-mix(in srgb, var(--_surface-subtle) 90%, white);
|
|
170
|
+
color: var(--_text-secondary);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
violet-icon.preview-icon {
|
|
174
|
+
--violet-icon-size: 0.9375rem;
|
|
175
|
+
flex: 0 0 auto;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.caret {
|
|
179
|
+
inline-size: 0.375rem;
|
|
180
|
+
block-size: 0.375rem;
|
|
181
|
+
flex: 0 0 auto;
|
|
182
|
+
margin-inline-start: 0.0625rem;
|
|
183
|
+
border-inline-end: 1.25px solid currentColor;
|
|
184
|
+
border-block-end: 1.25px solid currentColor;
|
|
185
|
+
transform: translateY(-2.5px) rotate(45deg);
|
|
186
|
+
opacity: 0.78;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.panel {
|
|
190
|
+
position: fixed;
|
|
191
|
+
inset: unset;
|
|
192
|
+
margin: 0;
|
|
193
|
+
box-sizing: border-box;
|
|
194
|
+
z-index: var(--_layer-popover);
|
|
195
|
+
display: none;
|
|
196
|
+
gap: 0.625rem;
|
|
197
|
+
inline-size: min(22rem, calc(100vw - 16px));
|
|
198
|
+
max-block-size: calc(100vh - 16px);
|
|
199
|
+
overflow: auto;
|
|
200
|
+
min-inline-size: 0;
|
|
201
|
+
padding: 0.625rem;
|
|
202
|
+
border: 1px solid color-mix(in srgb, var(--_border-strong) 50%, transparent);
|
|
203
|
+
border-radius: var(--_radius-md);
|
|
204
|
+
background: var(--_surface-floating);
|
|
205
|
+
box-shadow: var(--_shadow-floating);
|
|
206
|
+
color: var(--_text-primary);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.panel:popover-open {
|
|
210
|
+
display: grid;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@media (forced-colors: active) {
|
|
214
|
+
.trigger:focus-visible,
|
|
215
|
+
.panel:focus-visible {
|
|
216
|
+
outline: 2px solid Highlight;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.panel {
|
|
220
|
+
border-color: CanvasText;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.selection-summary {
|
|
225
|
+
color: var(--_text-secondary);
|
|
226
|
+
font-size: var(--_size-font-sm);
|
|
227
|
+
line-height: 1.2;
|
|
228
|
+
padding-inline: 0.125rem;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.attachment-list {
|
|
232
|
+
display: grid;
|
|
233
|
+
gap: 0.5rem;
|
|
234
|
+
min-inline-size: 0;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.attachment-row {
|
|
238
|
+
display: grid;
|
|
239
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
240
|
+
align-items: center;
|
|
241
|
+
gap: 0.625rem;
|
|
242
|
+
padding: 0.5rem;
|
|
243
|
+
border: 1px solid color-mix(in srgb, var(--_border-subtle) 88%, transparent);
|
|
244
|
+
border-radius: calc(var(--_radius-md) - 2px);
|
|
245
|
+
background: color-mix(in srgb, var(--_surface-subtle) 42%, var(--_surface-page));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.attachment-preview {
|
|
249
|
+
inline-size: 2rem;
|
|
250
|
+
block-size: 2rem;
|
|
251
|
+
display: inline-flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
justify-content: center;
|
|
254
|
+
flex: 0 0 auto;
|
|
255
|
+
border-radius: calc(var(--_radius-md) - 2px);
|
|
256
|
+
background: color-mix(in srgb, var(--_surface-subtle) 90%, white);
|
|
257
|
+
overflow: hidden;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
violet-image.row-thumb {
|
|
261
|
+
inline-size: 2rem;
|
|
262
|
+
block-size: 2rem;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.row-thumb-fallback {
|
|
266
|
+
inline-size: 2rem;
|
|
267
|
+
block-size: 2rem;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.attachment-copy {
|
|
271
|
+
display: grid;
|
|
272
|
+
gap: 2px;
|
|
273
|
+
min-inline-size: 0;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.attachment-label {
|
|
277
|
+
margin: 0;
|
|
278
|
+
color: var(--_text-primary);
|
|
279
|
+
font-size: var(--_size-font-md);
|
|
280
|
+
line-height: 1.25;
|
|
281
|
+
font-weight: 500;
|
|
282
|
+
overflow: hidden;
|
|
283
|
+
text-overflow: ellipsis;
|
|
284
|
+
white-space: nowrap;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.attachment-meta {
|
|
288
|
+
margin: 0;
|
|
289
|
+
color: var(--_text-muted);
|
|
290
|
+
font-size: var(--_size-font-sm);
|
|
291
|
+
line-height: 1.25;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.remove-button {
|
|
295
|
+
align-self: center;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.add-upload {
|
|
299
|
+
min-inline-size: 0;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.add-upload::part(label),
|
|
303
|
+
.add-upload::part(selection),
|
|
304
|
+
.add-upload::part(supporting-text),
|
|
305
|
+
.add-upload::part(error-text),
|
|
306
|
+
.add-upload::part(button-copy) {
|
|
307
|
+
display: none;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.add-upload::part(surface) {
|
|
311
|
+
padding: 0;
|
|
312
|
+
border: none;
|
|
313
|
+
background: transparent;
|
|
314
|
+
box-shadow: none;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.add-upload::part(button-layout) {
|
|
318
|
+
min-block-size: auto;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.empty {
|
|
322
|
+
padding: 0.25rem 0.125rem;
|
|
323
|
+
color: var(--_text-secondary);
|
|
324
|
+
font-size: var(--_size-font-sm);
|
|
325
|
+
}
|
|
326
|
+
`;
|
|
327
|
+
// The trigger's thumbnail falls back to an icon, not to the image's fallback words, so the trigger
|
|
328
|
+
// shows no text that its name lacks (WCAG 2.5.3).
|
|
329
|
+
const template = html `
|
|
330
|
+
<div class="root" part="base">
|
|
331
|
+
<span id="trigger-label" hidden>${(x) => x.triggerLabel}</span>
|
|
332
|
+
<button
|
|
333
|
+
class="trigger"
|
|
334
|
+
type="button"
|
|
335
|
+
part="trigger"
|
|
336
|
+
?disabled="${(x) => x.disabled}"
|
|
337
|
+
aria-labelledby="${(x) => x.triggerLabelledBy}"
|
|
338
|
+
aria-haspopup="dialog"
|
|
339
|
+
aria-controls="${(x) => x.panelId}"
|
|
340
|
+
aria-expanded="${(x) => String(x.open)}"
|
|
341
|
+
@click="${(x) => (x.handleTriggerClick(), true)}"
|
|
342
|
+
>
|
|
343
|
+
<span class="selection" id="trigger-value" part="selection" data-empty="${(x) => String(x.attachments.length === 0)}">
|
|
344
|
+
<span class="preview-stack">
|
|
345
|
+
${when((x) => x.attachments.length === 0, html `
|
|
346
|
+
<span class="placeholder">${(x) => x.placeholder || "Add attachments"}</span>
|
|
347
|
+
`)}
|
|
348
|
+
${repeat((x) => x.visibleAttachments, html `
|
|
349
|
+
${when((x, c) => c.parent.isImageItem(x), html `
|
|
350
|
+
<violet-image
|
|
351
|
+
class="preview-thumb"
|
|
352
|
+
decorative
|
|
353
|
+
shape="rounded"
|
|
354
|
+
ratio="square"
|
|
355
|
+
fit="cover"
|
|
356
|
+
src="${(x) => x.previewSrc ?? ""}"
|
|
357
|
+
alt="${(x) => x.label}"
|
|
358
|
+
>
|
|
359
|
+
<violet-icon slot="fallback" class="preview-icon" icon="system/document" decorative></violet-icon>
|
|
360
|
+
</violet-image>
|
|
361
|
+
`)}
|
|
362
|
+
${when((x) => isImageFallbackAttachment(x), html `
|
|
363
|
+
<span class="preview-thumb-fallback" aria-hidden="true">
|
|
364
|
+
<violet-icon class="preview-icon" icon="system/document" decorative></violet-icon>
|
|
365
|
+
</span>
|
|
366
|
+
`)}
|
|
367
|
+
${when((x, c) => !c.parent.isImageItem(x) && !isImageFallbackAttachment(x), html `
|
|
368
|
+
<span class="file-chip">
|
|
369
|
+
<violet-icon class="file-icon" icon="system/document" decorative></violet-icon>
|
|
370
|
+
<span class="chip-label">${(x) => x.label}</span>
|
|
371
|
+
</span>
|
|
372
|
+
`)}
|
|
373
|
+
`)}
|
|
374
|
+
${when((x) => x.overflowCount > 0, html `
|
|
375
|
+
<span class="overflow-chip" part="overflow-pill">+${(x) => x.overflowCount}</span>
|
|
376
|
+
`)}
|
|
377
|
+
</span>
|
|
378
|
+
${when((x) => x.attachments.length > 0, html `
|
|
379
|
+
<span class="summary">${(x) => x.selectionLabel}</span>
|
|
380
|
+
`)}
|
|
381
|
+
<span class="caret" part="caret" aria-hidden="true"></span>
|
|
382
|
+
</span>
|
|
383
|
+
</button>
|
|
384
|
+
|
|
385
|
+
${when((x) => x.open, html `
|
|
386
|
+
<div
|
|
387
|
+
class="panel"
|
|
388
|
+
id="${(x) => x.panelId}"
|
|
389
|
+
part="panel"
|
|
390
|
+
popover="manual"
|
|
391
|
+
role="dialog"
|
|
392
|
+
tabindex="-1"
|
|
393
|
+
aria-label="${(x) => x.getAttribute("aria-label") || x.placeholder || "Attachments"}"
|
|
394
|
+
@toggle="${(x, c) => (x.handlePanelToggle(c.event), true)}"
|
|
395
|
+
@keydown="${(x, c) => (x.handlePanelKeydown(c.event), true)}"
|
|
396
|
+
>
|
|
397
|
+
<div class="selection-summary" part="selection-summary">${(x) => x.selectionSummary}</div>
|
|
398
|
+
${when((x) => x.attachments.length > 0, html `
|
|
399
|
+
<div class="attachment-list" part="attachment-list">
|
|
400
|
+
${repeat((x) => x.attachments, html `
|
|
401
|
+
<div class="attachment-row" part="attachment-row">
|
|
402
|
+
<span class="attachment-preview">
|
|
403
|
+
${when((x, c) => c.parent.isImageItem(x), html `
|
|
404
|
+
<violet-image
|
|
405
|
+
class="row-thumb"
|
|
406
|
+
decorative
|
|
407
|
+
shape="rounded"
|
|
408
|
+
ratio="square"
|
|
409
|
+
fit="cover"
|
|
410
|
+
src="${(x) => x.previewSrc ?? ""}"
|
|
411
|
+
alt="${(x) => x.label}"
|
|
412
|
+
></violet-image>
|
|
413
|
+
`)}
|
|
414
|
+
${when((x) => isImageFallbackAttachment(x), html `
|
|
415
|
+
<span class="row-thumb-fallback" aria-hidden="true">
|
|
416
|
+
<violet-icon class="preview-icon" icon="system/document" decorative></violet-icon>
|
|
417
|
+
</span>
|
|
418
|
+
`)}
|
|
419
|
+
${when((x, c) => !c.parent.isImageItem(x) &&
|
|
420
|
+
!isImageFallbackAttachment(x), html `
|
|
421
|
+
<violet-icon class="file-icon" icon="system/document" decorative></violet-icon>
|
|
422
|
+
`)}
|
|
423
|
+
</span>
|
|
424
|
+
<div class="attachment-copy">
|
|
425
|
+
<p class="attachment-label" title="${(x) => x.label}">${(x) => x.label}</p>
|
|
426
|
+
<p class="attachment-meta">${(x) => x.meta || "Attachment"}</p>
|
|
427
|
+
</div>
|
|
428
|
+
${when((x, c) => !c.parent.readonly, html `
|
|
429
|
+
<violet-icon-button
|
|
430
|
+
class="remove-button"
|
|
431
|
+
part="remove-button"
|
|
432
|
+
appearance="transparent"
|
|
433
|
+
label="${(x) => `Remove ${x.label}`}"
|
|
434
|
+
?disabled="${(x, c) => c.parent.disabled}"
|
|
435
|
+
@click="${(x, c) => (c.parent.removeAttachmentById(x.id), true)}"
|
|
436
|
+
>
|
|
437
|
+
<violet-icon icon="system/dismiss" decorative></violet-icon>
|
|
438
|
+
</violet-icon-button>
|
|
439
|
+
`)}
|
|
440
|
+
</div>
|
|
441
|
+
`)}
|
|
442
|
+
</div>
|
|
443
|
+
`)}
|
|
444
|
+
${when((x) => x.attachments.length === 0, html `
|
|
445
|
+
<div class="empty" part="empty-state">No attachments yet</div>
|
|
446
|
+
`)}
|
|
447
|
+
${when((x) => !x.readonly, html `
|
|
448
|
+
<violet-file-upload
|
|
449
|
+
class="add-upload"
|
|
450
|
+
part="add-control"
|
|
451
|
+
appearance="button"
|
|
452
|
+
size="compact"
|
|
453
|
+
multiple
|
|
454
|
+
?disabled="${(x) => x.disabled}"
|
|
455
|
+
@input="${(_x, c) => (c.event.stopPropagation(), true)}"
|
|
456
|
+
@change="${(x, c) => (x.handleUploadChange(c.event), true)}"
|
|
457
|
+
></violet-file-upload>
|
|
458
|
+
`)}
|
|
459
|
+
</div>
|
|
460
|
+
`)}
|
|
461
|
+
</div>
|
|
462
|
+
`;
|
|
463
|
+
/**
|
|
464
|
+
* Compact attachment renderer/editor for dense grid cells.
|
|
465
|
+
*
|
|
466
|
+
* @summary Grid-native attachment cell with thumbnail-or-chip previews, compact list editing, and deferred commit on close.
|
|
467
|
+
* @fires input - Emitted whenever the pending attachment list changes while the panel is open.
|
|
468
|
+
* @fires change - Emitted on close with durable attachments matching the parsed serialized value, excluding owned thumbnail URLs.
|
|
469
|
+
* @fires upload-request - Upload intent with `{ files, attachments }` before the uploader is cleared. Hosts own persistence and can replace items by id with durable URLs; the cell does not upload files.
|
|
470
|
+
* @csspart base - Root wrapper for the attachment cell.
|
|
471
|
+
* @csspart trigger - Trigger button that opens the attachment panel.
|
|
472
|
+
* @csspart selection - Visible attachment preview surface rendered inside the trigger.
|
|
473
|
+
* @csspart overflow-pill - Overflow count chip when more attachments exist than can be shown inline.
|
|
474
|
+
* @csspart caret - Caret icon inside the trigger.
|
|
475
|
+
* @csspart panel - Floating attachment panel.
|
|
476
|
+
* @csspart selection-summary - Compact summary row describing the current attachment count.
|
|
477
|
+
* @csspart attachment-list - Wrapper around the current attachment rows.
|
|
478
|
+
* @csspart attachment-row - Individual attachment row inside the panel.
|
|
479
|
+
* @csspart add-control - Inline add-files control shown in editable mode.
|
|
480
|
+
* @csspart remove-button - Remove action for an attachment row.
|
|
481
|
+
* @csspart empty-state - Empty message shown when no attachments exist.
|
|
482
|
+
*/
|
|
483
|
+
export class VioletDataGridAttachmentCell extends FASTElement {
|
|
484
|
+
#instanceId = ++violetDataGridAttachmentCellInstanceCount;
|
|
485
|
+
#openAttachmentSnapshot = "[]";
|
|
486
|
+
#ownedPreviewUrls = new Set();
|
|
487
|
+
#skipAttachmentChangeSync = false;
|
|
488
|
+
#openGeneration = 0;
|
|
489
|
+
#focusFrame = null;
|
|
490
|
+
#scrollRoots = [];
|
|
491
|
+
#handleViewportChange = () => this.positionPanel();
|
|
492
|
+
#handleFocusOut = (event) => {
|
|
493
|
+
const target = event.relatedTarget;
|
|
494
|
+
if (target && target !== this && !this.shadowRoot?.contains(target)) {
|
|
495
|
+
this.close(true);
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
#handleDocumentPointerDown = (event) => {
|
|
499
|
+
if (!this.open) {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
const path = event.composedPath();
|
|
503
|
+
if (path.includes(this)) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this.close(true);
|
|
507
|
+
};
|
|
508
|
+
constructor() {
|
|
509
|
+
super();
|
|
510
|
+
this.placeholder = "";
|
|
511
|
+
this.disabled = false;
|
|
512
|
+
this.readonly = false;
|
|
513
|
+
this.attachments = [];
|
|
514
|
+
this.open = false;
|
|
515
|
+
}
|
|
516
|
+
connectedCallback() {
|
|
517
|
+
super.connectedCallback();
|
|
518
|
+
this.addEventListener("focusout", this.#handleFocusOut);
|
|
519
|
+
this.ownerDocument.addEventListener("pointerdown", this.#handleDocumentPointerDown, true);
|
|
520
|
+
}
|
|
521
|
+
disconnectedCallback() {
|
|
522
|
+
this.ownerDocument.removeEventListener("pointerdown", this.#handleDocumentPointerDown, true);
|
|
523
|
+
this.removeEventListener("focusout", this.#handleFocusOut);
|
|
524
|
+
this.close(false);
|
|
525
|
+
super.disconnectedCallback();
|
|
526
|
+
// Coupled FAST repeat observers survive unbind. Do not notify an array replacement
|
|
527
|
+
// while disconnected; clear only plain owned preview fields before recycling.
|
|
528
|
+
this.attachments.forEach(clearOwnedAttachmentPreview);
|
|
529
|
+
this.releaseAllOwnedPreviewUrls();
|
|
530
|
+
}
|
|
531
|
+
get value() {
|
|
532
|
+
return serializeAttachmentCellValue(this.attachments);
|
|
533
|
+
}
|
|
534
|
+
set value(nextValue) {
|
|
535
|
+
const nextAttachments = parseAttachmentCellValue(nextValue);
|
|
536
|
+
if (serializeAttachmentCellValue(nextAttachments) === this.value) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
this.setAttachments(nextAttachments);
|
|
540
|
+
}
|
|
541
|
+
/** What the trigger is for: the host's `aria-label`, else the placeholder. */
|
|
542
|
+
get triggerLabel() {
|
|
543
|
+
return this.getAttribute("aria-label") || this.placeholder || "Edit attachments";
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* The trigger is named by its label and then by what it shows, so its visible text is part
|
|
547
|
+
* of its name (WCAG 2.5.3). An empty trigger that shows its label is named once.
|
|
548
|
+
*/
|
|
549
|
+
get triggerLabelledBy() {
|
|
550
|
+
const showsLabel = this.attachments.length === 0 && this.triggerLabel === (this.placeholder || "Add attachments");
|
|
551
|
+
return showsLabel ? "trigger-value" : "trigger-label trigger-value";
|
|
552
|
+
}
|
|
553
|
+
get panelId() {
|
|
554
|
+
return `${this.localName}-panel-${this.#instanceId}`;
|
|
555
|
+
}
|
|
556
|
+
get visibleAttachments() {
|
|
557
|
+
return this.attachments.slice(0, MAX_VISIBLE_ATTACHMENTS);
|
|
558
|
+
}
|
|
559
|
+
get overflowCount() {
|
|
560
|
+
return Math.max(0, this.attachments.length - MAX_VISIBLE_ATTACHMENTS);
|
|
561
|
+
}
|
|
562
|
+
get selectionLabel() {
|
|
563
|
+
if (this.attachments.length === 0) {
|
|
564
|
+
return this.placeholder || "Add attachments";
|
|
565
|
+
}
|
|
566
|
+
if (this.attachments.length === 1) {
|
|
567
|
+
return this.attachments[0]?.label ?? "1 attachment";
|
|
568
|
+
}
|
|
569
|
+
const lead = this.attachments[0]?.label ?? `${this.attachments.length} attachments`;
|
|
570
|
+
return `${lead} +${this.attachments.length - 1}`;
|
|
571
|
+
}
|
|
572
|
+
get selectionSummary() {
|
|
573
|
+
if (this.attachments.length === 0) {
|
|
574
|
+
return "No attachments";
|
|
575
|
+
}
|
|
576
|
+
return `${this.attachments.length} attachment${this.attachments.length === 1 ? "" : "s"}`;
|
|
577
|
+
}
|
|
578
|
+
attachmentsChanged(previous, next) {
|
|
579
|
+
if (this.#skipAttachmentChangeSync) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
this.syncOwnedPreviewUrls(previous ?? [], next ?? []);
|
|
583
|
+
}
|
|
584
|
+
handleTriggerClick() {
|
|
585
|
+
if (this.disabled) {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
if (this.open) {
|
|
589
|
+
this.close(true);
|
|
590
|
+
this.focusTrigger();
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
this.#openAttachmentSnapshot = this.value;
|
|
594
|
+
this.open = true;
|
|
595
|
+
const generation = ++this.#openGeneration;
|
|
596
|
+
void Updates.next().then(() => {
|
|
597
|
+
if (!this.open || !this.$fastController.isConnected || generation !== this.#openGeneration) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
const panel = this.panelElement();
|
|
601
|
+
if (!panel) {
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
panel.showPopover();
|
|
605
|
+
this.startPanelTracking();
|
|
606
|
+
this.positionPanel();
|
|
607
|
+
this.#focusFrame = requestAnimationFrame(() => {
|
|
608
|
+
this.#focusFrame = null;
|
|
609
|
+
if (this.open && this.$fastController.isConnected && generation === this.#openGeneration) {
|
|
610
|
+
panel.focus({ preventScroll: true });
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
disabledChanged() {
|
|
616
|
+
if (this.disabled) {
|
|
617
|
+
this.close(true);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
handlePanelToggle(event) {
|
|
621
|
+
if (event.newState === "closed" &&
|
|
622
|
+
event.currentTarget === this.panelElement() &&
|
|
623
|
+
!this.panelElement()?.matches(":popover-open")) {
|
|
624
|
+
this.close(true);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
handlePanelKeydown(event) {
|
|
628
|
+
event.stopPropagation();
|
|
629
|
+
if (event.isComposing || event.keyCode === 229 || event.key !== "Escape") {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
event.preventDefault();
|
|
633
|
+
this.close(true);
|
|
634
|
+
this.focusTrigger();
|
|
635
|
+
}
|
|
636
|
+
handleUploadChange(event) {
|
|
637
|
+
event.stopPropagation();
|
|
638
|
+
if (this.disabled || this.readonly) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
const detail = event.detail;
|
|
642
|
+
const upload = event.currentTarget;
|
|
643
|
+
const incomingFiles = detail?.files ?? [];
|
|
644
|
+
if (incomingFiles.length === 0) {
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
this.appendFiles(incomingFiles);
|
|
648
|
+
upload?.clearFiles();
|
|
649
|
+
}
|
|
650
|
+
appendFiles(files) {
|
|
651
|
+
if (this.disabled || this.readonly) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
if (files.length === 0) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const items = attachmentItemsFromFiles(files);
|
|
658
|
+
this.appendAttachments(items);
|
|
659
|
+
this.$emit("upload-request", {
|
|
660
|
+
files: [...files],
|
|
661
|
+
attachments: parseAttachmentCellValue(serializeAttachmentCellValue(items)),
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
appendAttachments(items) {
|
|
665
|
+
if (this.disabled || this.readonly) {
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
const merged = normalizeAttachmentItems([...this.attachments, ...items]);
|
|
669
|
+
// Normalization can drop duplicate uploads; release their otherwise orphaned previews.
|
|
670
|
+
this.syncOwnedPreviewUrls([...this.attachments, ...items], merged);
|
|
671
|
+
this.applyAttachments(merged, "input");
|
|
672
|
+
}
|
|
673
|
+
removeAttachmentById(id) {
|
|
674
|
+
if (this.disabled || this.readonly) {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
this.applyAttachments(this.attachments.filter((attachment) => attachment.id !== id), "input");
|
|
678
|
+
}
|
|
679
|
+
isImageItem(item) {
|
|
680
|
+
return isImageAttachment(item);
|
|
681
|
+
}
|
|
682
|
+
applyAttachments(nextAttachments, eventName) {
|
|
683
|
+
this.setAttachments(normalizeAttachmentItems(nextAttachments));
|
|
684
|
+
this.$emit(eventName, {
|
|
685
|
+
attachments: [...this.attachments],
|
|
686
|
+
value: this.value,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
close(emitCommitEvent) {
|
|
690
|
+
this.#openGeneration += 1;
|
|
691
|
+
this.stopPanelTracking();
|
|
692
|
+
const panel = this.panelElement();
|
|
693
|
+
if (panel?.matches(":popover-open")) {
|
|
694
|
+
panel.hidePopover();
|
|
695
|
+
}
|
|
696
|
+
if (!this.open) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const nextValue = this.value;
|
|
700
|
+
const attachmentsChanged = nextValue !== this.#openAttachmentSnapshot;
|
|
701
|
+
this.open = false;
|
|
702
|
+
if (emitCommitEvent && attachmentsChanged) {
|
|
703
|
+
this.$emit("change", {
|
|
704
|
+
attachments: parseAttachmentCellValue(nextValue),
|
|
705
|
+
value: nextValue,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
focusTrigger() {
|
|
710
|
+
this.#focusFrame = requestAnimationFrame(() => {
|
|
711
|
+
this.#focusFrame = null;
|
|
712
|
+
if (this.open || this.disabled || !this.$fastController.isConnected) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
this.shadowRoot?.querySelector(".trigger")?.focus();
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
panelElement() {
|
|
719
|
+
return this.shadowRoot?.querySelector(".panel") ?? null;
|
|
720
|
+
}
|
|
721
|
+
startPanelTracking() {
|
|
722
|
+
this.stopPanelTracking();
|
|
723
|
+
// Scroll does not cross shadow roots, including the grid's own scroll surface.
|
|
724
|
+
let root = this.getRootNode();
|
|
725
|
+
while (root instanceof ShadowRoot) {
|
|
726
|
+
this.#scrollRoots.push(root);
|
|
727
|
+
root = root.host.getRootNode();
|
|
728
|
+
}
|
|
729
|
+
this.#scrollRoots.push(this.ownerDocument);
|
|
730
|
+
this.#scrollRoots.forEach((target) => {
|
|
731
|
+
target.addEventListener("scroll", this.#handleViewportChange, true);
|
|
732
|
+
});
|
|
733
|
+
this.ownerDocument.defaultView?.addEventListener("resize", this.#handleViewportChange);
|
|
734
|
+
}
|
|
735
|
+
stopPanelTracking() {
|
|
736
|
+
this.#scrollRoots.forEach((target) => {
|
|
737
|
+
target.removeEventListener("scroll", this.#handleViewportChange, true);
|
|
738
|
+
});
|
|
739
|
+
this.#scrollRoots.length = 0;
|
|
740
|
+
this.ownerDocument.defaultView?.removeEventListener("resize", this.#handleViewportChange);
|
|
741
|
+
if (this.#focusFrame !== null) {
|
|
742
|
+
cancelAnimationFrame(this.#focusFrame);
|
|
743
|
+
this.#focusFrame = null;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
positionPanel() {
|
|
747
|
+
const panel = this.panelElement();
|
|
748
|
+
const trigger = this.shadowRoot?.querySelector(".trigger");
|
|
749
|
+
const viewport = this.ownerDocument.defaultView;
|
|
750
|
+
if (!this.open || !panel?.matches(":popover-open") || !trigger || !viewport) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
const rect = trigger.getBoundingClientRect();
|
|
754
|
+
const panelRect = panel.getBoundingClientRect();
|
|
755
|
+
const padding = 8;
|
|
756
|
+
const below = rect.bottom + 6;
|
|
757
|
+
const top = below + panelRect.height <= viewport.innerHeight - padding
|
|
758
|
+
? below
|
|
759
|
+
: rect.top - panelRect.height - 6;
|
|
760
|
+
panel.style.left = `${Math.max(padding, Math.min(rect.left, viewport.innerWidth - panelRect.width - padding))}px`;
|
|
761
|
+
panel.style.top = `${Math.max(padding, top)}px`;
|
|
762
|
+
}
|
|
763
|
+
setAttachments(nextAttachments) {
|
|
764
|
+
this.syncOwnedPreviewUrls(this.attachments, nextAttachments);
|
|
765
|
+
this.#skipAttachmentChangeSync = true;
|
|
766
|
+
try {
|
|
767
|
+
this.attachments = nextAttachments;
|
|
768
|
+
}
|
|
769
|
+
finally {
|
|
770
|
+
this.#skipAttachmentChangeSync = false;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
syncOwnedPreviewUrls(previous, next) {
|
|
774
|
+
const nextOwnedPreviewUrls = new Set(next
|
|
775
|
+
.map((item) => getOwnedAttachmentPreviewUrl(item))
|
|
776
|
+
.filter((url) => Boolean(url)));
|
|
777
|
+
previous
|
|
778
|
+
.map((item) => getOwnedAttachmentPreviewUrl(item))
|
|
779
|
+
.filter((url) => Boolean(url))
|
|
780
|
+
.forEach((url) => {
|
|
781
|
+
if (!nextOwnedPreviewUrls.has(url)) {
|
|
782
|
+
URL.revokeObjectURL(url);
|
|
783
|
+
this.#ownedPreviewUrls.delete(url);
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
nextOwnedPreviewUrls.forEach((url) => {
|
|
787
|
+
this.#ownedPreviewUrls.add(url);
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
releaseAllOwnedPreviewUrls() {
|
|
791
|
+
this.#ownedPreviewUrls.forEach((url) => {
|
|
792
|
+
URL.revokeObjectURL(url);
|
|
793
|
+
});
|
|
794
|
+
this.#ownedPreviewUrls.clear();
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
attr(VioletDataGridAttachmentCell.prototype, "placeholder");
|
|
798
|
+
attr({ mode: "boolean" })(VioletDataGridAttachmentCell.prototype, "disabled");
|
|
799
|
+
attr({ mode: "boolean" })(VioletDataGridAttachmentCell.prototype, "readonly");
|
|
800
|
+
observable(VioletDataGridAttachmentCell.prototype, "attachments");
|
|
801
|
+
observable(VioletDataGridAttachmentCell.prototype, "open");
|
|
802
|
+
if (!customElements.get("violet-data-grid-attachment-cell")) {
|
|
803
|
+
await FASTElement.define(VioletDataGridAttachmentCell, {
|
|
804
|
+
name: "violet-data-grid-attachment-cell",
|
|
805
|
+
template,
|
|
806
|
+
styles,
|
|
807
|
+
shadowOptions: {
|
|
808
|
+
delegatesFocus: true,
|
|
809
|
+
},
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
//# sourceMappingURL=violet-data-grid-attachment-cell.js.map
|