@spectric/ui 0.0.26 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- spectric-input{--input-color: var(--spectric-input-color, #f4f4f4);--border-radius: var(--spectric-border-radius, .4em);--input-bottom: var(--spectric-input-bottom, var(--spectric-button-primary, #a8a8a8));--input-bottom-focused: var(--primary, #1ea7fd);--text-on-color: var(--spectric-text-on-color, #ffffff);--text-on-color-disabled: var(--spectric-text-on-color-disabled, #8d8d8d);--text-placeholder: rgba(22, 22, 22, .4);--text-primary: var(--spectric-text-primary, #161616);--text-secondary: var(--spectric-text-secondary, #525252)}spectric-input .inputWrapper{color:var(--text-secondary)}spectric-input .inputWrapper input{box-sizing:border-box;margin:0;vertical-align:baseline;font-size:.875rem;font-weight:400;line-height:1.28572;letter-spacing:.16px;outline:transparent solid 2px;outline-offset:-2px;border:none;padding:0 1rem;background-color:var(--input-color);color:var(--text-primary, #161616);font-family:inherit;inline-size:100%;block-size:2.5rem}spectric-input .inputWrapper .inputContainer:active:after,spectric-input .inputContainer:focus-within:after{border-bottom-color:var(--input-bottom-focused);width:calc(100% - 5px);transition:width .4s ease-in-out}spectric-input .inputWrapper input:read-only{background-color:transparent;border-bottom-color:var(--border-disabled)}spectric-input .inputContainer{position:relative;border-radius:var(--border-radius);overflow:hidden}spectric-input .inputContainer:after{content:"";width:0px;transition:background-color .4s cubic-bezier(.2,0,.38,.9),border-bottom-color .4s cubic-bezier(.2,0,.38,.9);border-bottom-color:var(--input-bottom);border-bottom-style:solid;border-bottom-width:1px;position:absolute;left:2.5px;bottom:0}spectric-input #helper-text{height:18px}spectric-input #helper-text.hidden{display:none}spectric-input .input-button-right{position:absolute;right:4px;bottom:3px}spectric-input .checkbox{display:flex;justify-self:center;align-items:center}spectric-input .checkbox spectric-button~span{padding-left:5px}spectric-input spectric-colorpicker{display:block}spectric-input[variant=color] .fieldwrapper{display:inline-block}spectric-query{font-family:monospace}spectric-query .autocomplete{color:var(--spectric-text-primary, #161616);border-radius:0em 0em var(--spectric-border-radius, .4em) var(--spectric-border-radius, .4em);background-color:var(--spectric-background, #ffffff);border:1px solid var(--spectric-background-hover, rgba(141, 141, 141, .12));max-height:300px;border-top:0px;margin:0;position:fixed;top:anchor(bottom);justify-self:anchor-center;text-align:center}spectric-query .autocomplete [popover]{overflow:visible}spectric-query .autocomplete .tooltip-content{width:100%}spectric-query .autocomplete .optiontype{float:left;max-width:10px}spectric-query .autocomplete .label{position:absolute;right:0}spectric-query .autocomplete .option.active,spectric-query .autocomplete .option:hover{background-color:var(--spectric-background-hover, rgba(141, 141, 141, .12));border-bottom:1px solid var(--primary, #1ea7fd)}spectric-query .autocomplete .option{border-bottom:1px solid transparent;padding:8px}.query-bar-date-quick-select{display:flex;justify-content:space-evenly}spectric-query span.field-name{color:#50b8f1}spectric-query span.expression-value{color:#c5937b}spectric-query span.field-numeric{color:#bacdab}spectric-query span.wild-card{color:#a94230}spectric-query span.value-constant{color:#3a7cc5}spectric-query .syntax-highlighter{color:#bc89bd;position:absolute;z-index:100;font-size:.875rem;letter-spacing:.16px;padding:0 1.7rem 0 1rem;font-family:inherit;inline-size:calc(100% - .5rem);block-size:2.5rem;content:no-close-quote;vertical-align:baseline;display:flex;align-items:center;pointer-events:none;white-space:nowrap;box-sizing:border-box}spectric-query .syntax-highlighter>*{overflow:hidden}spectric-query:focus-within .syntax-highlighter{display:none}spectric-query spectric-input .inputWrapper input{color:transparent}spectric-query:focus-within spectric-input .inputWrapper input{color:unset}spectric-pagination .spectric-pagination-container{display:flex;justify-content:space-between;align-items:center}spectric-pagination .spectric-pagination-text{flex-grow:1;text-align:center}spectric-table{display:flex;flex-direction:column;overflow:hidden;line-height:1}spectric-table .table-wrapper{overflow:auto;flex-grow:1;position:relative}spectric-table tr{text-align:center}spectric-table tr.odd{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 90%)}spectric-table spectric-table-virtual-body tr:hover{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 70%)}spectric-table spectric-table-virtual-body tr.virtual-scroll-spacer:hover{background-color:unset}spectric-table spectric-table-virtual-body tr{height:var(--rowHeight)}spectric-table td{padding:1px;border:1px solid transparent}spectric-table spectric-table-virtual-body td{height:var(--rowHeight)}spectric-table div[role=table]{display:table;min-width:100%}spectric-table-cell{display:contents;vertical-align:middle}spectric-table-cell td{position:relative}spectric-table td:hover:has(.hasActions){border:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-cell .table-cell-actions{position:absolute;display:flex;width:100%;flex-direction:row-reverse;visibility:hidden;z-index:1}spectric-table-cell .table-cell-actions.tiny{top:-10px}spectric-table-cell .table-cell-actions.xxsmall{top:-16px}spectric-table-cell td:hover .table-cell-actions{visibility:unset}spectric-table .table-checkbox-single spectric-button{--button-border-radius: 50%}spectric-input.table-checkbox-single[checked] spectric-button{--text-on-color: transparent;border-radius:50%;position:relative}spectric-input.table-checkbox-single[checked] spectric-button:before{position:absolute;content:" ";height:50%;width:50%;left:25%;top:25%;border-radius:50%;z-index:1;box-shadow:0 0 0 4px var(--input-color)}spectric-table .cell-contents{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--lineClamp, 1);-webkit-box-pack:center;overflow:hidden;text-overflow:ellipsis;font-size:var(--fontSize);line-height:calc(var(--lineClamp) * var(--fontSize));height:var(--rowHeight)}spectric-table-header{display:table-header-group;font-weight:700;position:sticky;top:0;left:0;z-index:1;background:var(--spectric-background, #ffffff)}spectric-table-header td{vertical-align:middle;position:relative}spectric-table-header .header-contents{position:relative}spectric-table-header .header-contents .sort-direction{position:absolute;right:2px;top:calc(50% - 8px)}spectric-table-header .header-contents.sortable{cursor:pointer;padding-right:15px}spectric-table-header .header-contents.resizing{-webkit-user-select:none;user-select:none}spectric-table-header .header-contents.sortable:hover .sort-direction.none:before{content:"⮁"}spectric-table-header td .header-resize-handle{width:2px;position:absolute;right:-1px;top:1px;visibility:hidden;background-color:var(--spectric-primary, #1ea7fd);height:100%;cursor:ew-resize;z-index:1}spectric-table-header td:hover .header-resize-handle{visibility:visible}spectric-table-header td:hover:has(*.header-resize-handle){border-bottom:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-body{display:table-row-group}spectric-table-virtual-body{display:contents}spectric-table-virtual-body .virtual-scroll-spacer td{padding:0;border:0px}.spectric-popover-portal{margin:0;border:0px;padding:0;position:fixed;z-index:9999;background:transparent;pointer-events:all;--spectric-tooltip-background-color: var(--spectric-tooltip-background, var(--spectric-background,#ffffff));--spectric-tooltip-text-color: var(--spectric-tooltip-text, var(--spectric-text-primary, rgb(0, 0, 0)));--spectric-tooltip-accent-color: var(--spectric-tooltip-accent, var(--spectric-primary, #1ea7fd))}.spectric-popover-portal.spectric-tooltip-portal{pointer-events:none}.spectric-popover-portal .tooltip-container{display:flex;justify-content:center;align-items:center}.spectric-popover-portal.top .tooltip-container{flex-direction:column-reverse}.spectric-popover-portal.bottom .tooltip-container{flex-direction:column}.spectric-popover-portal.left .tooltip-container{flex-direction:row-reverse}.spectric-popover-portal .tooltip-content{background:var(--spectric-tooltip-background-color);border-radius:var(--spectric-border-radius,.4em);border:1px solid color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%);box-shadow:0 0 .01em .01em color-mix(in srgb,var(--spectric-tooltip-accent-color) 90%,var(--spectric-text-on-color,#ffffff) 90%);padding:.2em;color:var(--spectric-tooltip-text-color)}.spectric-popover-portal .tooltip-caret{background:color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%)}.spectric-tooltip-portal.top .tooltip-caret,.spectric-tooltip-portal.bottom .tooltip-caret{inline-size:.75rem;block-size:.374rem}.spectric-tooltip-portal.left .tooltip-caret,.spectric-tooltip-portal.right .tooltip-caret{inline-size:.375rem;block-size:.75rem}.spectric-popover-portal.top .tooltip-caret{clip-path:polygon(0 0,50% 100%,100% 0)}.spectric-popover-portal.bottom .tooltip-caret{clip-path:polygon(0 100%,50% 0,100% 100%)}.spectric-popover-portal.left .tooltip-caret{clip-path:polygon(0 0,100% 50%,0 100%)}.spectric-popover-portal.right .tooltip-caret{clip-path:polygon(0 50%,100% 0,100% 100%)}spectric-input.hue-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.hue-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.alpha-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range],spectric-input.hue-gradient input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.color-picker-footer{display:flex;justify-content:space-evenly}.color-picker-saturation-lightness-grid{cursor:crosshair}.color-picker-eyedropper{--button-border-radius:50%}.color-picker-eyedropper.hidden{display:none}spectric-calendar{display:flex;justify-content:center;--default-text-on-color:var(--spectric-text-on-color, #ffffff)}spectric-calendar .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}spectric-calendar .month-year{display:flex;align-items:center;gap:10px}spectric-calendar select{font-size:14px;padding:2px}spectric-calendar .days{display:grid;grid-template-columns:repeat(7,34px);grid-template-rows:repeat(7,34px);text-align:center;background:radial-gradient(circle at var(--x, 200%) var(--y, 200%),var(--spectric-background-inverse,#ffffff) 0%,var(--spectric-background,#f4f4f4) 25%);transition:background .1s ease;--spectric-text-on-color: var(--spectric-primary,#1ea7fd)}spectric-calendar .day{font-weight:700;padding:5px;background-color:var(--spectric-background)}spectric-calendar .date.active{--spectric-text-on-color: var(--default-text-on-color, #ffffff)}spectric-calendar .date{margin:2px}
1
+ spectric-input{--input-color: var(--spectric-input-color, #f4f4f4);--border-radius: var(--spectric-border-radius, .4em);--input-bottom: var(--spectric-input-bottom, var(--spectric-button-primary, #a8a8a8));--input-bottom-focused: var(--primary, #1ea7fd);--text-on-color: var(--spectric-text-on-color, #ffffff);--text-on-color-disabled: var(--spectric-text-on-color-disabled, #8d8d8d);--text-placeholder: rgba(22, 22, 22, .4);--text-primary: var(--spectric-text-primary, #161616);--text-secondary: var(--spectric-text-secondary, #525252)}spectric-input .inputWrapper{color:var(--text-secondary)}spectric-input .inputWrapper input{box-sizing:border-box;margin:0;vertical-align:baseline;font-size:.875rem;font-weight:400;line-height:1.28572;letter-spacing:.16px;outline:transparent solid 2px;outline-offset:-2px;border:none;padding:0 1rem;background-color:var(--input-color);color:var(--text-primary, #161616);font-family:inherit;inline-size:100%;block-size:2.5rem}spectric-input .inputWrapper .inputContainer:active:after,spectric-input .inputContainer:focus-within:after{border-bottom-color:var(--input-bottom-focused);width:calc(100% - 5px);transition:width .4s ease-in-out}spectric-input .inputWrapper input:read-only{background-color:transparent;border-bottom-color:var(--border-disabled)}spectric-input .inputContainer{position:relative;border-radius:var(--border-radius);overflow:hidden}spectric-input .inputContainer:after{content:"";width:0px;transition:background-color .4s cubic-bezier(.2,0,.38,.9),border-bottom-color .4s cubic-bezier(.2,0,.38,.9);border-bottom-color:var(--input-bottom);border-bottom-style:solid;border-bottom-width:1px;position:absolute;left:2.5px;bottom:0}spectric-input #helper-text{height:18px}spectric-input #helper-text.hidden{display:none}spectric-input .input-button-right{position:absolute;right:4px;bottom:3px}spectric-input .checkbox{display:flex;justify-self:center;align-items:center}spectric-input .checkbox spectric-button~span{padding-left:5px}spectric-input spectric-colorpicker{display:block}spectric-input[variant=color] .fieldwrapper{display:inline-block}spectric-query{font-family:monospace}spectric-query .autocomplete{color:var(--spectric-text-primary, #161616);border-radius:0em 0em var(--spectric-border-radius, .4em) var(--spectric-border-radius, .4em);background-color:var(--spectric-background, #ffffff);border:1px solid var(--spectric-background-hover, rgba(141, 141, 141, .12));max-height:300px;border-top:0px;margin:0;position:fixed;top:anchor(bottom);justify-self:anchor-center;text-align:center}spectric-query .autocomplete [popover]{overflow:visible}spectric-query .autocomplete .tooltip-content{width:100%}spectric-query .autocomplete .optiontype{float:left;max-width:10px}spectric-query .autocomplete .label{position:absolute;right:0}spectric-query .autocomplete .option.active,spectric-query .autocomplete .option:hover{background-color:var(--spectric-background-hover, rgba(141, 141, 141, .12));border-bottom:1px solid var(--primary, #1ea7fd)}spectric-query .autocomplete .option{border-bottom:1px solid transparent;padding:8px}.query-bar-date-quick-select{display:flex;justify-content:space-evenly}spectric-query span.field-name{color:#50b8f1}spectric-query span.expression-value{color:#c5937b}spectric-query span.field-numeric{color:#bacdab}spectric-query span.wild-card{color:#a94230}spectric-query span.value-constant{color:#3a7cc5}spectric-query .syntax-highlighter{color:#bc89bd;position:absolute;z-index:100;font-size:.875rem;letter-spacing:.16px;padding:0 1.7rem 0 1rem;font-family:inherit;inline-size:calc(100% - .5rem);block-size:2.5rem;content:no-close-quote;vertical-align:baseline;display:flex;align-items:center;pointer-events:none;white-space:nowrap;box-sizing:border-box}spectric-query .syntax-highlighter>*{overflow:hidden}spectric-query:focus-within .syntax-highlighter{display:none}spectric-query spectric-input .inputWrapper input{color:transparent}spectric-query:focus-within spectric-input .inputWrapper input{color:unset}spectric-pagination .spectric-pagination-container{display:flex;justify-content:space-between;align-items:center}spectric-pagination .spectric-pagination-text{flex-grow:1;text-align:center}spectric-table{display:flex;flex-direction:column;overflow:hidden;line-height:1}spectric-table .table-wrapper{overflow:auto;flex-grow:1;position:relative}spectric-table tr{text-align:center}spectric-table tr.odd{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 90%)}spectric-table spectric-table-virtual-body tr:hover{background-color:color-mix(in srgb,var(--spectric-primary, #1ea7fd),transparent 70%)}spectric-table spectric-table-virtual-body tr.virtual-scroll-spacer:hover{background-color:unset}spectric-table spectric-table-virtual-body tr{height:var(--rowHeight)}spectric-table td{padding:1px;border:1px solid transparent}spectric-table spectric-table-virtual-body td{height:var(--rowHeight)}spectric-table div[role=table]{display:table;min-width:100%}spectric-table-cell{display:contents;vertical-align:middle}spectric-table-cell td{position:relative}spectric-table td:hover:has(.hasActions){border:1px solid var(--spectric-primary, #1ea7fd)}spectric-table-cell .table-cell-actions{position:absolute;display:flex;width:100%;flex-direction:row-reverse;visibility:hidden;z-index:1}spectric-table-cell .table-cell-actions.tiny{top:-10px}spectric-table-cell .table-cell-actions.xxsmall{top:-16px}spectric-table-cell td:hover .table-cell-actions{visibility:unset}spectric-table .table-checkbox-single spectric-button{--button-border-radius: 50%}spectric-input.table-checkbox-single[checked] spectric-button{--text-on-color: transparent;border-radius:50%;position:relative}spectric-input.table-checkbox-single[checked] spectric-button:before{position:absolute;content:" ";height:50%;width:50%;left:25%;top:25%;border-radius:50%;z-index:1;box-shadow:0 0 0 4px var(--input-color)}spectric-table .cell-contents{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--lineClamp, 1);-webkit-box-pack:center;overflow:hidden;text-overflow:ellipsis;font-size:var(--fontSize);line-height:calc(var(--lineClamp) * var(--fontSize));height:var(--rowHeight)}spectric-table-header{display:table-header-group;font-weight:700;position:sticky;top:0;left:0;z-index:1;background:var(--spectric-background, #ffffff)}spectric-table-header th{vertical-align:middle;position:relative;overflow:hidden}spectric-table-header .header-contents{position:relative}spectric-table-header .header-contents .sort-direction{position:absolute;right:2px;top:calc(50% - 8px)}spectric-table-header .header-contents.sortable{cursor:pointer;padding-right:15px}spectric-table-header .header-contents.resizing{-webkit-user-select:none;user-select:none}spectric-table-header .header-contents.sortable:hover .sort-direction.none:before{content:"⮁"}spectric-table-header th .header-resize-handle{width:6px;position:absolute;right:-1px;top:1px;visibility:hidden;height:100%;cursor:ew-resize;z-index:1}spectric-table-header th .header-resize-handle:before{width:2px;position:absolute;top:1px;background-color:var(--spectric-primary, #1ea7fd);height:100%;content:"";z-index:1}spectric-table-header th:hover .header-resize-handle{visibility:visible}spectric-table-header th:has(*.header-resize-handle):hover:after{content:"";bottom:0;width:100%;background-color:var(--spectric-primary, #1ea7fd);height:1px;display:block;position:absolute}spectric-table-body{display:table-row-group}spectric-table-virtual-body{display:contents}spectric-table-virtual-body .virtual-scroll-spacer td{padding:0;border:0px}.spectric-popover-portal{margin:0;border:0px;padding:0;position:fixed;z-index:9999;background:transparent;pointer-events:all;--spectric-tooltip-background-color: var(--spectric-tooltip-background, var(--spectric-background,#ffffff));--spectric-tooltip-text-color: var(--spectric-tooltip-text, var(--spectric-text-primary, rgb(0, 0, 0)));--spectric-tooltip-accent-color: var(--spectric-tooltip-accent, var(--spectric-primary, #1ea7fd))}.spectric-popover-portal.spectric-tooltip-portal{pointer-events:none}.spectric-popover-portal .tooltip-container{display:flex;justify-content:center;align-items:center}.spectric-popover-portal.top .tooltip-container{flex-direction:column-reverse}.spectric-popover-portal.bottom .tooltip-container{flex-direction:column}.spectric-popover-portal.left .tooltip-container{flex-direction:row-reverse}.spectric-popover-portal .tooltip-content{background:var(--spectric-tooltip-background-color);border-radius:var(--spectric-border-radius,.4em);border:1px solid color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%);box-shadow:0 0 .01em .01em color-mix(in srgb,var(--spectric-tooltip-accent-color) 90%,var(--spectric-text-on-color,#ffffff) 90%);padding:.2em;color:var(--spectric-tooltip-text-color)}.spectric-popover-portal .tooltip-caret{background:color-mix(in srgb,var(--spectric-tooltip-background-color) 90%,var(--spectric-tooltip-accent-color) 90%)}.spectric-tooltip-portal.top .tooltip-caret,.spectric-tooltip-portal.bottom .tooltip-caret{inline-size:.75rem;block-size:.374rem}.spectric-tooltip-portal.left .tooltip-caret,.spectric-tooltip-portal.right .tooltip-caret{inline-size:.375rem;block-size:.75rem}.spectric-popover-portal.top .tooltip-caret{clip-path:polygon(0 0,50% 100%,100% 0)}.spectric-popover-portal.bottom .tooltip-caret{clip-path:polygon(0 100%,50% 0,100% 100%)}.spectric-popover-portal.left .tooltip-caret{clip-path:polygon(0 0,100% 50%,0 100%)}.spectric-popover-portal.right .tooltip-caret{clip-path:polygon(0 50%,100% 0,100% 100%)}spectric-input.hue-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.hue-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);height:15px}spectric-input.alpha-gradient input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range]::-moz-range-track{background:linear-gradient(to right,#fff0,#fff),repeating-conic-gradient(#fff,#fff 25%,#000 25%,#000 50%,#fff 50%,#fff 75%,#000 75%,#000) 50% / 10px 10px;height:15px}spectric-input.alpha-gradient input[type=range],spectric-input.hue-gradient input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.color-picker-footer{display:flex;justify-content:space-evenly}.color-picker-saturation-lightness-grid{cursor:crosshair}.color-picker-eyedropper{--button-border-radius:50%}.color-picker-eyedropper.hidden{display:none}spectric-calendar{display:flex;justify-content:center;--default-text-on-color:var(--spectric-text-on-color, #ffffff)}spectric-calendar .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}spectric-calendar .month-year{display:flex;align-items:center;gap:10px}spectric-calendar select{font-size:14px;padding:2px}spectric-calendar .days{display:grid;grid-template-columns:repeat(7,34px);grid-template-rows:repeat(7,34px);text-align:center;background:radial-gradient(circle at var(--x, 200%) var(--y, 200%),var(--spectric-background-inverse,#ffffff) 0%,var(--spectric-background,#f4f4f4) 25%);transition:background .1s ease;--spectric-text-on-color: var(--spectric-primary,#1ea7fd)}spectric-calendar .day{font-weight:700;padding:5px;background-color:var(--spectric-background)}spectric-calendar .date.active{--spectric-text-on-color: var(--default-text-on-color, #ffffff)}spectric-calendar .date{margin:2px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectric/ui",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "module": "./dist/index.es.js",
@@ -1,54 +1,69 @@
1
-
2
- spectric-table-header{
3
- display: table-header-group;
4
- font-weight: bold;
5
- position: sticky;
6
- top: 0px;
7
- left: 0px;
8
- z-index: 1;
9
- background: var(--spectric-background, #ffffff);
10
- }
11
- spectric-table-header td {
12
- vertical-align: middle;
13
- position: relative;
1
+ spectric-table-header {
2
+ display: table-header-group;
3
+ font-weight: bold;
4
+ position: sticky;
5
+ top: 0px;
6
+ left: 0px;
7
+ z-index: 1;
8
+ background: var(--spectric-background, #ffffff);
9
+ }
10
+ spectric-table-header th {
11
+ vertical-align: middle;
12
+ position: relative;
13
+ overflow: hidden;
14
14
  }
15
15
  spectric-table-header .header-contents {
16
- position: relative;
16
+ position: relative;
17
17
  }
18
18
 
19
19
  spectric-table-header .header-contents .sort-direction {
20
- position: absolute;
21
- right: 2px;
22
- top: calc(50% - 8px)
20
+ position: absolute;
21
+ right: 2px;
22
+ top: calc(50% - 8px);
23
23
  }
24
24
  spectric-table-header .header-contents.sortable {
25
- cursor: pointer;
26
- padding-right:15px
25
+ cursor: pointer;
26
+ padding-right: 15px;
27
27
  }
28
28
  spectric-table-header .header-contents.resizing {
29
- user-select: none;
29
+ user-select: none;
30
30
  }
31
- spectric-table-header .header-contents.sortable:hover .sort-direction.none::before
32
- {
33
- content: "\2B81";
31
+ spectric-table-header
32
+ .header-contents.sortable:hover
33
+ .sort-direction.none::before {
34
+ content: "\2B81";
34
35
  }
35
36
 
36
-
37
- spectric-table-header td .header-resize-handle{
38
- width: 2px;
39
- position: absolute;
40
- right: -1px;
41
- top: 1px;
42
- visibility: hidden;
43
- background-color: var(--spectric-primary, #1ea7fd);
44
- height: 100%;
45
- cursor: ew-resize;
46
- z-index: 1;
37
+ spectric-table-header th .header-resize-handle {
38
+ width: 6px;
39
+ position: absolute;
40
+ right: -1px;
41
+ top: 1px;
42
+ visibility: hidden;
43
+ height: 100%;
44
+ cursor: ew-resize;
45
+ z-index: 1;
46
+ }
47
+ spectric-table-header th .header-resize-handle::before {
48
+ width: 2px;
49
+ position: absolute;
50
+ top: 1px;
51
+ background-color: var(--spectric-primary, #1ea7fd);
52
+ height: 100%;
53
+ content: "";
54
+ z-index: 1;
55
+ }
56
+ spectric-table-header th:hover .header-resize-handle {
57
+ visibility: visible;
47
58
  }
48
59
 
49
- spectric-table-header td:hover .header-resize-handle{
50
- visibility: visible;
60
+ spectric-table-header th:has(*.header-resize-handle):hover::after {
61
+ content: "";
62
+ position: absolute;
63
+ bottom: 0px;
64
+ width: 100%;
65
+ background-color: var(--spectric-primary, #1ea7fd);
66
+ height: 1px;
67
+ display: block;
68
+ position: absolute;
51
69
  }
52
- spectric-table-header td:hover:has(*.header-resize-handle) {
53
- border-bottom: 1px solid var(--spectric-primary, #1ea7fd);
54
- }
@@ -39,7 +39,7 @@ export class TableHeaderElement<T>
39
39
  this.addDisposableListener(
40
40
  () => document.body,
41
41
  "mouseup",
42
- this._handleResizeEnd
42
+ this._handleResizeEnd,
43
43
  );
44
44
  }
45
45
  protected createRenderRoot(): HTMLElement | DocumentFragment {
@@ -68,7 +68,7 @@ export class TableHeaderElement<T>
68
68
  composed: true,
69
69
  bubbles: true,
70
70
  detail: column,
71
- })
71
+ }),
72
72
  );
73
73
  };
74
74
  _handleResizeStart = (event: MouseEvent, column: ColumnSettings<T>) => {
@@ -83,13 +83,13 @@ export class TableHeaderElement<T>
83
83
  this._resizeStart.column.width = this._resizeStart.column.width + delta;
84
84
  } else {
85
85
  let cell = (this._resizeStart.event.target as HTMLDivElement).closest(
86
- "td"
86
+ "th",
87
87
  ) as HTMLTableCellElement;
88
88
  this._resizeStart.column.width =
89
89
  cell.getBoundingClientRect().width + delta;
90
90
  }
91
91
  this.dispatchEvent(
92
- new CustomEvent("columnResize", { detail: this._resizeStart.column })
92
+ new CustomEvent("columnResize", { detail: this._resizeStart.column }),
93
93
  );
94
94
  //We wrap this to ensure any sort events get fired before we are done FIXME?
95
95
  requestAnimationFrame(() => {
@@ -128,8 +128,8 @@ export class TableHeaderElement<T>
128
128
  column.sortDirection === TableSortDirection.ascending
129
129
  ? ARROW_UP
130
130
  : column.sortDirection == TableSortDirection.descending
131
- ? ARROW_DOWN
132
- : ``;
131
+ ? ARROW_DOWN
132
+ : ``;
133
133
  let sortClass = column.sortDirection || TableSortDirection.none;
134
134
  let resizable = column.allowResize || column.allowResize === undefined;
135
135
  let resizeHandle = resizable
@@ -145,7 +145,7 @@ export class TableHeaderElement<T>
145
145
  if (typeof title == "function") {
146
146
  title = title(this.table) || undefined;
147
147
  }
148
- return html` <td
148
+ return html` <th
149
149
  @click=${() => this._handleSortChange(column)}
150
150
  style="${columnWidth}"
151
151
  >
@@ -154,7 +154,7 @@ export class TableHeaderElement<T>
154
154
  ${title}
155
155
  <span class="sort-direction ${sortClass}">${sortDirection}</span>
156
156
  </div>
157
- </td>`;
157
+ </th>`;
158
158
  }
159
159
  }
160
160
 
@@ -135,6 +135,9 @@ export class SpectricTableElement<T = any>
135
135
  @property({ type: Number, reflect: true })
136
136
  fontSize: number = 16;
137
137
 
138
+ @property({ type: Number, reflect: false })
139
+ virtualBodyBuffer: number = 100;
140
+
138
141
  /**
139
142
  * Function that allows you to set the row class name programatically
140
143
  */
@@ -451,6 +454,7 @@ export class SpectricTableElement<T = any>
451
454
  @columnResize=${this._handleColumnResize}
452
455
  ></spectric-table-header>
453
456
  <spectric-table-virtual-body
457
+ .buffer=${this.virtualBodyBuffer}
454
458
  .columns=${columns}
455
459
  .data=${this.data}
456
460
  .table=${this}
@@ -41,6 +41,8 @@ export class TableVirtualBodyElement<T>
41
41
  @property({ type: Object, attribute: false })
42
42
  table!: SpectricTableElement<T>;
43
43
  columnsMeasured: boolean = false;
44
+ @property({ type: Number, attribute: false })
45
+ buffer: number = 100;
44
46
  constructor() {
45
47
  super();
46
48
  let lastScroll = 0;
@@ -86,42 +88,26 @@ export class TableVirtualBodyElement<T>
86
88
  }
87
89
  protected render(): unknown {
88
90
  let totalRows = this.data.length;
89
- let buffer = 10; // Have a buffer of rows to prevent column jitter
90
- let headerHeight = this.table.querySelector(
91
- "spectric-table-header",
92
- )!.clientHeight;
91
+ let buffer = this.buffer / 2; // Have a buffer of rows to prevent column jitter
93
92
  let viewport = this.table.querySelector(".table-wrapper")!;
94
- let startIndex = Math.max(this.startIndex, 0);
95
- const rowsThatFit = Math.ceil(
96
- (viewport.clientHeight - headerHeight) / this.rowHeight,
93
+ const scrollTop = viewport.scrollTop;
94
+ const start = Math.max(0, Math.floor(scrollTop / this.rowHeight) - buffer);
95
+ const end = Math.min(
96
+ totalRows,
97
+ Math.ceil((scrollTop + viewport.clientHeight) / this.rowHeight) + buffer,
97
98
  );
98
- const endIndex = Math.min(startIndex + rowsThatFit + buffer, totalRows);
99
- const visibleRows = endIndex - startIndex;
100
99
  let totalHeight = totalRows * this.rowHeight;
101
- let beforeHeight =
102
- startIndex * this.rowHeight +
103
- (viewport.scrollTop - startIndex * this.rowHeight);
104
- if (endIndex === totalRows) {
105
- beforeHeight = startIndex * this.rowHeight;
106
- }
107
- let visibleHeight = visibleRows * this.rowHeight;
108
- let afterHeight = totalHeight - beforeHeight - visibleHeight;
109
- let spacerElementBefore =
110
- startIndex != 0
111
- ? html` <tr
112
- style="height:${beforeHeight}px"
113
- class="virtual-scroll-spacer"
114
- >
115
- <td colspan="${this.columns.length}"></td>
116
- </tr>`
117
- : null;
100
+ let beforeHeight = start * this.rowHeight;
101
+ let afterHeight = (totalRows - end) * this.rowHeight;
118
102
 
103
+ let spacerElementBefore = html` <tr
104
+ style="height:${beforeHeight}px"
105
+ class="virtual-scroll-spacer"
106
+ ></tr>`;
119
107
  let spacerElementAfter = html` <tr
120
108
  style="height:${afterHeight}px"
121
109
  class="virtual-scroll-spacer"
122
- >
123
- <td colspan="${this.columns.length}"></td>
124
- </tr>`;
110
+ ></tr>`;
125
111
  return html`
126
112
  <div
127
113
  style="height:${totalHeight}px;position: absolute;overflow-x: hidden;overflow-y: hidden;z-index:-1;width:1px;"
@@ -129,20 +115,16 @@ export class TableVirtualBodyElement<T>
129
115
  <tbody>
130
116
  ${spacerElementBefore}
131
117
  </tbody>
132
- <div
133
- style="display:table-row-group;max-height:${visibleHeight}px; overflow:hidden;"
134
- >
118
+ <div style="display:table-row-group;overflow:hidden;">
135
119
  ${repeat(
136
- this.data.slice(Math.max(startIndex, 0), endIndex),
120
+ this.data.slice(Math.max(start, 0), end),
137
121
  (row, index) =>
138
- html` <tr
139
- class="${this.table.getRowClass(row, index + startIndex)}"
140
- >
122
+ html` <tr class="${this.table.getRowClass(row, index + start)}">
141
123
  ${repeat(this.columns, (col) => {
142
124
  return html`<spectric-table-cell
143
125
  .column=${col}
144
126
  .row=${row}
145
- .index=${index + startIndex}
127
+ .index=${index + start}
146
128
  .columns=${this.columns}
147
129
  .table=${this.table}
148
130
  ></spectric-table-cell>`;
@@ -151,7 +133,7 @@ export class TableVirtualBodyElement<T>
151
133
  )}
152
134
  </div>
153
135
  <tbody>
154
- ${afterHeight > 0 ? spacerElementAfter : null}
136
+ ${spacerElementAfter}
155
137
  </tbody>
156
138
  `;
157
139
  }