@limetech/lime-elements 38.25.0 → 38.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-checkbox.cjs.entry.js +1 -1
  4. package/dist/cjs/limel-checkbox.cjs.entry.js.map +1 -1
  5. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +3 -1
  6. package/dist/cjs/limel-color-picker-palette.cjs.entry.js.map +1 -1
  7. package/dist/cjs/limel-color-picker.cjs.entry.js +8 -5
  8. package/dist/cjs/limel-color-picker.cjs.entry.js.map +1 -1
  9. package/dist/cjs/limel-list-item.cjs.entry.js +1 -1
  10. package/dist/cjs/limel-list-item.cjs.entry.js.map +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/collection/components/checkbox/checkbox.css +70 -7
  13. package/dist/collection/components/color-picker/color-picker-palette.js +38 -1
  14. package/dist/collection/components/color-picker/color-picker-palette.js.map +1 -1
  15. package/dist/collection/components/color-picker/color-picker.css +3 -1
  16. package/dist/collection/components/color-picker/color-picker.js +62 -5
  17. package/dist/collection/components/color-picker/color-picker.js.map +1 -1
  18. package/dist/collection/components/list-item/list-item.css +72 -9
  19. package/dist/collection/style/internal/boolean-input.scss +44 -8
  20. package/dist/esm/lime-elements.js +1 -1
  21. package/dist/esm/limel-checkbox.entry.js +1 -1
  22. package/dist/esm/limel-checkbox.entry.js.map +1 -1
  23. package/dist/esm/limel-color-picker-palette.entry.js +3 -1
  24. package/dist/esm/limel-color-picker-palette.entry.js.map +1 -1
  25. package/dist/esm/limel-color-picker.entry.js +8 -5
  26. package/dist/esm/limel-color-picker.entry.js.map +1 -1
  27. package/dist/esm/limel-list-item.entry.js +1 -1
  28. package/dist/esm/limel-list-item.entry.js.map +1 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/lime-elements/lime-elements.esm.js +1 -1
  31. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  32. package/dist/lime-elements/p-0334e593.entry.js +2 -0
  33. package/dist/lime-elements/{p-0d4a48ce.entry.js.map → p-0334e593.entry.js.map} +1 -1
  34. package/dist/lime-elements/{p-3d25fce1.entry.js → p-0345965e.entry.js} +2 -2
  35. package/dist/lime-elements/p-0345965e.entry.js.map +1 -0
  36. package/dist/lime-elements/p-8539647d.entry.js +2 -0
  37. package/dist/lime-elements/p-8539647d.entry.js.map +1 -0
  38. package/dist/lime-elements/{p-20c96ff3.entry.js → p-e1213871.entry.js} +2 -2
  39. package/dist/lime-elements/p-e1213871.entry.js.map +1 -0
  40. package/dist/lime-elements/style/internal/boolean-input.scss +44 -8
  41. package/dist/types/components/color-picker/color-picker-palette.d.ts +10 -0
  42. package/dist/types/components/color-picker/color-picker.d.ts +20 -1
  43. package/dist/types/components.d.ts +42 -2
  44. package/package.json +1 -1
  45. package/dist/lime-elements/p-0d4a48ce.entry.js +0 -2
  46. package/dist/lime-elements/p-20c96ff3.entry.js.map +0 -1
  47. package/dist/lime-elements/p-3d25fce1.entry.js.map +0 -1
  48. package/dist/lime-elements/p-a7aa383b.entry.js +0 -2
  49. package/dist/lime-elements/p-a7aa383b.entry.js.map +0 -1
