@sky.ui/core 0.0.41 → 0.0.42

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 (104) hide show
  1. package/dist/custom-elements.json +2171 -1435
  2. package/dist/helper/controllers/index.d.ts +1 -0
  3. package/dist/helper/controllers/index.js +1 -1
  4. package/dist/helper/controllers/popover-controller.d.ts +1 -1
  5. package/dist/helper/controllers/popover-controller.js.map +1 -1
  6. package/dist/helper/controllers/preset-controller.d.ts +55 -0
  7. package/dist/helper/controllers/preset-controller.js +2 -0
  8. package/dist/helper/controllers/preset-controller.js.map +1 -0
  9. package/dist/helper/index.js +1 -1
  10. package/dist/helper/internals/form-control-base.d.ts +2 -2
  11. package/dist/helper/internals/form-control-base.js.map +1 -1
  12. package/dist/helper/styles/focus-ring.d.ts +10 -0
  13. package/dist/helper/styles/focus-ring.js +10 -0
  14. package/dist/helper/styles/focus-ring.js.map +1 -0
  15. package/dist/helper/utils/color-resolver.d.ts +0 -14
  16. package/dist/helper/utils/color-resolver.js +1 -1
  17. package/dist/helper/utils/color-resolver.js.map +1 -1
  18. package/dist/helper/utils/component-presets.d.ts +132 -0
  19. package/dist/helper/utils/component-presets.js +2 -0
  20. package/dist/helper/utils/component-presets.js.map +1 -0
  21. package/dist/helper/utils/contrast-color.d.ts +2 -2
  22. package/dist/helper/utils/contrast-color.js.map +1 -1
  23. package/dist/helper/utils/index.d.ts +1 -0
  24. package/dist/helper/utils/index.js +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/sky-alert/sky-alert.d.ts +12 -4
  27. package/dist/sky-alert/sky-alert.js +4 -4
  28. package/dist/sky-alert/sky-alert.js.map +1 -1
  29. package/dist/sky-appbar/sky-appbar.d.ts +9 -3
  30. package/dist/sky-appbar/sky-appbar.js +4 -4
  31. package/dist/sky-appbar/sky-appbar.js.map +1 -1
  32. package/dist/sky-avatar/sky-avatar.d.ts +5 -1
  33. package/dist/sky-avatar/sky-avatar.js +7 -7
  34. package/dist/sky-avatar/sky-avatar.js.map +1 -1
  35. package/dist/sky-badge/sky-badge.d.ts +6 -2
  36. package/dist/sky-badge/sky-badge.js +6 -6
  37. package/dist/sky-badge/sky-badge.js.map +1 -1
  38. package/dist/sky-button/sky-button.d.ts +24 -4
  39. package/dist/sky-button/sky-button.js +9 -8
  40. package/dist/sky-button/sky-button.js.map +1 -1
  41. package/dist/sky-card/sky-card.d.ts +10 -2
  42. package/dist/sky-card/sky-card.js +4 -4
  43. package/dist/sky-card/sky-card.js.map +1 -1
  44. package/dist/sky-checkbox/sky-checkbox.d.ts +6 -3
  45. package/dist/sky-checkbox/sky-checkbox.js +47 -40
  46. package/dist/sky-checkbox/sky-checkbox.js.map +1 -1
  47. package/dist/sky-chip/sky-chip.d.ts +6 -2
  48. package/dist/sky-chip/sky-chip.js +10 -9
  49. package/dist/sky-chip/sky-chip.js.map +1 -1
  50. package/dist/sky-col/sky-col.d.ts +5 -1
  51. package/dist/sky-col/sky-col.js +4 -4
  52. package/dist/sky-col/sky-col.js.map +1 -1
  53. package/dist/sky-combobox/sky-combobox.d.ts +9 -2
  54. package/dist/sky-combobox/sky-combobox.js +27 -58
  55. package/dist/sky-combobox/sky-combobox.js.map +1 -1
  56. package/dist/sky-dialog/sky-dialog.d.ts +5 -1
  57. package/dist/sky-dialog/sky-dialog.js +3 -3
  58. package/dist/sky-dialog/sky-dialog.js.map +1 -1
  59. package/dist/sky-divider/sky-divider.d.ts +5 -1
  60. package/dist/sky-divider/sky-divider.js +5 -5
  61. package/dist/sky-divider/sky-divider.js.map +1 -1
  62. package/dist/sky-flexbox/sky-flexbox.d.ts +5 -1
  63. package/dist/sky-flexbox/sky-flexbox.js +4 -4
  64. package/dist/sky-flexbox/sky-flexbox.js.map +1 -1
  65. package/dist/sky-flexcol/sky-flexcol.d.ts +5 -1
  66. package/dist/sky-flexcol/sky-flexcol.js +2 -2
  67. package/dist/sky-flexcol/sky-flexcol.js.map +1 -1
  68. package/dist/sky-form/sky-form.d.ts +5 -1
  69. package/dist/sky-form/sky-form.js +2 -2
  70. package/dist/sky-form/sky-form.js.map +1 -1
  71. package/dist/sky-grid/sky-grid.d.ts +5 -1
  72. package/dist/sky-grid/sky-grid.js +3 -3
  73. package/dist/sky-grid/sky-grid.js.map +1 -1
  74. package/dist/sky-icon/sky-icon.d.ts +4 -1
  75. package/dist/sky-icon/sky-icon.js +3 -3
  76. package/dist/sky-icon/sky-icon.js.map +1 -1
  77. package/dist/sky-image/sky-image.d.ts +5 -1
  78. package/dist/sky-image/sky-image.js +5 -5
  79. package/dist/sky-image/sky-image.js.map +1 -1
  80. package/dist/sky-input/sky-input.d.ts +5 -1
  81. package/dist/sky-input/sky-input.js +111 -111
  82. package/dist/sky-input/sky-input.js.map +1 -1
  83. package/dist/sky-list/sky-list.d.ts +5 -1
  84. package/dist/sky-list/sky-list.js +3 -3
  85. package/dist/sky-list/sky-list.js.map +1 -1
  86. package/dist/sky-listitem/sky-listitem.d.ts +5 -1
  87. package/dist/sky-listitem/sky-listitem.js +3 -3
  88. package/dist/sky-listitem/sky-listitem.js.map +1 -1
  89. package/dist/sky-radio/sky-radio.d.ts +8 -3
  90. package/dist/sky-radio/sky-radio.js +4 -3
  91. package/dist/sky-radio/sky-radio.js.map +1 -1
  92. package/dist/sky-row/sky-row.d.ts +4 -1
  93. package/dist/sky-row/sky-row.js +2 -2
  94. package/dist/sky-row/sky-row.js.map +1 -1
  95. package/dist/sky-sheet/sky-sheet.d.ts +7 -2
  96. package/dist/sky-sheet/sky-sheet.js +2 -2
  97. package/dist/sky-sheet/sky-sheet.js.map +1 -1
  98. package/dist/sky-simple-table/sky-simple-table.d.ts +5 -1
  99. package/dist/sky-simple-table/sky-simple-table.js +3 -3
  100. package/dist/sky-simple-table/sky-simple-table.js.map +1 -1
  101. package/dist/sky-theme-provider/sky-theme-provider.d.ts +1 -1
  102. package/dist/sky-theme-provider/sky-theme-provider.js +2 -2
  103. package/dist/sky-theme-provider/sky-theme-provider.js.map +1 -1
  104. package/package.json +1 -1
@@ -9,7 +9,7 @@ export type SkyColJustify = "start" | "center" | "end" | "space-between" | "spac
9
9
  * @status stable
10
10
  * @since 1.0.0
11
11
  *
12
- * @documentation https://library.sky-ui.com/components/grid
12
+ * @documentation https://sky-ui.com/components/grid
13
13
  *
14
14
  * @slot title - Optional title content shown before main content.
15
15
  * @slot - Default content for the column body.
@@ -26,6 +26,7 @@ export type SkyColJustify = "start" | "center" | "end" | "space-between" | "spac
26
26
  * @property {number | undefined} md - Responsive span for medium breakpoint.
27
27
  * @property {number | undefined} lg - Responsive span for large breakpoint.
28
28
  * @property {number | undefined} xl - Responsive span for extra-large breakpoint.
29
+ * @property {string} preset - Named prop preset from nearest `sky-config-provider`. Default: `""`.
29
30
  * @method refreshLayout Reapplies internal CSS variables from current properties.
30
31
  *
31
32
  * @Behavior
