@spectric/ui 0.0.21 → 0.0.22

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.
Files changed (45) hide show
  1. package/dist/components/dialog/dialog.d.ts +1 -0
  2. package/dist/components/pagination/pagination.d.ts +1 -1
  3. package/dist/components/query_bar/QueryBar.d.ts +30 -10
  4. package/dist/components/query_bar/dateTimePopup.d.ts +2 -0
  5. package/dist/components/query_bar/geojsonPopup.d.ts +2 -0
  6. package/dist/components/query_bar/querylanguage/kuery/functions/geospatial.d.ts +19 -0
  7. package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +2 -1
  8. package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +6 -1
  9. package/dist/components/symbols.d.ts +6 -0
  10. package/dist/components/table/cell.d.ts +1 -1
  11. package/dist/components/table/table.d.ts +5 -1
  12. package/dist/custom-elements.json +5 -5
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.es.js +4382 -2795
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.umd.js +349 -248
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/style.css +1 -1
  19. package/package.json +6 -1
  20. package/src/components/dialog/dialog.css.ts +29 -29
  21. package/src/components/dialog/dialog.ts +3 -1
  22. package/src/components/input.ts +49 -39
  23. package/src/components/pagination/pagination.ts +167 -113
  24. package/src/components/query_bar/QueryBar.ts +438 -187
  25. package/src/components/query_bar/dateTimePopup.ts +54 -0
  26. package/src/components/query_bar/geojsonPopup.ts +44 -0
  27. package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
  28. package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
  29. package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
  30. package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
  31. package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
  32. package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
  33. package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
  34. package/src/components/symbols.ts +6 -0
  35. package/src/components/table/__tests__/table.spec.ts +2 -2
  36. package/src/components/table/cell.ts +7 -3
  37. package/src/components/table/header.ts +3 -2
  38. package/src/components/table/table.css +4 -2
  39. package/src/components/table/table.ts +61 -5
  40. package/src/components/table/virtualBody.ts +8 -3
  41. package/src/components/tooltip/popover.ts +263 -225
  42. package/src/stories/Dialog.stories.ts +59 -0
  43. package/src/stories/QueryBar.stories.ts +46 -37
  44. package/src/stories/fixtures/data.ts +195 -36
  45. package/src/stories/table.stories.ts +70 -22
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}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(.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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectric/ui",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
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
- dialog {
9
- border: 0px solid var(--background-inverse);
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(--spectric-border-radius);
14
- overflow:hidden;
15
-
16
- }
17
- dialog[open]{
18
- display:flex;
19
- }
20
- spectric-panel{
21
- margin:0px
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="small"
136
+ size="xsmall"
135
137
  @click=${() => {
136
138
  this.open = false;
137
139
  }}
@@ -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 (changedProperties.has("checked")) {
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
- .popup=${this.variant === InputVariants.datePopup}
266
- @select=${(e: CustomEvent<Date>) => {
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
- </spectric-calendar>`
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
- ? `${(this._value as String).length}/${this.maxCount}`
291
- : null}
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
- this.variant !== InputVariants.password
310
- ? this.variant !== InputVariants.date ? this.variant : InputVariants.Text
311
- : this._showPassword
312
- ? InputVariants.Text
313
- : InputVariants.password
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
- this.maxCount > 0 ? this.maxCount : undefined
318
- )}"
322
+ this.maxCount > 0 ? this.maxCount : undefined
323
+ )}"
319
324
  @input="${this._handleInput}"
320
325
  @change=${this._handleChange}
321
326
  />
322
327
 
323
- ${this.variant === String(InputVariants.datePopup) ? calendar : null}
328
+ ${this.variant === String(InputVariants.datePopup)
329
+ ? calendar
330
+ : null}
324
331
  ${this.variant === String(InputVariants.password) &&
325
- this.showPasswordVisibilityToggle
326
- ? html`
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
- ? this.hidePasswordLabel
337
- : this.showPasswordLabel}
343
+ ? this.hidePasswordLabel
344
+ : this.showPasswordLabel}
338
345
  </spectric-button>
339
346
  `
340
- : null}
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} ${this.maxCount > 0 && this._value
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
- this.value = e.target.value;
370
- }}
377
+ this.value = e.target.value;
378
+ }}
371
379
  @change=${(e: DomEvent<SpectricColorPicker>) => {
372
- e.stopPropagation();
373
- this.value = e.target.value;
374
- this._handleChange(e);
375
- }} .value=${String(this.value)}></spectric-colorpicker>
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"> ${this.invalid ? this.invalidText : this.helperText
382
- } </slot>
389
+ <slot name="helper-text"> ${
390
+ this.invalid ? this.invalidText : this.helperText
391
+ } </slot>
383
392
  </div>
384
393
 
385
394
  </div>
@@ -393,10 +402,11 @@ export class SpectricInput extends LitElement implements InputProps {
393
402
  <spectric-button
394
403
  .tooltip=${this.helperText}
395
404
  @click=${() => {
396
- this.checked = !this.checked;
397
- this.value = Boolean(this.checked);
398
- }} icon size=${this.size || "xxsmall"} variant=${this.checked ? "primary" : "secondary"
399
- }>${this.checked ? "" : "\u00A0"}</spectric-button>
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>
400
410
 
401
411
  ${this.label}
402
412
  </div>