@@ -952,10 +952,18 @@ export namespace Components {
952
952
  * @exampleComponent limel-example-color-picker-custom-palette
953
953
  */
954
954
  interface LimelColorPicker {
955
+ /**
956
+ * Set to `true` to disable the field. Use `disabled` to indicate that the field can normally be interacted with, but is currently disabled. This tells the user that if certain requirements are met, the field may become enabled again.
957
+ */
958
+ "disabled": boolean;
955
959
  /**
956
960
  * Helper text of the input field
957
961
  */
958
962
  "helperText": string;
963
+ /**
964
+ * Set to `true` to indicate that the current value of the input field is invalid.
965
+ */
966
+ "invalid": boolean;
959
967
  /**
960
968
  * The label of the input field
961
969
  */
@@ -969,7 +977,11 @@ export namespace Components {
969
977
  */
970
978
  "paletteColumnCount"?: number;
971
979
  /**
972
- * Set to `true` if a value is readonly. This makes the component un-interactive.
980
+ * The placeholder text shown inside the input field, when the field is focused and empty.
981
+ */
982
+ "placeholder": string;
983
+ /**
984
+ * Set to `true` to make the field read-only. Use `readonly` when the field is only there to present the data it holds, and will not become possible for the current user to edit.
973
985
  */
974
986
  "readonly": boolean;
975
987
  /**
@@ -997,6 +1009,10 @@ export namespace Components {
997
1009
  * Helper text of the input field
998
1010
  */
999
1011
  "helperText": string;
1012
+ /**
1013
+ * Set to `true` to indicate that the current value of the input field is invalid.
1014
+ */
1015
+ "invalid": boolean;
1000
1016
  /**
1001
1017
  * Label of the input field
1002
1018
  */
@@ -1005,6 +1021,10 @@ export namespace Components {
1005
1021
  * Custom color palette to use instead of Lime palette. Internal prop passed from parent.
1006
1022
  */
1007
1023
  "palette"?: CustomPalette;
1024
+ /**
1025
+ * The placeholder text shown inside the input field, when the field is focused and empty.
1026
+ */
1027
+ "placeholder": string;
1008
1028
  /**
1009
1029
  * Set to `true` if a value is required
1010
1030
  */
@@ -5998,10 +6018,18 @@ declare namespace LocalJSX {
5998
6018
  * @exampleComponent limel-example-color-picker-custom-palette
5999
6019
  */
6000
6020
  interface LimelColorPicker {
6021
+ /**
6022
+ * Set to `true` to disable the field. Use `disabled` to indicate that the field can normally be interacted with, but is currently disabled. This tells the user that if certain requirements are met, the field may become enabled again.
6023
+ */
6024
+ "disabled"?: boolean;
6001
6025
  /**
6002
6026
  * Helper text of the input field
6003
6027
  */
6004
6028
  "helperText"?: string;
6029
+ /**
6030
+ * Set to `true` to indicate that the current value of the input field is invalid.
6031
+ */
6032
+ "invalid"?: boolean;
6005
6033
  /**
6006
6034
  * The label of the input field
6007
6035
  */
@@ -6019,7 +6047,11 @@ declare namespace LocalJSX {
6019
6047
  */
6020
6048
  "paletteColumnCount"?: number;
6021
6049
  /**
6022
- * Set to `true` if a value is readonly. This makes the component un-interactive.
6050
+ * The placeholder text shown inside the input field, when the field is focused and empty.
6051
+ */
6052
+ "placeholder"?: string;
6053
+ /**
6054
+ * Set to `true` to make the field read-only. Use `readonly` when the field is only there to present the data it holds, and will not become possible for the current user to edit.
6023
6055
  */
6024
6056
  "readonly"?: boolean;
6025
6057
  /**
@@ -6047,6 +6079,10 @@ declare namespace LocalJSX {
6047
6079
  * Helper text of the input field
6048
6080
  */
6049
6081
  "helperText"?: string;
6082
+ /**
6083
+ * Set to `true` to indicate that the current value of the input field is invalid.
6084
+ */
6085
+ "invalid"?: boolean;
6050
6086
  /**
6051
6087
  * Label of the input field
6052
6088
  */
@@ -6059,6 +6095,10 @@ declare namespace LocalJSX {
6059
6095
  * Custom color palette to use instead of Lime palette. Internal prop passed from parent.
6060
6096
  */
6061
6097
  "palette"?: CustomPalette;
6098
+ /**
6099
+ * The placeholder text shown inside the input field, when the field is focused and empty.
6100
+ */
6101
+ "placeholder"?: string;
6062
6102
  /**
6063
6103
  * Set to `true` if a value is required
6064
6104
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "38.25.0",
3
+ "version": "38.26.1",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -1,2 +0,0 @@
1
- import{h as e,r as i,c as t,H as o,g as l}from"./p-288f0842.js";import{g as r}from"./p-d251f404.js";import{c as s}from"./p-ad52787a.js";import{C as a}from"./p-8ded6465.js";import{t as n}from"./p-4c88e5d3.js";const c=i=>e("div",{class:{"boolean-input":true,"radio-button":true,checked:i.checked,disabled:i.disabled}},e("input",{type:"radio",id:i.id,checked:i.checked,disabled:i.disabled,onChange:i.onChange}),e("div",{class:"box"}),e("label",{class:"boolean-input-label",htmlFor:i.id},i.label));const d='@charset "UTF-8";*,*:before,*:after{box-sizing:border-box}.boolean-input{--limel-boolean-input-box-size:1.25rem;--limel-boolean-input-gap-size:0.5rem;position:relative;isolation:isolate;display:flex;align-items:center;min-height:var(--limel-checkbox-min-height, 2.5rem);width:100%}.boolean-input input[type=checkbox],.boolean-input input[type=radio]{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap;-webkit-appearance:none;-moz-appearance:none;appearance:none}label.boolean-input-label{min-width:var(--limel-boolean-input-box-size);min-height:var(--limel-boolean-input-box-size);padding-top:0.125rem;cursor:pointer;position:relative;width:100%;font-size:var(--limel-theme-default-small-font-size);color:var(--limel-theme-text-primary-on-background-color);padding-left:calc(var(--limel-boolean-input-box-size) + var(--limel-boolean-input-gap-size))}.disabled:not([readonly]):not([readonly=true]) label.boolean-input-label{cursor:not-allowed;color:var(--limel-theme-text-disabled-color)}.required label.boolean-input-label:after{margin-left:0.0625rem;content:"*"}.invalid:not(.readonly) label.boolean-input-label{color:var(--limel-theme-error-text-color)}:host(limel-checkbox.hide-label) label.boolean-input-label,.hide-label label.boolean-input-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0;width:var(--limel-boolean-input-box-size)}.box{position:absolute;pointer-events:none;transition:border-color 0.4s ease 0.2s, background-color 0.2s ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease;display:inline-block;vertical-align:middle;width:var(--limel-boolean-input-box-size);height:var(--limel-boolean-input-box-size);margin-right:var(--limel-boolean-input-gap-size);border-radius:var(--limel-boolean-input-box-border-radius);border:0.125rem solid;border-color:var(--checkbox-unchecked-border-color, rgb(var(--contrast-900)));background-color:var(--limel-checkbox-background-color, rgb(var(--contrast-300)))}.checked .box,.boolean-input:has(input[type=checkbox]:checked) .box,.boolean-input:has(input[type=radio]:checked) .box{background-color:var(--lime-primary-color, var(--limel-theme-primary-color));border-color:var(--lime-primary-color, var(--limel-theme-primary-color))}.disabled .box{opacity:0.4}.boolean-input:not(.disabled):has(label.boolean-input-label:hover) .box{will-change:box-shadow;box-shadow:var(--button-shadow-hovered)}.boolean-input:not(.disabled):has(label.boolean-input-label:active) .box{will-change:box-shadow;box-shadow:var(--button-shadow-pressed)}.box:before{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);content:"";position:absolute;inset:-0.1875rem;border-radius:inherit}.boolean-input:has(input[type=checkbox]:focus-visible) .box:before,.boolean-input:has(input[type=radio]:focus-visible) .box:before{will-change:box-shadow;box-shadow:var(--shadow-depth-8-focused)}.box:after{transition:opacity 0.2s ease, width 0.4s ease, box-shadow 0.6s cubic-bezier(0.68, -0.55, 0, 1.87), transform 0.6s cubic-bezier(0.68, -0.55, 0, 1.87);content:"";position:absolute;inset:0;margin:auto;border-radius:1rem;opacity:0;background-color:rgb(var(--color-white))}.boolean-input:not(.disabled):has(label.boolean-input-label:hover) .box:after{will-change:opacity, box-shadow, transform, width}:host(limel-checkbox){min-height:var(--limel-checkbox-min-height, 2.5rem)}.box:after{height:0.125rem;width:0.25rem}.indeterminate .box:after{opacity:1;width:calc(var(--limel-boolean-input-box-size) - 0.5rem)}.checkbox{--limel-boolean-input-box-border-radius:0.25rem}.checkbox svg.check-mark{position:absolute;z-index:1;inset:0;transform:translate3d(-0.125rem, -0.125rem, 0);width:var(--limel-boolean-input-box-size);height:var(--limel-boolean-input-box-size);padding:0.25rem;color:rgb(var(--color-white));opacity:0;stroke-width:0.1875rem;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}.checkbox svg.check-mark path{stroke-dashoffset:29.7833;stroke-dasharray:29.7833;transition:stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1)}.checkbox:not(.indeterminate):has(input[type=checkbox]:checked) svg.check-mark{opacity:1}.checkbox:not(.indeterminate):has(input[type=checkbox]:checked) svg.check-mark path{stroke-dashoffset:0}limel-dynamic-label{margin-top:0.375rem;margin-left:-0.25rem}:host(limel-checkbox:focus),:host(limel-checkbox:focus-visible),:host(limel-checkbox:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limel-checkbox){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limel-checkbox:focus) limel-helper-line,:host(limel-checkbox:focus-visible) limel-helper-line,:host(limel-checkbox:focus-within) limel-helper-line,:host(limel-checkbox:hover) limel-helper-line{will-change:grid-template-rows}.radio-button{--limel-boolean-input-box-border-radius:var(\n --limel-boolean-input-box-size\n )}.box:after{width:100%;height:100%;border-radius:50%}.boolean-input:has(input[type=radio]:checked) .box:after{opacity:1;transform:scale(0.6);box-shadow:var(--shadow-depth-8)}*,*:before,*:after{box-sizing:border-box}limel-list-item{min-height:2.5rem;transition:background-color 0.6s ease;position:relative;isolation:isolate;display:flex;align-items:center;gap:0.5rem;padding:0 1rem;background-color:rgb(var(--contrast-100))}limel-list-item:focus{outline:none}limel-list-item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}limel-list-item:hover{z-index:1;transition:background-color 0.2s ease;border-radius:0.5rem}limel-list-item:focus,limel-list-item:focus-visible,limel-list-item:active{z-index:1;border-radius:0.5rem}limel-list-item:first-of-type{border-top-left-radius:0.5rem;border-top-right-radius:0.5rem}limel-list-item:last-of-type{border-bottom-left-radius:0.5rem;border-bottom-right-radius:0.5rem}limel-list-item:not([disabled]):not([disabled=true]){cursor:pointer}limel-list-item[disabled]:not([disabled=false]){cursor:not-allowed}limel-list-item[disabled]:not([disabled=false]){cursor:not-allowed}limel-list-item[disabled]:not([disabled=false]) .text,limel-list-item[disabled]:not([disabled=false]) limel-icon,limel-list-item[disabled]:not([disabled=false]) img,limel-list-item[disabled]:not([disabled=false]) .boolean-input{opacity:0.4}limel-list-item:not([disabled]):not([disabled=true]):hover,limel-list-item:not([disabled]):not([disabled=true]):focus-visible{background-color:rgb(var(--contrast-400))}limel-list-item[type=option]:before{transition:background-color 0.6s ease;content:"";position:absolute;inset:0;opacity:0.2;border-radius:0.5rem}limel-list-item[type=option][selected]:not([selected=false]):before{transition:background-color 0.2s ease;background-color:var(--limel-theme-primary-color)}limel-list-item .text{flex-grow:1;min-width:0;display:flex;flex-direction:column;padding:0.5rem 0;color:var(--limel-theme-text-primary-on-background-color)}limel-list-item .label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:var(--limel-theme-default-font-size);line-height:1rem}limel-list-item .description{display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:var(--maxLinesSecondaryText);line-height:1rem;font-size:var(--limel-theme-default-small-font-size);opacity:0.6}limel-list-item limel-icon{color:var(--limel-theme-text-secondary-on-background-color);flex-shrink:0;margin-left:-0.5rem}limel-list-item limel-icon:has(+img){margin-left:0;position:absolute;top:0.125rem;left:0.125rem;padding:0.1875rem;width:1.25rem;background-color:rgb(var(--contrast-200), 0.8)}limel-list-item img{flex-shrink:0;object-fit:cover;border-radius:50%;width:2rem;height:2rem;box-shadow:0 0 0 1px rgb(var(--contrast-800), 0.5)}limel-list-item limel-menu{margin-right:-0.5rem;order:var(--limel-list-item-menu-order, 3)}limel-list-item[role=menuitem] limel-list-item .label{font-size:var(--limel-theme-default-small-font-size)}.boolean-input{width:var(--limel-boolean-input-box-size);margin-left:-0.25rem}.boolean-input.checkbox{margin-right:0.25rem}limel-list-item:has(limel-icon) .boolean-input,limel-list-item:has(img) .boolean-input{margin-right:-0.25rem;margin-left:0;order:2}.boolean-input-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0;width:var(--limel-boolean-input-box-size)}';const h=class{constructor(o){i(this,o);this.interact=t(this,"interact",7);this.renderLabel=()=>e("span",{class:"label",id:this.labelId},this.text);this.renderDescription=()=>{if(!this.secondaryText){return}return e("span",{class:"description",id:this.descriptionId},this.secondaryText)};this.renderIcon=()=>{const i=r(this.icon);if(!i){return}let t;let o;let l;if(typeof this.icon==="object"){t=this.icon.color;o=this.icon.backgroundColor;l=this.icon.title}const s={"aria-label":l,"aria-hidden":l?null:"true",name:i,style:{color:t,"background-color":o},badge:this.badgeIcon,size:this.iconSize};return e("limel-icon",Object.assign({},s))};this.renderPrimaryComponent=()=>{const i=this.primaryComponent;if(!(i===null||i===void 0?void 0:i.name)){return}const t=i.name;const o=i.props||{};return e(t,Object.assign({},o))};this.renderImage=()=>{if(!this.image){return}return e("img",{src:this.image.src,alt:this.image.alt,loading:"lazy"})};this.renderActionMenu=i=>{if(!i||i.length===0){return}const t=this.getStableActions(i);return e("limel-menu",{class:"mdc-deprecated-list-item__meta",items:t,openDirection:"left-start"},e("limel-icon-button",{class:"action-menu-trigger",slot:"trigger",icon:"menu_2",label:this.actionMenuLabel()}))};this.renderRadioButton=()=>{if(this.type!=="radio"){return}return e(c,{id:`radio_${this.labelId}`,checked:this.selected,disabled:this.disabled})};this.renderCheckbox=()=>{if(this.type!=="checkbox"){return}return e(a,{id:`checkbox_${this.labelId}`,checked:this.selected,disabled:this.disabled})};this.onClick=e=>{if(this.disabled){return}const i=e.target;const t=!!(i===null||i===void 0?void 0:i.closest(".action-menu-trigger"));const o=!!(i===null||i===void 0?void 0:i.closest("[data-no-toggle]"));const l=!!(i===null||i===void 0?void 0:i.closest("limel-menu"));if(t||o||l){return}if(this.isSelectableType()){this.handleInteraction()}};this.onKeyDown=e=>{if(this.disabled){return}const i=this.host.shadowRoot;const t=i?i.activeElement:null;if(t&&t!==this.host){return}const o=e.key==="Enter";const l=e.key===" "||e.key==="Space"||e.key==="Spacebar"||e.code==="Space";if(!o&&!l){return}if(e.repeat){if(l){e.preventDefault()}return}if(l){e.preventDefault()}if(this.isSelectableType()){this.handleInteraction();return}if(o||l){this.host.click()}};this.handleInteraction=()=>{const e=!this.selected;const i={text:this.text,secondaryText:this.secondaryText,disabled:this.disabled,icon:this.icon,selected:e,value:this.value,actions:this.actions,primaryComponent:this.primaryComponent,image:this.image};this.interact.emit({selected:e,item:i})};this.actionMenuLabel=()=>n.get("file-viewer.more-actions",this.language);this.language="en";this.value=undefined;this.text=undefined;this.secondaryText=undefined;this.disabled=false;this.icon=undefined;this.iconSize="small";this.badgeIcon=false;this.selected=false;this.actions=undefined;this.primaryComponent=undefined;this.image=undefined;this.type="listitem";this.labelId=s();this.descriptionId=s()}render(){var i;const t={"aria-labelledby":this.labelId,"aria-describedby":this.secondaryText?this.descriptionId:undefined,"aria-disabled":this.disabled?"true":"false"};if(this.type==="radio"||this.type==="checkbox"){t["aria-checked"]=this.selected?"true":"false"}else if(this.type==="option"||this.type==="menuitem"){t["aria-selected"]=this.selected?"true":"false"}return e(o,Object.assign({role:this.getHostRole(),class:{"has-primary-component":!!((i=this.primaryComponent)===null||i===void 0?void 0:i.name)}},t,{onClick:this.onClick,onKeyDown:this.onKeyDown}),this.renderRadioButton(),this.renderCheckbox(),this.renderIcon(),this.renderImage(),this.renderPrimaryComponent(),e("div",{class:"text"},this.renderLabel(),this.renderDescription()),this.renderActionMenu(this.actions))}getStableActions(e){if(this.memoizedActions===e){return this.memoizedActions}this.memoizedActions=e;return e}isSelectableType(){return this.type==="option"||this.type==="radio"||this.type==="checkbox"}getHostRole(){switch(this.type){case"option":{return"option"}case"radio":{return"radio"}case"checkbox":{return"checkbox"}case"menuitem":{return"menuitem"}default:{return"listitem"}}}get host(){return l(this)}};h.style=d;export{h as limel_list_item};
2
- //# sourceMappingURL=p-0d4a48ce.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["colorPickerCss","ColorPicker","this","shouldFocus","renderTooltip","readonly","tooltipLabel","h","label","elementId","renderPickerPalette","renderPickerTrigger","open","isOpen","openDirection","onClose","onPopoverClose","ref","setColorPickerPaletteElement","value","helperText","onChange","handleChange","required","palette","columnCount","paletteColumnCount","background","slot","style","role","onClick","openPopover","id","disabled","element","contentElement","event","stopPropagation","change","emit","detail","componentDidRender","_a","focus","render","Host"],"sources":["./src/components/color-picker/color-picker.scss?tag=limel-color-picker&encapsulation=shadow","./src/components/color-picker/color-picker.tsx"],"sourcesContent":["@use '../../style/mixins';\n@use '../../style/internal/shared_input-select-picker';\n@import './partial-styles/lime-admin-hack';\n\n:host(limel-color-picker) {\n display: grid;\n gap: 0.25rem;\n grid-template-columns: auto 1fr;\n}\n\nbutton[slot='trigger'] {\n all: unset;\n box-sizing: border-box;\n position: relative;\n isolation: isolate;\n width: shared_input-select-picker.$height-of-mdc-text-field;\n height: shared_input-select-picker.$height-of-mdc-text-field;\n\n border-radius: 0.5rem;\n\n &:not([disabled]):not([disabled='true']) {\n @include mixins.is-elevated-clickable();\n @include mixins.visualize-keyboard-focus();\n }\n\n &:before,\n &:after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n }\n\n &:before {\n @include mixins.add-chessboard-background();\n z-index: 0;\n }\n\n &:after {\n z-index: 1;\n box-shadow: 0 0 0 0.25rem rgb(var(--contrast-100)) inset;\n background: var(--background);\n }\n}\n\n:host([readonly]:not([readonly='false'])) {\n limel-input-field {\n transform: translateX(\n calc(\n #{shared_input-select-picker.$height-of-mdc-text-field} /\n 4 * -1\n )\n )\n translateY(\n calc(\n #{shared_input-select-picker.$height-of-mdc-text-field} / 4\n )\n );\n }\n\n button[slot='trigger'] {\n border: 1px solid rgba(var(--contrast-700), 0.65);\n }\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Event,\n EventEmitter,\n Host,\n} from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\nimport type { CustomColorSwatch } from './color-picker.types';\n\n/**\n * This component enables you to select a swatch from out color palette, simply\n * by clicking on it. You can then copy the css variable name of the chosen color\n * and use it where desired.\n *\n * The color picker can also show you a preview of any valid color name or color value.\n *\n * :::note\n * Make sure to read our [guidelines about usage of colors](/#/DesignGuidelines/color-system.md/) from our palette.\n * :::\n *\n * @exampleComponent limel-example-color-picker\n * @exampleComponent limel-example-color-picker-readonly\n * @exampleComponent limel-example-color-picker-custom-palette\n */\n@Component({\n tag: 'limel-color-picker',\n shadow: true,\n styleUrl: 'color-picker.scss',\n})\nexport class ColorPicker implements FormComponent {\n /**\n * Name or code of the chosen color\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * The label of the input field\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Helper text of the input field\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * Displayed as tooltips when picker is hovered.\n */\n @Prop({ reflect: true })\n public tooltipLabel: string;\n\n /**\n * Set to `true` if a value is required\n */\n @Prop({ reflect: true })\n public required: boolean;\n\n /**\n * Set to `true` if a value is readonly. This makes the component un-interactive.\n */\n @Prop({ reflect: true })\n public readonly: boolean;\n\n /**\n * An array of either color value strings, or objects with a `name` and a `value`,\n * which replaces the default palette. Any valid CSS color format is accepted as value\n * (HEX, RGB/A, HSL, HWB, color-mix(), named colors, etc.).\n */\n @Prop()\n public palette?: Array<string | CustomColorSwatch>;\n\n /**\n * Defines the number of columns in the color swatch grid.\n * If not provided, it will default to the number of colors in the palette;\n * but stops at a maximum of 25 columns.\n */\n @Prop({ reflect: true })\n public paletteColumnCount?: number;\n\n /**\n * Emits chosen value to the parent component\n */\n @Event()\n public change: EventEmitter<string>;\n\n @State()\n private isOpen = false;\n\n public componentDidRender() {\n if (this.shouldFocus && this.isOpen) {\n this.shouldFocus = false;\n this.contentElement?.focus();\n }\n }\n\n private contentElement?: HTMLLimelColorPickerPaletteElement;\n\n private shouldFocus = false;\n\n public render() {\n return (\n <Host>\n {this.renderTooltip()}\n {this.renderPickerPalette()}\n <limel-input-field\n label={this.label}\n helperText={this.helperText}\n value={this.value}\n onChange={this.handleChange}\n required={this.required}\n readonly={this.readonly}\n />\n </Host>\n );\n }\n private renderTooltip = () => {\n if (!this.readonly && this.tooltipLabel) {\n return (\n <limel-tooltip\n label={this.tooltipLabel}\n elementId=\"tooltip-button\"\n />\n );\n }\n };\n\n private renderPickerPalette = () => {\n if (this.readonly) {\n return this.renderPickerTrigger();\n }\n\n return (\n <limel-popover\n open={this.isOpen}\n openDirection=\"bottom-start\"\n onClose={this.onPopoverClose}\n >\n {this.renderPickerTrigger()}\n <limel-color-picker-palette\n ref={this.setColorPickerPaletteElement}\n value={this.value}\n label={this.label}\n helperText={this.helperText}\n onChange={this.handleChange}\n required={this.required}\n palette={this.palette as any}\n columnCount={this.paletteColumnCount}\n />\n </limel-popover>\n );\n };\n\n private renderPickerTrigger = () => {\n const background = this.value ? { '--background': this.value } : {};\n\n return (\n <button\n slot=\"trigger\"\n style={background}\n role=\"button\"\n onClick={this.openPopover}\n id=\"tooltip-button\"\n disabled={this.readonly}\n />\n );\n };\n\n private setColorPickerPaletteElement = (\n element: HTMLLimelColorPickerPaletteElement\n ) => {\n this.contentElement = element;\n };\n\n private openPopover = (event: MouseEvent) => {\n event.stopPropagation();\n this.isOpen = true;\n\n this.shouldFocus = this.isOpen;\n };\n\n private onPopoverClose = (event: CustomEvent) => {\n event.stopPropagation();\n this.isOpen = false;\n };\n\n private handleChange = (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n}\n"],"mappings":"yDAAA,MAAMA,EAAiB,irI,MCgCVC,EAAW,M,wDAuEZC,KAAAC,YAAc,MAkBdD,KAAAE,cAAgB,KACpB,IAAKF,KAAKG,UAAYH,KAAKI,aAAc,CACrC,OACIC,EAAA,iBACIC,MAAON,KAAKI,aACZG,UAAU,kB,GAMlBP,KAAAQ,oBAAsB,KAC1B,GAAIR,KAAKG,SAAU,CACf,OAAOH,KAAKS,qB,CAGhB,OACIJ,EAAA,iBACIK,KAAMV,KAAKW,OACXC,cAAc,eACdC,QAASb,KAAKc,gBAEbd,KAAKS,sBACNJ,EAAA,8BACIU,IAAKf,KAAKgB,6BACVC,MAAOjB,KAAKiB,MACZX,MAAON,KAAKM,MACZY,WAAYlB,KAAKkB,WACjBC,SAAUnB,KAAKoB,aACfC,SAAUrB,KAAKqB,SACfC,QAAStB,KAAKsB,QACdC,YAAavB,KAAKwB,qBAEV,EAIhBxB,KAAAS,oBAAsB,KAC1B,MAAMgB,EAAazB,KAAKiB,MAAQ,CAAE,eAAgBjB,KAAKiB,OAAU,GAEjE,OACIZ,EAAA,UACIqB,KAAK,UACLC,MAAOF,EACPG,KAAK,SACLC,QAAS7B,KAAK8B,YACdC,GAAG,iBACHC,SAAUhC,KAAKG,UACjB,EAIFH,KAAAgB,6BACJiB,IAEAjC,KAAKkC,eAAiBD,CAAO,EAGzBjC,KAAA8B,YAAeK,IACnBA,EAAMC,kBACNpC,KAAKW,OAAS,KAEdX,KAAKC,YAAcD,KAAKW,MAAM,EAG1BX,KAAAc,eAAkBqB,IACtBA,EAAMC,kBACNpC,KAAKW,OAAS,KAAK,EAGfX,KAAAoB,aAAgBe,IACpBA,EAAMC,kBACNpC,KAAKqC,OAAOC,KAAKH,EAAMI,OAAO,E,qNArGjB,K,CAEVC,qB,MACH,GAAIxC,KAAKC,aAAeD,KAAKW,OAAQ,CACjCX,KAAKC,YAAc,OACnBwC,EAAAzC,KAAKkC,kBAAc,MAAAO,SAAA,SAAAA,EAAEC,O,EAQtBC,SACH,OACItC,EAACuC,EAAI,KACA5C,KAAKE,gBACLF,KAAKQ,sBACNH,EAAA,qBACIC,MAAON,KAAKM,MACZY,WAAYlB,KAAKkB,WACjBD,MAAOjB,KAAKiB,MACZE,SAAUnB,KAAKoB,aACfC,SAAUrB,KAAKqB,SACflB,SAAUH,KAAKG,W"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["colors","brightnesses","getColorName","color","brightness","getSwatchValue","getSwatchName","createSwatch","name","value","colorPickerPaletteCss","Palette","this","renderSwatches","getPalette","map","renderSwatchButton","swatch","index","isSelected","classList","usesCustomPalette","h","class","style","title","disabled","key","onClick","handleSwatchClick","handleChange","event","stopPropagation","change","emit","detail","newValue","render","background","getColumnCount","label","helperText","onChange","required","palette","entry","normalized","normalizeEntry","swatches","b","push","_a","length","columnCount"],"sources":["./src/components/color-picker/swatches.ts","./src/components/color-picker/color-picker-palette.scss?tag=limel-color-picker-palette&encapsulation=shadow","./src/components/color-picker/color-picker-palette.tsx"],"sourcesContent":["export const colors = [\n 'red',\n 'pink',\n 'magenta',\n 'purple',\n 'violet',\n 'indigo',\n 'blue',\n 'sky',\n 'cyan',\n 'teal',\n 'green',\n 'lime',\n 'grass',\n 'yellow',\n 'amber',\n 'orange',\n 'coral',\n 'brown',\n 'gray',\n 'glaucous',\n];\n\nexport const brightnesses = ['lighter', 'light', 'default', 'dark', 'darker'];\n\nexport interface Swatch {\n name: string;\n value: string;\n disabled?: boolean;\n}\n\n/**\n * Returns the CSS variable name holding the RGB triplet for the color & brightness.\n *\n * @param color the base color identifier (e.g. \"red\", \"blue\")\n * @param brightness the brightness variant (e.g. \"light\", \"default\")\n * @returns CSS variable name in the form --color-{color}-{brightness}\n */\nexport function getColorName(color: string, brightness: string): string {\n return `--color-${color}-${brightness}`;\n}\n\n/**\n * Swatch value: inline CSS color value in the required format: rgb(var(--color-*-*))\n * @param color\n * @param brightness\n */\nexport function getSwatchValue(color: string, brightness: string): string {\n return `rgb(var(${getColorName(color, brightness)}))`;\n}\n\n/**\n * Swatch name: human readable label like \"red default\"\n * @param color\n * @param brightness\n */\nexport function getSwatchName(color: string, brightness: string): string {\n return `${color} ${brightness}`;\n}\n\n/**\n * Convenience factory returning both name & value.\n * @param color\n * @param brightness\n */\nexport function createSwatch(color: string, brightness: string): Swatch {\n return {\n name: getSwatchName(color, brightness),\n value: getSwatchValue(color, brightness),\n };\n}\n\n/**\n * Returns the CSS color value for the given color and brightness.\n * @param color\n * @param brightness\n */\nexport function getCssColor(color: string, brightness: string): string {\n return getSwatchValue(color, brightness);\n}\n","@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins';\n@import './partial-styles/lime-admin-hack';\n\n:host(limel-color-picker-palette) {\n --limel-color-palette-gap: 0.25rem;\n --limel-color-palette-max-column-count: 25;\n --limel-color-palette-min-width: 8rem;\n box-sizing: border-box;\n\n border-radius: 0.75rem; // is like popover's default `--popover-border-radius`\n display: flex;\n flex-direction: column;\n gap: 1rem;\n padding: 0.75rem;\n}\n\n*,\n*:before,\n:after {\n box-sizing: border-box;\n}\n\n.color-picker-palette {\n display: grid;\n gap: var(--limel-color-palette-gap);\n grid-template-columns: repeat(\n min(\n var(--color-picker-column-count),\n var(--limel-color-palette-max-column-count)\n ),\n 1fr\n );\n width: 100%;\n max-width: 58rem;\n min-width: var(--limel-color-palette-min-width);\n}\n\n.chosen-color-name {\n display: flex;\n gap: 0.5rem;\n}\n\nlimel-input-field {\n flex-grow: 1;\n width: min-content;\n}\n\n.chosen-color-preview {\n flex-shrink: 0;\n isolation: isolate;\n\n position: relative;\n width: shared_input-select-picker.$height-of-mdc-text-field;\n height: shared_input-select-picker.$height-of-mdc-text-field;\n\n border: 1px solid rgba(var(--contrast-700), 0.65);\n border-radius: 50%;\n\n &:before,\n &:after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n }\n\n &:before {\n @include mixins.add-chessboard-background();\n z-index: 0;\n }\n\n &:after {\n background: var(--background);\n z-index: 1;\n }\n}\n\nbutton.swatch {\n all: unset;\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n\n max-width: 3rem;\n min-width: max(\n 2rem,\n 100% /\n min(\n var(--color-picker-column-count),\n var(--limel-color-palette-max-column-count)\n ) -\n (\n min(\n var(--color-picker-column-count),\n var(--limel-color-palette-max-column-count)\n ) -\n 1\n ) *\n var(--limel-color-palette-gap)\n );\n aspect-ratio: 1;\n border-radius: 0.1875rem;\n\n @include mixins.visualize-keyboard-focus();\n\n // Since the background color will be overwritten by the mixin,\n // we need to set it explicitly here and repeated in the mixin.\n background-color: var(--limel-color-picker-swatch-color);\n &:not([disabled]) {\n @include mixins.is-flat-clickable(\n $background-color: var(--limel-color-picker-swatch-color),\n $background-color--hovered: var(--limel-color-picker-swatch-color)\n );\n }\n\n &:focus-visible {\n box-shadow:\n var(--shadow-depth-8-focused),\n 0 0 0 0.125rem rgb(var(--contrast-100)) inset;\n }\n\n &[disabled] {\n cursor: not-allowed;\n box-shadow: 0 0 0 0.125rem rgb(var(--contrast-100), 0.6) inset;\n\n &:after {\n content: '';\n position: absolute;\n inset: 0;\n margin: auto;\n width: 0.125rem;\n height: 100%;\n\n opacity: 0.6;\n rotate: 45deg;\n border-radius: 1rem;\n background-color: rgb(var(--contrast-100));\n }\n }\n}\n\nbutton.swatch--selected {\n box-shadow: var(--button-shadow-inset);\n\n border-radius: 50%;\n}\n","import { Component, h, Prop, Event, EventEmitter } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\nimport { brightnesses, colors, createSwatch, Swatch } from './swatches';\nimport type { CustomPalette, CustomColorSwatch } from './color-picker.types';\n\n/**\n * @private\n */\n@Component({\n tag: 'limel-color-picker-palette',\n shadow: { delegatesFocus: true },\n styleUrl: 'color-picker-palette.scss',\n})\nexport class Palette implements FormComponent {\n /**\n * Color value that is manually typed by the user\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * Label of the input field\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Helper text of the input field\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * Set to `true` if a value is required\n */\n @Prop({ reflect: true })\n public required: boolean;\n\n /**\n * Defines the number of columns in the color swatch grid.\n * If not provided, it will default to the number of colors in the palette.\n */\n @Prop({ reflect: true })\n public columnCount?: number;\n\n /**\n * Custom color palette to use instead of Lime palette. Internal prop passed from parent.\n */\n @Prop()\n public palette?: CustomPalette;\n\n /**\n * Emits chosen value to the parent component\n */\n @Event()\n public change: EventEmitter<string>;\n\n public render() {\n const background = this.value ? { '--background': this.value } : {};\n\n return [\n <div\n class=\"color-picker-palette\"\n style={{\n '--color-picker-column-count': `${this.getColumnCount()}`,\n }}\n >\n {this.renderSwatches()}\n </div>,\n <div class=\"chosen-color-name\">\n <limel-input-field\n label={this.label}\n helperText={this.helperText}\n value={this.value}\n onChange={this.handleChange}\n required={this.required}\n />\n <div class=\"chosen-color-preview\" style={background} />\n </div>,\n ];\n }\n\n private renderSwatches = () => {\n return this.getPalette().map(this.renderSwatchButton);\n };\n\n private getPalette(): Swatch[] {\n if (this.usesCustomPalette()) {\n return (this.palette || []).map((entry) => {\n const normalized = this.normalizeEntry(entry);\n return {\n name: normalized.name || normalized.value,\n value: normalized.value,\n disabled: normalized.disabled,\n };\n });\n }\n\n // Order default swatches by brightness first, then by color.\n // This gives a more intuitive CSS grid layout logic, and\n // enables adding the `columnCount` prop.\n const swatches: Swatch[] = [];\n for (const b of brightnesses) {\n for (const color of colors) {\n swatches.push(createSwatch(color, b));\n }\n }\n return swatches;\n }\n\n private renderSwatchButton = (swatch: Swatch, index: number) => {\n const isSelected = this.value === swatch.value;\n const classList = {\n swatch: true,\n 'swatch--selected': isSelected,\n 'custom-swatch': this.usesCustomPalette(),\n };\n\n return (\n <button\n class={classList}\n style={{ '--limel-color-picker-swatch-color': swatch.value }}\n title={swatch.name}\n disabled={swatch.disabled}\n data-index={index}\n key={index}\n onClick={this.handleSwatchClick(swatch.value)}\n />\n );\n };\n\n private handleChange = (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n\n private handleSwatchClick = (value: string) => (event: MouseEvent) => {\n event.stopPropagation();\n const newValue = this.value === value ? '' : value;\n this.change.emit(newValue);\n };\n\n private normalizeEntry(\n entry: string | CustomColorSwatch\n ): CustomColorSwatch {\n if (typeof entry === 'string') {\n return { value: entry };\n }\n return entry;\n }\n\n private usesCustomPalette(): boolean {\n return this.palette?.length > 0;\n }\n\n private getColumnCount(): number {\n if (this.columnCount > 0) {\n return this.columnCount;\n }\n\n // Default palette: fixed 20 columns (one per base color)\n if (!this.usesCustomPalette()) {\n return 20;\n }\n\n // Custom palette: span all provided swatches unless empty\n const palette = this.getPalette();\n return palette.length > 0 ? palette.length : 1;\n }\n}\n"],"mappings":"kDAAO,MAAMA,EAAS,CAClB,MACA,OACA,UACA,SACA,SACA,SACA,OACA,MACA,OACA,OACA,QACA,OACA,QACA,SACA,QACA,SACA,QACA,QACA,OACA,YAGG,MAAMC,EAAe,CAAC,UAAW,QAAS,UAAW,OAAQ,U,SAepDC,EAAaC,EAAeC,GACxC,MAAO,WAAWD,KAASC,GAC/B,C,SAOgBC,EAAeF,EAAeC,GAC1C,MAAO,WAAWF,EAAaC,EAAOC,MAC1C,C,SAOgBE,EAAcH,EAAeC,GACzC,MAAO,GAAGD,KAASC,GACvB,C,SAOgBG,EAAaJ,EAAeC,GACxC,MAAO,CACHI,KAAMF,EAAcH,EAAOC,GAC3BK,MAAOJ,EAAeF,EAAOC,GAErC,CCtEA,MAAMM,EAAwB,whK,MCajBC,EAAO,M,wDAqERC,KAAAC,eAAiB,IACdD,KAAKE,aAAaC,IAAIH,KAAKI,oBA2B9BJ,KAAAI,mBAAqB,CAACC,EAAgBC,KAC1C,MAAMC,EAAaP,KAAKH,QAAUQ,EAAOR,MACzC,MAAMW,EAAY,CACdH,OAAQ,KACR,mBAAoBE,EACpB,gBAAiBP,KAAKS,qBAG1B,OACIC,EAAA,UACIC,MAAOH,EACPI,MAAO,CAAE,oCAAqCP,EAAOR,OACrDgB,MAAOR,EAAOT,KACdkB,SAAUT,EAAOS,SAAQ,aACbR,EACZS,IAAKT,EACLU,QAAShB,KAAKiB,kBAAkBZ,EAAOR,QACzC,EAIFG,KAAAkB,aAAgBC,IACpBA,EAAMC,kBACNpB,KAAKqB,OAAOC,KAAKH,EAAMI,OAAO,EAG1BvB,KAAAiB,kBAAqBpB,GAAmBsB,IAC5CA,EAAMC,kBACN,MAAMI,EAAWxB,KAAKH,QAAUA,EAAQ,GAAKA,EAC7CG,KAAKqB,OAAOC,KAAKE,EAAS,E,8IAlFvBC,SACH,MAAMC,EAAa1B,KAAKH,MAAQ,CAAE,eAAgBG,KAAKH,OAAU,GAEjE,MAAO,CACHa,EAAA,OACIC,MAAM,uBACNC,MAAO,CACH,8BAA+B,GAAGZ,KAAK2B,qBAG1C3B,KAAKC,kBAEVS,EAAA,OAAKC,MAAM,qBACPD,EAAA,qBACIkB,MAAO5B,KAAK4B,MACZC,WAAY7B,KAAK6B,WACjBhC,MAAOG,KAAKH,MACZiC,SAAU9B,KAAKkB,aACfa,SAAU/B,KAAK+B,WAEnBrB,EAAA,OAAKC,MAAM,uBAAuBC,MAAOc,K,CAS7CxB,aACJ,GAAIF,KAAKS,oBAAqB,CAC1B,OAAQT,KAAKgC,SAAW,IAAI7B,KAAK8B,IAC7B,MAAMC,EAAalC,KAAKmC,eAAeF,GACvC,MAAO,CACHrC,KAAMsC,EAAWtC,MAAQsC,EAAWrC,MACpCA,MAAOqC,EAAWrC,MAClBiB,SAAUoB,EAAWpB,SACxB,G,CAOT,MAAMsB,EAAqB,GAC3B,IAAK,MAAMC,KAAKhD,EAAc,CAC1B,IAAK,MAAME,KAASH,EAAQ,CACxBgD,EAASE,KAAK3C,EAAaJ,EAAO8C,G,EAG1C,OAAOD,C,CAmCHD,eACJF,GAEA,UAAWA,IAAU,SAAU,CAC3B,MAAO,CAAEpC,MAAOoC,E,CAEpB,OAAOA,C,CAGHxB,oB,MACJ,QAAO8B,EAAAvC,KAAKgC,WAAO,MAAAO,SAAA,SAAAA,EAAEC,QAAS,C,CAG1Bb,iBACJ,GAAI3B,KAAKyC,YAAc,EAAG,CACtB,OAAOzC,KAAKyC,W,CAIhB,IAAKzC,KAAKS,oBAAqB,CAC3B,OAAO,E,CAIX,MAAMuB,EAAUhC,KAAKE,aACrB,OAAO8B,EAAQQ,OAAS,EAAIR,EAAQQ,OAAS,C"}
@@ -1,2 +0,0 @@
1
- import{r as e,c as i,h as o,g as t}from"./p-288f0842.js";import{c as l}from"./p-ad52787a.js";import{C as a}from"./p-8ded6465.js";const r='@charset "UTF-8";*,*:before,*:after{box-sizing:border-box}.boolean-input{--limel-boolean-input-box-size:1.25rem;--limel-boolean-input-gap-size:0.5rem;position:relative;isolation:isolate;display:flex;align-items:center;min-height:var(--limel-checkbox-min-height, 2.5rem);width:100%}.boolean-input input[type=checkbox],.boolean-input input[type=radio]{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap;-webkit-appearance:none;-moz-appearance:none;appearance:none}label.boolean-input-label{min-width:var(--limel-boolean-input-box-size);min-height:var(--limel-boolean-input-box-size);padding-top:0.125rem;cursor:pointer;position:relative;width:100%;font-size:var(--limel-theme-default-small-font-size);color:var(--limel-theme-text-primary-on-background-color);padding-left:calc(var(--limel-boolean-input-box-size) + var(--limel-boolean-input-gap-size))}.disabled:not([readonly]):not([readonly=true]) label.boolean-input-label{cursor:not-allowed;color:var(--limel-theme-text-disabled-color)}.required label.boolean-input-label:after{margin-left:0.0625rem;content:"*"}.invalid:not(.readonly) label.boolean-input-label{color:var(--limel-theme-error-text-color)}:host(limel-checkbox.hide-label) label.boolean-input-label,.hide-label label.boolean-input-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0;width:var(--limel-boolean-input-box-size)}.box{position:absolute;pointer-events:none;transition:border-color 0.4s ease 0.2s, background-color 0.2s ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease;display:inline-block;vertical-align:middle;width:var(--limel-boolean-input-box-size);height:var(--limel-boolean-input-box-size);margin-right:var(--limel-boolean-input-gap-size);border-radius:var(--limel-boolean-input-box-border-radius);border:0.125rem solid;border-color:var(--checkbox-unchecked-border-color, rgb(var(--contrast-900)));background-color:var(--limel-checkbox-background-color, rgb(var(--contrast-300)))}.checked .box,.boolean-input:has(input[type=checkbox]:checked) .box,.boolean-input:has(input[type=radio]:checked) .box{background-color:var(--lime-primary-color, var(--limel-theme-primary-color));border-color:var(--lime-primary-color, var(--limel-theme-primary-color))}.disabled .box{opacity:0.4}.boolean-input:not(.disabled):has(label.boolean-input-label:hover) .box{will-change:box-shadow;box-shadow:var(--button-shadow-hovered)}.boolean-input:not(.disabled):has(label.boolean-input-label:active) .box{will-change:box-shadow;box-shadow:var(--button-shadow-pressed)}.box:before{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);content:"";position:absolute;inset:-0.1875rem;border-radius:inherit}.boolean-input:has(input[type=checkbox]:focus-visible) .box:before,.boolean-input:has(input[type=radio]:focus-visible) .box:before{will-change:box-shadow;box-shadow:var(--shadow-depth-8-focused)}.box:after{transition:opacity 0.2s ease, width 0.4s ease, box-shadow 0.6s cubic-bezier(0.68, -0.55, 0, 1.87), transform 0.6s cubic-bezier(0.68, -0.55, 0, 1.87);content:"";position:absolute;inset:0;margin:auto;border-radius:1rem;opacity:0;background-color:rgb(var(--color-white))}.boolean-input:not(.disabled):has(label.boolean-input-label:hover) .box:after{will-change:opacity, box-shadow, transform, width}:host(limel-checkbox){min-height:var(--limel-checkbox-min-height, 2.5rem)}.box:after{height:0.125rem;width:0.25rem}.indeterminate .box:after{opacity:1;width:calc(var(--limel-boolean-input-box-size) - 0.5rem)}.checkbox{--limel-boolean-input-box-border-radius:0.25rem}.checkbox svg.check-mark{position:absolute;z-index:1;inset:0;transform:translate3d(-0.125rem, -0.125rem, 0);width:var(--limel-boolean-input-box-size);height:var(--limel-boolean-input-box-size);padding:0.25rem;color:rgb(var(--color-white));opacity:0;stroke-width:0.1875rem;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}.checkbox svg.check-mark path{stroke-dashoffset:29.7833;stroke-dasharray:29.7833;transition:stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1)}.checkbox:not(.indeterminate):has(input[type=checkbox]:checked) svg.check-mark{opacity:1}.checkbox:not(.indeterminate):has(input[type=checkbox]:checked) svg.check-mark path{stroke-dashoffset:0}limel-dynamic-label{margin-top:0.375rem;margin-left:-0.25rem}:host(limel-checkbox:focus),:host(limel-checkbox:focus-visible),:host(limel-checkbox:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limel-checkbox){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limel-checkbox:focus) limel-helper-line,:host(limel-checkbox:focus-visible) limel-helper-line,:host(limel-checkbox:focus-within) limel-helper-line,:host(limel-checkbox:hover) limel-helper-line{will-change:grid-template-rows}';const n=class{constructor(o){e(this,o);this.change=i(this,"change",7);this.shouldReinitialize=false;this.id=l();this.helperTextId=l();this.destroyMDCInstances=()=>{const e=this.getCheckboxElement();if(e){delete e.dataset["indeterminate"];e.indeterminate=false}};this.isInvalid=()=>{if(this.invalid){return true}if(this.required&&this.modified&&!this.checked){return true}};this.initialize=()=>{const e=this.getCheckboxElement();if(!e){return}e.indeterminate=this.indeterminate;e.checked=this.checked||this.indeterminate};this.getCheckboxElement=()=>{var e,i;return((i=(e=this.limelCheckbox)===null||e===void 0?void 0:e.shadowRoot)===null||i===void 0?void 0:i.querySelector('input[type="checkbox"]'))||null};this.onChange=e=>{var i;e.stopPropagation();const o=e.currentTarget;const t=(i=o===null||o===void 0?void 0:o.checked)!==null&&i!==void 0?i:this.checked;this.change.emit(t);this.modified=true};this.disabled=false;this.readonly=false;this.invalid=undefined;this.label=undefined;this.helperText=undefined;this.checked=false;this.indeterminate=false;this.required=false;this.readonlyLabels=[];this.modified=false}handleCheckedChange(e){const i=this.getCheckboxElement();if(!i){return}i.checked=e||this.indeterminate}handleIndeterminateChange(e){const i=this.getCheckboxElement();if(!i){return}i.checked=this.checked||e;i.indeterminate=e}handleReadonlyChange(){this.destroyMDCInstances();this.shouldReinitialize=true}componentDidRender(){if(this.shouldReinitialize){this.initialize();this.shouldReinitialize=false}}connectedCallback(){this.initialize()}componentDidLoad(){this.initialize()}disconnectedCallback(){this.destroyMDCInstances()}render(){return o(a,{disabled:this.disabled||this.readonly,label:this.label,readonlyLabels:this.readonlyLabels,helperText:this.helperText,helperTextId:this.helperTextId,checked:this.checked||this.indeterminate,indeterminate:this.indeterminate,required:this.required,readonly:this.readonly,invalid:this.isInvalid(),onChange:this.onChange,id:this.id})}get limelCheckbox(){return t(this)}static get watchers(){return{checked:["handleCheckedChange"],indeterminate:["handleIndeterminateChange"],readonly:["handleReadonlyChange"]}}};n.style=r;export{n as limel_checkbox};
2
- //# sourceMappingURL=p-a7aa383b.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["checkboxCss","Checkbox","this","shouldReinitialize","id","createRandomString","helperTextId","destroyMDCInstances","input","getCheckboxElement","dataset","indeterminate","isInvalid","invalid","required","modified","checked","initialize","_b","_a","limelCheckbox","shadowRoot","querySelector","onChange","event","stopPropagation","currentTarget","isChecked","change","emit","handleCheckedChange","newValue","handleIndeterminateChange","handleReadonlyChange","componentDidRender","connectedCallback","componentDidLoad","disconnectedCallback","render","h","CheckboxTemplate","disabled","readonly","label","readonlyLabels","helperText"],"sources":["./src/components/checkbox/checkbox.scss?tag=limel-checkbox&encapsulation=shadow","./src/components/checkbox/checkbox.tsx"],"sourcesContent":["/**\n* :::important\n* The `CheckboxTemplate` can be imported and used in the HTML of\n* other components, to render a non-functional and decorative checkbox in\n* their UI. An example of this is the list component.\n* This means the content of `CheckboxTemplate` will become a part of the\n* consumer's DOM structure.\n*\n* Additionally, the consumer components' also need to import the current `.scss`\n* file into their own styles file, for the checkbox to be rendered correctly!\n* This means, if the styles in this file are not \"specific\" enough,\n* there is a risk that the consumer component's styles are affected by\n* our styles here.\n*\n* For instance if the consumer has a `<label>` or `<svg>` element,\n* it might unintentionally inherit styles from the checkbox; unless we\n* make the such styles more specific here.\n*\n* Naturally, we cannot mitigate all sorts of potential styling problems.\n* The consumer component should be aware of this issue too.\n* But we can ensure that our styles here both make sense,\n* are readable, and are as specific as possible to avoid unintended side effects.\n* :::\n*/\n\n@use '../../style/mixins';\n\n/**\n* @prop --checkbox-unchecked-border-color: Affects the border color of the default state of the checkbox (when it is not checked). Defaults to `--contrast-900`.\n*/\n\n@forward '../../style/internal/boolean-input.scss';\n\n:host(limel-checkbox) {\n min-height: var(--limel-checkbox-min-height, 2.5rem); // prevents flickering\n // when switching between `readonly` and normal states in `limel-checkbox`,\n // but not where `CheckboxTemplate` is imported & used.\n}\n\n.box {\n &:after {\n height: 0.125rem;\n width: 0.25rem;\n\n .indeterminate & {\n opacity: 1;\n width: calc(var(--limel-boolean-input-box-size) - 0.5rem);\n }\n }\n}\n\n.checkbox {\n --limel-boolean-input-box-border-radius: 0.25rem;\n\n svg.check-mark {\n position: absolute;\n z-index: 1;\n inset: 0;\n\n transform: translate3d(-0.125rem, -0.125rem, 0);\n\n width: var(--limel-boolean-input-box-size);\n height: var(--limel-boolean-input-box-size);\n\n padding: 0.25rem;\n\n color: rgb(var(--color-white));\n opacity: 0;\n\n stroke-width: 0.1875rem; // 3px\n stroke: currentColor;\n stroke-linecap: round;\n stroke-linejoin: round;\n\n path {\n stroke-dashoffset: 29.7833;\n stroke-dasharray: 29.7833;\n transition: stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1);\n }\n }\n\n &:not(.indeterminate):has(input[type='checkbox']:checked) {\n svg.check-mark {\n opacity: 1;\n\n path {\n stroke-dashoffset: 0;\n }\n }\n }\n}\n\nlimel-dynamic-label {\n margin-top: 0.375rem;\n margin-left: -0.25rem;\n}\n\n@include mixins.hide-helper-line-when-not-needed(limel-checkbox);\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport { CheckboxTemplate } from './checkbox.template';\nimport { Label } from '../dynamic-label/label.types';\n\n/**\n * The Checkbox component is a classic and essential element in UI design that allows\n * users to make multiple selections from a predefined list of options. The Checkbox component is commonly used in forms and settings interfaces to enable users to\n * select one or more items from a list of choices.\n *\n * ## States of a Checkbox\n * When a user clicks or taps on the box, it toggles between two states:\n * Checked and Unchecked.\n *\n * However, a Checkbox can visualize a third state called the \"Indeterminate\" state.\n * In this state, the checkbox appears as a filled box with a horizontal line or dash inside it.\n *\n * The Indeterminate state is typically used when dealing with checkbox groups\n * that have hierarchical relationships or when the group contains sub-items.\n * This state is used to indicate that that some, but not all, of the items in a group are selected.\n *\n * :::important\n * Checkboxes are sometimes used interchangeably with switches in user interfaces.\n * But there is an important difference between the two! Please read our guidelines about\n * [Switch vs. Checkbox](/#/DesignGuidelines/switch-vs-checkbox.md/).\n *\n * @exampleComponent limel-example-checkbox\n * @exampleComponent limel-example-checkbox-helper-text\n * @exampleComponent limel-example-checkbox-readonly\n */\n@Component({\n tag: 'limel-checkbox',\n shadow: true,\n styleUrl: 'checkbox.scss',\n})\nexport class Checkbox {\n /**\n * Disables the checkbox when `true`. Works exactly the same as `readonly`.\n * If either property is `true`, the checkbox will be disabled.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Disables the checkbox when `true`. This visualizes the checkbox slightly differently.\n * But shows no visual sign indicating that the checkbox is disabled\n * or can ever become interactable.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Set to `true` to indicate that the current value is invalid.\n */\n @Prop({ reflect: true })\n public invalid: boolean;\n\n /**\n * The checkbox label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Optional helper text to display below the checkbox\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * The value of the checkbox. Set to `true` to make the checkbox checked.\n */\n @Prop({ reflect: true })\n public checked = false;\n\n /**\n * Enables indeterminate state. Set to `true` to signal indeterminate check.\n */\n @Prop({ reflect: true })\n public indeterminate = false;\n\n /**\n * Set to `true` to indicate that the checkbox must be checked.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * The labels to use to clarify what kind of data is being visualized,\n * when the component is `readonly`.\n */\n @Prop()\n public readonlyLabels?: Array<Label<boolean>> = [];\n\n @State()\n private modified = false;\n private shouldReinitialize = false;\n\n /**\n * Emitted when the input value is changed.\n */\n @Event()\n private change: EventEmitter<boolean>;\n\n @Element()\n private limelCheckbox: HTMLLimelCheckboxElement;\n private id: string = createRandomString();\n private helperTextId: string = createRandomString();\n\n @Watch('checked')\n protected handleCheckedChange(newValue: boolean) {\n const input = this.getCheckboxElement();\n if (!input) {\n return;\n }\n\n input.checked = newValue || this.indeterminate;\n }\n\n @Watch('indeterminate')\n protected handleIndeterminateChange(newValue: boolean) {\n const input = this.getCheckboxElement();\n if (!input) {\n return;\n }\n\n input.checked = this.checked || newValue;\n input.indeterminate = newValue;\n }\n\n @Watch('readonly')\n protected handleReadonlyChange() {\n this.destroyMDCInstances();\n this.shouldReinitialize = true;\n }\n\n componentDidRender() {\n if (this.shouldReinitialize) {\n this.initialize();\n this.shouldReinitialize = false;\n }\n }\n\n public connectedCallback() {\n this.initialize();\n }\n\n public componentDidLoad() {\n this.initialize();\n }\n\n private destroyMDCInstances = () => {\n const input = this.getCheckboxElement();\n if (input) {\n delete input.dataset['indeterminate'];\n input.indeterminate = false;\n }\n };\n\n public disconnectedCallback() {\n this.destroyMDCInstances();\n }\n\n public render() {\n return (\n <CheckboxTemplate\n disabled={this.disabled || this.readonly}\n label={this.label}\n readonlyLabels={this.readonlyLabels}\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n checked={this.checked || this.indeterminate}\n indeterminate={this.indeterminate}\n required={this.required}\n readonly={this.readonly}\n invalid={this.isInvalid()}\n onChange={this.onChange}\n id={this.id}\n />\n );\n }\n\n private isInvalid = () => {\n if (this.invalid) {\n return true;\n }\n\n if (this.required && this.modified && !this.checked) {\n return true;\n }\n };\n\n private initialize = () => {\n const input = this.getCheckboxElement();\n if (!input) {\n return;\n }\n\n input.indeterminate = this.indeterminate;\n input.checked = this.checked || this.indeterminate;\n };\n\n private getCheckboxElement = (): HTMLInputElement | null => {\n return (\n this.limelCheckbox?.shadowRoot?.querySelector(\n 'input[type=\"checkbox\"]'\n ) || null\n );\n };\n\n private onChange = (event: Event) => {\n event.stopPropagation();\n const input = event.currentTarget as HTMLInputElement;\n const isChecked = input?.checked ?? this.checked;\n this.change.emit(isChecked);\n this.modified = true;\n };\n}\n"],"mappings":"iIAAA,MAAMA,EAAc,+gK,MC4CPC,EAAQ,M,wDA6DTC,KAAAC,mBAAqB,MAUrBD,KAAAE,GAAaC,IACbH,KAAAI,aAAuBD,IA4CvBH,KAAAK,oBAAsB,KAC1B,MAAMC,EAAQN,KAAKO,qBACnB,GAAID,EAAO,QACAA,EAAME,QAAQ,iBACrBF,EAAMG,cAAgB,K,GA2BtBT,KAAAU,UAAY,KAChB,GAAIV,KAAKW,QAAS,CACd,OAAO,I,CAGX,GAAIX,KAAKY,UAAYZ,KAAKa,WAAab,KAAKc,QAAS,CACjD,OAAO,I,GAIPd,KAAAe,WAAa,KACjB,MAAMT,EAAQN,KAAKO,qBACnB,IAAKD,EAAO,CACR,M,CAGJA,EAAMG,cAAgBT,KAAKS,cAC3BH,EAAMQ,QAAUd,KAAKc,SAAWd,KAAKS,aAAa,EAG9CT,KAAAO,mBAAqB,K,QACzB,QACIS,GAAAC,EAAAjB,KAAKkB,iBAAa,MAAAD,SAAA,SAAAA,EAAEE,cAAU,MAAAH,SAAA,SAAAA,EAAEI,cAC5B,4BACC,IAAI,EAITpB,KAAAqB,SAAYC,I,MAChBA,EAAMC,kBACN,MAAMjB,EAAQgB,EAAME,cACpB,MAAMC,GAAYR,EAAAX,IAAK,MAALA,SAAK,SAALA,EAAOQ,WAAO,MAAAG,SAAA,EAAAA,EAAIjB,KAAKc,QACzCd,KAAK0B,OAAOC,KAAKF,GACjBzB,KAAKa,SAAW,IAAI,E,cA9KN,M,cAQA,M,mFAwBD,M,mBAMM,M,cAMI,M,oBAOqB,G,cAG7B,K,CAeTe,oBAAoBC,GAC1B,MAAMvB,EAAQN,KAAKO,qBACnB,IAAKD,EAAO,CACR,M,CAGJA,EAAMQ,QAAUe,GAAY7B,KAAKS,a,CAI3BqB,0BAA0BD,GAChC,MAAMvB,EAAQN,KAAKO,qBACnB,IAAKD,EAAO,CACR,M,CAGJA,EAAMQ,QAAUd,KAAKc,SAAWe,EAChCvB,EAAMG,cAAgBoB,C,CAIhBE,uBACN/B,KAAKK,sBACLL,KAAKC,mBAAqB,I,CAG9B+B,qBACI,GAAIhC,KAAKC,mBAAoB,CACzBD,KAAKe,aACLf,KAAKC,mBAAqB,K,EAI3BgC,oBACHjC,KAAKe,Y,CAGFmB,mBACHlC,KAAKe,Y,CAWFoB,uBACHnC,KAAKK,qB,CAGF+B,SACH,OACIC,EAACC,EAAgB,CACbC,SAAUvC,KAAKuC,UAAYvC,KAAKwC,SAChCC,MAAOzC,KAAKyC,MACZC,eAAgB1C,KAAK0C,eACrBC,WAAY3C,KAAK2C,WACjBvC,aAAcJ,KAAKI,aACnBU,QAASd,KAAKc,SAAWd,KAAKS,cAC9BA,cAAeT,KAAKS,cACpBG,SAAUZ,KAAKY,SACf4B,SAAUxC,KAAKwC,SACf7B,QAASX,KAAKU,YACdW,SAAUrB,KAAKqB,SACfnB,GAAIF,KAAKE,I"}