@lushly-dev/violet-elements 0.0.0-bootstrap.0 → 0.2.0-preview.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/LICENSE +21 -0
- package/README.md +263 -0
- 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 +591 -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 +81 -1
- 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,666 @@
|
|
|
1
|
+
import { FASTElement, attr, css, html, when } from "@lushly-dev/fast-element";
|
|
2
|
+
import { violetFieldTokenDefaults } from "../theme/violet-token-defaults";
|
|
3
|
+
import { installFormDisabled } from "../foundations/violet-form-disabled";
|
|
4
|
+
let violetSliderCount = 0;
|
|
5
|
+
const styles = css `
|
|
6
|
+
${violetFieldTokenDefaults}
|
|
7
|
+
|
|
8
|
+
:host {
|
|
9
|
+
display: grid;
|
|
10
|
+
|
|
11
|
+
--_selection-fill: color-mix(in srgb, var(--color-control-selected-foreground, #244635) 50%, var(--color-control-selected-background, #ddeadf));
|
|
12
|
+
--_rail-background: var(--color-border-strong, rgba(28, 26, 13, 0.48));
|
|
13
|
+
--_danger-border: var(--color-state-danger-border, rgba(220, 38, 38, 0.34));
|
|
14
|
+
--_shadow-floating: var(--shadow-floating, 0 2px 5px rgba(28, 26, 13, 0.22), 0 18px 34px rgba(28, 26, 13, 0.08));
|
|
15
|
+
--_radius-full: var(--radius-round, 9999px);
|
|
16
|
+
--_thumb-size: calc(var(--_target-size) * 0.625);
|
|
17
|
+
--_track-size: calc(var(--_target-size) * 0.125);
|
|
18
|
+
--_control-block-size: var(--_target-size);
|
|
19
|
+
--_vertical-track-size: calc(var(--_target-size) * 4);
|
|
20
|
+
--_tick-size: 6px;
|
|
21
|
+
--_tick-color: var(--_rail-background);
|
|
22
|
+
--_slider-percent: 50%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.field {
|
|
26
|
+
display: grid;
|
|
27
|
+
gap: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.label {
|
|
31
|
+
color: var(--_text-secondary);
|
|
32
|
+
font-size: var(--_control-label-size);
|
|
33
|
+
font-weight: var(--_type-label-weight);
|
|
34
|
+
line-height: var(--_type-label-line);
|
|
35
|
+
margin-block-end: var(--_space-stack-xs);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.control-shell {
|
|
39
|
+
position: relative;
|
|
40
|
+
display: grid;
|
|
41
|
+
align-items: center;
|
|
42
|
+
inline-size: 100%;
|
|
43
|
+
min-inline-size: 0;
|
|
44
|
+
block-size: var(--_control-block-size);
|
|
45
|
+
border-radius: var(--_radius-md);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([orientation="vertical"]) .control-shell {
|
|
49
|
+
justify-items: center;
|
|
50
|
+
inline-size: var(--_target-size);
|
|
51
|
+
block-size: var(--_vertical-track-size);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.input {
|
|
55
|
+
position: absolute;
|
|
56
|
+
inset: 0;
|
|
57
|
+
margin: 0;
|
|
58
|
+
inline-size: 100%;
|
|
59
|
+
block-size: 100%;
|
|
60
|
+
appearance: none;
|
|
61
|
+
-webkit-appearance: none;
|
|
62
|
+
background: transparent;
|
|
63
|
+
border: 0;
|
|
64
|
+
opacity: 0;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
touch-action: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:host([orientation="vertical"]) .input {
|
|
70
|
+
writing-mode: vertical-lr;
|
|
71
|
+
direction: rtl;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.visual {
|
|
75
|
+
position: relative;
|
|
76
|
+
display: grid;
|
|
77
|
+
align-items: center;
|
|
78
|
+
inline-size: 100%;
|
|
79
|
+
block-size: 100%;
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([orientation="vertical"]) .visual {
|
|
84
|
+
justify-items: center;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.rail {
|
|
88
|
+
position: relative;
|
|
89
|
+
inline-size: 100%;
|
|
90
|
+
block-size: var(--_track-size);
|
|
91
|
+
border-radius: var(--_radius-full);
|
|
92
|
+
background: var(--_rail-background);
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host([orientation="vertical"]) .rail {
|
|
97
|
+
inline-size: var(--_track-size);
|
|
98
|
+
block-size: 100%;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.fill {
|
|
102
|
+
display: none;
|
|
103
|
+
position: absolute;
|
|
104
|
+
inset-inline-start: 0;
|
|
105
|
+
inset-block-start: 0;
|
|
106
|
+
inline-size: var(--_slider-percent);
|
|
107
|
+
block-size: 100%;
|
|
108
|
+
border-radius: inherit;
|
|
109
|
+
background: var(--_selection-fill);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([show-fill]) .fill {
|
|
113
|
+
display: block;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([orientation="vertical"]) .fill {
|
|
117
|
+
inset-block-start: auto;
|
|
118
|
+
inset-block-end: 0;
|
|
119
|
+
inline-size: 100%;
|
|
120
|
+
block-size: var(--_slider-percent);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ticks {
|
|
124
|
+
display: none;
|
|
125
|
+
position: absolute;
|
|
126
|
+
inset-inline: 0;
|
|
127
|
+
block-size: var(--_tick-size);
|
|
128
|
+
inset-block-start: calc(50% - var(--_track-size) / 2 - var(--_tick-size) - 2px);
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
:host([show-ticks]) .ticks {
|
|
133
|
+
display: block;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:host([orientation="vertical"]) .ticks {
|
|
137
|
+
inset-block: 0;
|
|
138
|
+
inset-inline: auto;
|
|
139
|
+
inset-inline-start: calc(50% - var(--_track-size) / 2 - var(--_tick-size) - 2px);
|
|
140
|
+
inline-size: var(--_tick-size);
|
|
141
|
+
block-size: auto;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.thumb {
|
|
145
|
+
position: absolute;
|
|
146
|
+
inset-inline-start: var(--_slider-percent);
|
|
147
|
+
inset-block-start: 50%;
|
|
148
|
+
inline-size: var(--_thumb-size);
|
|
149
|
+
block-size: var(--_thumb-size);
|
|
150
|
+
border-radius: var(--_radius-full);
|
|
151
|
+
background: var(--_surface-page);
|
|
152
|
+
border: 1px solid var(--_border-subtle);
|
|
153
|
+
box-shadow: var(--_shadow-floating);
|
|
154
|
+
transform: translate(-50%, -50%);
|
|
155
|
+
transition:
|
|
156
|
+
transform var(--_duration-base) var(--_easing-standard),
|
|
157
|
+
box-shadow var(--_duration-base) var(--_easing-standard);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host([orientation="vertical"]) .thumb {
|
|
161
|
+
inset-inline-start: 50%;
|
|
162
|
+
inset-block-start: auto;
|
|
163
|
+
inset-block-end: var(--_slider-percent);
|
|
164
|
+
transform: translate(-50%, 50%);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.control-shell:focus-within .thumb {
|
|
168
|
+
box-shadow:
|
|
169
|
+
var(--_shadow-floating),
|
|
170
|
+
0 0 0 2px var(--_focus-ring);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:host([disabled]) .input,
|
|
174
|
+
:host(:disabled) .input {
|
|
175
|
+
cursor: not-allowed;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
:host([disabled]) .control-shell,
|
|
179
|
+
:host(:disabled) .control-shell {
|
|
180
|
+
cursor: not-allowed;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
:host([disabled]) .visual,
|
|
184
|
+
:host(:disabled) .visual {
|
|
185
|
+
opacity: 0.6;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
:host([disabled]) .rail,
|
|
189
|
+
:host(:disabled) .rail {
|
|
190
|
+
background: color-mix(in srgb, var(--_rail-background) 55%, var(--_surface-page));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
:host([disabled]) .fill,
|
|
194
|
+
:host(:disabled) .fill {
|
|
195
|
+
background: color-mix(in srgb, var(--_selection-fill) 55%, var(--_surface-page));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
:host([disabled]) .thumb,
|
|
199
|
+
:host(:disabled) .thumb {
|
|
200
|
+
background: color-mix(in srgb, var(--_surface-page) 72%, var(--_surface-subtle));
|
|
201
|
+
box-shadow: var(--_shadow-control);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:host([invalid]) .rail {
|
|
205
|
+
outline: 1px solid var(--_danger-border);
|
|
206
|
+
outline-offset: -1px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.supporting,
|
|
210
|
+
.error {
|
|
211
|
+
margin: 0;
|
|
212
|
+
font-size: var(--_control-caption-size);
|
|
213
|
+
line-height: var(--_type-caption-line);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.supporting {
|
|
217
|
+
color: var(--_text-muted);
|
|
218
|
+
margin-block-start: var(--_space-stack-2xs);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.error {
|
|
222
|
+
color: var(--color-state-danger-foreground, #b42318);
|
|
223
|
+
margin-block-start: var(--_space-stack-2xs);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@media (forced-colors: active) {
|
|
227
|
+
.rail {
|
|
228
|
+
forced-color-adjust: none;
|
|
229
|
+
background: ButtonText;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.fill {
|
|
233
|
+
background: Highlight;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.thumb {
|
|
237
|
+
background: HighlightText;
|
|
238
|
+
border: 1px solid Highlight;
|
|
239
|
+
box-shadow: none;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
:host([disabled]) .rail,
|
|
243
|
+
:host(:disabled) .rail {
|
|
244
|
+
background: GrayText;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:host([disabled]) .fill,
|
|
248
|
+
:host(:disabled) .fill {
|
|
249
|
+
background: GrayText;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
:host([disabled]) .thumb,
|
|
253
|
+
:host(:disabled) .thumb {
|
|
254
|
+
border-color: GrayText;
|
|
255
|
+
background: Canvas;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
`;
|
|
259
|
+
const template = html `
|
|
260
|
+
<div class="field" part="field">
|
|
261
|
+
${when(x => Boolean(x.label), html `
|
|
262
|
+
<label class="label" part="label" for="${x => x.inputId}">${x => x.label}</label>
|
|
263
|
+
`)}
|
|
264
|
+
<div class="control-shell" part="control-shell" style="${x => x.controlStyle}">
|
|
265
|
+
<input
|
|
266
|
+
id="${x => x.inputId}"
|
|
267
|
+
class="input"
|
|
268
|
+
part="input"
|
|
269
|
+
type="range"
|
|
270
|
+
min="${x => x.min}"
|
|
271
|
+
max="${x => x.max}"
|
|
272
|
+
step="${x => x.step}"
|
|
273
|
+
:value="${x => x.value}"
|
|
274
|
+
name="${x => x.name}"
|
|
275
|
+
?disabled="${x => x.effectiveDisabled}"
|
|
276
|
+
?required="${x => x.required}"
|
|
277
|
+
aria-label="${x => x.label || x.getAttribute("aria-label") || ""}"
|
|
278
|
+
aria-describedby="${x => x.describedByIds}"
|
|
279
|
+
aria-invalid="${x => x.invalid ? "true" : "false"}"
|
|
280
|
+
aria-orientation="${x => x.orientation}"
|
|
281
|
+
aria-valuetext="${x => x.valueText || null}"
|
|
282
|
+
@pointerdown="${(x, c) => x.handlePointerDown(c.event)}"
|
|
283
|
+
@input="${(x, c) => x.handleInput(c.event)}"
|
|
284
|
+
@change="${(x, c) => x.handleCommit(c.event)}"
|
|
285
|
+
/>
|
|
286
|
+
<div class="visual" part="visual" aria-hidden="true">
|
|
287
|
+
<div class="ticks" part="ticks" style="${x => x.tickStyle}"></div>
|
|
288
|
+
<div class="rail" part="rail">
|
|
289
|
+
<div class="fill" part="fill"></div>
|
|
290
|
+
</div>
|
|
291
|
+
<div class="thumb" part="thumb"></div>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
${when(x => Boolean(x.supportingText), html `
|
|
295
|
+
<p class="supporting" id="${x => x.supportingTextId}" part="supporting-text">${x => x.supportingText}</p>
|
|
296
|
+
`)}
|
|
297
|
+
${when(x => Boolean(x.validationMessageText), html `
|
|
298
|
+
<p class="error" id="${x => x.errorTextId}" part="error-message">${x => x.validationMessageText}</p>
|
|
299
|
+
`)}
|
|
300
|
+
</div>
|
|
301
|
+
`;
|
|
302
|
+
/**
|
|
303
|
+
* Violet reusable slider primitive.
|
|
304
|
+
*
|
|
305
|
+
* @summary Token-driven native-first range input with Violet rail, thumb, label, and supporting/error text.
|
|
306
|
+
* @fires input - Emitted when the slider value changes while dragging or using the keyboard.
|
|
307
|
+
* @fires change - Emitted when the slider value is committed.
|
|
308
|
+
* @csspart field - Field wrapper.
|
|
309
|
+
* @csspart label - Slider label text.
|
|
310
|
+
* @csspart control-shell - Slider control wrapper.
|
|
311
|
+
* @csspart input - Native range input carrying semantics.
|
|
312
|
+
* @csspart visual - Visual wrapper for the custom rail and thumb.
|
|
313
|
+
* @csspart rail - Resting slider rail.
|
|
314
|
+
* @csspart fill - Active filled portion of the rail.
|
|
315
|
+
* @csspart thumb - Slider thumb.
|
|
316
|
+
* @csspart supporting-text - Supporting helper text.
|
|
317
|
+
* @csspart error-message - Visible error text.
|
|
318
|
+
*/
|
|
319
|
+
export class VioletSlider extends FASTElement {
|
|
320
|
+
static { this.formAssociated = true; }
|
|
321
|
+
#internals;
|
|
322
|
+
#defaultValue;
|
|
323
|
+
#activePointerId;
|
|
324
|
+
constructor() {
|
|
325
|
+
super();
|
|
326
|
+
this.#internals = this.attachInternals();
|
|
327
|
+
violetSliderCount += 1;
|
|
328
|
+
this.inputId = `violet-slider-${violetSliderCount}`;
|
|
329
|
+
this.supportingTextId = `${this.inputId}-supporting`;
|
|
330
|
+
this.errorTextId = `${this.inputId}-error`;
|
|
331
|
+
this.#defaultValue = "";
|
|
332
|
+
this.#activePointerId = null;
|
|
333
|
+
this.label = "";
|
|
334
|
+
this.supportingText = "";
|
|
335
|
+
this.errorText = "";
|
|
336
|
+
this.valueText = "";
|
|
337
|
+
this.value = "50";
|
|
338
|
+
this.min = "0";
|
|
339
|
+
this.max = "100";
|
|
340
|
+
this.step = "1";
|
|
341
|
+
this.name = "";
|
|
342
|
+
this.required = false;
|
|
343
|
+
this.orientation = "horizontal";
|
|
344
|
+
this.disabled = false;
|
|
345
|
+
this.invalid = false;
|
|
346
|
+
this.showFill = false;
|
|
347
|
+
this.showTicks = false;
|
|
348
|
+
}
|
|
349
|
+
get form() {
|
|
350
|
+
return this.#internals.form;
|
|
351
|
+
}
|
|
352
|
+
get validity() {
|
|
353
|
+
return this.#internals.validity;
|
|
354
|
+
}
|
|
355
|
+
get validationMessage() {
|
|
356
|
+
return this.#internals.validationMessage;
|
|
357
|
+
}
|
|
358
|
+
get willValidate() {
|
|
359
|
+
return this.#internals.willValidate;
|
|
360
|
+
}
|
|
361
|
+
checkValidity() {
|
|
362
|
+
return this.#internals.checkValidity();
|
|
363
|
+
}
|
|
364
|
+
reportValidity() {
|
|
365
|
+
return this.#internals.reportValidity();
|
|
366
|
+
}
|
|
367
|
+
connectedCallback() {
|
|
368
|
+
super.connectedCallback();
|
|
369
|
+
if (this.name && this.getAttribute("name") !== this.name) {
|
|
370
|
+
this.setAttribute("name", this.name);
|
|
371
|
+
}
|
|
372
|
+
this.#defaultValue = this.getAttribute("value") ?? this.value;
|
|
373
|
+
this.#syncHostAttributes();
|
|
374
|
+
this.#syncValue();
|
|
375
|
+
this.#syncFormState();
|
|
376
|
+
}
|
|
377
|
+
formStateRestoreCallback(state) {
|
|
378
|
+
if (typeof state === "string") {
|
|
379
|
+
this.value = state;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
formResetCallback() {
|
|
383
|
+
this.value = this.#defaultValue || this.min || "0";
|
|
384
|
+
this.#syncValue();
|
|
385
|
+
this.#syncFormState();
|
|
386
|
+
}
|
|
387
|
+
nameChanged() {
|
|
388
|
+
if (this.$fastController.isConnected && this.name && this.getAttribute("name") !== this.name) {
|
|
389
|
+
this.setAttribute("name", this.name);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
valueChanged() {
|
|
393
|
+
if (this.$fastController.isConnected) {
|
|
394
|
+
this.#syncValue();
|
|
395
|
+
this.#syncFormState();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
minChanged() {
|
|
399
|
+
if (this.$fastController.isConnected) {
|
|
400
|
+
this.#syncValue();
|
|
401
|
+
this.#syncFormState();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
maxChanged() {
|
|
405
|
+
if (this.$fastController.isConnected) {
|
|
406
|
+
this.#syncValue();
|
|
407
|
+
this.#syncFormState();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
stepChanged() {
|
|
411
|
+
if (this.$fastController.isConnected) {
|
|
412
|
+
this.#syncValue();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
disabledChanged() {
|
|
416
|
+
if (this.$fastController.isConnected) {
|
|
417
|
+
this.#syncHostAttributes();
|
|
418
|
+
this.#syncFormState();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
invalidChanged() {
|
|
422
|
+
if (this.$fastController.isConnected) {
|
|
423
|
+
this.#syncHostAttributes();
|
|
424
|
+
this.#syncFormState();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
orientationChanged() {
|
|
428
|
+
if (this.$fastController.isConnected) {
|
|
429
|
+
this.#syncHostAttributes();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
get validationMessageText() {
|
|
433
|
+
return this.invalid ? this.errorText || "Please choose a valid value." : "";
|
|
434
|
+
}
|
|
435
|
+
get describedByIds() {
|
|
436
|
+
return [this.supportingText ? this.supportingTextId : "", this.validationMessageText ? this.errorTextId : ""]
|
|
437
|
+
.filter(Boolean)
|
|
438
|
+
.join(" ");
|
|
439
|
+
}
|
|
440
|
+
get controlStyle() {
|
|
441
|
+
return `--_slider-percent: ${this.percent};`;
|
|
442
|
+
}
|
|
443
|
+
get tickStyle() {
|
|
444
|
+
const min = this.minAsNumber;
|
|
445
|
+
const max = this.maxAsNumber;
|
|
446
|
+
const step = this.stepAsNumber;
|
|
447
|
+
const range = max - min;
|
|
448
|
+
if (range <= 0 || step <= 0) {
|
|
449
|
+
return "";
|
|
450
|
+
}
|
|
451
|
+
const count = Math.round(range / step);
|
|
452
|
+
if (count < 2 || count > 50) {
|
|
453
|
+
return "";
|
|
454
|
+
}
|
|
455
|
+
const stops = [];
|
|
456
|
+
for (let i = 0; i <= count; i++) {
|
|
457
|
+
const pct = (i / count) * 100;
|
|
458
|
+
if (i === 0) {
|
|
459
|
+
stops.push(`var(--_tick-color) 0`, `var(--_tick-color) 1px`, `transparent 1px`);
|
|
460
|
+
}
|
|
461
|
+
else if (i === count) {
|
|
462
|
+
stops.push(`transparent calc(100% - 1px)`, `var(--_tick-color) calc(100% - 1px)`, `var(--_tick-color) 100%`);
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
stops.push(`transparent calc(${pct}% - 0.5px)`, `var(--_tick-color) calc(${pct}% - 0.5px)`, `var(--_tick-color) calc(${pct}% + 0.5px)`, `transparent calc(${pct}% + 0.5px)`);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
const dir = this.orientation === "vertical" ? "to top" : "to right";
|
|
469
|
+
return `background-image: linear-gradient(${dir}, ${stops.join(", ")});`;
|
|
470
|
+
}
|
|
471
|
+
handleInput(event) {
|
|
472
|
+
const input = event.currentTarget;
|
|
473
|
+
this.value = input?.value ?? this.value;
|
|
474
|
+
this.$emit("input", { value: this.value });
|
|
475
|
+
}
|
|
476
|
+
handleCommit(event) {
|
|
477
|
+
const input = event.currentTarget;
|
|
478
|
+
this.value = input?.value ?? this.value;
|
|
479
|
+
this.$emit("change", { value: this.value });
|
|
480
|
+
}
|
|
481
|
+
handlePointerDown(event) {
|
|
482
|
+
if (this.effectiveDisabled || !this.#isPrimaryPointer(event)) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const input = this.#inputControl;
|
|
486
|
+
if (!input) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
event.preventDefault();
|
|
490
|
+
this.#activePointerId = event.pointerId;
|
|
491
|
+
input.focus({ preventScroll: true });
|
|
492
|
+
this.#teardownPointerListeners();
|
|
493
|
+
this.ownerDocument.addEventListener("pointermove", this.#handlePointerMove);
|
|
494
|
+
this.ownerDocument.addEventListener("pointerup", this.#handlePointerEnd);
|
|
495
|
+
this.ownerDocument.addEventListener("pointercancel", this.#handlePointerEnd);
|
|
496
|
+
this.#syncPointerValue(event, "input");
|
|
497
|
+
}
|
|
498
|
+
disconnectedCallback() {
|
|
499
|
+
this.#teardownPointerListeners();
|
|
500
|
+
super.disconnectedCallback();
|
|
501
|
+
}
|
|
502
|
+
#syncValue() {
|
|
503
|
+
this.value = this.#normalizeValue(this.value);
|
|
504
|
+
const input = this.#inputControl;
|
|
505
|
+
if (input && input.value !== this.value) {
|
|
506
|
+
input.value = this.value;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
#syncFormState() {
|
|
510
|
+
if (this.effectiveDisabled) {
|
|
511
|
+
this.#internals.setFormValue(null);
|
|
512
|
+
this.#internals.setValidity({});
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
this.#internals.setFormValue(this.value);
|
|
516
|
+
if (this.invalid) {
|
|
517
|
+
this.#internals.setValidity({ customError: true }, this.validationMessageText);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
this.#internals.setValidity({});
|
|
521
|
+
}
|
|
522
|
+
#syncHostAttributes() {
|
|
523
|
+
this.#reflectBooleanAttribute("disabled", this.disabled);
|
|
524
|
+
this.#reflectBooleanAttribute("invalid", this.invalid);
|
|
525
|
+
const nextOrientation = this.orientation === "vertical" ? "vertical" : "horizontal";
|
|
526
|
+
if (this.getAttribute("orientation") !== nextOrientation) {
|
|
527
|
+
this.setAttribute("orientation", nextOrientation);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
#reflectBooleanAttribute(name, value) {
|
|
531
|
+
if (this.hasAttribute(name) !== value) {
|
|
532
|
+
this.toggleAttribute(name, value);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
#normalizeValue(rawValue) {
|
|
536
|
+
const min = this.minAsNumber;
|
|
537
|
+
const max = this.maxAsNumber;
|
|
538
|
+
const step = this.stepAsNumber;
|
|
539
|
+
const parsed = Number.parseFloat(rawValue);
|
|
540
|
+
const fallback = Number.isFinite(parsed) ? parsed : min;
|
|
541
|
+
const clamped = Math.min(max, Math.max(min, fallback));
|
|
542
|
+
if (!Number.isFinite(step) || step <= 0) {
|
|
543
|
+
return String(clamped);
|
|
544
|
+
}
|
|
545
|
+
const stepped = Math.round((clamped - min) / step) * step + min;
|
|
546
|
+
const precision = this.#decimalPlaces(step);
|
|
547
|
+
return String(Number(stepped.toFixed(precision)));
|
|
548
|
+
}
|
|
549
|
+
#decimalPlaces(value) {
|
|
550
|
+
const [, fraction = ""] = String(value).split(".");
|
|
551
|
+
return fraction.length;
|
|
552
|
+
}
|
|
553
|
+
#isPrimaryPointer(event) {
|
|
554
|
+
return event.pointerType !== "mouse" || event.button === 0;
|
|
555
|
+
}
|
|
556
|
+
get #inputControl() {
|
|
557
|
+
return this.shadowRoot?.querySelector(".input") ?? null;
|
|
558
|
+
}
|
|
559
|
+
#syncPointerValue(event, phase) {
|
|
560
|
+
const input = this.#inputControl;
|
|
561
|
+
if (!input) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const nextValue = this.#valueFromPointer(event, input);
|
|
565
|
+
if (nextValue === null) {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
if (this.value !== nextValue) {
|
|
569
|
+
this.value = nextValue;
|
|
570
|
+
}
|
|
571
|
+
if (input.value !== this.value) {
|
|
572
|
+
input.value = this.value;
|
|
573
|
+
}
|
|
574
|
+
if (phase === "input") {
|
|
575
|
+
this.$emit("input", { value: this.value });
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
this.$emit("change", { value: this.value });
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
#valueFromPointer(event, input) {
|
|
582
|
+
const rect = input.getBoundingClientRect();
|
|
583
|
+
const min = this.minAsNumber;
|
|
584
|
+
const max = this.maxAsNumber;
|
|
585
|
+
if (rect.width <= 0 || rect.height <= 0 || max <= min) {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
const ratio = this.orientation === "vertical"
|
|
589
|
+
? 1 - (event.clientY - rect.top) / rect.height
|
|
590
|
+
: (event.clientX - rect.left) / rect.width;
|
|
591
|
+
const boundedRatio = Math.min(1, Math.max(0, ratio));
|
|
592
|
+
const rawValue = min + boundedRatio * (max - min);
|
|
593
|
+
return this.#normalizeValue(String(rawValue));
|
|
594
|
+
}
|
|
595
|
+
#handlePointerMove = (event) => {
|
|
596
|
+
if (event.pointerId !== this.#activePointerId) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
event.preventDefault();
|
|
600
|
+
this.#syncPointerValue(event, "input");
|
|
601
|
+
};
|
|
602
|
+
#handlePointerEnd = (event) => {
|
|
603
|
+
if (event.pointerId !== this.#activePointerId) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
event.preventDefault();
|
|
607
|
+
this.#syncPointerValue(event, "change");
|
|
608
|
+
this.#activePointerId = null;
|
|
609
|
+
this.#teardownPointerListeners();
|
|
610
|
+
};
|
|
611
|
+
#teardownPointerListeners() {
|
|
612
|
+
this.ownerDocument.removeEventListener("pointermove", this.#handlePointerMove);
|
|
613
|
+
this.ownerDocument.removeEventListener("pointerup", this.#handlePointerEnd);
|
|
614
|
+
this.ownerDocument.removeEventListener("pointercancel", this.#handlePointerEnd);
|
|
615
|
+
}
|
|
616
|
+
get minAsNumber() {
|
|
617
|
+
const parsed = Number.parseFloat(this.min);
|
|
618
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
619
|
+
}
|
|
620
|
+
get maxAsNumber() {
|
|
621
|
+
const parsed = Number.parseFloat(this.max);
|
|
622
|
+
return Number.isFinite(parsed) ? parsed : 100;
|
|
623
|
+
}
|
|
624
|
+
get stepAsNumber() {
|
|
625
|
+
const parsed = Number.parseFloat(this.step);
|
|
626
|
+
return Number.isFinite(parsed) ? parsed : 1;
|
|
627
|
+
}
|
|
628
|
+
get valueAsNumber() {
|
|
629
|
+
const parsed = Number.parseFloat(this.value);
|
|
630
|
+
return Number.isFinite(parsed) ? parsed : this.minAsNumber;
|
|
631
|
+
}
|
|
632
|
+
get percent() {
|
|
633
|
+
const min = this.minAsNumber;
|
|
634
|
+
const max = this.maxAsNumber;
|
|
635
|
+
if (max <= min) {
|
|
636
|
+
return "0%";
|
|
637
|
+
}
|
|
638
|
+
const ratio = (this.valueAsNumber - min) / (max - min);
|
|
639
|
+
const percent = Math.min(1, Math.max(0, ratio)) * 100;
|
|
640
|
+
return `${percent}%`;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
attr(VioletSlider.prototype, "label");
|
|
644
|
+
attr({ attribute: "supporting-text" })(VioletSlider.prototype, "supportingText");
|
|
645
|
+
attr({ attribute: "error-text" })(VioletSlider.prototype, "errorText");
|
|
646
|
+
attr({ attribute: "value-text" })(VioletSlider.prototype, "valueText");
|
|
647
|
+
attr(VioletSlider.prototype, "value");
|
|
648
|
+
attr(VioletSlider.prototype, "min");
|
|
649
|
+
attr(VioletSlider.prototype, "max");
|
|
650
|
+
attr(VioletSlider.prototype, "step");
|
|
651
|
+
attr(VioletSlider.prototype, "name");
|
|
652
|
+
attr({ mode: "boolean" })(VioletSlider.prototype, "required");
|
|
653
|
+
attr(VioletSlider.prototype, "orientation");
|
|
654
|
+
attr({ mode: "boolean" })(VioletSlider.prototype, "disabled");
|
|
655
|
+
installFormDisabled(VioletSlider.prototype);
|
|
656
|
+
attr({ mode: "boolean" })(VioletSlider.prototype, "invalid");
|
|
657
|
+
attr({ attribute: "show-fill", mode: "boolean" })(VioletSlider.prototype, "showFill");
|
|
658
|
+
attr({ attribute: "show-ticks", mode: "boolean" })(VioletSlider.prototype, "showTicks");
|
|
659
|
+
if (!customElements.get("violet-slider")) {
|
|
660
|
+
await FASTElement.define(VioletSlider, {
|
|
661
|
+
name: "violet-slider",
|
|
662
|
+
template,
|
|
663
|
+
styles,
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
//# sourceMappingURL=violet-slider.js.map
|