@@ -70,6 +71,9 @@ export declare class SkyCol extends LitElement {
70
71
  md?: number;
71
72
  lg?: number;
72
73
  xl?: number;
74
+ /** Named prop preset from nearest `sky-config-provider`. */
75
+ preset: string;
76
+ private _presets;
73
77
  static styles: import("lit").CSSResult;
74
78
  firstUpdated(): void;
75
79
  updated(changed: Map<string | number | symbol, unknown>): void;
@@ -1,9 +1,9 @@
1
- import{property as t,customElement as s}from"lit/decorators.js";import{when as r}from"lit/directives/when.js";import{css as e,LitElement as o,html as i}from"lit";var a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p=(t,s,r,e)=>{for(var o,i=e>1?void 0:e?l(s,r):s,p=t.length-1;p>=0;p--)(o=t[p])&&(i=(e?o(s,r,i):o(i))||i);return e&&i&&a(s,r,i),i};let n=class extends o{constructor(){super(...arguments),this.span=1,this.gap="0",this.justify="center",this.align="stretch"}firstUpdated(){this.syncVars()}updated(t){(t.has("span")||t.has("gap")||t.has("justify")||t.has("align")||t.has("sm")||t.has("md")||t.has("lg")||t.has("xl")||t.has("start")||t.has("end"))&&this.syncVars()}refreshLayout(){this.syncVars()}syncVars(){this.style.setProperty("--col-span",String(this.span)),this.style.setProperty("--col-gap",this.gap),this.style.setProperty("--col-justify",this.justify),this.style.setProperty("--col-align",this.align),this.sm&&this.style.setProperty("--col-span-sm",String(this.sm)),this.md&&this.style.setProperty("--col-span-md",String(this.md)),this.lg&&this.style.setProperty("--col-span-lg",String(this.lg)),this.xl&&this.style.setProperty("--col-span-xl",String(this.xl)),this.start&&this.style.setProperty("--col-start",String(this.start)),this.end&&this.style.setProperty("--col-end",String(this.end))}render(){const t=this.start||this.end?`grid-column: ${this.start??"auto"} / ${this.end??"auto"};`:"";return i`
2
- <div class="col" style=${r(this.start||this.end,()=>t,()=>"")} part="col">
1
+ import{property as t,customElement as s}from"lit/decorators.js";import{when as e}from"lit/directives/when.js";import{css as r,LitElement as o,html as i}from"lit";import{PresetController as p}from"../helper/controllers/preset-controller.js";var a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,n=(t,s,e,r)=>{for(var o,i=r>1?void 0:r?l(s,e):s,p=t.length-1;p>=0;p--)(o=t[p])&&(i=(r?o(s,e,i):o(i))||i);return r&&i&&a(s,e,i),i};let h=class extends o{constructor(){super(...arguments),this.span=1,this.gap="0",this.justify="center",this.align="stretch",this.preset="",this._presets=new p(this)}firstUpdated(){this.syncVars()}updated(t){(t.has("span")||t.has("gap")||t.has("justify")||t.has("align")||t.has("sm")||t.has("md")||t.has("lg")||t.has("xl")||t.has("start")||t.has("end"))&&this.syncVars()}refreshLayout(){this.syncVars()}syncVars(){this.style.setProperty("--col-span",String(this.span)),this.style.setProperty("--col-gap",this.gap),this.style.setProperty("--col-justify",this.justify),this.style.setProperty("--col-align",this.align),this.sm&&this.style.setProperty("--col-span-sm",String(this.sm)),this.md&&this.style.setProperty("--col-span-md",String(this.md)),this.lg&&this.style.setProperty("--col-span-lg",String(this.lg)),this.xl&&this.style.setProperty("--col-span-xl",String(this.xl)),this.start&&this.style.setProperty("--col-start",String(this.start)),this.end&&this.style.setProperty("--col-end",String(this.end))}render(){const t=this.start||this.end?`grid-column: ${this.start??"auto"} / ${this.end??"auto"};`:"";return i`
2
+ <div class="col" style=${e(this.start||this.end,()=>t,()=>"")} part="col">
3
3
  <slot name="title"></slot>
4
4
  <slot></slot>
5
5
  </div>
6
- `}};n.styles=e`
6
+ `}};h.styles=r`
7
7
  :host {
8
8
  display: contents;
9
9
  }
@@ -42,5 +42,5 @@ import{property as t,customElement as s}from"lit/decorators.js";import{when as r
42
42
  grid-column: span var(--col-span-xl, var(--col-span, var(--col-span, 1)));
43
43
  }
44
44
  }
45
- `,p([t({type:Number})],n.prototype,"span",2),p([t({type:String})],n.prototype,"gap",2),p([t({type:String})],n.prototype,"justify",2),p([t({type:String})],n.prototype,"align",2),p([t({type:Number})],n.prototype,"start",2),p([t({type:Number})],n.prototype,"end",2),p([t({type:Number})],n.prototype,"sm",2),p([t({type:Number})],n.prototype,"md",2),p([t({type:Number})],n.prototype,"lg",2),p([t({type:Number})],n.prototype,"xl",2),n=p([s("sky-col")],n);export{n as SkyCol};
45
+ `,n([t({type:Number})],h.prototype,"span",2),n([t({type:String})],h.prototype,"gap",2),n([t({type:String})],h.prototype,"justify",2),n([t({type:String})],h.prototype,"align",2),n([t({type:Number})],h.prototype,"start",2),n([t({type:Number})],h.prototype,"end",2),n([t({type:Number})],h.prototype,"sm",2),n([t({type:Number})],h.prototype,"md",2),n([t({type:Number})],h.prototype,"lg",2),n([t({type:Number})],h.prototype,"xl",2),n([t({type:String,reflect:!0})],h.prototype,"preset",2),h=n([s("sky-col")],h);export{h as SkyCol};
46
46
  //# sourceMappingURL=sky-col.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sky-col.js","sources":["../../src/sky-col/sky-col.ts"],"sourcesContent":["import { customElement, property } from \"lit/decorators.js\";\r\nimport { when } from \"lit/directives/when.js\";\r\nimport { LitElement, html, css } from \"lit\";\r\n\r\nexport type SkyColAlign = \"stretch\" | \"start\" | \"center\" | \"end\" | \"baseline\";\r\nexport type SkyColJustify =\r\n | \"start\"\r\n | \"center\"\r\n | \"end\"\r\n | \"space-between\"\r\n | \"space-around\"\r\n | \"space-evenly\";\r\n\r\n/**\r\n * @element sky-col\r\n *\r\n * @summary Grid/flex column helper with responsive spans and configurable alignment/justification.\r\n *\r\n * @status stable\r\n * @since 1.0.0\r\n *\r\n * @documentation https://library.sky-ui.com/components/grid\r\n *\r\n * @slot title - Optional title content shown before main content.\r\n * @slot - Default content for the column body.\r\n *\r\n * @csspart col - The column container.\r\n *\r\n * @property {number} span - Default column span.\r\n * @property {string} gap - Internal content gap CSS value.\r\n * @property {SkyColJustify} justify - Content justification within the column.\r\n * @property {SkyColAlign} align - Content alignment within the column.\r\n * @property {number | undefined} start - Optional explicit grid column start.\r\n * @property {number | undefined} end - Optional explicit grid column end.\r\n * @property {number | undefined} sm - Responsive span for small breakpoint.\r\n * @property {number | undefined} md - Responsive span for medium breakpoint.\r\n * @property {number | undefined} lg - Responsive span for large breakpoint.\r\n * @property {number | undefined} xl - Responsive span for extra-large breakpoint.\r\n * @method refreshLayout Reapplies internal CSS variables from current properties.\r\n *\r\n * @Behavior\r\n * - Applies span and responsive spans through host CSS variables.\r\n * - Supports explicit `start`/`end` grid positioning when provided.\r\n * - Automatically updates layout variables when relevant properties change.\r\n *\r\n * @example\r\n * ```html\r\n * <sky-col span=\"4\" md=\"6\" justify=\"space-between\" align=\"center\">\r\n * <span slot=\"title\">Revenue</span>\r\n * Q2 performance details\r\n * </sky-col>\r\n * ```\r\n * ```vue\r\n * <template>\r\n * <sky-col span=\"4\" md=\"6\" justify=\"space-between\" align=\"center\">\r\n * <span slot=\"title\">Revenue</span>\r\n * Q2 performance details\r\n * </sky-col>\r\n * </template>\r\n * ```\r\n * ```jsx\r\n * export default function Demo() {\r\n * return (\r\n * <sky-col span=\"4\" md=\"6\" justify=\"space-between\" align=\"center\">\r\n * <span slot=\"title\">Revenue</span>\r\n * Q2 performance details\r\n * </sky-col>\r\n * );\r\n * }\r\n * ```\r\n */\r\n@customElement(\"sky-col\")\r\nexport class SkyCol extends LitElement {\r\n @property({ type: Number }) span = 1;\r\n @property({ type: String }) gap = \"0\";\r\n @property({ type: String }) justify: SkyColJustify = \"center\";\r\n @property({ type: String }) align: SkyColAlign = \"stretch\";\r\n\r\n @property({ type: Number }) start?: number;\r\n @property({ type: Number }) end?: number;\r\n\r\n @property({ type: Number }) sm?: number;\r\n @property({ type: Number }) md?: number;\r\n @property({ type: Number }) lg?: number;\r\n @property({ type: Number }) xl?: number;\r\n\r\n static override styles = css`\r\n :host {\r\n display: contents;\r\n }\r\n\r\n .col {\r\n display: flex;\r\n flex-direction: column;\r\n grid-column: span var(--col-span, 1);\r\n gap: var(--col-gap, 0);\r\n align-items: var(--col-align, stretch);\r\n justify-content: var(--col-justify, center);\r\n }\r\n\r\n ::slotted([slot=\"title\"]) {\r\n font-weight: bold;\r\n margin-bottom: 0.5rem;\r\n }\r\n\r\n @media (max-width: 768px) {\r\n .col {\r\n grid-column: span var(--col-span-sm, var(--col-span, 1));\r\n }\r\n }\r\n @media (max-width: 992px) {\r\n .col {\r\n grid-column: span var(--col-span-md, var(--col-span, 1));\r\n }\r\n }\r\n @media (max-width: 1200px) {\r\n .col {\r\n grid-column: span var(--col-span-lg, var(--col-span, 1));\r\n }\r\n }\r\n @media (min-width: 1201px) {\r\n .col {\r\n grid-column: span var(--col-span-xl, var(--col-span, var(--col-span, 1)));\r\n }\r\n }\r\n `;\r\n\r\n override firstUpdated(): void {\r\n this.syncVars();\r\n }\r\n\r\n override updated(changed: Map<string | number | symbol, unknown>): void {\r\n if (\r\n changed.has(\"span\") ||\r\n changed.has(\"gap\") ||\r\n changed.has(\"justify\") ||\r\n changed.has(\"align\") ||\r\n changed.has(\"sm\") ||\r\n changed.has(\"md\") ||\r\n changed.has(\"lg\") ||\r\n changed.has(\"xl\") ||\r\n changed.has(\"start\") ||\r\n changed.has(\"end\")\r\n ) {\r\n this.syncVars();\r\n }\r\n }\r\n\r\n /**\r\n * Reapplies internal CSS variables from current properties.\r\n *\r\n * @returns {void}\r\n */\r\n public refreshLayout(): void {\r\n this.syncVars();\r\n }\r\n\r\n private syncVars(): void {\r\n this.style.setProperty(\"--col-span\", String(this.span));\r\n this.style.setProperty(\"--col-gap\", this.gap);\r\n this.style.setProperty(\"--col-justify\", this.justify);\r\n this.style.setProperty(\"--col-align\", this.align);\r\n\r\n if (this.sm) this.style.setProperty(\"--col-span-sm\", String(this.sm));\r\n if (this.md) this.style.setProperty(\"--col-span-md\", String(this.md));\r\n if (this.lg) this.style.setProperty(\"--col-span-lg\", String(this.lg));\r\n if (this.xl) this.style.setProperty(\"--col-span-xl\", String(this.xl));\r\n\r\n if (this.start) this.style.setProperty(\"--col-start\", String(this.start));\r\n if (this.end) this.style.setProperty(\"--col-end\", String(this.end));\r\n }\r\n\r\n override render() {\r\n const gridStyle =\r\n this.start || this.end\r\n ? `grid-column: ${this.start ?? \"auto\"} / ${this.end ?? \"auto\"};`\r\n : \"\";\r\n\r\n return html`\r\n <div class=\"col\" style=${when(this.start || this.end, () => gridStyle, () => \"\")} part=\"col\">\r\n <slot name=\"title\"></slot>\r\n <slot></slot>\r\n </div>\r\n `;\r\n }\r\n}"],"names":["SkyCol","LitElement","constructor","super","arguments","this","span","gap","justify","align","firstUpdated","syncVars","updated","changed","has","refreshLayout","style","setProperty","String","sm","md","lg","xl","start","end","render","gridStyle","html","when","styles","css","__decorateClass","property","type","Number","prototype","customElement"],"mappings":"kWAwEO,IAAMA,EAAN,cAAqBC,EAArB,WAAAC,GAAAC,SAAAC,WACuBC,KAAAC,KAAO,EACPD,KAAAE,IAAM,IACNF,KAAAG,QAAyB,SACzBH,KAAAI,MAAqB,SAAA,CAmDxC,YAAAC,GACPL,KAAKM,UACP,CAES,OAAAC,CAAQC,IAEbA,EAAQC,IAAI,SACZD,EAAQC,IAAI,QACZD,EAAQC,IAAI,YACZD,EAAQC,IAAI,UACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,UACZD,EAAQC,IAAI,SAEZT,KAAKM,UAET,CAOO,aAAAI,GACLV,KAAKM,UACP,CAEQ,QAAAA,GACNN,KAAKW,MAAMC,YAAY,aAAcC,OAAOb,KAAKC,OACjDD,KAAKW,MAAMC,YAAY,YAAaZ,KAAKE,KACzCF,KAAKW,MAAMC,YAAY,gBAAiBZ,KAAKG,SAC7CH,KAAKW,MAAMC,YAAY,cAAeZ,KAAKI,OAEvCJ,KAAKc,IAAId,KAAKW,MAAMC,YAAY,gBAAiBC,OAAOb,KAAKc,KAC7Dd,KAAKe,IAAIf,KAAKW,MAAMC,YAAY,gBAAiBC,OAAOb,KAAKe,KAC7Df,KAAKgB,IAAIhB,KAAKW,MAAMC,YAAY,gBAAiBC,OAAOb,KAAKgB,KAC7DhB,KAAKiB,IAAIjB,KAAKW,MAAMC,YAAY,gBAAiBC,OAAOb,KAAKiB,KAE7DjB,KAAKkB,OAAOlB,KAAKW,MAAMC,YAAY,cAAeC,OAAOb,KAAKkB,QAC9DlB,KAAKmB,KAAKnB,KAAKW,MAAMC,YAAY,YAAaC,OAAOb,KAAKmB,KAChE,CAES,MAAAC,GACP,MAAMC,EACJrB,KAAKkB,OAASlB,KAAKmB,IACf,gBAAgBnB,KAAKkB,OAAS,YAAYlB,KAAKmB,KAAO,UACtD,GAEN,OAAOG,CAAA;+BACoBC,EAAKvB,KAAKkB,OAASlB,KAAKmB,IAAK,IAAME,EAAW,IAAM;;;;KAKjF,GAhHW1B,EAcK6B,OAASC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAbGC,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UADPlC,EACiBmC,UAAA,OAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMf,UAFPlB,EAEiBmC,UAAA,MAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMf,UAHPlB,EAGiBmC,UAAA,UAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMf,UAJPlB,EAIiBmC,UAAA,QAAA,GAEAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UANPlC,EAMiBmC,UAAA,QAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAPPlC,EAOiBmC,UAAA,MAAA,GAEAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UATPlC,EASiBmC,UAAA,KAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAVPlC,EAUiBmC,UAAA,KAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAXPlC,EAWiBmC,UAAA,KAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAZPlC,EAYiBmC,UAAA,KAAA,GAZjBnC,EAAN+B,EAAA,CADNK,EAAc,YACFpC"}
1
+ {"version":3,"file":"sky-col.js","sources":["../../src/sky-col/sky-col.ts"],"sourcesContent":["import { customElement, property } from \"lit/decorators.js\";\r\nimport { when } from \"lit/directives/when.js\";\r\nimport { LitElement, html, css } from \"lit\";\r\nimport { PresetController } from \"../helper/controllers/preset-controller\";\n\r\nexport type SkyColAlign = \"stretch\" | \"start\" | \"center\" | \"end\" | \"baseline\";\r\nexport type SkyColJustify =\r\n | \"start\"\r\n | \"center\"\r\n | \"end\"\r\n | \"space-between\"\r\n | \"space-around\"\r\n | \"space-evenly\";\r\n\r\n/**\r\n * @element sky-col\r\n *\r\n * @summary Grid/flex column helper with responsive spans and configurable alignment/justification.\r\n *\r\n * @status stable\r\n * @since 1.0.0\r\n *\r\n * @documentation https://sky-ui.com/components/grid\r\n *\r\n * @slot title - Optional title content shown before main content.\r\n * @slot - Default content for the column body.\r\n *\r\n * @csspart col - The column container.\r\n *\r\n * @property {number} span - Default column span.\r\n * @property {string} gap - Internal content gap CSS value.\r\n * @property {SkyColJustify} justify - Content justification within the column.\r\n * @property {SkyColAlign} align - Content alignment within the column.\r\n * @property {number | undefined} start - Optional explicit grid column start.\r\n * @property {number | undefined} end - Optional explicit grid column end.\r\n * @property {number | undefined} sm - Responsive span for small breakpoint.\r\n * @property {number | undefined} md - Responsive span for medium breakpoint.\r\n * @property {number | undefined} lg - Responsive span for large breakpoint.\r\n * @property {number | undefined} xl - Responsive span for extra-large breakpoint.\r\n * @property {string} preset - Named prop preset from nearest `sky-config-provider`. Default: `\"\"`.\n * @method refreshLayout Reapplies internal CSS variables from current properties.\r\n *\r\n * @Behavior\r\n * - Applies span and responsive spans through host CSS variables.\r\n * - Supports explicit `start`/`end` grid positioning when provided.\r\n * - Automatically updates layout variables when relevant properties change.\r\n *\r\n * @example\r\n * ```html\r\n * <sky-col span=\"4\" md=\"6\" justify=\"space-between\" align=\"center\">\r\n * <span slot=\"title\">Revenue</span>\r\n * Q2 performance details\r\n * </sky-col>\r\n * ```\r\n * ```vue\r\n * <template>\r\n * <sky-col span=\"4\" md=\"6\" justify=\"space-between\" align=\"center\">\r\n * <span slot=\"title\">Revenue</span>\r\n * Q2 performance details\r\n * </sky-col>\r\n * </template>\r\n * ```\r\n * ```jsx\r\n * export default function Demo() {\r\n * return (\r\n * <sky-col span=\"4\" md=\"6\" justify=\"space-between\" align=\"center\">\r\n * <span slot=\"title\">Revenue</span>\r\n * Q2 performance details\r\n * </sky-col>\r\n * );\r\n * }\r\n * ```\r\n */\r\n@customElement(\"sky-col\")\r\nexport class SkyCol extends LitElement {\r\n @property({ type: Number }) span = 1;\r\n @property({ type: String }) gap = \"0\";\r\n @property({ type: String }) justify: SkyColJustify = \"center\";\r\n @property({ type: String }) align: SkyColAlign = \"stretch\";\r\n\r\n @property({ type: Number }) start?: number;\r\n @property({ type: Number }) end?: number;\r\n\r\n @property({ type: Number }) sm?: number;\r\n @property({ type: Number }) md?: number;\r\n @property({ type: Number }) lg?: number;\r\n @property({ type: Number }) xl?: number;\r\n\r\n\n /** Named prop preset from nearest `sky-config-provider`. */\n @property({ type: String, reflect: true }) preset = \"\";\n\n private _presets = new PresetController(this);\n\n static override styles = css`\r\n :host {\r\n display: contents;\r\n }\r\n\r\n .col {\r\n display: flex;\r\n flex-direction: column;\r\n grid-column: span var(--col-span, 1);\r\n gap: var(--col-gap, 0);\r\n align-items: var(--col-align, stretch);\r\n justify-content: var(--col-justify, center);\r\n }\r\n\r\n ::slotted([slot=\"title\"]) {\r\n font-weight: bold;\r\n margin-bottom: 0.5rem;\r\n }\r\n\r\n @media (max-width: 768px) {\r\n .col {\r\n grid-column: span var(--col-span-sm, var(--col-span, 1));\r\n }\r\n }\r\n @media (max-width: 992px) {\r\n .col {\r\n grid-column: span var(--col-span-md, var(--col-span, 1));\r\n }\r\n }\r\n @media (max-width: 1200px) {\r\n .col {\r\n grid-column: span var(--col-span-lg, var(--col-span, 1));\r\n }\r\n }\r\n @media (min-width: 1201px) {\r\n .col {\r\n grid-column: span var(--col-span-xl, var(--col-span, var(--col-span, 1)));\r\n }\r\n }\r\n `;\r\n\r\n override firstUpdated(): void {\r\n this.syncVars();\r\n }\r\n\r\n override updated(changed: Map<string | number | symbol, unknown>): void {\r\n if (\r\n changed.has(\"span\") ||\r\n changed.has(\"gap\") ||\r\n changed.has(\"justify\") ||\r\n changed.has(\"align\") ||\r\n changed.has(\"sm\") ||\r\n changed.has(\"md\") ||\r\n changed.has(\"lg\") ||\r\n changed.has(\"xl\") ||\r\n changed.has(\"start\") ||\r\n changed.has(\"end\")\r\n ) {\r\n this.syncVars();\r\n }\r\n }\r\n\r\n /**\r\n * Reapplies internal CSS variables from current properties.\r\n *\r\n * @returns {void}\r\n */\r\n public refreshLayout(): void {\r\n this.syncVars();\r\n }\r\n\r\n private syncVars(): void {\r\n this.style.setProperty(\"--col-span\", String(this.span));\r\n this.style.setProperty(\"--col-gap\", this.gap);\r\n this.style.setProperty(\"--col-justify\", this.justify);\r\n this.style.setProperty(\"--col-align\", this.align);\r\n\r\n if (this.sm) this.style.setProperty(\"--col-span-sm\", String(this.sm));\r\n if (this.md) this.style.setProperty(\"--col-span-md\", String(this.md));\r\n if (this.lg) this.style.setProperty(\"--col-span-lg\", String(this.lg));\r\n if (this.xl) this.style.setProperty(\"--col-span-xl\", String(this.xl));\r\n\r\n if (this.start) this.style.setProperty(\"--col-start\", String(this.start));\r\n if (this.end) this.style.setProperty(\"--col-end\", String(this.end));\r\n }\r\n\r\n override render() {\r\n const gridStyle =\r\n this.start || this.end\r\n ? `grid-column: ${this.start ?? \"auto\"} / ${this.end ?? \"auto\"};`\r\n : \"\";\r\n\r\n return html`\r\n <div class=\"col\" style=${when(this.start || this.end, () => gridStyle, () => \"\")} part=\"col\">\r\n <slot name=\"title\"></slot>\r\n <slot></slot>\r\n </div>\r\n `;\r\n }\r\n}"],"names":["SkyCol","LitElement","constructor","super","arguments","this","span","gap","justify","align","preset","_presets","PresetController","firstUpdated","syncVars","updated","changed","has","refreshLayout","style","setProperty","String","sm","md","lg","xl","start","end","render","gridStyle","html","when","styles","css","__decorateClass","property","type","Number","prototype","reflect","customElement"],"mappings":"gbA0EO,IAAMA,EAAN,cAAqBC,EAArB,WAAAC,GAAAC,SAAAC,WACuBC,KAAAC,KAAO,EACPD,KAAAE,IAAM,IACNF,KAAAG,QAAyB,SACzBH,KAAAI,MAAqB,UAYNJ,KAAAK,OAAS,GAEpDL,KAAQM,SAAW,IAAIC,EAAiBP,KAAI,CA2CnC,YAAAQ,GACPR,KAAKS,UACP,CAES,OAAAC,CAAQC,IAEbA,EAAQC,IAAI,SACZD,EAAQC,IAAI,QACZD,EAAQC,IAAI,YACZD,EAAQC,IAAI,UACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,OACZD,EAAQC,IAAI,UACZD,EAAQC,IAAI,SAEZZ,KAAKS,UAET,CAOO,aAAAI,GACLb,KAAKS,UACP,CAEQ,QAAAA,GACNT,KAAKc,MAAMC,YAAY,aAAcC,OAAOhB,KAAKC,OACjDD,KAAKc,MAAMC,YAAY,YAAaf,KAAKE,KACzCF,KAAKc,MAAMC,YAAY,gBAAiBf,KAAKG,SAC7CH,KAAKc,MAAMC,YAAY,cAAef,KAAKI,OAEvCJ,KAAKiB,IAAIjB,KAAKc,MAAMC,YAAY,gBAAiBC,OAAOhB,KAAKiB,KAC7DjB,KAAKkB,IAAIlB,KAAKc,MAAMC,YAAY,gBAAiBC,OAAOhB,KAAKkB,KAC7DlB,KAAKmB,IAAInB,KAAKc,MAAMC,YAAY,gBAAiBC,OAAOhB,KAAKmB,KAC7DnB,KAAKoB,IAAIpB,KAAKc,MAAMC,YAAY,gBAAiBC,OAAOhB,KAAKoB,KAE7DpB,KAAKqB,OAAOrB,KAAKc,MAAMC,YAAY,cAAeC,OAAOhB,KAAKqB,QAC9DrB,KAAKsB,KAAKtB,KAAKc,MAAMC,YAAY,YAAaC,OAAOhB,KAAKsB,KAChE,CAES,MAAAC,GACP,MAAMC,EACJxB,KAAKqB,OAASrB,KAAKsB,IACf,gBAAgBtB,KAAKqB,OAAS,YAAYrB,KAAKsB,KAAO,UACtD,GAEN,OAAOG,CAAA;+BACoBC,EAAK1B,KAAKqB,OAASrB,KAAKsB,IAAK,IAAME,EAAW,IAAM;;;;KAKjF,GAtHW7B,EAoBKgC,OAASC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAnBGC,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UADPrC,EACiBsC,UAAA,OAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMf,UAFPrB,EAEiBsC,UAAA,MAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMf,UAHPrB,EAGiBsC,UAAA,UAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMf,UAJPrB,EAIiBsC,UAAA,QAAA,GAEAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UANPrC,EAMiBsC,UAAA,QAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAPPrC,EAOiBsC,UAAA,MAAA,GAEAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UATPrC,EASiBsC,UAAA,KAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAVPrC,EAUiBsC,UAAA,KAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAXPrC,EAWiBsC,UAAA,KAAA,GACAJ,EAAA,CAA3BC,EAAS,CAAEC,KAAMC,UAZPrC,EAYiBsC,UAAA,KAAA,GAIeJ,EAAA,CAA1CC,EAAS,CAAEC,KAAMf,OAAQkB,SAAS,KAhBxBvC,EAgBgCsC,UAAA,SAAA,GAhBhCtC,EAANkC,EAAA,CADNM,EAAc,YACFxC"}
@@ -34,9 +34,10 @@ export type SkyComboboxAddNewOptionDetail = {
34
34
  * @status stable
35
35
  * @since 1.0.0
36
36
  *
37
- * @documentation https://library.sky-ui.com/components/combobox
37
+ * @documentation https://sky-ui.com/components/combobox
38
38
  * @dependency sky-icon
39
39
  * @dependency sky-checkbox
40
+ * @dependency sky-input
40
41
  *
41
42
  * @uiVModel value value-changed
42
43
  * @uiVModel searchQuery search-query-changed
@@ -122,6 +123,7 @@ export type SkyComboboxAddNewOptionDetail = {
122
123
  * @property {string} variant - Visual style: `default`, `highlight`, `fieldset`, or `inside`.
123
124
  * @property {string} label - Label text. Above the field by default; on the border for `fieldset`; inside the field for `inside`.
124
125
  * @property {SkyComboboxMultiDisplay} multiDisplay - Multi-select value UI: `chips` (default), `text` (comma-joined), or `count` (“N selected”).
126
+ * @property {string} preset - Named prop preset from nearest `sky-config-provider`. Default: `""`.
125
127
  *
126
128
  * @method openDropdown Opens the combobox dropdown.
127
129
  * @method closeDropdown Closes the combobox dropdown.
@@ -220,6 +222,9 @@ export declare class SkyCombobox extends FormControlBase {
220
222
  private static readonly _CLOSE_RESET_MS;
221
223
  private dropdownPopover;
222
224
  private hiddenPopover;
225
+ /** Named prop preset from nearest `sky-config-provider`. */
226
+ preset: string;
227
+ private _presets;
223
228
  static styles: import("lit").CSSResult;
224
229
  constructor();
225
230
  static shadowRootOptions: {
@@ -291,7 +296,9 @@ export declare class SkyCombobox extends FormControlBase {
291
296
  private filterOptions;
292
297
  /** Emit search query for hosts / `v-model:search-query` when `searchQuery` changes outside the search input handler. */
293
298
  private emitSearchQueryChanged;
294
- private handleInput;
299
+ private handleSearchValueChanged;
300
+ private handleSearchValueCleared;
301
+ private applySearchQuery;
295
302
  disconnectedCallback(): void;
296
303
  private handleClear;
297
304
  selectOption(option: any): void;
@@ -1,4 +1,4 @@
1
- import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";import{property as r,state as n,query as a,queryAll as l,queryAssignedElements as h,customElement as d}from"lit/decorators.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";import{when as c}from"lit/directives/when.js";import{repeat as u}from"lit/directives/repeat.js";import{classMap as y}from"lit/directives/class-map.js";import{resolveColor as v}from"../helper/utils/color-resolver.js";import{cssOnFillEnhance as m}from"../helper/utils/contrast-color.js";import{PopoverController as g}from"../helper/controllers/popover-controller.js";import{FormControlBase as f}from"../helper/internals/form-control-base.js";import{SkyIcon as b}from"../sky-icon/sky-icon.js";import{SkyCheckbox as k}from"../sky-checkbox/sky-checkbox.js";var w=Object.defineProperty,x=Object.getOwnPropertyDescriptor,I=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?x(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&w(e,i,r),r};let S=class extends f{constructor(){super(),this.value="",this.placeholder="Select An Option",this.searchPlaceholder="Search...",this.label="",this._options=[],this.chipSize=20,this.color="primary",this.clearable=!1,this.loading=!1,this.compact=!1,this.disabled=!1,this.searchable=!1,this.multiSelect=!1,this.visibleChips=2,this.selectAll=!1,this._validations=[],this.showErrors=!1,this.errorDisplayMode="single",this.required=!1,this.emitFullObject=!1,this.emittedKey="value",this.displayKey="",this.addOption=!1,this.validationArrayFormat=!1,this.prefix="",this.suffix="",this.prefixColor="",this.suffixColor="",this.justify="flex-start",this.zIndex=11,this.height="200px",this.requiredMessage="Selection is required.",this.readonly=!1,this.enforceMinOneSelection=!1,this.openAbove=!1,this.validationActive=!1,this.invalid=!1,this.variant="default",this.multiDisplay="chips",this.searchQuery="",this.filteredOptions=[],this.focused=!1,this.open=!1,this.selectedItems=[],this.hiddenChipsOpen=!1,this.activeIndex=-1,this.validationErrors=[],this.validationStatus=[],this.hasLeftIcon=!1,this.hasRightIcon=!1,this.optionSlotSet=new Set,this._searchDebounceId=null,this._closeResetId=null,this.dropdownPopover=new g(this,{getAnchor:()=>this.inputWrapperEl,getPopover:()=>this.dropdownEl,cssVarLeft:"--sky-dd-left",cssVarTop:"--sky-dd-top",cssVarWidth:"--sky-dd-width",getPlacement:()=>"bottom",getAlign:()=>"start",getGap:()=>6,getPadding:()=>8,getMatchAnchorWidth:()=>!0,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>160,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!0,onOpenChange:(t,e)=>{this.open=t,t?(this.focused=!0,null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=null),this.validationActive=!0,this.filterOptions(),requestAnimationFrame(()=>this.focusOnOpen())):(this.activeIndex=-1,null!=this._closeResetId&&clearTimeout(this._closeResetId),this._closeResetId=setTimeout(()=>{this._closeResetId=null,this.open||(this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions())},S._CLOSE_RESET_MS),this.hiddenChipsOpen=!1,this.hiddenPopover.closePopover("api"))}}),this.hiddenPopover=new g(this,{getAnchor:()=>this.overflowChipEl,getPopover:()=>this.hiddenDropdownEl,cssVarLeft:"--sky-hc-left",cssVarTop:"--sky-hc-top",cssVarWidth:"--sky-hc-width",getPlacement:()=>"bottom",getAlign:()=>"center",getGap:()=>4,getPadding:()=>8,getMatchAnchorWidth:()=>!1,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>120,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!1,onOpenChange:t=>{this.hiddenChipsOpen=t,t&&this.open&&this.dropdownPopover.closePopover("api")}}),this.refreshOptionSlots=()=>{const t=new Set;this.querySelectorAll('[slot^="option-"]').forEach(e=>{const i=e.slot;i&&t.add(i)}),this.optionSlotSet=t},this.onSearchKeydown=t=>{const{key:e,shiftKey:i}=t;if("Enter"===e)return t.preventDefault(),t.stopPropagation(),void this.commitDropdownEnter();if("ArrowDown"===e||"ArrowUp"===e||"Tab"===e){t.preventDefault(),t.stopPropagation();const i=this.searchable||this.addOption,s=this.multiSelect&&this.selectAll?i?1:0:this.headerRows,o=this.headerRows+Math.max(0,this.filteredOptions.length)-1,r="ArrowUp"===e||"Tab"===e&&t.shiftKey?-1:1;this.activeIndex<s?this.activeIndex=s:this.activeIndex=this.activeIndex+r<s?o:this.activeIndex+r>o?s:this.activeIndex+r,this.scrollActiveItemIntoView()}return"Escape"===e?(t.preventDefault(),t.stopPropagation(),void this.dropdownPopover.closePopover("escape")):void 0},this.handleAddaddOption=t=>{if(t.stopPropagation(),this.disabled||this.readonly)return;if(!this.canAddaddOption())return;const e=this.searchQuery.trim();this.dispatchEvent(new CustomEvent("add-new-option",{detail:{value:e},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions()},this.onIconSlotChange=()=>{this.hasLeftIcon=(this.iconLeftEls?.length??0)>0,this.hasRightIcon=(this.iconRightEls?.length??0)>0},this.captureDefaultValue("")}get options(){return this._options}set options(t){const e=this._options;this._options=Array.isArray(t)?t:[],this.requestUpdate("options",e)}get validations(){return this._validations}set validations(t){const e=this._validations;this._validations=Array.isArray(t)?t:[],this.requestUpdate("validations",e)}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=this.disabled?-1:0),this.refreshOptionSlots()}firstUpdated(){this.dropdownPopover.refreshTargets(),this.hiddenPopover.refreshTargets()}getFormValue(){if(this.disabled||!this.name)return null;if(this.multiSelect){const t=new FormData;return this.selectedItems.forEach(e=>{const i=this.emitFullObject?JSON.stringify(e):String(this.getOptionValue(e));t.append(this.name,i)}),0===this.selectedItems.length&&this.required&&t.append(this.name,""),t}{if(0===this.selectedItems.length)return"";const t=this.selectedItems[0];return this.emitFullObject?JSON.stringify(t):String(this.getOptionValue(t))}}setValueFromFormState(t){if(null===t||""===t)return this.value=this.multiSelect?[]:"",void(this.selectedItems=[]);if(this.multiSelect){let e=[];if(t instanceof FormData)e=t.getAll(this.name);else if(Array.isArray(t))e=t;else if("string"==typeof t)try{const i=JSON.parse(t);e=Array.isArray(i)?i:[t]}catch{e=[t]}this.setValueFromArray(e)}else{let e="";"string"==typeof t?e=t:t instanceof FormData?e=t.get(this.name)?.toString()||"":Array.isArray(t)&&t.length>0&&(e=t[0].toString()),this.value=e,this.syncSelectedItemsWithValue()}}syncFormValue(){if(!this.name||this.disabled)return void this.internals.setFormValue(null);const t=this.getFormValue();if(null!==t)if(this.multiSelect&&Array.isArray(t)){const e=new FormData;t.forEach(t=>{null!=t&&""!==t&&e.append(this.name,String(t))}),this.internals.setFormValue(e)}else this.internals.setFormValue(t);else this.internals.setFormValue(null)}setValueFromArray(t){const e=Array.isArray(this.options)?this.options:[];this.selectedItems=e.filter(e=>{const i=this.getOptionValue(e),s=this.emitFullObject?JSON.stringify(e):String(i);return t.some(t=>{const e=String(t);if(!this.emitFullObject)return e===s;try{const t=JSON.parse(e);return JSON.stringify(t)===s}catch{return e===s}})}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}getValidityAnchor(){return this}isEmpty(){return this.multiSelect?0===this.selectedItems.length:0===this.selectedItems.length||!this.value}getNativeControl(){return this.inputWrapperEl||null}getCustomErrorMessage(){return this.validationErrors?.[0]||""}onFormReset(){super.onFormReset(),this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.invalid=!1,this.validationErrors=[],this.validationActive=!1}onFormDisabled(t){this.disabled=t}onFormStateRestore(t){this.setValueFromFormState(t)}toggleSelectAll(){if(this.disabled||this.readonly)return;const t=t=>String(this.getOptionValue(t));if(this.isAllFilteredSelected()){const e=new Set(this.filteredOptions.map(t=>String(this.getOptionValue(t.original)))),i=this.selectedItems.filter(i=>!e.has(t(i)));if(this.enforceMinOneSelection&&0===i.length)return;this.selectedItems=i}else{const e=new Set(this.selectedItems.map(e=>t(e))),i=this.filteredOptions.map(t=>t.original).filter(i=>!e.has(t(i)));this.selectedItems=[...this.selectedItems,...i]}const e=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t));this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:e,selectedItems:[...this.selectedItems],emittedValues:e,isFilteredSelection:!!this.searchQuery.trim()},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.requestUpdate()}isAllFilteredSelected(){if(0===this.filteredOptions.length)return!1;return this.filteredOptions.map(t=>this.getOptionValue(t.original)).every(t=>this.selectedItems.some(e=>this.getOptionValue(e)===t))}truncateText(t,e){return t.length>e?t.slice(0,e)+"...":t}validateInput(){if(!this.validationActive)return;this.validationErrors=[];const t=this.validationArrayFormat?this.selectedItems:this.value;if(this.required&&this.isEmpty())this.validationErrors.push(this.requiredMessage||"Selection is required.");else if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);!0!==i&&this.validationErrors.push(String(i||"Invalid value."))}this.invalid=this.validationErrors.length>0,this.dispatchEvent(new CustomEvent(this.invalid?"validation-error":"validation-success",{detail:this.invalid?{errors:this.validationErrors}:{value:this.selectedItems},bubbles:!0,composed:!0})),this.syncValidity(),this.requestUpdate()}validateForForm(){if(this.disabled)return"";const t=this.validationArrayFormat?this.selectedItems:this.value;if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);if(!0!==i)return String(i||"Invalid value.")}return this.enforceMinOneSelection&&this.isEmpty()?this.requiredMessage||"At least one selection is required.":this.required&&this.isEmpty()?this.requiredMessage||"Selection is required.":""}focus(t){super.focus(t),this.searchInputEl?this.searchInputEl.focus(t):this.inputWrapperEl&&this.inputWrapperEl.focus(t)}blur(){this.open&&this.dropdownPopover.closePopover("light-dismiss"),super.blur()}handleFocus(){this.focused=!0,this.validationActive||(this.validationActive=!0)}reset(){this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions(),this.validationErrors=[],this.validationActive=!1,this.open=!1,this.invalid=!1,this.syncFormValue(),this.syncValidity(),this.requestUpdate()}openDropdown(){this.disabled||this.readonly||this.dropdownPopover.openPopover()}closeDropdown(){this.dropdownPopover.closePopover("api")}clearSelection(){this.handleClear()}handleBlur(){this.open||(this.focused=!1,this.validationActive&&this.validateInput())}updated(t){t.has("color")&&this.style.setProperty("--sky-dropdown-color",v(this.color)),t.has("height")&&this.style.setProperty("--sky-scroll-height",this.height)}willUpdate(t){t.has("value")&&(this.syncSelectedItemsWithValue(),this.syncFormValue(),this.syncValidity()),t.has("options")&&(Array.isArray(this.options)||(this.options=[]),this.syncSelectedItemsWithValue(),this.filterOptions(),this.syncFormValue(),this.syncValidity()),t.has("searchable")&&this.filterOptions(),t.has("searchQuery")&&this.filterOptions(),t.has("validationErrors")&&this.requestUpdate()}syncSelectedItemsWithValue(){const t=Array.isArray(this.options)?this.options:[],e=this.multiSelect&&Array.isArray(this.value)&&0===this.value.length;if(null==this.value||""===this.value||e)return this.selectedItems=[],void(this.value=this.multiSelect?[]:"");if(this.multiSelect&&"string"==typeof this.value)try{const t=JSON.parse(this.value);Array.isArray(t)&&(this.value=t)}catch(t){}const i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)};if(this.multiSelect){const e=Array.isArray(this.value)?this.value:[this.value],s=new Set(e.map(t=>this.emitFullObject&&"object"==typeof t?JSON.stringify(t):String(t)));this.selectedItems=t.filter(t=>{const e=this.emitFullObject?JSON.stringify(t):i(t);return s.has(e)}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}else{const e=this.emitFullObject&&"object"==typeof this.value?JSON.stringify(this.value):String(this.value),s=t.find(t=>(this.emitFullObject?JSON.stringify(t):i(t))===e);this.selectedItems=s?[s]:[],this.value=s?this.emitFullObject?s:this.getOptionValue(s):""}}filterOptions(){const t=Array.isArray(this.options)?this.options:[],e=(t,e)=>{const i=this.getOptionLabel(t);return{original:t,_idx:e,label:i,highlighted:i}};if(!this.searchable||!this.searchQuery.trim())return void(this.filteredOptions=t.map(e));const i=this.searchQuery.toLowerCase();this.filteredOptions=t.map(e).filter(t=>String(t.label).toLowerCase().includes(i)).map(t=>{const e=new RegExp(`(${i})`,"gi");return{...t,highlighted:String(t.label).replace(e,t=>`<span class="highlight">${t}</span>`)}})}emitSearchQueryChanged(){this.dispatchEvent(new CustomEvent("search-query-changed",{detail:{searchQuery:this.searchQuery},bubbles:!0,composed:!0}))}handleInput(t){if(this.disabled||this.readonly)return;this.searchQuery=t.target.value;const e=Array.isArray(this.options)?this.options.length:0,i=this.searchable&&e>S._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD,s=()=>{this.filterOptions(),this.emitSearchQueryChanged()};i?(null!=this._searchDebounceId&&clearTimeout(this._searchDebounceId),this._searchDebounceId=setTimeout(()=>{this._searchDebounceId=null,s()},S._SEARCH_DEBOUNCE_MS)):s()}disconnectedCallback(){super.disconnectedCallback(),null!=this._searchDebounceId&&(clearTimeout(this._searchDebounceId),this._searchDebounceId=null),null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=null)}handleClear(){if(this.disabled||this.readonly)return;const t=this.multiSelect?this.selectedItems.length>0:!!this.value;this.enforceMinOneSelection&&t||(this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:[],isFilteredSelection:!1},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity())}selectOption(t){if(this.disabled||this.readonly)return;const e=t=>this.emitFullObject?t:this.getOptionValue(t),i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)},s=""!==this.searchQuery.trim();if(!this.multiSelect){const o=this.selectedItems.length&&i(this.selectedItems[0])===i(t);return o&&this.enforceMinOneSelection?void(this.open=!1):(o?(this.selectedItems=[],this.value=""):(this.selectedItems=[t],this.value=e(t)),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.selectedItems.map(e),isFilteredSelection:s},bubbles:!0,composed:!0})),this.dropdownPopover.closePopover("api"),this.syncFormValue(),this.syncValidity(),void this.requestUpdate())}const o=this.selectedItems.findIndex(e=>i(e)===i(t));let r;r=o>-1?[...this.selectedItems.slice(0,o),...this.selectedItems.slice(o+1)]:[...this.selectedItems,t],this.enforceMinOneSelection&&0===r.length||(this.selectedItems=r,this.value=r.map(e),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.value,isFilteredSelection:s},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.open=!0,this.requestUpdate())}toggleHiddenChips(t){t.stopPropagation(),t.preventDefault(),this.disabled||this.readonly||(this.open&&this.dropdownPopover.closePopover("api"),this.hiddenPopover.toggle())}renderHiddenChipsDropdown(){return s`
1
+ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";import{property as r,state as a,query as n,queryAll as l,queryAssignedElements as h,customElement as d}from"lit/decorators.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";import{when as c}from"lit/directives/when.js";import{repeat as u}from"lit/directives/repeat.js";import{classMap as y}from"lit/directives/class-map.js";import{resolveColor as v}from"../helper/utils/color-resolver.js";import{cssOnFillEnhance as m}from"../helper/utils/contrast-color.js";import{PopoverController as g}from"../helper/controllers/popover-controller.js";import{FormControlBase as f}from"../helper/internals/form-control-base.js";import{SkyIcon as b}from"../sky-icon/sky-icon.js";import{SkyCheckbox as k}from"../sky-checkbox/sky-checkbox.js";import{SkyInput as w}from"../sky-input/sky-input.js";import{PresetController as x}from"../helper/controllers/preset-controller.js";var S=Object.defineProperty,I=Object.getOwnPropertyDescriptor,O=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?I(e,i):e,a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&S(e,i,r),r};let A=class extends f{constructor(){super(),this.value="",this.placeholder="Select An Option",this.searchPlaceholder="Search...",this.label="",this._options=[],this.chipSize=20,this.color="primary",this.clearable=!1,this.loading=!1,this.compact=!1,this.disabled=!1,this.searchable=!1,this.multiSelect=!1,this.visibleChips=2,this.selectAll=!1,this._validations=[],this.showErrors=!1,this.errorDisplayMode="single",this.required=!1,this.emitFullObject=!1,this.emittedKey="value",this.displayKey="",this.addOption=!1,this.validationArrayFormat=!1,this.prefix="",this.suffix="",this.prefixColor="",this.suffixColor="",this.justify="flex-start",this.zIndex=11,this.height="200px",this.requiredMessage="Selection is required.",this.readonly=!1,this.enforceMinOneSelection=!1,this.openAbove=!1,this.validationActive=!1,this.invalid=!1,this.variant="default",this.multiDisplay="chips",this.searchQuery="",this.filteredOptions=[],this.focused=!1,this.open=!1,this.selectedItems=[],this.hiddenChipsOpen=!1,this.activeIndex=-1,this.validationErrors=[],this.validationStatus=[],this.hasLeftIcon=!1,this.hasRightIcon=!1,this.optionSlotSet=new Set,this._searchDebounceId=null,this._closeResetId=null,this.dropdownPopover=new g(this,{getAnchor:()=>this.inputWrapperEl,getPopover:()=>this.dropdownEl,cssVarLeft:"--sky-dd-left",cssVarTop:"--sky-dd-top",cssVarWidth:"--sky-dd-width",getPlacement:()=>"bottom",getAlign:()=>"start",getGap:()=>6,getPadding:()=>8,getMatchAnchorWidth:()=>!0,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>160,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!0,onOpenChange:(t,e)=>{this.open=t,t?(this.focused=!0,null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=null),this.validationActive=!0,this.filterOptions(),requestAnimationFrame(()=>this.focusOnOpen())):(this.activeIndex=-1,null!=this._closeResetId&&clearTimeout(this._closeResetId),this._closeResetId=setTimeout(()=>{this._closeResetId=null,this.open||(this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions())},A._CLOSE_RESET_MS),this.hiddenChipsOpen=!1,this.hiddenPopover.closePopover("api"))}}),this.hiddenPopover=new g(this,{getAnchor:()=>this.overflowChipEl,getPopover:()=>this.hiddenDropdownEl,cssVarLeft:"--sky-hc-left",cssVarTop:"--sky-hc-top",cssVarWidth:"--sky-hc-width",getPlacement:()=>"bottom",getAlign:()=>"center",getGap:()=>4,getPadding:()=>8,getMatchAnchorWidth:()=>!1,getMaxWidthToViewport:()=>!0,getMaxWidthMode:()=>"cap",getFlip:()=>!0,getFlipOrder:()=>[],getAnimateReposition:()=>!0,getRepositionMs:()=>120,getCloseOnEscape:()=>!0,getCloseOnOutside:()=>!0,getRestoreFocusOnClose:()=>!1,onOpenChange:t=>{this.hiddenChipsOpen=t,t&&this.open&&this.dropdownPopover.closePopover("api")}}),this.preset="",this._presets=new x(this),this.refreshOptionSlots=()=>{const t=new Set;this.querySelectorAll('[slot^="option-"]').forEach(e=>{const i=e.slot;i&&t.add(i)}),this.optionSlotSet=t},this.onSearchKeydown=t=>{const{key:e,shiftKey:i}=t;if("Enter"===e)return t.preventDefault(),t.stopPropagation(),void this.commitDropdownEnter();if("ArrowDown"===e||"ArrowUp"===e||"Tab"===e){t.preventDefault(),t.stopPropagation();const i=this.searchable||this.addOption,s=this.multiSelect&&this.selectAll?i?1:0:this.headerRows,o=this.headerRows+Math.max(0,this.filteredOptions.length)-1,r="ArrowUp"===e||"Tab"===e&&t.shiftKey?-1:1;this.activeIndex<s?this.activeIndex=s:this.activeIndex=this.activeIndex+r<s?o:this.activeIndex+r>o?s:this.activeIndex+r,this.scrollActiveItemIntoView()}return"Escape"===e?(t.preventDefault(),t.stopPropagation(),void this.dropdownPopover.closePopover("escape")):void 0},this.handleAddaddOption=t=>{if(t.stopPropagation(),this.disabled||this.readonly)return;if(!this.canAddaddOption())return;const e=this.searchQuery.trim();this.dispatchEvent(new CustomEvent("add-new-option",{detail:{value:e},bubbles:!0,composed:!0})),this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions()},this.onIconSlotChange=()=>{this.hasLeftIcon=(this.iconLeftEls?.length??0)>0,this.hasRightIcon=(this.iconRightEls?.length??0)>0},this.captureDefaultValue("")}get options(){return this._options}set options(t){const e=this._options;this._options=Array.isArray(t)?t:[],this.requestUpdate("options",e)}get validations(){return this._validations}set validations(t){const e=this._validations;this._validations=Array.isArray(t)?t:[],this.requestUpdate("validations",e)}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=this.disabled?-1:0),this.refreshOptionSlots()}firstUpdated(){this.dropdownPopover.refreshTargets(),this.hiddenPopover.refreshTargets()}getFormValue(){if(this.disabled||!this.name)return null;if(this.multiSelect){const t=new FormData;return this.selectedItems.forEach(e=>{const i=this.emitFullObject?JSON.stringify(e):String(this.getOptionValue(e));t.append(this.name,i)}),0===this.selectedItems.length&&this.required&&t.append(this.name,""),t}{if(0===this.selectedItems.length)return"";const t=this.selectedItems[0];return this.emitFullObject?JSON.stringify(t):String(this.getOptionValue(t))}}setValueFromFormState(t){if(null===t||""===t)return this.value=this.multiSelect?[]:"",void(this.selectedItems=[]);if(this.multiSelect){let e=[];if(t instanceof FormData)e=t.getAll(this.name);else if(Array.isArray(t))e=t;else if("string"==typeof t)try{const i=JSON.parse(t);e=Array.isArray(i)?i:[t]}catch{e=[t]}this.setValueFromArray(e)}else{let e="";"string"==typeof t?e=t:t instanceof FormData?e=t.get(this.name)?.toString()||"":Array.isArray(t)&&t.length>0&&(e=t[0].toString()),this.value=e,this.syncSelectedItemsWithValue()}}syncFormValue(){if(!this.name||this.disabled)return void this.internals.setFormValue(null);const t=this.getFormValue();if(null!==t)if(this.multiSelect&&Array.isArray(t)){const e=new FormData;t.forEach(t=>{null!=t&&""!==t&&e.append(this.name,String(t))}),this.internals.setFormValue(e)}else this.internals.setFormValue(t);else this.internals.setFormValue(null)}setValueFromArray(t){const e=Array.isArray(this.options)?this.options:[];this.selectedItems=e.filter(e=>{const i=this.getOptionValue(e),s=this.emitFullObject?JSON.stringify(e):String(i);return t.some(t=>{const e=String(t);if(!this.emitFullObject)return e===s;try{const t=JSON.parse(e);return JSON.stringify(t)===s}catch{return e===s}})}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}getValidityAnchor(){return this}isEmpty(){return this.multiSelect?0===this.selectedItems.length:0===this.selectedItems.length||!this.value}getNativeControl(){return this.inputWrapperEl||null}getCustomErrorMessage(){return this.validationErrors?.[0]||""}onFormReset(){super.onFormReset(),this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.invalid=!1,this.validationErrors=[],this.validationActive=!1}onFormDisabled(t){this.disabled=t}onFormStateRestore(t){this.setValueFromFormState(t)}toggleSelectAll(){if(this.disabled||this.readonly)return;const t=t=>String(this.getOptionValue(t));if(this.isAllFilteredSelected()){const e=new Set(this.filteredOptions.map(t=>String(this.getOptionValue(t.original)))),i=this.selectedItems.filter(i=>!e.has(t(i)));if(this.enforceMinOneSelection&&0===i.length)return;this.selectedItems=i}else{const e=new Set(this.selectedItems.map(e=>t(e))),i=this.filteredOptions.map(t=>t.original).filter(i=>!e.has(t(i)));this.selectedItems=[...this.selectedItems,...i]}const e=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t));this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:e,selectedItems:[...this.selectedItems],emittedValues:e,isFilteredSelection:!!this.searchQuery.trim()},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.requestUpdate()}isAllFilteredSelected(){if(0===this.filteredOptions.length)return!1;return this.filteredOptions.map(t=>this.getOptionValue(t.original)).every(t=>this.selectedItems.some(e=>this.getOptionValue(e)===t))}truncateText(t,e){return t.length>e?t.slice(0,e)+"...":t}validateInput(){if(!this.validationActive)return;this.validationErrors=[];const t=this.validationArrayFormat?this.selectedItems:this.value;if(this.required&&this.isEmpty())this.validationErrors.push(this.requiredMessage||"Selection is required.");else if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);!0!==i&&this.validationErrors.push(String(i||"Invalid value."))}this.invalid=this.validationErrors.length>0,this.dispatchEvent(new CustomEvent(this.invalid?"validation-error":"validation-success",{detail:this.invalid?{errors:this.validationErrors}:{value:this.selectedItems},bubbles:!0,composed:!0})),this.syncValidity(),this.requestUpdate()}validateForForm(){if(this.disabled)return"";const t=this.validationArrayFormat?this.selectedItems:this.value;if(Array.isArray(this.validations)&&this.validations.length)for(const e of this.validations){const i=e(t);if(!0!==i)return String(i||"Invalid value.")}return this.enforceMinOneSelection&&this.isEmpty()?this.requiredMessage||"At least one selection is required.":this.required&&this.isEmpty()?this.requiredMessage||"Selection is required.":""}focus(t){super.focus(t),this.searchInputEl?this.searchInputEl.focus(t):this.inputWrapperEl&&this.inputWrapperEl.focus(t)}blur(){this.open&&this.dropdownPopover.closePopover("light-dismiss"),super.blur()}handleFocus(){this.focused=!0,this.validationActive||(this.validationActive=!0)}reset(){this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.filterOptions(),this.validationErrors=[],this.validationActive=!1,this.open=!1,this.invalid=!1,this.syncFormValue(),this.syncValidity(),this.requestUpdate()}openDropdown(){this.disabled||this.readonly||this.dropdownPopover.openPopover()}closeDropdown(){this.dropdownPopover.closePopover("api")}clearSelection(){this.handleClear()}handleBlur(){this.open||(this.focused=!1,this.validationActive&&this.validateInput())}updated(t){t.has("color")&&this.style.setProperty("--sky-dropdown-color",v(this.color)),t.has("height")&&this.style.setProperty("--sky-scroll-height",this.height)}willUpdate(t){t.has("value")&&(this.syncSelectedItemsWithValue(),this.syncFormValue(),this.syncValidity()),t.has("options")&&(Array.isArray(this.options)||(this.options=[]),this.syncSelectedItemsWithValue(),this.filterOptions(),this.syncFormValue(),this.syncValidity()),t.has("searchable")&&this.filterOptions(),t.has("searchQuery")&&this.filterOptions(),t.has("validationErrors")&&this.requestUpdate()}syncSelectedItemsWithValue(){const t=Array.isArray(this.options)?this.options:[],e=this.multiSelect&&Array.isArray(this.value)&&0===this.value.length;if(null==this.value||""===this.value||e)return this.selectedItems=[],void(this.value=this.multiSelect?[]:"");if(this.multiSelect&&"string"==typeof this.value)try{const t=JSON.parse(this.value);Array.isArray(t)&&(this.value=t)}catch(t){}const i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)};if(this.multiSelect){const e=Array.isArray(this.value)?this.value:[this.value],s=new Set(e.map(t=>this.emitFullObject&&"object"==typeof t?JSON.stringify(t):String(t)));this.selectedItems=t.filter(t=>{const e=this.emitFullObject?JSON.stringify(t):i(t);return s.has(e)}),this.value=this.selectedItems.map(t=>this.emitFullObject?t:this.getOptionValue(t))}else{const e=this.emitFullObject&&"object"==typeof this.value?JSON.stringify(this.value):String(this.value),s=t.find(t=>(this.emitFullObject?JSON.stringify(t):i(t))===e);this.selectedItems=s?[s]:[],this.value=s?this.emitFullObject?s:this.getOptionValue(s):""}}filterOptions(){const t=Array.isArray(this.options)?this.options:[],e=(t,e)=>{const i=this.getOptionLabel(t);return{original:t,_idx:e,label:i,highlighted:i}};if(!this.searchable||!this.searchQuery.trim())return void(this.filteredOptions=t.map(e));const i=this.searchQuery.toLowerCase();this.filteredOptions=t.map(e).filter(t=>String(t.label).toLowerCase().includes(i)).map(t=>{const e=new RegExp(`(${i})`,"gi");return{...t,highlighted:String(t.label).replace(e,t=>`<span class="highlight">${t}</span>`)}})}emitSearchQueryChanged(){this.dispatchEvent(new CustomEvent("search-query-changed",{detail:{searchQuery:this.searchQuery},bubbles:!0,composed:!0}))}handleSearchValueChanged(t){t.stopPropagation(),this.disabled||this.readonly||this.applySearchQuery(String(t.detail?.value??""))}handleSearchValueCleared(t){t.stopPropagation(),this.disabled||this.readonly||this.applySearchQuery("")}applySearchQuery(t){this.searchQuery=t;const e=Array.isArray(this.options)?this.options.length:0,i=this.searchable&&e>A._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD,s=()=>{this.filterOptions(),this.emitSearchQueryChanged()};i?(null!=this._searchDebounceId&&clearTimeout(this._searchDebounceId),this._searchDebounceId=setTimeout(()=>{this._searchDebounceId=null,s()},A._SEARCH_DEBOUNCE_MS)):s()}disconnectedCallback(){super.disconnectedCallback(),null!=this._searchDebounceId&&(clearTimeout(this._searchDebounceId),this._searchDebounceId=null),null!=this._closeResetId&&(clearTimeout(this._closeResetId),this._closeResetId=null)}handleClear(){if(this.disabled||this.readonly)return;const t=this.multiSelect?this.selectedItems.length>0:!!this.value;this.enforceMinOneSelection&&t||(this.value=this.multiSelect?[]:"",this.selectedItems=[],this.searchQuery="",this.emitSearchQueryChanged(),this.open=!1,this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:[],isFilteredSelection:!1},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity())}selectOption(t){if(this.disabled||this.readonly)return;const e=t=>this.emitFullObject?t:this.getOptionValue(t),i=t=>{const e=this.getOptionValue(t);return"object"==typeof e?JSON.stringify(e):String(e)},s=""!==this.searchQuery.trim();if(!this.multiSelect){const o=this.selectedItems.length&&i(this.selectedItems[0])===i(t);return o&&this.enforceMinOneSelection?void(this.open=!1):(o?(this.selectedItems=[],this.value=""):(this.selectedItems=[t],this.value=e(t)),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.selectedItems.map(e),isFilteredSelection:s},bubbles:!0,composed:!0})),this.dropdownPopover.closePopover("api"),this.syncFormValue(),this.syncValidity(),void this.requestUpdate())}const o=this.selectedItems.findIndex(e=>i(e)===i(t));let r;r=o>-1?[...this.selectedItems.slice(0,o),...this.selectedItems.slice(o+1)]:[...this.selectedItems,t],this.enforceMinOneSelection&&0===r.length||(this.selectedItems=r,this.value=r.map(e),this.validateInput(),this.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this.value,selectedItems:this.selectedItems,emittedValues:this.value,isFilteredSelection:s},bubbles:!0,composed:!0})),this.syncFormValue(),this.syncValidity(),this.open=!0,this.requestUpdate())}toggleHiddenChips(t){t.stopPropagation(),t.preventDefault(),this.disabled||this.readonly||(this.open&&this.dropdownPopover.closePopover("api"),this.hiddenPopover.toggle())}renderHiddenChipsDropdown(){return s`
2
2
  <div
3
3
  class="hidden-chips-dropdown"
4
4
  part="hidden-chips-dropdown"
@@ -92,22 +92,24 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
92
92
  data-row-index="0"
93
93
  part="search-container"
94
94
  >
95
- <sky-icon icon="ion:search"></sky-icon>
96
-
97
- <input
98
- .value=${this.searchQuery}
95
+ <sky-input
96
+ class="dropdown-search-input"
97
+ compact
98
+ clearable
99
99
  part="search-input"
100
100
  tabindex="0"
101
101
  ?readonly=${this.readonly||!this.searchable&&!this.addOption}
102
- @input=${this.searchable||this.addOption?this.handleInput:null}
102
+ ?disabled=${this.disabled}
103
+ placeholder=${this.searchPlaceholder}
104
+ .value=${this.searchQuery}
105
+ @value-changed=${this.searchable||this.addOption?this.handleSearchValueChanged:null}
106
+ @value-cleared=${this.searchable||this.addOption?this.handleSearchValueCleared:null}
103
107
  @keydown=${this.onSearchKeydown}
104
108
  @focus=${this.searchable||this.addOption?this.handleFocus:null}
105
109
  @blur=${this.searchable||this.addOption?this.handleBlur:null}
106
- ?compact=${this.compact}
107
- ?disabled=${this.disabled}
108
- placeholder=${this.searchPlaceholder}
109
- class="input"
110
- />
110
+ >
111
+ <sky-icon slot="icon-left" icon="ion:search"></sky-icon>
112
+ </sky-input>
111
113
 
112
114
  ${c(this.addOption,()=>s`
113
115
  <sky-icon
@@ -138,7 +140,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
138
140
  Select All
139
141
  </div>
140
142
  `})}
141
- ${c(this.filteredOptions.length>0,()=>u(this.filteredOptions,({original:t,_idx:e})=>`${e}-${String(this.getOptionValue(t))}`,({original:t,highlighted:e,_idx:i},o)=>{const r=`option-${i}`,n=this.optionSlotSet.has(r),a=t=>String(this.getOptionValue(t.original??t)),l=Array.isArray(this.selectedItems)&&this.selectedItems.some(e=>a(e)===a(t)),h=this.headerRows+o,d=h===this.activeIndex,u=y({"dropdown-item":!0,active:d,selected:l});return s`
143
+ ${c(this.filteredOptions.length>0,()=>u(this.filteredOptions,({original:t,_idx:e})=>`${e}-${String(this.getOptionValue(t))}`,({original:t,highlighted:e,_idx:i},o)=>{const r=`option-${i}`,a=this.optionSlotSet.has(r),n=t=>String(this.getOptionValue(t.original??t)),l=Array.isArray(this.selectedItems)&&this.selectedItems.some(e=>n(e)===n(t)),h=this.headerRows+o,d=h===this.activeIndex,u=y({"dropdown-item":!0,active:d,selected:l});return s`
142
144
  <div
143
145
  class=${u}
144
146
  data-row-index=${h}
@@ -152,7 +154,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
152
154
  .checked=${l}
153
155
  readonly
154
156
  ></sky-checkbox>`)}
155
- ${c(n,()=>s`
157
+ ${c(a,()=>s`
156
158
  <div style="display: flex; gap: 8px;width:100%">
157
159
  <slot name=${r}>
158
160
  <span
@@ -183,7 +185,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
183
185
  ${u(t,t=>t,t=>s`<li class="error" part="error-item">${t}</li>`)}
184
186
  </ul>
185
187
  </div>
186
- `}getErrorMessages(){const t=Array.isArray(this.validationErrors)?this.validationErrors:[];switch(this.errorDisplayMode){case"single":return t.slice(0,1);case"all":return t;default:return[]}}handleIconClick(t,e){this.dispatchEvent(new CustomEvent("icon-click",{detail:{position:t,event:e},bubbles:!0,composed:!0}))}render(){const t=y({"icon-slot":!0,left:!0,focused:this.focused}),e=y({"icon-slot":!0,right:!0,focused:this.focused}),i=y({"placeholder-label":!0,active:this.selectedItems.length>0}),r="fieldset"===this.variant,n="inside"===this.variant,a=this.label?r?s`<legend class="label" part="label">${this.label}</legend>`:s`<div class="label" part="label">${this.label}</div>`:null,l=s`
188
+ `}getErrorMessages(){const t=Array.isArray(this.validationErrors)?this.validationErrors:[];switch(this.errorDisplayMode){case"single":return t.slice(0,1);case"all":return t;default:return[]}}handleIconClick(t,e){this.dispatchEvent(new CustomEvent("icon-click",{detail:{position:t,event:e},bubbles:!0,composed:!0}))}render(){const t=y({"icon-slot":!0,left:!0,focused:this.focused}),e=y({"icon-slot":!0,right:!0,focused:this.focused}),i=y({"placeholder-label":!0,active:this.selectedItems.length>0}),r="fieldset"===this.variant,a="inside"===this.variant,n=this.label?r?s`<legend class="label" part="label">${this.label}</legend>`:s`<div class="label" part="label">${this.label}</div>`:null,l=s`
187
189
  <div
188
190
  class=${t}
189
191
  part="icon-slot"
@@ -242,13 +244,13 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
242
244
  `,u=s`
243
245
  ${l}
244
246
  <div class="input-inside-main">
245
- ${a}
247
+ ${n}
246
248
  <div class="input-inside-row">
247
249
  <div class="field-main" part="field-main">${h}</div>
248
250
  </div>
249
251
  </div>
250
252
  ${this.readonly?o:d}
251
- `,v=n?u:p,m=t=>{this.disabled||this.readonly||this.toggleDropdown(t)},g=this.handleKeydown,f=r?s`
253
+ `,v=a?u:p,m=t=>{this.disabled||this.readonly||this.toggleDropdown(t)},g=this.handleKeydown,f=r?s`
252
254
  <fieldset
253
255
  class="input-wrapper"
254
256
  tabindex="0"
@@ -261,7 +263,7 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
261
263
  @click=${m}
262
264
  @keydown=${g}
263
265
  >
264
- ${a}
266
+ ${n}
265
267
  <div class="input-fieldset-body">${v}</div>
266
268
  </fieldset>
267
269
  `:s`
@@ -281,13 +283,13 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
281
283
  </div>
282
284
  `;return s`
283
285
  <div class="combo-box-container" part="combo-box-container">
284
- ${r||n?o:a}
286
+ ${r||a?o:n}
285
287
  ${f}
286
288
  ${this.renderHiddenChipsDropdown()} ${this.renderDropdown()}
287
289
  ${this.renderValidationErrors()}
288
290
  <slot style="display:none" @slotchange=${this.refreshOptionSlots}></slot>
289
291
  </div>
290
- `}};S.dependencies={"sky-icon":b,"sky-checkbox":k},S._SEARCH_DEBOUNCE_MS=150,S._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD=30,S._CLOSE_RESET_MS=250,S.styles=e`
292
+ `}};A.dependencies={"sky-icon":b,"sky-checkbox":k,"sky-input":w},A._SEARCH_DEBOUNCE_MS=150,A._SEARCH_DEBOUNCE_OPTIONS_THRESHOLD=30,A._CLOSE_RESET_MS=250,A.styles=e`
291
293
  :host {
292
294
  display: block;
293
295
  font-family: var(--sky-font);
@@ -639,21 +641,15 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
639
641
  display: flex;
640
642
  align-items: center;
641
643
  padding: 8px 10px;
642
- gap: 5px;
644
+ gap: var(--sky-input-gap, 4px);
643
645
  border-bottom: 1px solid var(--sky-border-light);
644
- justify-content: space-between;
645
646
  margin-bottom: 5px;
646
647
  }
647
648
 
648
- .search-container sky-icon {
649
- width: 16px;
650
- height: 16px;
651
- color: var(--sky-text-secondary);
652
- transition: color 0.15s ease;
653
- }
654
-
655
- .search-container:has(.input:focus) sky-icon {
656
- color: var(--sky-active-primary);
649
+ .search-container .dropdown-search-input {
650
+ flex: 1 1 auto;
651
+ min-width: 0;
652
+ width: 100%;
657
653
  }
658
654
 
659
655
  .new-option-btn {
@@ -939,33 +935,6 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
939
935
  transition: color 0.2s ease, background-color 0.2s ease;
940
936
  }
941
937
 
942
- .input {
943
- border: none;
944
- font-family: var(--sky-font);
945
- outline: none;
946
- font-size: var(--sky-font-size-md);
947
- background: transparent;
948
- box-sizing: border-box;
949
- color: var(--sky-text-secondary);
950
- width: 100%;
951
- transition: all 0.2 ease-in-out;
952
- }
953
-
954
- .search-container:has(.input:focus:focus) {
955
- border-bottom-color: var(--sky-active-primary);
956
- }
957
-
958
- .input:-webkit-autofill {
959
- -webkit-text-fill-color: var(--sky-text-secondary, inherit) !important;
960
- transition: background-color 9999s ease-in-out 0s !important;
961
- }
962
-
963
- .input[disabled] {
964
- opacity: 70%;
965
- color: var(--sky-text-primary);
966
- cursor: disabled;
967
- }
968
-
969
938
  .input-wrapper[disabled] {
970
939
  opacity: 0.6;
971
940
  pointer-events: none;
@@ -1395,5 +1364,5 @@ import{unsafeCSS as t,css as e,LitElement as i,html as s,nothing as o}from"lit";
1395
1364
  }
1396
1365
 
1397
1366
  ${t(m([{selector:".placeholder-label.active[compact]",fillVar:"--sky-dropdown-color"},{selector:".sky-checkbox:checked::after",fillVar:"--sky-active-primary",property:"border-color"},{selector:".sky-checkbox.indeterminate::after",fillVar:"--sky-active-primary",property:"background-color"}]))}
1398
- `,S.shadowRootOptions={...i.shadowRootOptions,delegatesFocus:!0},I([r()],S.prototype,"value",2),I([r({type:String})],S.prototype,"placeholder",2),I([r({type:String})],S.prototype,"searchPlaceholder",2),I([r({type:String})],S.prototype,"label",2),I([r({type:Array})],S.prototype,"options",1),I([r({type:Number})],S.prototype,"chipSize",2),I([r({type:String})],S.prototype,"color",2),I([r({type:Boolean,reflect:!0})],S.prototype,"clearable",2),I([r({type:Boolean,reflect:!0})],S.prototype,"loading",2),I([r({type:Boolean,reflect:!0})],S.prototype,"compact",2),I([r({type:Boolean,reflect:!0})],S.prototype,"disabled",2),I([r({type:Boolean,reflect:!0})],S.prototype,"searchable",2),I([r({type:Boolean,reflect:!0})],S.prototype,"multiSelect",2),I([r({type:Number,reflect:!0})],S.prototype,"visibleChips",2),I([r({type:Boolean,reflect:!0})],S.prototype,"selectAll",2),I([r({type:Array})],S.prototype,"validations",1),I([r({type:Boolean})],S.prototype,"showErrors",2),I([r({type:String})],S.prototype,"errorDisplayMode",2),I([r({type:Boolean,reflect:!0})],S.prototype,"required",2),I([r({type:Boolean,reflect:!0})],S.prototype,"emitFullObject",2),I([r({type:String})],S.prototype,"emittedKey",2),I([r({type:String})],S.prototype,"displayKey",2),I([r({type:Boolean})],S.prototype,"addOption",2),I([r({type:Boolean})],S.prototype,"validationArrayFormat",2),I([r({type:String})],S.prototype,"prefix",2),I([r({type:String})],S.prototype,"suffix",2),I([r({type:String})],S.prototype,"prefixColor",2),I([r({type:String})],S.prototype,"suffixColor",2),I([r({type:String})],S.prototype,"justify",2),I([r({type:Number})],S.prototype,"zIndex",2),I([r({type:String})],S.prototype,"height",2),I([r({type:String})],S.prototype,"requiredMessage",2),I([r({type:Boolean,reflect:!0})],S.prototype,"readonly",2),I([r({type:Boolean})],S.prototype,"enforceMinOneSelection",2),I([r({type:Boolean})],S.prototype,"openAbove",2),I([r({type:Boolean,reflect:!0})],S.prototype,"validationActive",2),I([r({type:Boolean,reflect:!0})],S.prototype,"invalid",2),I([r({type:String,reflect:!0})],S.prototype,"variant",2),I([r({type:String,reflect:!0,attribute:"multi-display"})],S.prototype,"multiDisplay",2),I([r({type:String,attribute:!1})],S.prototype,"searchQuery",2),I([n()],S.prototype,"filteredOptions",2),I([n()],S.prototype,"focused",2),I([n()],S.prototype,"open",2),I([n()],S.prototype,"selectedItems",2),I([n()],S.prototype,"hiddenChipsOpen",2),I([n()],S.prototype,"activeIndex",2),I([n()],S.prototype,"validationErrors",2),I([n()],S.prototype,"validationStatus",2),I([n()],S.prototype,"hasLeftIcon",2),I([n()],S.prototype,"hasRightIcon",2),I([n()],S.prototype,"optionSlotSet",2),I([a(".input-wrapper")],S.prototype,"inputWrapperEl",2),I([a(".dropdown")],S.prototype,"dropdownEl",2),I([a(".hidden-chips-dropdown")],S.prototype,"hiddenDropdownEl",2),I([a(".search-container .input")],S.prototype,"searchInputEl",2),I([a(".overflow-chip")],S.prototype,"overflowChipEl",2),I([a(".combo-box-container")],S.prototype,"comboContainerEl",2),I([l("[data-row-index]")],S.prototype,"rowEls",2),I([h({slot:"icon-left"})],S.prototype,"iconLeftEls",2),I([h({slot:"icon-right"})],S.prototype,"iconRightEls",2),S=I([d("sky-combobox")],S);export{S as SkyCombobox};
1367
+ `,A.shadowRootOptions={...i.shadowRootOptions,delegatesFocus:!0},O([r()],A.prototype,"value",2),O([r({type:String})],A.prototype,"placeholder",2),O([r({type:String})],A.prototype,"searchPlaceholder",2),O([r({type:String})],A.prototype,"label",2),O([r({type:Array})],A.prototype,"options",1),O([r({type:Number})],A.prototype,"chipSize",2),O([r({type:String})],A.prototype,"color",2),O([r({type:Boolean,reflect:!0})],A.prototype,"clearable",2),O([r({type:Boolean,reflect:!0})],A.prototype,"loading",2),O([r({type:Boolean,reflect:!0})],A.prototype,"compact",2),O([r({type:Boolean,reflect:!0})],A.prototype,"disabled",2),O([r({type:Boolean,reflect:!0})],A.prototype,"searchable",2),O([r({type:Boolean,reflect:!0})],A.prototype,"multiSelect",2),O([r({type:Number,reflect:!0})],A.prototype,"visibleChips",2),O([r({type:Boolean,reflect:!0})],A.prototype,"selectAll",2),O([r({type:Array})],A.prototype,"validations",1),O([r({type:Boolean})],A.prototype,"showErrors",2),O([r({type:String})],A.prototype,"errorDisplayMode",2),O([r({type:Boolean,reflect:!0})],A.prototype,"required",2),O([r({type:Boolean,reflect:!0})],A.prototype,"emitFullObject",2),O([r({type:String})],A.prototype,"emittedKey",2),O([r({type:String})],A.prototype,"displayKey",2),O([r({type:Boolean})],A.prototype,"addOption",2),O([r({type:Boolean})],A.prototype,"validationArrayFormat",2),O([r({type:String})],A.prototype,"prefix",2),O([r({type:String})],A.prototype,"suffix",2),O([r({type:String})],A.prototype,"prefixColor",2),O([r({type:String})],A.prototype,"suffixColor",2),O([r({type:String})],A.prototype,"justify",2),O([r({type:Number})],A.prototype,"zIndex",2),O([r({type:String})],A.prototype,"height",2),O([r({type:String})],A.prototype,"requiredMessage",2),O([r({type:Boolean,reflect:!0})],A.prototype,"readonly",2),O([r({type:Boolean})],A.prototype,"enforceMinOneSelection",2),O([r({type:Boolean})],A.prototype,"openAbove",2),O([r({type:Boolean,reflect:!0})],A.prototype,"validationActive",2),O([r({type:Boolean,reflect:!0})],A.prototype,"invalid",2),O([r({type:String,reflect:!0})],A.prototype,"variant",2),O([r({type:String,reflect:!0,attribute:"multi-display"})],A.prototype,"multiDisplay",2),O([r({type:String,attribute:!1})],A.prototype,"searchQuery",2),O([a()],A.prototype,"filteredOptions",2),O([a()],A.prototype,"focused",2),O([a()],A.prototype,"open",2),O([a()],A.prototype,"selectedItems",2),O([a()],A.prototype,"hiddenChipsOpen",2),O([a()],A.prototype,"activeIndex",2),O([a()],A.prototype,"validationErrors",2),O([a()],A.prototype,"validationStatus",2),O([a()],A.prototype,"hasLeftIcon",2),O([a()],A.prototype,"hasRightIcon",2),O([a()],A.prototype,"optionSlotSet",2),O([n(".input-wrapper")],A.prototype,"inputWrapperEl",2),O([n(".dropdown")],A.prototype,"dropdownEl",2),O([n(".hidden-chips-dropdown")],A.prototype,"hiddenDropdownEl",2),O([n(".search-container sky-input")],A.prototype,"searchInputEl",2),O([n(".overflow-chip")],A.prototype,"overflowChipEl",2),O([n(".combo-box-container")],A.prototype,"comboContainerEl",2),O([l("[data-row-index]")],A.prototype,"rowEls",2),O([h({slot:"icon-left"})],A.prototype,"iconLeftEls",2),O([h({slot:"icon-right"})],A.prototype,"iconRightEls",2),O([r({type:String,reflect:!0})],A.prototype,"preset",2),A=O([d("sky-combobox")],A);export{A as SkyCombobox};
1399
1368
  //# sourceMappingURL=sky-combobox.js.map