@sula-tech/webcomponents 0.1.1 → 0.2.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 (131) hide show
  1. package/dist/cjs/{index-7973b779.js → index-87eec792.js} +126 -5
  2. package/dist/cjs/index-87eec792.js.map +1 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/{sula-avatar_3.cjs.entry.js → sula-avatar_9.cjs.entry.js} +652 -7
  5. package/dist/cjs/sula-avatar_9.cjs.entry.js.map +1 -0
  6. package/dist/cjs/webcomponents.cjs.js +2 -2
  7. package/dist/collection/collection-manifest.json +7 -1
  8. package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
  9. package/dist/collection/components/sula-avatar/sula-avatar.stories.js +14 -17
  10. package/dist/collection/components/sula-avatar/sula-avatar.stories.js.map +1 -1
  11. package/dist/collection/components/sula-badge/model/sula-badge.model.js +23 -0
  12. package/dist/collection/components/sula-badge/model/sula-badge.model.js.map +1 -0
  13. package/dist/collection/components/sula-badge/sula-badge.css +1 -0
  14. package/dist/collection/components/sula-badge/sula-badge.js +230 -0
  15. package/dist/collection/components/sula-badge/sula-badge.js.map +1 -0
  16. package/dist/collection/components/sula-badge/sula-badge.stories.js +148 -0
  17. package/dist/collection/components/sula-badge/sula-badge.stories.js.map +1 -0
  18. package/dist/collection/components/sula-button/sula-button.css +1 -1
  19. package/dist/collection/components/sula-button/sula-button.js +1 -1
  20. package/dist/collection/components/sula-button/sula-button.stories.js +36 -9
  21. package/dist/collection/components/sula-button/sula-button.stories.js.map +1 -1
  22. package/dist/collection/components/sula-checkbox/model/sula-checkbox.model.js +6 -0
  23. package/dist/collection/components/sula-checkbox/model/sula-checkbox.model.js.map +1 -0
  24. package/dist/collection/components/sula-checkbox/sula-checkbox.css +1 -0
  25. package/dist/collection/components/sula-checkbox/sula-checkbox.js +233 -0
  26. package/dist/collection/components/sula-checkbox/sula-checkbox.js.map +1 -0
  27. package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js +113 -0
  28. package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js.map +1 -0
  29. package/dist/collection/components/sula-icon/sula-icon.css +1 -1
  30. package/dist/collection/components/sula-icon/sula-icon.js +1 -1
  31. package/dist/collection/components/sula-icon/sula-icon.stories.js +35 -14
  32. package/dist/collection/components/sula-icon/sula-icon.stories.js.map +1 -1
  33. package/dist/collection/components/sula-switch/model/sula-switch.model.js +6 -0
  34. package/dist/collection/components/sula-switch/model/sula-switch.model.js.map +1 -0
  35. package/dist/collection/components/sula-switch/sula-switch.css +1 -0
  36. package/dist/collection/components/sula-switch/sula-switch.js +235 -0
  37. package/dist/collection/components/sula-switch/sula-switch.js.map +1 -0
  38. package/dist/collection/components/sula-switch/sula-switch.stories.js +111 -0
  39. package/dist/collection/components/sula-switch/sula-switch.stories.js.map +1 -0
  40. package/dist/collection/components/sula-tag/model/sula-tag.model.js +28 -0
  41. package/dist/collection/components/sula-tag/model/sula-tag.model.js.map +1 -0
  42. package/dist/collection/components/sula-tag/sula-tag.css +1 -0
  43. package/dist/collection/components/sula-tag/sula-tag.js +249 -0
  44. package/dist/collection/components/sula-tag/sula-tag.js.map +1 -0
  45. package/dist/collection/components/sula-tag/sula-tag.stories.js +201 -0
  46. package/dist/collection/components/sula-tag/sula-tag.stories.js.map +1 -0
  47. package/dist/collection/components/sula-textarea/model/sula-textarea.model.js +6 -0
  48. package/dist/collection/components/sula-textarea/model/sula-textarea.model.js.map +1 -0
  49. package/dist/collection/components/sula-textarea/sula-textarea.css +1 -0
  50. package/dist/collection/components/sula-textarea/sula-textarea.js +358 -0
  51. package/dist/collection/components/sula-textarea/sula-textarea.js.map +1 -0
  52. package/dist/collection/components/sula-textarea/sula-textarea.stories.js +138 -0
  53. package/dist/collection/components/sula-textarea/sula-textarea.stories.js.map +1 -0
  54. package/dist/collection/components/sula-textfield/model/sula-textfield.model.js +11 -0
  55. package/dist/collection/components/sula-textfield/model/sula-textfield.model.js.map +1 -0
  56. package/dist/collection/components/sula-textfield/sula-textfield.css +1 -0
  57. package/dist/collection/components/sula-textfield/sula-textfield.js +376 -0
  58. package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -0
  59. package/dist/collection/components/sula-textfield/sula-textfield.stories.js +148 -0
  60. package/dist/collection/components/sula-textfield/sula-textfield.stories.js.map +1 -0
  61. package/dist/components/index.js +1 -1
  62. package/dist/components/{p-81fcc74a.js → p-2d5f97d1.js} +4 -4
  63. package/dist/components/{p-81fcc74a.js.map → p-2d5f97d1.js.map} +1 -1
  64. package/dist/components/{p-d3ba6302.js → p-881c6b35.js} +114 -6
  65. package/dist/components/p-881c6b35.js.map +1 -0
  66. package/dist/components/sula-avatar.js +3 -3
  67. package/dist/components/sula-avatar.js.map +1 -1
  68. package/dist/components/sula-badge.d.ts +11 -0
  69. package/dist/components/sula-badge.js +154 -0
  70. package/dist/components/sula-badge.js.map +1 -0
  71. package/dist/components/sula-button.js +4 -4
  72. package/dist/components/sula-button.js.map +1 -1
  73. package/dist/components/sula-checkbox.d.ts +11 -0
  74. package/dist/components/sula-checkbox.js +109 -0
  75. package/dist/components/sula-checkbox.js.map +1 -0
  76. package/dist/components/sula-icon.js +1 -1
  77. package/dist/components/sula-switch.d.ts +11 -0
  78. package/dist/components/sula-switch.js +105 -0
  79. package/dist/components/sula-switch.js.map +1 -0
  80. package/dist/components/sula-tag.d.ts +11 -0
  81. package/dist/components/sula-tag.js +157 -0
  82. package/dist/components/sula-tag.js.map +1 -0
  83. package/dist/components/sula-textarea.d.ts +11 -0
  84. package/dist/components/sula-textarea.js +166 -0
  85. package/dist/components/sula-textarea.js.map +1 -0
  86. package/dist/components/sula-textfield.d.ts +11 -0
  87. package/dist/components/sula-textfield.js +171 -0
  88. package/dist/components/sula-textfield.js.map +1 -0
  89. package/dist/esm/{index-9bf8f892.js → index-aa1c5f36.js} +126 -6
  90. package/dist/esm/index-aa1c5f36.js.map +1 -0
  91. package/dist/esm/loader.js +3 -3
  92. package/dist/esm/{sula-avatar_3.entry.js → sula-avatar_9.entry.js} +647 -8
  93. package/dist/esm/sula-avatar_9.entry.js.map +1 -0
  94. package/dist/esm/webcomponents.js +3 -3
  95. package/dist/types/components/sula-avatar/sula-avatar.stories.d.ts +0 -1
  96. package/dist/types/components/sula-badge/model/sula-badge.model.d.ts +19 -0
  97. package/dist/types/components/sula-badge/sula-badge.d.ts +33 -0
  98. package/dist/types/components/sula-badge/sula-badge.stories.d.ts +65 -0
  99. package/dist/types/components/sula-button/sula-button.stories.d.ts +2 -0
  100. package/dist/types/components/sula-checkbox/model/sula-checkbox.model.d.ts +4 -0
  101. package/dist/types/components/sula-checkbox/sula-checkbox.d.ts +42 -0
  102. package/dist/types/components/sula-checkbox/sula-checkbox.stories.d.ts +73 -0
  103. package/dist/types/components/sula-icon/sula-icon.stories.d.ts +5 -2
  104. package/dist/types/components/sula-switch/model/sula-switch.model.d.ts +4 -0
  105. package/dist/types/components/sula-switch/sula-switch.d.ts +41 -0
  106. package/dist/types/components/sula-switch/sula-switch.stories.d.ts +72 -0
  107. package/dist/types/components/sula-tag/model/sula-tag.model.d.ts +23 -0
  108. package/dist/types/components/sula-tag/sula-tag.d.ts +33 -0
  109. package/dist/types/components/sula-tag/sula-tag.stories.d.ts +82 -0
  110. package/dist/types/components/sula-textarea/model/sula-textarea.model.d.ts +4 -0
  111. package/dist/types/components/sula-textarea/sula-textarea.d.ts +65 -0
  112. package/dist/types/components/sula-textarea/sula-textarea.stories.d.ts +98 -0
  113. package/dist/types/components/sula-textfield/model/sula-textfield.model.d.ts +8 -0
  114. package/dist/types/components/sula-textfield/sula-textfield.d.ts +74 -0
  115. package/dist/types/components/sula-textfield/sula-textfield.stories.d.ts +108 -0
  116. package/dist/types/components.d.ts +510 -0
  117. package/dist/webcomponents/{p-82d7a024.entry.js → p-1c8457aa.entry.js} +917 -64
  118. package/dist/webcomponents/p-1c8457aa.entry.js.map +1 -0
  119. package/dist/webcomponents/{p-cca32e44.js → p-5a36af0f.js} +343 -220
  120. package/dist/webcomponents/p-5a36af0f.js.map +1 -0
  121. package/dist/webcomponents/webcomponents.esm.js +68 -13
  122. package/dist/webcomponents/webcomponents.esm.js.map +1 -1
  123. package/package.json +21 -13
  124. package/readme.md +36 -18
  125. package/dist/cjs/index-7973b779.js.map +0 -1
  126. package/dist/cjs/sula-avatar_3.cjs.entry.js.map +0 -1
  127. package/dist/components/p-d3ba6302.js.map +0 -1
  128. package/dist/esm/index-9bf8f892.js.map +0 -1
  129. package/dist/esm/sula-avatar_3.entry.js.map +0 -1
  130. package/dist/webcomponents/p-82d7a024.entry.js.map +0 -1
  131. package/dist/webcomponents/p-cca32e44.js.map +0 -1
