@spectric/ui 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dialog/dialog.d.ts +1 -0
- package/dist/components/pagination/pagination.d.ts +1 -1
- package/dist/components/query_bar/QueryBar.d.ts +30 -10
- package/dist/components/query_bar/dateTimePopup.d.ts +2 -0
- package/dist/components/query_bar/geojsonPopup.d.ts +2 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/geospatial.d.ts +19 -0
- package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +2 -1
- package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +6 -1
- package/dist/components/symbols.d.ts +6 -0
- package/dist/components/table/cell.d.ts +1 -1
- package/dist/components/table/table.d.ts +14 -1
- package/dist/custom-elements.json +6 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +4405 -2803
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +361 -252
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -1
- package/src/components/dialog/dialog.css.ts +29 -29
- package/src/components/dialog/dialog.ts +3 -1
- package/src/components/input.css +5 -0
- package/src/components/input.ts +50 -41
- package/src/components/pagination/pagination.ts +167 -113
- package/src/components/query_bar/QueryBar.ts +438 -187
- package/src/components/query_bar/dateTimePopup.ts +54 -0
- package/src/components/query_bar/geojsonPopup.ts +44 -0
- package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
- package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
- package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
- package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
- package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
- package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
- package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
- package/src/components/symbols.ts +6 -0
- package/src/components/table/__tests__/table.spec.ts +2 -2
- package/src/components/table/cell.ts +28 -11
- package/src/components/table/header.ts +3 -2
- package/src/components/table/table.css +11 -4
- package/src/components/table/table.ts +75 -5
- package/src/components/table/virtualBody.ts +8 -3
- package/src/components/tooltip/popover.ts +263 -225
- package/src/stories/Dialog.stories.ts +59 -0
- package/src/stories/QueryBar.stories.ts +46 -37
- package/src/stories/fixtures/data.ts +229 -37
- package/src/stories/table.stories.ts +77 -29
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}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-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 tr{height:var(--rowHeight)}spectric-table td{height:var(--rowHeight);padding:1px;border:1px solid transparent}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(.filterable){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;top:-10px;z-index:1}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);height:calc(var(--lineClamp) * var(--fontSize))}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-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{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);height:calc(var(--lineClamp) * var(--fontSize))}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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectric/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.es.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc && vite build",
|
|
15
|
+
"build:peg": "npx grunt peg",
|
|
15
16
|
"start": "storybook dev -p 6006",
|
|
16
17
|
"test-setup": "storybook dev -p 6006 --no-open --ci --loglevel verbose",
|
|
17
18
|
"storybook:build": "web-component-analyzer src --outFiles .storybook/build/custom-elements.json && storybook build --output-dir public",
|
|
@@ -20,6 +21,7 @@
|
|
|
20
21
|
"type-check": "tsc --noemit"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
24
|
+
"@terraformer/wkt": "^2.2.1",
|
|
23
25
|
"lit": "^3.2.1"
|
|
24
26
|
},
|
|
25
27
|
"devDependencies": {
|
|
@@ -32,6 +34,9 @@
|
|
|
32
34
|
"@storybook/web-components": "^8.4.6",
|
|
33
35
|
"@storybook/web-components-vite": "^8.4.6",
|
|
34
36
|
"@types/react": "^18.3.12",
|
|
37
|
+
"@types/terraformer__wkt": "^2.0.3",
|
|
38
|
+
"grunt": "^1.6.1",
|
|
39
|
+
"peggy": "^5.0.6",
|
|
35
40
|
"storybook": "^8.4.6",
|
|
36
41
|
"typescript": "~5.6.2",
|
|
37
42
|
"vite": "^5.4.10",
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
|
|
3
3
|
export const style = css`
|
|
4
|
-
:host {
|
|
4
|
+
:host {
|
|
5
5
|
--dialog-padding: var(--spectric-dialog-padding, 5px);
|
|
6
|
-
--dialog-background:var(--spectric-background,rgb(246, 249, 252));
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
--dialog-background: var(--spectric-background, rgb(246, 249, 252));
|
|
7
|
+
--dialog-border-radius: var(--spectric-border-radius, 0.4em);
|
|
8
|
+
}
|
|
9
|
+
dialog {
|
|
10
|
+
border: 0px;
|
|
10
11
|
--spectric-background: var(--dialog-background);
|
|
11
|
-
--panel-color:var(--dialog-background);
|
|
12
|
+
--panel-color: var(--dialog-background);
|
|
12
13
|
padding: 0;
|
|
13
|
-
border-radius: var(--
|
|
14
|
-
overflow:hidden;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
dialog::backdrop {
|
|
14
|
+
border-radius: var(--dialog-border-radius);
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
dialog[open] {
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
spectric-panel {
|
|
21
|
+
margin: 0px;
|
|
22
|
+
}
|
|
23
|
+
dialog::backdrop {
|
|
24
24
|
background-color: transparent;
|
|
25
|
-
}
|
|
26
|
-
dialog.backdrop::backdrop {
|
|
25
|
+
}
|
|
26
|
+
dialog.backdrop::backdrop {
|
|
27
27
|
background-color: rgba(0, 0, 0, 0.5);
|
|
28
|
-
}
|
|
29
|
-
.modal{
|
|
28
|
+
}
|
|
29
|
+
.modal {
|
|
30
30
|
display: flex;
|
|
31
31
|
overflow: hidden;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
height: 100%;
|
|
34
|
-
}
|
|
35
|
-
.content{
|
|
34
|
+
}
|
|
35
|
+
.content {
|
|
36
36
|
flex-shrink: 1;
|
|
37
37
|
overflow: auto;
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
|
|
40
|
-
h3 {
|
|
40
|
+
h3 {
|
|
41
41
|
padding: 1em var(--dialog-padding);
|
|
42
42
|
margin: 0;
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
spectric-button{
|
|
45
|
+
spectric-button {
|
|
46
46
|
position: absolute;
|
|
47
47
|
right: 0;
|
|
48
48
|
top: 0;
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
HTMLElementTagWithEvents,
|
|
7
7
|
ReactElementWithPropsAndEvents,
|
|
8
8
|
} from "../types";
|
|
9
|
+
import "../Panel";
|
|
9
10
|
export const DialogElementTag = "spectric-dialog";
|
|
10
11
|
export type { DialogProps as Props, DialogEvents };
|
|
11
12
|
interface DialogProps {
|
|
@@ -20,6 +21,7 @@ interface DialogProps {
|
|
|
20
21
|
/**
|
|
21
22
|
* Dialog Element
|
|
22
23
|
* @slot title - sets the title of the dialog attribute/property can also be use for setting the title to a string
|
|
24
|
+
* @slot footer - Space at the bottom of the dialog that you can put buttons or other tools
|
|
23
25
|
*/
|
|
24
26
|
@customElement(DialogElementTag)
|
|
25
27
|
export class DialogElement extends LitElement implements DialogProps {
|
|
@@ -131,7 +133,7 @@ export class DialogElement extends LitElement implements DialogProps {
|
|
|
131
133
|
${this.dismissable
|
|
132
134
|
? html`<spectric-button
|
|
133
135
|
variant="text"
|
|
134
|
-
size="
|
|
136
|
+
size="xsmall"
|
|
135
137
|
@click=${() => {
|
|
136
138
|
this.open = false;
|
|
137
139
|
}}
|
package/src/components/input.css
CHANGED
|
@@ -78,6 +78,11 @@ spectric-input .input-button-right {
|
|
|
78
78
|
spectric-input .checkbox{
|
|
79
79
|
display: flex;
|
|
80
80
|
justify-self: center;
|
|
81
|
+
align-items: center;
|
|
82
|
+
}
|
|
83
|
+
/* Padding for checkbox label */
|
|
84
|
+
spectric-input .checkbox spectric-button ~ span{
|
|
85
|
+
padding-left: 5px;
|
|
81
86
|
}
|
|
82
87
|
spectric-input spectric-colorpicker{
|
|
83
88
|
display: block;
|
package/src/components/input.ts
CHANGED
|
@@ -85,7 +85,7 @@ export interface InputProps {
|
|
|
85
85
|
@customElement("spectric-input")
|
|
86
86
|
export class SpectricInput extends LitElement implements InputProps {
|
|
87
87
|
@property({ type: Boolean, reflect: true })
|
|
88
|
-
checked?: boolean;
|
|
88
|
+
checked?: boolean = false;
|
|
89
89
|
size?: ButtonSizesTypes;
|
|
90
90
|
files: FileList | null = null;
|
|
91
91
|
//static styles?: CSSResultGroup | undefined = style;
|
|
@@ -246,7 +246,10 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
246
246
|
this.requestUpdate();
|
|
247
247
|
};
|
|
248
248
|
protected updated(changedProperties: PropertyValues): void {
|
|
249
|
-
if (
|
|
249
|
+
if (
|
|
250
|
+
changedProperties.has("checked") &&
|
|
251
|
+
changedProperties.get("checked") !== undefined
|
|
252
|
+
) {
|
|
250
253
|
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
251
254
|
}
|
|
252
255
|
}
|
|
@@ -261,14 +264,14 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
261
264
|
this.dispatchEvent(new Event("change", { bubbles: true }));
|
|
262
265
|
}
|
|
263
266
|
protected render(): unknown {
|
|
264
|
-
const calendar = html`<spectric-calendar
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
const calendar = html`<spectric-calendar
|
|
268
|
+
.popup=${this.variant === InputVariants.datePopup}
|
|
269
|
+
@select=${(e: CustomEvent<Date>) => {
|
|
267
270
|
this.value = e.detail.toISOString();
|
|
268
|
-
this.querySelector<PopoverElement>("spectric-popover")?.hidePopover()
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
this.querySelector<PopoverElement>("spectric-popover")?.hidePopover();
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
</spectric-calendar>`;
|
|
272
275
|
switch (this.variant) {
|
|
273
276
|
case InputVariants.Text:
|
|
274
277
|
case InputVariants.password:
|
|
@@ -287,8 +290,8 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
287
290
|
<div class="--text-input__label-wrapper">
|
|
288
291
|
${this.label}
|
|
289
292
|
${this.maxCount > 0 && this._value
|
|
290
|
-
|
|
291
|
-
|
|
293
|
+
? `${(this._value as String).length}/${this.maxCount}`
|
|
294
|
+
: null}
|
|
292
295
|
</div>
|
|
293
296
|
</div>
|
|
294
297
|
<div class="fieldwrapper">
|
|
@@ -306,24 +309,28 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
306
309
|
?readonly="${this.readonly}"
|
|
307
310
|
?required="${this.required}"
|
|
308
311
|
type="${ifNonEmpty(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
this.variant !== InputVariants.password
|
|
313
|
+
? this.variant !== InputVariants.date
|
|
314
|
+
? this.variant
|
|
315
|
+
: InputVariants.Text
|
|
316
|
+
: this._showPassword
|
|
317
|
+
? InputVariants.Text
|
|
318
|
+
: InputVariants.password
|
|
319
|
+
)}"
|
|
315
320
|
.value="${this._value as string}"
|
|
316
321
|
maxlength="${ifNonEmpty(
|
|
317
|
-
|
|
318
|
-
|
|
322
|
+
this.maxCount > 0 ? this.maxCount : undefined
|
|
323
|
+
)}"
|
|
319
324
|
@input="${this._handleInput}"
|
|
320
325
|
@change=${this._handleChange}
|
|
321
326
|
/>
|
|
322
327
|
|
|
323
|
-
|
|
328
|
+
${this.variant === String(InputVariants.datePopup)
|
|
329
|
+
? calendar
|
|
330
|
+
: null}
|
|
324
331
|
${this.variant === String(InputVariants.password) &&
|
|
325
|
-
|
|
326
|
-
|
|
332
|
+
this.showPasswordVisibilityToggle
|
|
333
|
+
? html`
|
|
327
334
|
<spectric-button
|
|
328
335
|
icon
|
|
329
336
|
class="input-button-right"
|
|
@@ -333,11 +340,11 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
333
340
|
@click=${this.handleTogglePasswordVisibility}
|
|
334
341
|
>
|
|
335
342
|
${this._showPassword
|
|
336
|
-
|
|
337
|
-
|
|
343
|
+
? this.hidePasswordLabel
|
|
344
|
+
: this.showPasswordLabel}
|
|
338
345
|
</spectric-button>
|
|
339
346
|
`
|
|
340
|
-
|
|
347
|
+
: null}
|
|
341
348
|
</div>
|
|
342
349
|
<div
|
|
343
350
|
id="helper-text"
|
|
@@ -355,10 +362,11 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
355
362
|
return html`<div class="inputWrapper">
|
|
356
363
|
<div class="text-input__label-helper-wrapper">
|
|
357
364
|
<div class="--text-input__label-wrapper">
|
|
358
|
-
${this.label} ${
|
|
365
|
+
${this.label} ${
|
|
366
|
+
this.maxCount > 0 && this._value
|
|
359
367
|
? `${(this._value as String).length}/${this.maxCount}`
|
|
360
368
|
: null
|
|
361
|
-
|
|
369
|
+
}
|
|
362
370
|
</div>
|
|
363
371
|
</div>
|
|
364
372
|
<div class="fieldwrapper">
|
|
@@ -366,20 +374,21 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
366
374
|
<input type="hidden" .value=${String(this.value)} > </input>
|
|
367
375
|
<spectric-colorpicker
|
|
368
376
|
@cancel=${(e: DomEvent<SpectricColorPicker>) => {
|
|
369
|
-
|
|
370
|
-
|
|
377
|
+
this.value = e.target.value;
|
|
378
|
+
}}
|
|
371
379
|
@change=${(e: DomEvent<SpectricColorPicker>) => {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
380
|
+
e.stopPropagation();
|
|
381
|
+
this.value = e.target.value;
|
|
382
|
+
this._handleChange(e);
|
|
383
|
+
}} .value=${String(this.value)}></spectric-colorpicker>
|
|
376
384
|
</div>
|
|
377
385
|
<div
|
|
378
386
|
id="helper-text"
|
|
379
387
|
class="${this.helperText || this.invalid ? "" : "hidden"}"
|
|
380
388
|
>
|
|
381
|
-
<slot name="helper-text"> ${
|
|
382
|
-
|
|
389
|
+
<slot name="helper-text"> ${
|
|
390
|
+
this.invalid ? this.invalidText : this.helperText
|
|
391
|
+
} </slot>
|
|
383
392
|
</div>
|
|
384
393
|
|
|
385
394
|
</div>
|
|
@@ -393,12 +402,12 @@ export class SpectricInput extends LitElement implements InputProps {
|
|
|
393
402
|
<spectric-button
|
|
394
403
|
.tooltip=${this.helperText}
|
|
395
404
|
@click=${() => {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
${this.label}
|
|
405
|
+
this.checked = !this.checked;
|
|
406
|
+
this.value = Boolean(this.checked);
|
|
407
|
+
}} icon size=${this.size || "xxsmall"} variant=${
|
|
408
|
+
this.checked ? "primary" : "secondary"
|
|
409
|
+
}>${this.checked ? "✓" : "\u00A0"}</spectric-button>
|
|
410
|
+
${this.label.length ? html`<span>${this.label}</span>` : null}
|
|
402
411
|
</div>
|
|
403
412
|
</label>
|
|
404
413
|
`;
|