@@ -0,0 +1,171 @@
1
+ import { p as proxyCustomElement, H, d as createEvent, h, c as Host } from './p-881c6b35.js';
2
+ import { d as defineCustomElement$2 } from './p-2d5f97d1.js';
3
+
4
+ var SulaTextfieldType;
5
+ (function (SulaTextfieldType) {
6
+ SulaTextfieldType["Text"] = "text";
7
+ SulaTextfieldType["Password"] = "password";
8
+ })(SulaTextfieldType || (SulaTextfieldType = {}));
9
+ var SulaTextfieldStatus;
10
+ (function (SulaTextfieldStatus) {
11
+ SulaTextfieldStatus["Default"] = "default";
12
+ SulaTextfieldStatus["Error"] = "error";
13
+ })(SulaTextfieldStatus || (SulaTextfieldStatus = {}));
14
+
15
+ const sulaTextfieldCss = "*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.outline{outline-style:solid}:host{display:block}.button-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}.button-error{outline:2px solid var(--color-feedback-error)!important;outline-offset:2px!important}.from-down{animation:from-down .2s ease-in-out}.from-up{animation:from-up .2s ease-in-out}@keyframes from-down{0%{opacity:0;transform:translateY(75%)}to{opacity:1;transform:translateY(0)}}@keyframes from-up{0%{opacity:0;transform:translateY(-75%)}to{opacity:1;transform:translateY(0)}}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#02361a;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#500202;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#683f08;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#691e07;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#6a3b01;--color-gray-50:#fff;--color-gray-100:#f4f4f4;--color-gray-200:#e6e6e6;--color-gray-300:#c3c3c3;--color-gray-400:#b9b9b9;--color-gray-500:#949494;--color-gray-600:#737373;--color-gray-700:#5c5c5c;--color-gray-800:#323232;--color-gray-900:#292929;--color-gray-950:#141414;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#0a2e61;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:#14141405;--color-black-opacity-100:#1414141a;--color-black-opacity-200:#14141426;--color-black-opacity-300:#14141445;--color-black-opacity-400:#1414145c;--color-black-opacity-500:#14141480;--color-black-opacity-600:#1414148c;--color-black-opacity-700:#141414a3;--color-black-opacity-800:#141414ba;--color-black-opacity-900:#141414cc;--color-black-opacity-950:#141414e8;--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f4f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#323232;--color-text-secondary:#5c5c5c;--color-text-disabled:#949494;--color-text-link:#1355b4;--color-states-empty-bg-hover:#1414141a;--color-states-empty-bg-pressed:#14141426;--color-states-bg-disabled:#14141405;--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e6e6e6;--color-states-negative-pressed:#c3c3c3;--color-icon-primary:#5c5c5c;--color-icon-secondary:#fff;--color-icon-disabled:#b9b9b9;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f4f4f4;--color-neutral-neutral-3:#b9b9b9;--color-neutral-neutral-4:#949494;--color-neutral-neutral-5:#737373;--color-neutral-neutral-6:#5c5c5c;--color-neutral-neutral-7:#323232;--color-neutral-neutral-8:#292929;--color-negative-negative-1:#fff;--color-negative-negative-2:#323232;--color-opacity-body:#fffc;--color-opacity-on-body:#14141405;--color-opacity-overlay:#1414148c;--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949494;--color-line-general-strong:#c3c3c3;--color-line-general:#e6e6e6}.static{position:static}.mt-4{margin-top:.25rem}.flex{display:flex}.hidden{display:none}.h-\\[72px\\]{height:72px}.w-full{width:100%}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded-sm{border-radius:.75rem}.border{border-width:1px}.border-line-general{border-color:var(--color-line-general)}.border-line-input{border-color:var(--color-line-input)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-body{background-color:var(--color-surface-body)}.bg-transparent{background-color:transparent}.px-16{padding-left:1rem;padding-right:1rem}.pr-12{padding-right:.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-feedback-error{color:var(--color-feedback-error)}.text-icon-disabled{color:var(--color-icon-disabled)}.text-icon-primary{color:var(--color-icon-primary)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.caret-brand-primary{caret-color:var(--color-brand-primary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}";
16
+ const SulaTextfieldStyle0 = sulaTextfieldCss;
17
+
18
+ const SulaTextfield$1 = /*@__PURE__*/ proxyCustomElement(class SulaTextfield extends H {
19
+ constructor() {
20
+ super();
21
+ this.__registerHost();
22
+ this.__attachShadow();
23
+ this.valueChanged = createEvent(this, "valueChanged", 7);
24
+ this.focusedOn = createEvent(this, "focusedOn", 7);
25
+ this.focusedOut = createEvent(this, "focusedOut", 7);
26
+ /**
27
+ * The textfield type
28
+ */
29
+ this.type = SulaTextfieldType.Text;
30
+ /**
31
+ * The textfield status
32
+ */
33
+ this.status = SulaTextfieldStatus.Default;
34
+ this.inputIsOpen = false;
35
+ this.textValue = '';
36
+ this.showPassword = false;
37
+ this.inputIsFocused = false;
38
+ this.handleInputClick = () => {
39
+ this.toggleOptions(true);
40
+ };
41
+ this.handleInputChanges = (event) => {
42
+ const newValue = event.target.value;
43
+ this.textValue = newValue;
44
+ this.valueChanged.emit(newValue);
45
+ };
46
+ this.handleFocus = () => {
47
+ if (this.disabled)
48
+ return;
49
+ this.toggleOptions(true);
50
+ this.inputElement.focus();
51
+ };
52
+ this.handleBlur = () => {
53
+ this.toggleOptions(false);
54
+ this.focusedOut.emit();
55
+ this.inputIsFocused = false;
56
+ };
57
+ this.handleInputFocus = () => {
58
+ this.focusedOn.emit();
59
+ this.inputIsFocused = true;
60
+ };
61
+ this.handleIconClick = (event) => {
62
+ if (this.type === SulaTextfieldType.Password) {
63
+ event.stopPropagation();
64
+ this.handlePasswordIconClicked();
65
+ }
66
+ };
67
+ }
68
+ handleClick(event) {
69
+ if (!this.node)
70
+ return;
71
+ const clickInside = this.node.contains(event.target);
72
+ if (!clickInside) {
73
+ this.toggleOptions(false);
74
+ this.focusedOut.emit();
75
+ this.inputIsFocused = false;
76
+ }
77
+ }
78
+ componentWillLoad() {
79
+ if (this.value && this.value.trim().length > 0) {
80
+ this.textValue = this.value;
81
+ this.inputIsOpen = true;
82
+ }
83
+ }
84
+ componentDidLoad() {
85
+ if (this.textValue && this.textValue.trim().length > 0) {
86
+ this.changeElementsStyle();
87
+ }
88
+ }
89
+ toggleOptions(inputIsOpen) {
90
+ if ((this.inputIsOpen && this.textValue && this.textValue.length > 0) || this.disabled)
91
+ return;
92
+ this.inputIsOpen = inputIsOpen;
93
+ this.changeElementsStyle();
94
+ this.inputElement.focus();
95
+ }
96
+ changeElementsStyle() {
97
+ this.inputContainer.style.display = this.inputIsOpen ? 'flex' : 'none';
98
+ this.labelElement.style.display = this.inputIsOpen ? 'none' : 'block';
99
+ if (!this.inputIsOpen) {
100
+ this.labelElement.classList.add('from-up');
101
+ }
102
+ }
103
+ handlePasswordIconClicked() {
104
+ const cursorPosition = this.inputElement.selectionStart;
105
+ const inputValue = this.inputElement.value;
106
+ const inputType = this.showPassword ? SulaTextfieldType.Password : SulaTextfieldType.Text;
107
+ this.inputElement.setAttribute('type', inputType);
108
+ this.showPassword = !this.showPassword;
109
+ setTimeout(() => {
110
+ this.inputElement.value = inputValue;
111
+ this.inputElement.setSelectionRange(cursorPosition, cursorPosition);
112
+ }, 0);
113
+ }
114
+ getInputIcon() {
115
+ if (this.type === SulaTextfieldType.Password) {
116
+ return this.showPassword ? 'ph ph-eye' : 'ph ph-eye-slash';
117
+ }
118
+ return this.icon;
119
+ }
120
+ render() {
121
+ return (h(Host, { key: '7861723c4c9a71e02a642cc856978432f1ed408e', ref: node => (this.node = node) }, h("div", { key: 'bc52f29a24273991355aa8b168f4e0740391e582' }, h("div", { key: '69fe9a5ffad527e0667fd47c8afa53b8dfd1f999', id: "button-container", class: {
122
+ 'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,
123
+ 'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,
124
+ 'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,
125
+ 'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,
126
+ 'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
127
+ 'bg-surface-body border-line-input cursor-pointer': !this.disabled,
128
+ }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h("div", { key: '8590a7a30d6f8887fa6e32305ecdd7a446abe690', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, h("label", { key: '6c93818aa3b4d0dbc487b45b6cf1935fe38669fe', class: "font-bold text-sm text-text-primary from-down" }, this.label), h("input", { key: 'e24e3743fb2aa481eaa20034b60b94e932396b24', type: this.type, ref: node => (this.inputElement = node), placeholder: this.placeholder, class: "outline-none text-base text-text-primary bg-transparent", onInput: this.handleInputChanges, onFocus: this.handleInputFocus, value: this.value }))), h("div", { key: '5c4542212763798121f13b7fcd1039ceaea3f2d3', id: "textfield-label", class: { 'text-base flex items-center': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled }, ref: node => (this.labelElement = node) }, this.label), (!!this.icon || this.type === SulaTextfieldType.Password) && (h("div", { key: 'faa4e5e74277dec53ed4665885c18f56b4f4b487', class: "flex items-center justify-center", onClick: this.handleIconClick }, h("sula-icon", { key: '5c189458c9994fc2a849d9ff1720044f070be2b1', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (h("div", { key: 'a79c6661890b9fe306329de28d8471b9b051e78e', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: 'c7f7cba7ec6cb4e1492d9ae0cae3368325aaa5a4', id: "textfield-help-text", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.helpText)), this.maxLength && (h("div", { key: 'b50537b15c8f565b02b0eceac9a061e250a7bd10', id: "max-length-container", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.textValue ? this.textValue.length : 0, "/", this.maxLength)))))));
129
+ }
130
+ static get style() { return SulaTextfieldStyle0; }
131
+ }, [1, "sula-textfield", {
132
+ "value": [1025],
133
+ "type": [1],
134
+ "status": [1025],
135
+ "label": [1],
136
+ "placeholder": [1],
137
+ "disabled": [1028],
138
+ "helpText": [1, "help-text"],
139
+ "maxLength": [2, "max-length"],
140
+ "icon": [1],
141
+ "inputIsOpen": [32],
142
+ "textValue": [32],
143
+ "showPassword": [32],
144
+ "inputIsFocused": [32]
145
+ }, [[4, "click", "handleClick"]]]);
146
+ function defineCustomElement$1() {
147
+ if (typeof customElements === "undefined") {
148
+ return;
149
+ }
150
+ const components = ["sula-textfield", "sula-icon"];
151
+ components.forEach(tagName => { switch (tagName) {
152
+ case "sula-textfield":
153
+ if (!customElements.get(tagName)) {
154
+ customElements.define(tagName, SulaTextfield$1);
155
+ }
156
+ break;
157
+ case "sula-icon":
158
+ if (!customElements.get(tagName)) {
159
+ defineCustomElement$2();
160
+ }
161
+ break;
162
+ } });
163
+ }
164
+ defineCustomElement$1();
165
+
166
+ const SulaTextfield = SulaTextfield$1;
167
+ const defineCustomElement = defineCustomElement$1;
168
+
169
+ export { SulaTextfield, defineCustomElement };
170
+
171
+ //# sourceMappingURL=sula-textfield.js.map
@@ -0,0 +1 @@
1
+ {"file":"sula-textfield.js","mappings":";;;AAAA,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,0CAAqB,CAAA;AACvB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,sCAAe,CAAA;AACjB,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB;;ACL/B,MAAM,gBAAgB,GAAG,8yUAA8yU,CAAC;AACx0U,4BAAe,gBAAgB;;MCOlBA,eAAa;IAL1B;;;;;;;;;;QAeU,SAAI,GAAsB,iBAAiB,CAAC,IAAI,CAAC;;;;QAKhC,WAAM,GAAwB,mBAAmB,CAAC,OAAO,CAAC;QAmDnF,gBAAW,GAAG,KAAK,CAAC;QAGpB,cAAS,GAAW,EAA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EAAE,YAAY,IAAI,CAAC,QAAQ,GAAG,oBAAoB,GAAG,mBAAmB,EAAE,GAAI,CAC3H,CACP,CACG,EAEL,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,QAAQ,KAClD,4DAAK,KAAK,EAAC,sDAAsD,IAC9D,IAAI,CAAC,QAAQ,KACZ,4DACE,EAAE,EAAC,qBAAqB,EACxB,KAAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,KAAK,EAAE,IAE5I,IAAI,CAAC,QAAQ,CACV,CACP,EACA,IAAI,CAAC,SAAS,KACb,4DACE,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,KAAK,EAAE,IAE5I,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,OAAG,IAAI,CAAC,SAAS,CACxD,CACP,CACG,CACP,CACG,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SulaTextfield"],"sources":["src/components/sula-textfield/model/sula-textfield.model.ts","src/components/sula-textfield/sula-textfield.scss?tag=sula-textfield&encapsulation=shadow","src/components/sula-textfield/sula-textfield.tsx"],"sourcesContent":["export enum SulaTextfieldType {\n Text = 'text',\n Password = 'password',\n}\n\nexport enum SulaTextfieldStatus {\n Default = 'default',\n Error = 'error',\n}\n",":host {\n display: block;\n}\n\n.button-focus {\n outline: 2px solid var(--color-feedback-informational) !important;\n outline-offset: 2px !important;\n}\n\n.button-error {\n outline: 2px solid var(--color-feedback-error) !important;\n outline-offset: 2px !important;\n}\n\n.from-down {\n animation: from-down 0.2s ease-in-out;\n}\n\n.from-up {\n animation: from-up 0.2s ease-in-out;\n}\n\n@keyframes from-down {\n from {\n transform: translateY(75%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n\n@keyframes from-up {\n from {\n transform: translateY(-75%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n","import { Component, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core';\nimport { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\n\n@Component({\n tag: 'sula-textfield',\n styleUrl: 'sula-textfield.scss',\n shadow: true,\n})\nexport class SulaTextfield {\n /**\n * Value for the input.\n */\n @Prop({ mutable: true })\n value?: string;\n\n /**\n * The textfield type\n */\n @Prop() type: SulaTextfieldType = SulaTextfieldType.Text;\n\n /**\n * The textfield status\n */\n @Prop({ mutable: true }) status: SulaTextfieldStatus = SulaTextfieldStatus.Default;\n\n /**\n * The textfield label\n */\n @Prop() label: string;\n\n /**\n * The textfield placeholder\n */\n @Prop() placeholder: string;\n\n /**\n * The textfield is disabled\n */\n @Prop({ mutable: true }) disabled: boolean;\n\n /**\n * The help text for textfield\n */\n @Prop() helpText?: string;\n\n /**\n * The textfield max length\n */\n @Prop() maxLength?: number;\n\n /**\n * The textfield icon\n */\n @Prop() icon?: string;\n\n /**\n * Event emitted when input value changes.\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Event emitted when input is focused.\n */\n @Event()\n focusedOn: EventEmitter<void>;\n\n /**\n * Event emitted when input is focused out.\n */\n @Event()\n focusedOut: EventEmitter<void>;\n\n @State()\n inputIsOpen = false;\n\n @State()\n textValue: string = '';\n\n @State()\n showPassword = false;\n\n @State()\n inputIsFocused = false;\n\n inputContainer: HTMLDivElement;\n inputElement: HTMLInputElement;\n labelElement: HTMLDivElement;\n\n node?: HTMLElement;\n\n @Listen('click', { target: 'document' })\n handleClick(event: Event) {\n if (!this.node) return;\n\n const clickInside = this.node.contains(event.target as Node);\n\n if (!clickInside) {\n this.toggleOptions(false);\n this.focusedOut.emit();\n this.inputIsFocused = false;\n }\n }\n\n componentWillLoad() {\n if (this.value && this.value.trim().length > 0) {\n this.textValue = this.value;\n this.inputIsOpen = true;\n }\n }\n\n componentDidLoad() {\n if (this.textValue && this.textValue.trim().length > 0) {\n this.changeElementsStyle();\n }\n }\n\n handleInputClick = () => {\n this.toggleOptions(true);\n };\n\n toggleOptions(inputIsOpen: boolean) {\n if ((this.inputIsOpen && this.textValue && this.textValue.length > 0) || this.disabled) return;\n\n this.inputIsOpen = inputIsOpen;\n this.changeElementsStyle();\n this.inputElement.focus();\n }\n\n changeElementsStyle() {\n this.inputContainer.style.display = this.inputIsOpen ? 'flex' : 'none';\n this.labelElement.style.display = this.inputIsOpen ? 'none' : 'block';\n if (!this.inputIsOpen) {\n this.labelElement.classList.add('from-up');\n }\n }\n\n handleInputChanges = (event: InputEvent) => {\n const newValue = (event.target as HTMLInputElement).value;\n this.textValue = newValue;\n\n this.valueChanged.emit(newValue);\n };\n\n handleFocus = () => {\n if (this.disabled) return;\n this.toggleOptions(true);\n this.inputElement.focus();\n };\n\n handleBlur = () => {\n this.toggleOptions(false);\n\n this.focusedOut.emit();\n this.inputIsFocused = false;\n };\n\n handleInputFocus = () => {\n this.focusedOn.emit();\n this.inputIsFocused = true;\n };\n\n handleIconClick = (event: MouseEvent) => {\n if (this.type === SulaTextfieldType.Password) {\n event.stopPropagation();\n this.handlePasswordIconClicked();\n }\n };\n\n handlePasswordIconClicked() {\n const cursorPosition = this.inputElement.selectionStart;\n const inputValue = this.inputElement.value;\n const inputType = this.showPassword ? SulaTextfieldType.Password : SulaTextfieldType.Text;\n\n this.inputElement.setAttribute('type', inputType);\n this.showPassword = !this.showPassword;\n\n setTimeout(() => {\n this.inputElement.value = inputValue;\n\n this.inputElement.setSelectionRange(cursorPosition, cursorPosition);\n }, 0);\n }\n\n getInputIcon() {\n if (this.type === SulaTextfieldType.Password) {\n return this.showPassword ? 'ph ph-eye' : 'ph ph-eye-slash';\n }\n\n return this.icon;\n }\n\n render() {\n return (\n <Host ref={node => (this.node = node)}>\n <div>\n <div\n id=\"button-container\"\n class={{\n 'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,\n 'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,\n 'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,\n 'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,\n 'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,\n 'bg-surface-body border-line-input cursor-pointer': !this.disabled,\n }}\n tabIndex={0}\n onFocus={this.handleFocus}\n onClick={this.handleInputClick}\n >\n {!this.disabled && (\n <div class={{ 'hidden flex-col w-full': true, 'pr-12': !!this.icon }} ref={node => (this.inputContainer = node)}>\n <label class=\"font-bold text-sm text-text-primary from-down\">{this.label}</label>\n <input\n type={this.type}\n ref={node => (this.inputElement = node)}\n placeholder={this.placeholder}\n class=\"outline-none text-base text-text-primary bg-transparent\"\n onInput={this.handleInputChanges}\n onFocus={this.handleInputFocus}\n value={this.value}\n />\n </div>\n )}\n\n <div\n id=\"textfield-label\"\n class={{ 'text-base flex items-center': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled }}\n ref={node => (this.labelElement = node)}\n >\n {this.label}\n </div>\n\n {(!!this.icon || this.type === SulaTextfieldType.Password) && (\n <div class=\"flex items-center justify-center\" onClick={this.handleIconClick}>\n <sula-icon icon={this.getInputIcon()} customClass={`text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}`} />\n </div>\n )}\n </div>\n\n {(this.helpText || this.maxLength) && !this.disabled && (\n <div class=\"flex justify-between items-center px-16 mt-4 text-sm\">\n {this.helpText && (\n <div\n id=\"textfield-help-text\"\n class={{ 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error }}\n >\n {this.helpText}\n </div>\n )}\n {this.maxLength && (\n <div\n id=\"max-length-container\"\n class={{ 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error }}\n >\n {this.textValue ? this.textValue.length : 0}/{this.maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,5 +1,5 @@
1
1
  const NAMESPACE = 'webcomponents';
2
- const BUILD = /* webcomponents */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: true, isDev: false, isTesting: false, lazyLoad: true, lifecycle: false, lifecycleDOMEvents: true, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: false, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
2
+ const BUILD = /* webcomponents */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: true, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: true, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: false };
3
3
 
4
4
  /*
5
5
  Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
@@ -82,6 +82,22 @@ var plt = {
82
82
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
83
83
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
84
84
  };
85
+ var supportsListenerOptions = /* @__PURE__ */ (() => {
86
+ let supportsListenerOptions2 = false;
87
+ try {
88
+ doc.addEventListener(
89
+ "e",
90
+ null,
91
+ Object.defineProperty({}, "passive", {
92
+ get() {
93
+ supportsListenerOptions2 = true;
94
+ }
95
+ })
96
+ );
97
+ } catch (e) {
98
+ }
99
+ return supportsListenerOptions2;
100
+ })();
85
101
  var promiseResolve = (v) => Promise.resolve(v);
86
102
  var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
87
103
  try {
@@ -268,6 +284,9 @@ var parsePropertyValue = (propValue, propType) => {
268
284
  if (propType & 4 /* Boolean */) {
269
285
  return propValue === "false" ? false : propValue === "" || !!propValue;
270
286
  }
287
+ if (propType & 2 /* Number */) {
288
+ return parseFloat(propValue);
289
+ }
271
290
  if (propType & 1 /* String */) {
272
291
  return String(propValue);
273
292
  }
@@ -401,7 +420,32 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
401
420
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
402
421
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
403
422
  }
404
- } else if (memberName === "key") ; else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
423
+ } else if (memberName === "style") {
424
+ {
425
+ for (const prop in oldValue) {
426
+ if (!newValue || newValue[prop] == null) {
427
+ if (prop.includes("-")) {
428
+ elm.style.removeProperty(prop);
429
+ } else {
430
+ elm.style[prop] = "";
431
+ }
432
+ }
433
+ }
434
+ }
435
+ for (const prop in newValue) {
436
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
437
+ if (prop.includes("-")) {
438
+ elm.style.setProperty(prop, newValue[prop]);
439
+ } else {
440
+ elm.style[prop] = newValue[prop];
441
+ }
442
+ }
443
+ }
444
+ } else if (memberName === "key") ; else if (memberName === "ref") {
445
+ if (newValue) {
446
+ newValue(elm);
447
+ }
448
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
405
449
  if (memberName[2] === "-") {
406
450
  memberName = memberName.slice(3);
407
451
  } else if (isMemberInElement(win, ln)) {
@@ -555,6 +599,7 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
555
599
  const vnode = vnodes[index];
556
600
  if (vnode) {
557
601
  const elm = vnode.$elm$;
602
+ nullifyVNodeRefs(vnode);
558
603
  if (elm) {
559
604
  elm.remove();
560
605
  }
@@ -661,10 +706,11 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
661
706
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
662
707
  const oldChildren = oldVNode.$children$;
663
708
  const newChildren = newVNode2.$children$;
709
+ const tag = newVNode2.$tag$;
664
710
  const text = newVNode2.$text$;
665
711
  if (text === null) {
666
712
  {
667
- {
713
+ if (tag === "slot" && !useNativeShadowDom) ; else {
668
714
  updateElement(oldVNode, newVNode2, isSvgMode);
669
715
  }
670
716
  }
@@ -685,6 +731,12 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
685
731
  elm.data = text;
686
732
  }
687
733
  };
734
+ var nullifyVNodeRefs = (vNode) => {
735
+ {
736
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
737
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
738
+ }
739
+ };
688
740
  var insertBefore = (parent, newNode, reference) => {
689
741
  {
690
742
  return parent == null ? void 0 : parent.insertBefore(newNode, reference);
@@ -747,7 +799,17 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
747
799
  }
748
800
  let maybePromise;
749
801
  if (isInitialLoad) {
802
+ {
803
+ hostRef.$flags$ |= 256 /* isListenReady */;
804
+ if (hostRef.$queuedListeners$) {
805
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
806
+ hostRef.$queuedListeners$ = void 0;
807
+ }
808
+ }
750
809
  emitLifecycleEvent(elm, "componentWillLoad");
810
+ {
811
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
812
+ }
751
813
  } else {
752
814
  emitLifecycleEvent(elm, "componentWillUpdate");
753
815
  }
@@ -815,6 +877,7 @@ var postUpdateComponent = (hostRef) => {
815
877
  const tagName = hostRef.$cmpMeta$.$tagName$;
816
878
  const elm = hostRef.$hostElement$;
817
879
  const endPostUpdate = createTime("postUpdate", tagName);
880
+ const instance = hostRef.$lazyInstance$ ;
818
881
  const ancestorComponent = hostRef.$ancestorComponent$;
819
882
  emitLifecycleEvent(elm, "componentDidRender");
820
883
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
@@ -822,6 +885,9 @@ var postUpdateComponent = (hostRef) => {
822
885
  {
823
886
  addHydratedFlag(elm);
824
887
  }
888
+ {
889
+ safeCall(instance, "componentDidLoad", void 0, elm);
890
+ }
825
891
  emitLifecycleEvent(elm, "componentDidLoad");
826
892
  endPostUpdate();
827
893
  {
@@ -848,6 +914,16 @@ var postUpdateComponent = (hostRef) => {
848
914
  var appDidLoad = (who) => {
849
915
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
850
916
  };
917
+ var safeCall = (instance, method, arg, elm) => {
918
+ if (instance && instance[method]) {
919
+ try {
920
+ return instance[method](arg);
921
+ } catch (e) {
922
+ consoleError(e, elm);
923
+ }
924
+ }
925
+ return void 0;
926
+ };
851
927
  var emitLifecycleEvent = (elm, lifecycleName) => {
852
928
  {
853
929
  emitEvent(elm, "stencil_" + lifecycleName, {
@@ -1104,6 +1180,7 @@ var connectedCallback = (elm) => {
1104
1180
  initializeComponent(elm, hostRef, cmpMeta);
1105
1181
  }
1106
1182
  } else {
1183
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1107
1184
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1108
1185
  hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1109
1186
  }
@@ -1116,6 +1193,12 @@ var disconnectInstance = (instance, elm) => {
1116
1193
  var disconnectedCallback = async (elm) => {
1117
1194
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1118
1195
  const hostRef = getHostRef(elm);
1196
+ {
1197
+ if (hostRef.$rmListeners$) {
1198
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1199
+ hostRef.$rmListeners$ = void 0;
1200
+ }
1201
+ }
1119
1202
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1120
1203
  hostRef.$onReadyPromise$.then(() => disconnectInstance());
1121
1204
  }
@@ -1158,6 +1241,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1158
1241
  {
1159
1242
  cmpMeta.$members$ = compactMeta[2];
1160
1243
  }
1244
+ {
1245
+ cmpMeta.$listeners$ = compactMeta[3];
1246
+ }
1161
1247
  const tagName = cmpMeta.$tagName$;
1162
1248
  const HostElement = class extends HTMLElement {
1163
1249
  // StencilLazyHost
@@ -1183,9 +1269,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1183
1269
  }
1184
1270
  }
1185
1271
  connectedCallback() {
1186
- getHostRef(this);
1272
+ const hostRef = getHostRef(this);
1187
1273
  if (!this.hasRegisteredEventListeners) {
1188
1274
  this.hasRegisteredEventListeners = true;
1275
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
1189
1276
  }
1190
1277
  if (appLoadFallback) {
1191
1278
  clearTimeout(appLoadFallback);
@@ -1251,10 +1338,43 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1251
1338
  }
1252
1339
  endBootstrap();
1253
1340
  };
1341
+ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1342
+ if (listeners) {
1343
+ listeners.map(([flags, name, method]) => {
1344
+ const target = getHostListenerTarget(elm, flags) ;
1345
+ const handler = hostListenerProxy(hostRef, method);
1346
+ const opts = hostListenerOpts(flags);
1347
+ plt.ael(target, name, handler, opts);
1348
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1349
+ });
1350
+ }
1351
+ };
1352
+ var hostListenerProxy = (hostRef, methodName) => (ev) => {
1353
+ var _a;
1354
+ try {
1355
+ {
1356
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
1357
+ (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
1358
+ } else {
1359
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1360
+ }
1361
+ }
1362
+ } catch (e) {
1363
+ consoleError(e, hostRef.$hostElement$);
1364
+ }
1365
+ };
1366
+ var getHostListenerTarget = (elm, flags) => {
1367
+ if (flags & 4 /* TargetDocument */) return doc;
1368
+ return elm;
1369
+ };
1370
+ var hostListenerOpts = (flags) => supportsListenerOptions ? {
1371
+ passive: (flags & 1 /* Passive */) !== 0,
1372
+ capture: (flags & 2 /* Capture */) !== 0
1373
+ } : (flags & 2 /* Capture */) !== 0;
1254
1374
 
1255
1375
  // src/runtime/nonce.ts
1256
1376
  var setNonce = (nonce) => plt.$nonce$ = nonce;
1257
1377
 
1258
- export { Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r, setNonce as s };
1378
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1259
1379
 
1260
- //# sourceMappingURL=index-9bf8f892.js.map
1380
+ //# sourceMappingURL=index-aa1c5f36.js.map