@ukic/canary-web-components 3.0.0-canary.13 → 3.0.0-canary.14

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 (222) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/{helpers-0e4c4fdd.js → helpers-32016c21.js} +21 -3
  3. package/dist/cjs/helpers-32016c21.js.map +1 -0
  4. package/dist/cjs/ic-button_3.cjs.entry.js +59 -1
  5. package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
  6. package/dist/cjs/ic-card-horizontal.cjs.entry.js +1 -1
  7. package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +1 -1
  8. package/dist/cjs/ic-data-table.cjs.entry.js +2 -2
  9. package/dist/cjs/ic-data-table.cjs.entry.js.map +1 -1
  10. package/dist/cjs/ic-date-input.cjs.entry.js +52 -19
  11. package/dist/cjs/ic-date-input.cjs.entry.js.map +1 -1
  12. package/dist/cjs/ic-date-picker.cjs.entry.js +15 -10
  13. package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -1
  14. package/dist/cjs/ic-empty-state_2.cjs.entry.js +1 -1
  15. package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
  16. package/dist/cjs/ic-menu-item.cjs.entry.js.map +1 -1
  17. package/dist/cjs/ic-navigation-group.cjs.entry.js +6 -3
  18. package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
  19. package/dist/cjs/ic-navigation-menu.cjs.entry.js +36 -22
  20. package/dist/cjs/ic-navigation-menu.cjs.entry.js.map +1 -1
  21. package/dist/cjs/ic-pagination_4.cjs.entry.js +13 -10
  22. package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
  23. package/dist/cjs/ic-popover-menu.cjs.entry.js +5 -4
  24. package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
  25. package/dist/cjs/ic-side-navigation.cjs.entry.js +7 -4
  26. package/dist/cjs/ic-side-navigation.cjs.entry.js.map +1 -1
  27. package/dist/cjs/ic-skip-link.cjs.entry.js +10 -9
  28. package/dist/cjs/ic-skip-link.cjs.entry.js.map +1 -1
  29. package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
  30. package/dist/cjs/ic-status-tag.cjs.entry.js.map +1 -1
  31. package/dist/cjs/ic-step.cjs.entry.js +13 -12
  32. package/dist/cjs/ic-step.cjs.entry.js.map +1 -1
  33. package/dist/cjs/ic-toast.cjs.entry.js +3 -3
  34. package/dist/cjs/ic-toast.cjs.entry.js.map +1 -1
  35. package/dist/cjs/ic-tree-item.cjs.entry.js +29 -8
  36. package/dist/cjs/ic-tree-item.cjs.entry.js.map +1 -1
  37. package/dist/cjs/ic-tree-view.cjs.entry.js +113 -12
  38. package/dist/cjs/ic-tree-view.cjs.entry.js.map +1 -1
  39. package/dist/cjs/loader.cjs.js +1 -1
  40. package/dist/collection/components/ic-data-table/ic-data-table.css +3 -2
  41. package/dist/collection/components/ic-date-input/ic-date-input.js +83 -24
  42. package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -1
  43. package/dist/collection/components/ic-date-input/ic-date-input.stories.js +18 -0
  44. package/dist/collection/components/ic-date-input/ic-date-input.stories.js.map +1 -1
  45. package/dist/collection/components/ic-date-picker/ic-date-picker.js +34 -9
  46. package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -1
  47. package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js +9 -1
  48. package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js.map +1 -1
  49. package/dist/collection/components/ic-date-picker/story-data.js +16 -1
  50. package/dist/collection/components/ic-date-picker/story-data.js.map +1 -1
  51. package/dist/collection/components/ic-tree-item/ic-tree-item.js +50 -7
  52. package/dist/collection/components/ic-tree-item/ic-tree-item.js.map +1 -1
  53. package/dist/collection/components/ic-tree-view/ic-tree-view.js +146 -16
  54. package/dist/collection/components/ic-tree-view/ic-tree-view.js.map +1 -1
  55. package/dist/collection/components/ic-tree-view/ic-tree-view.stories.js +384 -12
  56. package/dist/collection/components/ic-tree-view/ic-tree-view.stories.js.map +1 -1
  57. package/dist/collection/components/ic-tree-view/ic-tree-view.types.js +2 -0
  58. package/dist/collection/components/ic-tree-view/ic-tree-view.types.js.map +1 -0
  59. package/dist/collection/utils/helpers.js.map +1 -1
  60. package/dist/components/helpers.js +1 -1
  61. package/dist/components/helpers2.js +19 -3
  62. package/dist/components/helpers2.js.map +1 -1
  63. package/dist/components/ic-button2.js +59 -1
  64. package/dist/components/ic-button2.js.map +1 -1
  65. package/dist/components/ic-data-table.js +1 -1
  66. package/dist/components/ic-data-table.js.map +1 -1
  67. package/dist/components/ic-date-input2.js +58 -21
  68. package/dist/components/ic-date-input2.js.map +1 -1
  69. package/dist/components/ic-date-picker.js +15 -9
  70. package/dist/components/ic-date-picker.js.map +1 -1
  71. package/dist/components/ic-menu-item2.js +1 -1
  72. package/dist/components/ic-menu-item2.js.map +1 -1
  73. package/dist/components/ic-navigation-group.js +6 -3
  74. package/dist/components/ic-navigation-group.js.map +1 -1
  75. package/dist/components/ic-navigation-menu2.js +37 -23
  76. package/dist/components/ic-navigation-menu2.js.map +1 -1
  77. package/dist/components/ic-popover-menu.js +5 -4
  78. package/dist/components/ic-popover-menu.js.map +1 -1
  79. package/dist/components/ic-select2.js +13 -10
  80. package/dist/components/ic-select2.js.map +1 -1
  81. package/dist/components/ic-side-navigation.js +7 -4
  82. package/dist/components/ic-side-navigation.js.map +1 -1
  83. package/dist/components/ic-skip-link.js +10 -9
  84. package/dist/components/ic-skip-link.js.map +1 -1
  85. package/dist/components/ic-status-tag.js +1 -1
  86. package/dist/components/ic-status-tag.js.map +1 -1
  87. package/dist/components/ic-step.js +13 -12
  88. package/dist/components/ic-step.js.map +1 -1
  89. package/dist/components/ic-toast.js +4 -4
  90. package/dist/components/ic-toast.js.map +1 -1
  91. package/dist/components/ic-top-navigation.js +1 -1
  92. package/dist/components/ic-tree-item.js +29 -7
  93. package/dist/components/ic-tree-item.js.map +1 -1
  94. package/dist/components/ic-tree-view.js +119 -14
  95. package/dist/components/ic-tree-view.js.map +1 -1
  96. package/dist/core/core.css +35 -29
  97. package/dist/core/core.esm.js +1 -1
  98. package/dist/core/core.esm.js.map +1 -1
  99. package/dist/core/p-0ad472d0.entry.js +2 -0
  100. package/dist/core/p-0ad472d0.entry.js.map +1 -0
  101. package/dist/core/{p-fde3bbb2.entry.js → p-0c97a53d.entry.js} +2 -2
  102. package/dist/core/p-250bf568.entry.js +2 -0
  103. package/dist/core/p-250bf568.entry.js.map +1 -0
  104. package/dist/core/{p-c6f1e205.entry.js → p-48163a2a.entry.js} +2 -2
  105. package/dist/core/p-48163a2a.entry.js.map +1 -0
  106. package/dist/core/{p-95f2c59a.entry.js → p-4f00aa91.entry.js} +2 -2
  107. package/dist/core/{p-95f2c59a.entry.js.map → p-4f00aa91.entry.js.map} +1 -1
  108. package/dist/core/p-54e01fad.entry.js +2 -0
  109. package/dist/core/p-54e01fad.entry.js.map +1 -0
  110. package/dist/core/p-5d85bd73.entry.js +2 -0
  111. package/dist/core/p-5d85bd73.entry.js.map +1 -0
  112. package/dist/core/p-6040a025.entry.js +2 -0
  113. package/dist/core/p-6040a025.entry.js.map +1 -0
  114. package/dist/core/p-62f7f2bd.entry.js +2 -0
  115. package/dist/core/p-62f7f2bd.entry.js.map +1 -0
  116. package/dist/core/p-72310da8.js +2 -0
  117. package/dist/core/p-72310da8.js.map +1 -0
  118. package/dist/core/p-762a4d7c.entry.js +2 -0
  119. package/dist/core/p-762a4d7c.entry.js.map +1 -0
  120. package/dist/core/p-836d302a.entry.js +2 -0
  121. package/dist/core/p-836d302a.entry.js.map +1 -0
  122. package/dist/core/p-881bb783.entry.js +2 -0
  123. package/dist/core/p-881bb783.entry.js.map +1 -0
  124. package/dist/core/{p-3dc4e128.entry.js → p-895a3eb1.entry.js} +2 -2
  125. package/dist/core/p-9a46b1e5.entry.js +2 -0
  126. package/dist/core/p-9a46b1e5.entry.js.map +1 -0
  127. package/dist/core/{p-67f3bf1a.entry.js → p-a13dc5ba.entry.js} +2 -2
  128. package/dist/core/{p-e86c1c95.entry.js → p-c0687222.entry.js} +2 -2
  129. package/dist/core/p-c0687222.entry.js.map +1 -0
  130. package/dist/core/p-c4f7e479.entry.js +2 -0
  131. package/dist/core/p-c4f7e479.entry.js.map +1 -0
  132. package/dist/core/{p-f6013934.entry.js → p-ef25bb6d.entry.js} +2 -2
  133. package/dist/core/p-ef25bb6d.entry.js.map +1 -0
  134. package/dist/core/p-fb11ce9b.entry.js +2 -0
  135. package/dist/core/p-fb11ce9b.entry.js.map +1 -0
  136. package/dist/esm/core.js +1 -1
  137. package/dist/esm/{helpers-4e38ba2b.js → helpers-5479985d.js} +20 -4
  138. package/dist/esm/helpers-5479985d.js.map +1 -0
  139. package/dist/esm/ic-button_3.entry.js +59 -1
  140. package/dist/esm/ic-button_3.entry.js.map +1 -1
  141. package/dist/esm/ic-card-horizontal.entry.js +1 -1
  142. package/dist/esm/ic-data-table-title-bar.entry.js +1 -1
  143. package/dist/esm/ic-data-table.entry.js +2 -2
  144. package/dist/esm/ic-data-table.entry.js.map +1 -1
  145. package/dist/esm/ic-date-input.entry.js +52 -19
  146. package/dist/esm/ic-date-input.entry.js.map +1 -1
  147. package/dist/esm/ic-date-picker.entry.js +15 -10
  148. package/dist/esm/ic-date-picker.entry.js.map +1 -1
  149. package/dist/esm/ic-empty-state_2.entry.js +1 -1
  150. package/dist/esm/ic-menu-item.entry.js +1 -1
  151. package/dist/esm/ic-menu-item.entry.js.map +1 -1
  152. package/dist/esm/ic-navigation-group.entry.js +6 -3
  153. package/dist/esm/ic-navigation-group.entry.js.map +1 -1
  154. package/dist/esm/ic-navigation-menu.entry.js +37 -23
  155. package/dist/esm/ic-navigation-menu.entry.js.map +1 -1
  156. package/dist/esm/ic-pagination_4.entry.js +13 -10
  157. package/dist/esm/ic-pagination_4.entry.js.map +1 -1
  158. package/dist/esm/ic-popover-menu.entry.js +5 -4
  159. package/dist/esm/ic-popover-menu.entry.js.map +1 -1
  160. package/dist/esm/ic-side-navigation.entry.js +7 -4
  161. package/dist/esm/ic-side-navigation.entry.js.map +1 -1
  162. package/dist/esm/ic-skip-link.entry.js +10 -9
  163. package/dist/esm/ic-skip-link.entry.js.map +1 -1
  164. package/dist/esm/ic-status-tag.entry.js +1 -1
  165. package/dist/esm/ic-status-tag.entry.js.map +1 -1
  166. package/dist/esm/ic-step.entry.js +13 -12
  167. package/dist/esm/ic-step.entry.js.map +1 -1
  168. package/dist/esm/ic-toast.entry.js +3 -3
  169. package/dist/esm/ic-toast.entry.js.map +1 -1
  170. package/dist/esm/ic-tree-item.entry.js +29 -8
  171. package/dist/esm/ic-tree-item.entry.js.map +1 -1
  172. package/dist/esm/ic-tree-view.entry.js +113 -12
  173. package/dist/esm/ic-tree-view.entry.js.map +1 -1
  174. package/dist/esm/loader.js +1 -1
  175. package/dist/types/components/ic-date-input/ic-date-input.d.ts +15 -4
  176. package/dist/types/components/ic-date-input/ic-date-input.stories.d.ts +6 -0
  177. package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +4 -0
  178. package/dist/types/components/ic-date-picker/ic-date-picker.stories.d.ts +8 -0
  179. package/dist/types/components/ic-date-picker/story-data.d.ts +1 -0
  180. package/dist/types/components/ic-tree-item/ic-tree-item.d.ts +6 -0
  181. package/dist/types/components/ic-tree-view/ic-tree-view.d.ts +17 -0
  182. package/dist/types/components/ic-tree-view/ic-tree-view.stories.d.ts +91 -13
  183. package/dist/types/components/ic-tree-view/ic-tree-view.types.d.ts +12 -0
  184. package/dist/types/components.d.ts +39 -6
  185. package/dist/types/utils/helpers.d.ts +2 -2
  186. package/hydrate/index.js +449 -184
  187. package/hydrate/index.mjs +449 -184
  188. package/package.json +3 -3
  189. package/dist/cjs/helpers-0e4c4fdd.js.map +0 -1
  190. package/dist/core/p-44ffa951.entry.js +0 -2
  191. package/dist/core/p-44ffa951.entry.js.map +0 -1
  192. package/dist/core/p-47962514.entry.js +0 -2
  193. package/dist/core/p-47962514.entry.js.map +0 -1
  194. package/dist/core/p-5329e478.entry.js +0 -2
  195. package/dist/core/p-5329e478.entry.js.map +0 -1
  196. package/dist/core/p-5b2a7c1a.entry.js +0 -2
  197. package/dist/core/p-5b2a7c1a.entry.js.map +0 -1
  198. package/dist/core/p-8c4f212a.entry.js +0 -2
  199. package/dist/core/p-8c4f212a.entry.js.map +0 -1
  200. package/dist/core/p-9265efef.entry.js +0 -2
  201. package/dist/core/p-9265efef.entry.js.map +0 -1
  202. package/dist/core/p-a35cdfc3.entry.js +0 -2
  203. package/dist/core/p-a35cdfc3.entry.js.map +0 -1
  204. package/dist/core/p-ac74cdac.entry.js +0 -2
  205. package/dist/core/p-ac74cdac.entry.js.map +0 -1
  206. package/dist/core/p-ad3e543e.entry.js +0 -2
  207. package/dist/core/p-ad3e543e.entry.js.map +0 -1
  208. package/dist/core/p-ae2bae87.entry.js +0 -2
  209. package/dist/core/p-ae2bae87.entry.js.map +0 -1
  210. package/dist/core/p-afde50b8.js +0 -2
  211. package/dist/core/p-afde50b8.js.map +0 -1
  212. package/dist/core/p-b84213d1.entry.js +0 -2
  213. package/dist/core/p-b84213d1.entry.js.map +0 -1
  214. package/dist/core/p-c6f1e205.entry.js.map +0 -1
  215. package/dist/core/p-cd59dc16.entry.js +0 -2
  216. package/dist/core/p-cd59dc16.entry.js.map +0 -1
  217. package/dist/core/p-e86c1c95.entry.js.map +0 -1
  218. package/dist/core/p-f6013934.entry.js.map +0 -1
  219. package/dist/esm/helpers-4e38ba2b.js.map +0 -1
  220. /package/dist/core/{p-fde3bbb2.entry.js.map → p-0c97a53d.entry.js.map} +0 -0
  221. /package/dist/core/{p-3dc4e128.entry.js.map → p-895a3eb1.entry.js.map} +0 -0
  222. /package/dist/core/{p-67f3bf1a.entry.js.map → p-a13dc5ba.entry.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"names":["IC_DEVICE_SIZES","XS","S","M","L","XL","IC_BLOCK_COLOR_COMPONENTS","IC_FIXED_COLOR_COMPONENTS","IC_BLOCK_COLOR_EXCEPTIONS","IcInformationStatus","IcBrandForegroundEnum","IcDateInputMonths","IcShortDayNames","IcDayNames","IcWeekDays","stringEnumToArray","theEnum","arr","Object","values","forEach","val","isNaN","Number","str","push","dynamicDebounce","func","getDelay","timer","args","delay","clearTimeout","setTimeout","renderHiddenInput","always","container","name","value","disabled","undefined","hasShadowDom","inputs","querySelectorAll","inputEls","Array","from","filtered","filter","el","parentElement","input","ownerDocument","createElement","type","classList","add","appendChild","Date","toISOString","getBrandFromContext","brandFromEvent","getRootNode","host","blockColorParent","closest","join","parentTag","tagName","toLowerCase","currentTag","_a","includes","Default","contains","Dark","Light","isEmptyString","trim","length","isPropDefined","prop","deviceSizeMatches","size","window","matchMedia","matches","getCssProperty","cssVar","getComputedStyle","document","documentElement","getPropertyValue","getSlotElements","slot","slotContent","firstElementChild","elements","assignedElements","childNodes","replace","UNDEFINED","isSlotUsed","element","slotName","children","some","child","getAttribute","shadowRoot","attachShadow","getInputHelperTextID","id","getInputValidationTextID","getInputDescribedByText","inputId","helperText","validationText","pxToRem","px","base","parseInt","isNumeric","test","onComponentRequiredPropUndefined","props","component","i","propName","console","error","kebabToCamelCase","kebabCase","individualWords","split","camelCase","substring","toUpperCase","checkResizeObserver","callbackFn","ResizeObserver","getForm","addFormResetListener","form","addEventListener","removeFormResetListener","removeEventListener","removeDisabledFalse","removeAttribute","capitalize","text","charAt","slice","checkSlotInChildMutations","addedNodes","removedNodes","hasSlot","nodeList","node","isArray","addDataToPosition","dataObject","newKeys","newValue","newData","newIndexes","map","key","index","keys","numberOfKeys","j","indexOf","hasDynamicChildSlots","mutationList","slotNames","renderDynamicChildSlots","ref","forceUpdate"],"sources":["src/utils/constants.ts","src/utils/types.ts","src/utils/helpers.ts"],"sourcesContent":["import errorIcon from \"../assets/error-icon.svg\";\nimport infoIcon from \"../assets/info-icon.svg\";\nimport neutralIcon from \"../assets/neutral-icon.svg\";\nimport successIcon from \"../assets/success-icon.svg\";\nimport warningIcon from \"../assets/warning-icon.svg\";\n\n// Global status icons\nexport const VARIANT_ICONS = {\n neutral: {\n icon: neutralIcon,\n ariaLabel: \"Neutral\",\n },\n info: {\n icon: infoIcon,\n ariaLabel: \"For your information\",\n },\n warning: {\n icon: warningIcon,\n ariaLabel: \"Warning\",\n },\n error: {\n icon: errorIcon,\n ariaLabel: \"Error\",\n },\n success: {\n icon: successIcon,\n ariaLabel: \"Success\",\n },\n};\n\n// Global ARIA attributes\nexport const IC_INHERITED_ARIA = [\n \"aria-atomic\",\n \"aria-autocomplete\",\n \"aria-busy\",\n \"aria-controls\",\n \"aria-current\",\n \"aria-describedby\",\n \"aria-description\",\n \"aria-details\",\n \"aria-disabled\",\n \"aria-dropeffect\",\n \"aria-errormessage\",\n \"aria-expanded\",\n \"aria-flowto\",\n \"aria-grabbed\",\n \"aria-haspopup\",\n \"aria-hidden\",\n \"aria-invalid\",\n \"aria-keyshortcuts\",\n \"aria-label\",\n \"aria-labelledby\",\n \"aria-live\",\n \"aria-owns\",\n \"aria-relevant\",\n \"aria-roledescription\",\n];\n\nexport const IC_DEVICE_SIZES = {\n XS: 576,\n S: 768,\n M: 992,\n L: 1200,\n XL: 99999,\n};\n\nexport const IC_BLOCK_COLOR_COMPONENTS = [\n \"ic-hero\",\n \"ic-top-navigation\",\n \"ic-footer\",\n \"ic-side-navigation\",\n \"ic-alert\",\n];\n\nexport const IC_FIXED_COLOR_COMPONENTS = [\"ic-alert\"];\n\nexport interface IcColorExceptions {\n [details: string]: string[];\n}\n\nexport const IC_BLOCK_COLOR_EXCEPTIONS: IcColorExceptions = {\n \"ic-alert\": [\"ic-link\"],\n};\n\n/* Range within which the chosen theme colour would not have a sufficient brightness difference with either of the black or white foreground colours\n * The brightness difference must be greater than 125 to provide good colour visibility\n * Calculated by:\n * - Using the brightness formula for both colours: https://www.w3.org/TR/AERT/#color-contrast\n * - Adding 125 to the brightness of the black foreground colour - RGB(11, 12, 12)\n * - Subtracting 125 from the brightness of the white foreground colour - RGB(255, 255, 255)\n */\nexport const BLACK_MIN_COLOR_BRIGHTNESS = 136.701;\nexport const WHITE_MAX_COLOR_BRIGHTNESS = 130;\n","import {\n IcPaginationLabelTypes,\n IcPaginationTypes,\n IcPaginationAlignmentOptions,\n} from \"../components\";\n\nexport type IcFocusableComponents =\n | HTMLIcBreadcrumbElement\n | HTMLIcButtonElement\n | HTMLIcCardVerticalElement\n | HTMLIcCheckboxElement\n | HTMLIcChipElement\n | HTMLIcLinkElement\n | HTMLIcNavigationButtonElement\n | HTMLIcNavigationGroupElement\n | HTMLIcNavigationItemElement\n | HTMLIcRadioOptionElement\n | HTMLIcSearchBarElement\n | HTMLIcSelectElement\n | HTMLIcSwitchElement\n | HTMLIcTabElement\n | HTMLIcTextFieldElement;\n\nexport type IcStatusVariants =\n | \"neutral\"\n | \"info\"\n | \"warning\"\n | \"error\"\n | \"success\";\n\nexport enum IcInformationStatus {\n Warning = \"warning\",\n Error = \"error\",\n Success = \"success\",\n}\n\nexport type IcSizes = \"medium\" | \"large\" | \"small\";\n\nexport type IcSizesNoLarge = \"medium\" | \"small\";\n\nexport type IcInformationStatusOrEmpty = \"warning\" | \"error\" | \"success\" | \"\";\n\nexport type IcNavType = \"side\" | \"top\" | \"page-header\";\n\n// From: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\nexport type IcAutocompleteTypes =\n | \"on\"\n | \"off\"\n | \"name\"\n | \"honorific-prefix\"\n | \"given-name\"\n | \"additional-name\"\n | \"family-name\"\n | \"honorific-suffix\"\n | \"nickname\"\n | \"email\"\n | \"username\"\n | \"new-password\"\n | \"current-password\"\n | \"one-time-code\"\n | \"organization-title\"\n | \"organization\"\n | \"street-address\"\n | \"address-line1\"\n | \"address-line2\"\n | \"address-line3\"\n | \"address-level4\"\n | \"address-level3\"\n | \"address-level2\"\n | \"address-level1\"\n | \"country\"\n | \"country-name\"\n | \"postal-code\"\n | \"cc-name\"\n | \"cc-given-name\"\n | \"cc-additional-name\"\n | \"cc-family-name\"\n | \"cc-family-name\"\n | \"cc-number\"\n | \"cc-exp\"\n | \"cc-exp-month\"\n | \"cc-exp-year\"\n | \"cc-csc\"\n | \"cc-type\"\n | \"transaction-currency\"\n | \"transaction-amount\"\n | \"language\"\n | \"bday\"\n | \"bday-day\"\n | \"bday-month\"\n | \"bday-year\"\n | \"sex\"\n | \"tel\"\n | \"tel-country-code\"\n | \"tel-national\"\n | \"tel-area-code\"\n | \"tel-local\"\n | \"tel-extension\"\n | \"impp\"\n | \"url\"\n | \"photo\";\n\nexport type IcAlignment = \"left\" | \"center\" | \"full-width\";\n\nexport enum IcBrandForegroundEnum {\n Default = \"default\",\n Dark = \"dark\",\n Light = \"light\",\n}\n\nexport type IcBrandForeground = \"default\" | \"dark\" | \"light\";\n\nexport type IcBrandForegroundNoDefault = \"dark\" | \"light\";\n\nexport type IcBrand = {\n mode: IcBrandForeground;\n color: IcColorRGB;\n};\n\nexport type IcThemeMode = \"dark\" | \"light\" | \"inherit\";\n\nexport type IcAdditionalFieldTypes = \"static\" | \"dynamic\";\n\nexport type IcColorRGB = {\n r: number;\n g: number;\n b: number;\n};\n\nexport type IcColorRGBA = IcColorRGB & {\n a: number;\n};\n\nexport type IcActivationTypes = \"automatic\" | \"manual\";\n\nexport type IcAutocorrectStates = \"on\" | \"off\";\n\nexport type IcNavParentDetails = {\n navType: IcNavType | \"\";\n parent: HTMLElement;\n};\n\nexport type IcTypographyVariants =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"subtitle-large\"\n | \"subtitle-small\"\n | \"body\"\n | \"label\"\n | \"label-uppercase\"\n | \"caption\"\n | \"caption-uppercase\"\n | \"code-large\"\n | \"code-small\"\n | \"code-extra-small\"\n | \"badge\"\n | \"badge-small\";\n\n/**\n * @interface IcMenuOption\n * @field {string} A label field to options. Defaults to \"label\", but can have any custom name.\n * @field {string} A value field to options. Defaults to \"value\", but can have any custom name.\n */\nexport interface IcMenuOption {\n description?: string;\n disabled?: boolean;\n recommended?: boolean;\n children?: IcMenuOption[];\n loading?: boolean;\n timedOut?: boolean;\n [key: string]: any;\n element?: {\n component: any;\n ariaLabel: string;\n };\n icon?: any;\n}\n\nexport type IcSearchMatchPositions = \"start\" | \"anywhere\";\n\nexport interface IcPaginationBarOptions {\n alignment?: IcPaginationAlignmentOptions;\n hideAllFromItemsPerPage?: boolean;\n hideRangeLabel?: boolean;\n itemLabel?: string;\n itemsPerPageOptions?: { label: string; value: string }[];\n monochrome?: boolean;\n pageLabel?: string;\n rangeLabelType?: IcPaginationLabelTypes;\n selectedItemsPerPage?: number;\n setToFirstPageOnPaginationChange?: boolean;\n showGoToPageControl?: boolean;\n showItemsPerPageControl?: boolean;\n theme?: IcThemeMode;\n type?: IcPaginationTypes;\n}\n\nexport type IcCallbackFunctionNoReturn = (...args: unknown[]) => void;\n\nexport type IcDateFormat = \"DD/MM/YYYY\" | \"MM/DD/YYYY\" | \"YYYY/MM/DD\";\n\nexport enum IcDateInputMonths {\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n}\n\nexport enum IcShortDayNames {\n \"Sun\",\n \"Mon\",\n \"Tue\",\n \"Wed\",\n \"Thu\",\n \"Fri\",\n \"Sat\",\n}\n\nexport enum IcDayNames {\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n}\n\nexport enum IcWeekDays {\n Sunday = 0,\n Monday = 1,\n Tuesday = 2,\n Wednesday = 3,\n Thursday = 4,\n Friday = 5,\n Saturday = 6,\n}\n\nexport interface IcValueEventDetail {\n value: string | string[];\n keyPressed?: string;\n}\n","/**\n * To investigate:\n * IcColorRGBA works via @ukic/web-components but IcBrandForeground does not even though they are exported\n * from @ukic/web-components in the same file. Why?\n */\nimport {\n IcCallbackFunctionNoReturn,\n IcInformationStatusOrEmpty,\n IcNavParentDetails,\n IcPropObject,\n IcSearchMatchPositions,\n IcColorRGBA,\n} from \"@ukic/web-components\";\nimport {\n IC_BLOCK_COLOR_COMPONENTS,\n IC_BLOCK_COLOR_EXCEPTIONS,\n IC_FIXED_COLOR_COMPONENTS,\n} from \"./constants\"; // Using @ukic/web-components/dist/types/utils/constants does not work so duplicated constants into canary package\nimport {\n IcMenuOption,\n IcBrandForeground,\n IcBrandForegroundEnum,\n} from \"./types\"; // Using @ukic/web-components/dist/types/utils/types does not work so duplicated constants into canary package\nimport { EventEmitter, forceUpdate } from \"@stencil/core\";\nimport { IcDataTableDataType } from \"../interface\";\n\nconst DARK_MODE_THRESHOLD = 133.3505;\n\n/**\n * converts an enum of strings into an array of strings\n */\nexport const stringEnumToArray = (\n theEnum: Record<string, string | number>\n): string[] => {\n const arr: string[] = [];\n Object.values(theEnum).forEach((val) => {\n if (isNaN(Number(val))) {\n const str = val as string;\n arr.push(str);\n }\n });\n return arr;\n};\n\n/**\n * Used to inherit global attributes set on the host. Called in componentWillLoad and assigned\n * to a variable that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\nexport const inheritAttributes = (\n element: HTMLElement,\n attributes: string[] = []\n): { [key: string]: string } => {\n const attributeObject: { [key: string]: string } = {};\n\n attributes.forEach((attr) => {\n if (element.hasAttribute(attr)) {\n const value = element.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = value;\n }\n element.removeAttribute(attr);\n }\n });\n\n return attributeObject;\n};\n\nexport const debounceEvent = (\n event: EventEmitter,\n wait: number\n): EventEmitter => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const original = (event as any)._original || event;\n return {\n _original: event,\n emit: debounce(original.emit.bind(original), wait),\n } as EventEmitter;\n};\n\nexport const debounce = (\n func: (...args: unknown[]) => void,\n wait = 0\n): unknown => {\n let timer: ReturnType<typeof setTimeout>;\n return (...args: unknown[]) => {\n clearTimeout(timer);\n timer = setTimeout(func, wait, ...args);\n };\n};\n\nexport const dynamicDebounce = (\n func: (...args: unknown[]) => void,\n getDelay: () => number\n): unknown => {\n let timer: ReturnType<typeof setTimeout>;\n return (...args: unknown[]) => {\n const delay = getDelay();\n clearTimeout(timer);\n timer = setTimeout(func, delay, ...args);\n };\n};\n\n/**\n * This method is used to add a hidden input to a host element that contains\n * a Shadow DOM. It does not add the input inside of the Shadow root which\n * allows it to be picked up inside of forms. It should contain the same\n * values as the host element.\n *\n * @param always Add a hidden input even if the container does not use Shadow\n * @param container The element where the input will be added\n * @param name The name of the input\n * @param value The value of the input\n * @param disabled If true, the input is disabled\n */\nexport const renderHiddenInput = (\n always: boolean,\n container: HTMLElement,\n name: string,\n value: string | Date | undefined | null,\n disabled: boolean\n): void => {\n if (name !== undefined && (always || hasShadowDom(container))) {\n const inputs = container.querySelectorAll(\"input.ic-input\");\n const inputEls = Array.from(inputs);\n const filtered = inputEls.filter((el) => container === el.parentElement);\n\n let input = filtered[0] as HTMLInputElement;\n if (input === null || input === undefined) {\n input = container.ownerDocument.createElement(\"input\");\n input.type = \"hidden\";\n input.classList.add(\"ic-input\");\n container.appendChild(input);\n }\n input.disabled = disabled;\n input.name = name;\n\n if (value instanceof Date) {\n input.value = value ? value.toISOString() : null;\n } else {\n input.value = value || \"\";\n }\n }\n};\n\nexport const removeHiddenInput = (container: HTMLElement): void => {\n const inputs = container.querySelectorAll(\"input.ic-input\");\n const inputEls = Array.from(inputs);\n const filtered = inputEls.filter((el) => container === el.parentElement);\n const input = filtered[0] as HTMLInputElement;\n input?.remove();\n};\n\n/**\n * This method helps to understand the context in which a component exists,\n * to assist with choosing appropriate foreground colours to use. For example,\n * this method will help you use the 'white' version of a button if it's within\n * a block colour element using white foreground text.\n *\n * This only works for components/elements passed via <slot> and not if they\n * are part of an IC component.\n *\n * \"\"\n * @returns IcBrandForeground depending on the context\n */\nexport const getBrandFromContext = (\n el: Element,\n brandFromEvent: IcBrandForeground = null\n): IcBrandForeground => {\n const parentElement =\n el.parentElement || (<ShadowRoot>el.getRootNode()).host.parentElement;\n const blockColorParent = parentElement.closest(\n IC_BLOCK_COLOR_COMPONENTS.join(\",\")\n );\n\n // If within a block color component\n if (blockColorParent !== null) {\n const parentTag = blockColorParent.tagName.toLowerCase();\n const currentTag = el.tagName.toLowerCase();\n\n if (IC_BLOCK_COLOR_EXCEPTIONS[parentTag]?.includes(currentTag)) {\n return IcBrandForegroundEnum.Default;\n } else if (\n brandFromEvent !== null &&\n !IC_FIXED_COLOR_COMPONENTS.includes(parentTag)\n ) {\n return brandFromEvent;\n } else if (\n blockColorParent.classList.contains(IcBrandForegroundEnum.Dark)\n ) {\n return IcBrandForegroundEnum.Dark;\n }\n\n return IcBrandForegroundEnum.Light;\n }\n\n return IcBrandForegroundEnum.Default;\n};\n\n/**\n * Will create a button within the lightDOM which interacts with the parent form.\n * This is required as buttons within the shadowDOM will not invoke a submit or reset\n *\n * @param form - parent form element which contains shadowDom button\n * @param button - shadowDOM button\n */\nexport const handleHiddenFormButtonClick = (\n form: HTMLFormElement,\n button: HTMLIcButtonElement | HTMLButtonElement\n): void => {\n const hiddenFormButton = document.createElement(\"button\");\n\n hiddenFormButton.setAttribute(\"type\", button.type);\n hiddenFormButton.style.display = \"none\";\n\n form.appendChild(hiddenFormButton);\n\n hiddenFormButton.click();\n hiddenFormButton.remove();\n};\n\nexport const isEmptyString = (value: string): boolean =>\n value ? value.trim().length === 0 : true;\n\n// A helper function that checks if a prop has been defined\nexport const isPropDefined = (prop: string): string | null =>\n prop !== undefined ? prop : null;\n\nexport const deviceSizeMatches = (size: number): boolean =>\n window.matchMedia(`(max-width: ${size}px)`).matches;\n\nexport const getCurrentDeviceSize = (): number => {\n if (deviceSizeMatches(DEVICE_SIZES.S)) {\n return DEVICE_SIZES.S;\n }\n if (deviceSizeMatches(DEVICE_SIZES.M)) {\n return DEVICE_SIZES.M;\n }\n if (deviceSizeMatches(DEVICE_SIZES.L)) {\n return DEVICE_SIZES.L;\n }\n if (deviceSizeMatches(DEVICE_SIZES.XL)) {\n return DEVICE_SIZES.XL;\n }\n //fallback needed as all of above get initialised to 0 in jest tests\n return DEVICE_SIZES.UNDEFINED;\n};\n\nexport const getCssProperty = (cssVar: string): string =>\n getComputedStyle(document.documentElement).getPropertyValue(cssVar);\n\n/**\n * Returns the brightness of the brand colour, calculated by using the brand RGB CSS values by:\n * - Multiplying each RGB value by a set number: https://www.w3.org/TR/AERT/#color-contrast\n * - Adding them together and dividing by 1000\n * This is a similar calculation to its CSS counterpart: \"--ic-brand-text-color\"\n * @returns number representing the brightness of the brand colour\n */\nexport const getBrandColorBrightness = (): number => {\n const r = getCssProperty(\"--ic-brand-color-primary-r\");\n const g = getCssProperty(\"--ic-brand-color-primary-g\");\n const b = getCssProperty(\"--ic-brand-color-primary-b\");\n return (parseInt(r) * 299 + parseInt(g) * 587 + parseInt(b) * 114) / 1000;\n};\n\n/**\n * Returns if dark or light foreground colors should be used for color contrast reasons\n * @returns \"dark\" or \"light\"\n */\nexport const getBrandForegroundAppearance = (): IcBrandForeground =>\n getBrandColorBrightness() > DARK_MODE_THRESHOLD\n ? IcBrandForegroundEnum.Dark\n : IcBrandForegroundEnum.Light;\n\nexport const getSlot = (element: HTMLElement, name: string): Element | null => {\n if (element && element.querySelector) {\n return element.querySelector(`[slot=\"${name}\"]`);\n }\n return null;\n};\n\nexport const slotHasContent = (element: HTMLElement, name: string): boolean =>\n getSlot(element, name) !== null;\n\nexport const getSlotContent = (\n element: HTMLElement,\n name: string\n): Element[] | NodeListOf<ChildNode> | null => {\n const slot = getSlot(element, name);\n if (slot) {\n return getSlotElements(slot);\n }\n\n return null;\n};\n\nexport const getSlotElements = (\n slot: Element\n): NodeListOf<ChildNode> | Element[] => {\n const slotContent = slot.firstElementChild as HTMLSlotElement;\n\n if (slotContent !== null) {\n const elements = slotContent.assignedElements\n ? slotContent.assignedElements()\n : slotContent.childNodes;\n return elements.length ? elements : slot.tagName ? [slot] : null;\n } else {\n //check for single element\n return slot === null ? null : [slot];\n }\n};\n\nexport const getNavItemParentDetails = (\n el: HTMLElement\n): IcNavParentDetails => {\n let navType: IcNavParentDetails = { navType: \"\", parent: null };\n switch (getParentElementType(el)) {\n case \"IC-NAVIGATION-GROUP\":\n navType = getNavItemParentDetails(el.parentElement);\n break;\n case \"IC-TOP-NAVIGATION\":\n navType = { navType: \"top\", parent: getParentElement(el) };\n break;\n case \"IC-SIDE-NAVIGATION\":\n navType = { navType: \"side\", parent: getParentElement(el) };\n break;\n case \"IC-PAGE-HEADER\":\n navType = { navType: \"page-header\", parent: null };\n break;\n }\n return navType;\n};\n\nexport const DEVICE_SIZES = {\n XS: Number(getCssProperty(\"--ic-breakpoint-xs\").replace(\"px\", \"\")), // 0\n S: Number(getCssProperty(\"--ic-breakpoint-sm\").replace(\"px\", \"\")), // 576\n M: Number(getCssProperty(\"--ic-breakpoint-md\").replace(\"px\", \"\")), // 768\n L: Number(getCssProperty(\"--ic-breakpoint-lg\").replace(\"px\", \"\")), // 992\n XL: Number(getCssProperty(\"--ic-breakpoint-xl\").replace(\"px\", \"\")), // 1200\n UNDEFINED: 1200,\n};\n\nexport const isSlotUsed = (element: HTMLElement, slotName: string): boolean =>\n Array.from(element.children).some(\n (child) => child.getAttribute(\"slot\") === slotName\n );\n\n// added as a common method to allow detection of gatsby hydration issue, where (camelCase) props are initially undefined & then update\n// with a value. Allows a callback function to be executed when this is the case\nexport const onComponentPropUndefinedChange = (\n oldValue: string | undefined,\n newValue: string | undefined,\n callback: IcCallbackFunctionNoReturn\n): void => {\n if (oldValue === undefined && newValue !== oldValue) {\n callback();\n }\n};\n\nexport const hasShadowDom = (el: HTMLElement): boolean =>\n !!el.shadowRoot && !!el.attachShadow;\n\nexport const getInputHelperTextID = (id: string): string => id + \"-helper-text\";\n\nexport const getInputValidationTextID = (id: string): string =>\n id + \"-validation-text\";\n\nexport const getInputDescribedByText = (\n inputId: string,\n helperText: boolean,\n validationText: boolean\n): string =>\n `${helperText ? getInputHelperTextID(inputId) : \"\"} ${\n validationText ? getInputValidationTextID(inputId) : \"\"\n }`.trim();\n\nexport const isMobileOrTablet = (): boolean =>\n \"maxTouchPoints\" in navigator ? navigator.maxTouchPoints > 0 : false;\n\n/**\n * Extracts the label using the value from an object. Requires the object to have a label and value property.\n * @param value - value from object\n * @param options - list of menu items\n * @returns - label corresponding to value\n */\nexport const getLabelFromValue = (\n value: string,\n options: IcMenuOption[],\n valueField = \"value\",\n labelField = \"label\"\n): string | undefined => {\n const ungroupedOptions: IcMenuOption[] = [];\n if (options.length > 0 && options.map) {\n options.map((option) => {\n if (option.children) {\n option.children.map((option: IcMenuOption) =>\n ungroupedOptions.push(option)\n );\n } else {\n ungroupedOptions.push(option);\n }\n });\n const matchingValue = ungroupedOptions.find(\n (option) => option[valueField] === value\n );\n if (matchingValue !== undefined) return matchingValue[labelField];\n }\n\n return undefined;\n};\n\n/**\n * Filters the options based on the search string.\n * @param options - array of options\n * @param includeDescriptions - determines whether option descriptions are included when filtering options\n * @param searchString - string used to filter the options\n * @param position - whether the search string matches the start of or anywhere in the options\n * @returns filtered array of options\n */\nexport const getFilteredMenuOptions = (\n options: IcMenuOption[],\n includeDescriptions: boolean,\n searchString: string,\n position: IcSearchMatchPositions,\n labelField = \"label\"\n): IcMenuOption[] =>\n options.filter((option) => {\n const label: string = option[labelField].toLowerCase();\n const description = option.description?.toLowerCase();\n const lowerSearchString = searchString.toLowerCase();\n\n return position === \"anywhere\"\n ? includeDescriptions\n ? label.includes(lowerSearchString) ||\n description?.includes(lowerSearchString)\n : label.includes(lowerSearchString)\n : includeDescriptions\n ? label.startsWith(lowerSearchString) ||\n description?.startsWith(lowerSearchString)\n : label.startsWith(lowerSearchString);\n });\n\n/**\n * Gets count of options where only group title \"parent\" options have been removed.\n * Disabled options are included in the count.\n * @param options - array of options\n * @returns number of options not including group titles\n */\nexport const getOptionsWithoutGroupTitlesCount = (\n options: IcMenuOption[]\n): number => {\n const optionsWithoutGroupTitles: IcMenuOption[] = [];\n\n if (options.length > 0 && options.map) {\n options.map((option) => {\n if (option.children) {\n option.children.map((option) => optionsWithoutGroupTitles.push(option));\n } else {\n optionsWithoutGroupTitles.push(option);\n }\n });\n }\n\n return optionsWithoutGroupTitles.length;\n};\n\nconst hex2dec = function (v: string) {\n return parseInt(v, 16);\n};\n\nexport const hexToRgba = (hex: string): IcColorRGBA => {\n let c;\n if (hex.length === 4) {\n c = hex.replace(\"#\", \"\").split(\"\");\n return {\n r: hex2dec(c[0] + c[0]),\n g: hex2dec(c[1] + c[1]),\n b: hex2dec(c[2] + c[2]),\n a: 1,\n };\n } else {\n return {\n r: hex2dec(hex.slice(1, 3)),\n g: hex2dec(hex.slice(3, 5)),\n b: hex2dec(hex.slice(5)),\n a: 1,\n };\n }\n};\n\nexport const rgbaStrToObj = (rgbaStr: string): IcColorRGBA => {\n const fourthChar = rgbaStr.slice(3, 4);\n let colorRGBA: IcColorRGBA;\n if (fourthChar.toLowerCase() === \"a\") {\n colorRGBA = { r: null, g: null, b: null, a: null };\n const rgba = rgbaStr\n .substring(5, rgbaStr.length - 1)\n .replace(/ /g, \"\")\n .split(\",\");\n colorRGBA.r = Number(rgba[0]);\n colorRGBA.g = Number(rgba[1]);\n colorRGBA.b = Number(rgba[2]);\n colorRGBA.a = Number(rgba[3]);\n } else {\n colorRGBA = { r: null, g: null, b: null, a: 1 };\n const rgb = rgbaStr\n .substring(4, rgbaStr.length - 1)\n .replace(/ /g, \"\")\n .split(\",\");\n colorRGBA.r = Number(rgb[0]);\n colorRGBA.g = Number(rgb[1]);\n colorRGBA.b = Number(rgb[2]);\n }\n\n return colorRGBA;\n};\n\nexport const elementOverflowsX = (element: HTMLElement): boolean =>\n element.scrollWidth > element.clientWidth;\n\n/**\n *\n * @param child - The child element\n * @returns string\n */\nexport const getParentElementType = (child: HTMLElement): string =>\n child.parentElement.tagName;\n\nexport const getParentElement = (child: HTMLElement): HTMLElement =>\n child.parentElement;\n\nexport const hasClassificationBanner = (): boolean =>\n !!document.querySelector(\"ic-classification-banner:not([inline='true'])\");\n\nexport const pxToRem = (px: string, base = 16): string =>\n `${(1 / base) * parseInt(px)}rem`;\n\nexport const isNumeric = (value: string): boolean => {\n return /^-?\\d+$/.test(value);\n};\n\nexport const hasValidationStatus = (\n status: IcInformationStatusOrEmpty,\n disabled: boolean\n): boolean => {\n return status !== \"\" && !disabled;\n};\n\nexport const onComponentRequiredPropUndefined = (\n props: IcPropObject[],\n component: string\n): void => {\n for (let i = 0; i < props.length; i++) {\n const { prop, propName } = props[i];\n if (prop === null || prop === undefined) {\n console.error(\n `No ${propName} specified for ${component} component - prop '${propName}' (web components) / '${kebabToCamelCase(\n propName\n )}' (react) required`\n );\n }\n }\n};\n\nexport const kebabToCamelCase = (kebabCase: string): string => {\n kebabCase = kebabCase.toLowerCase();\n const individualWords: string[] = kebabCase.split(\"-\");\n let camelCase = individualWords[0];\n for (let i = 1; i < individualWords.length; i++) {\n camelCase +=\n individualWords[i].substring(0, 1).toUpperCase() +\n individualWords[i].substring(1);\n }\n return camelCase;\n};\n\nexport const checkResizeObserver = (\n callbackFn: IcCallbackFunctionNoReturn\n): void => {\n if (\n typeof window !== \"undefined\" &&\n typeof window.ResizeObserver !== \"undefined\"\n ) {\n callbackFn();\n }\n};\n\nexport const getForm = (el: HTMLElement): HTMLFormElement => el.closest(\"FORM\");\n\nexport const addFormResetListener = (\n el: HTMLElement,\n callbackFn: IcCallbackFunctionNoReturn\n): void => {\n const form = getForm(el);\n if (form !== null) {\n form.addEventListener(\"reset\", callbackFn);\n }\n};\n\nexport const removeFormResetListener = (\n el: HTMLElement,\n callbackFn: IcCallbackFunctionNoReturn\n): void => {\n const form = getForm(el);\n if (form !== null) {\n form.removeEventListener(\"reset\", callbackFn);\n }\n};\n\nexport const removeDisabledFalse = (\n disabled: boolean,\n element: HTMLElement\n): void => {\n if (!disabled) {\n element.removeAttribute(\"disabled\");\n }\n};\n\nexport const isMacDevice = (): boolean => {\n return window.navigator.userAgent.toUpperCase().indexOf(\"MAC\") >= 0;\n};\n\nexport async function waitForHydration(): Promise<boolean> {\n const elements = document.getElementsByTagName(\"*\");\n\n for (let i = 0; i < elements.length; i++) {\n if (elements[i].tagName.startsWith(\"IC-\")) {\n if (elements[i].classList.contains(\"hydrated\")) {\n return true;\n }\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nexport const capitalize = (text: string): string => {\n return text.charAt(0).toUpperCase() + text.slice(1);\n};\n\nexport const checkSlotInChildMutations = (\n addedNodes: NodeList,\n removedNodes: NodeList,\n slotName: string | string[]\n): boolean => {\n const hasSlot = (nodeList: NodeList) =>\n Array.from(nodeList).some((node) =>\n Array.isArray(slotName)\n ? slotName.some((name) => (node as Element).slot === name)\n : (node as Element).slot === slotName\n );\n return hasSlot(addedNodes) || hasSlot(removedNodes);\n};\n\nexport const addDataToPosition = (\n dataObject: IcDataTableDataType,\n newKeys: { key: string; index: number }[],\n newValue: unknown\n): IcDataTableDataType => {\n const newData: IcDataTableDataType = {};\n const newIndexes = newKeys.map((key) => key.index);\n\n const keys = Object.keys(dataObject);\n const values = Object.values(dataObject);\n const numberOfKeys = keys.length + newIndexes.length;\n\n for (let i = 0, j = 0; i < numberOfKeys; i++) {\n if (newIndexes.includes(i)) {\n newData[newKeys[newIndexes.indexOf(i)].key] = newValue;\n continue;\n }\n newData[keys[j]] = values[j];\n j++;\n }\n return newData;\n};\n\n/*\n * Checks if the component is slotted in its relevant 'group' component\n * @param component - the component to check\n */\nexport const isSlottedInGroup = (component: any): boolean => {\n const parent = component?.tagName + \"-GROUP\";\n return component?.parentElement?.tagName === parent;\n};\n\nexport const hasDynamicChildSlots = (\n mutationList: MutationRecord[],\n slotNames: string | string[]\n) =>\n mutationList.some(({ type, addedNodes, removedNodes }) =>\n type === \"childList\"\n ? checkSlotInChildMutations(addedNodes, removedNodes, slotNames)\n : false\n );\n\nexport const renderDynamicChildSlots = (\n mutationList: MutationRecord[],\n slotNames: string | string[],\n ref: any\n): void => {\n if (hasDynamicChildSlots(mutationList, slotNames)) {\n forceUpdate(ref);\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AEnC,OAAOoD,EAAQF,IAAeE,EAAQD,EAAa,E,MAGxCK,EAAoB,CAC/BC,EACAC,EACAC,KAEA,MAAMC,EAA+B,GACrC,MAAMC,EAAaH,EAAQI,KAAKC,GAAQA,EAAIC,QAE5C,MAAMC,EAAOvJ,OAAOuJ,KAAKR,GACzB,MAAM9I,EAASD,OAAOC,OAAO8I,GAC7B,MAAMS,EAAeD,EAAK1F,OAASsF,EAAWtF,OAE9C,IAAK,IAAIgD,EAAI,EAAG4C,EAAI,EAAG5C,EAAI2C,EAAc3C,IAAK,CAC5C,GAAIsC,EAAW7F,SAASuD,GAAI,CAC1BqC,EAAQF,EAAQG,EAAWO,QAAQ7C,IAAIwC,KAAOJ,EAC9C,Q,CAEFC,EAAQK,EAAKE,IAAMxJ,EAAOwJ,GAC1BA,G,CAEF,OAAOP,CAAO,EAYT,MAAMS,EAAuB,CAClCC,EACAC,IAEAD,EAAapE,MAAK,EAAGpD,OAAMoG,aAAYC,kBACrCrG,IAAS,YACLmG,EAA0BC,EAAYC,EAAcoB,GACpD,Q,MAGKC,EAA0B,CACrCF,EACAC,EACAE,KAEA,GAAIJ,EAAqBC,EAAcC,GAAY,CACjDG,EAAYD,E","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as t,c as i,h as s,H as e,g as a}from"./p-00135a74.js";import{b as h,s as r,t as n,r as o,u as l,v as c,o as d,w as u,x as f,y as b,k as p,l as v}from"./p-afde50b8.js";import{b as m,i as w,j as y,s as g,h as k,k as x}from"./p-33dd24eb.js";const $=`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.8327 5.34199L14.6577 4.16699L9.99935 8.82533L5.34102 4.16699L4.16602 5.34199L8.82435 10.0003L4.16602 14.6587L5.34102 15.8337L9.99935 11.1753L14.6577 15.8337L15.8327 14.6587L11.1743 10.0003L15.8327 5.34199Z" fill="currentColor"/>\n</svg>\n`;const D=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">\n <path d="M16.6667 2.50004H15.8334V0.833374H14.1667V2.50004H5.83342V0.833374H4.16675V2.50004H3.33341C2.41675 2.50004 1.66675 3.25004 1.66675 4.16671V17.5C1.66675 18.4167 2.41675 19.1667 3.33341 19.1667H16.6667C17.5834 19.1667 18.3334 18.4167 18.3334 17.5V4.16671C18.3334 3.25004 17.5834 2.50004 16.6667 2.50004ZM16.6667 17.5H3.33341V6.66671H16.6667V17.5Z" fill="currentColor"/>\n</svg>`;const Y='/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0;}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px;}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}:host{--ic-input-label-helpertext-padding:var(--ic-space-xxs);--input-bg-color:var(--ic-date-input-bg);--ic-input-label-text-color:var(--ic-date-input-label);--ic-input-label-helper-text-color:var(--ic-date-input-subtitle);--border-color:var(--ic-date-input-border);--border-color-disabled:var(--ic-date-input-border-disabled);--border-color-hover:var(--ic-date-input-border-default-hover);--border-color-pressed:var(--ic-date-input-border-default-pressed);--border-error-color:var(--ic-date-input-border-error);--border-error-color-hover:var(--ic-date-input-border-error-hover);--border-error-color-pressed:var(--ic-date-input-border-error-pressed);--border-success-color:var(--ic-date-input-border-success);--border-success-color-hover:var(--ic-date-input-border-success-hover);--border-success-color-pressed:var(--ic-date-input-border-success-pressed);--border-warning-color:var(--ic-date-input-border-warning);--border-warning-color-hover:var(--ic-date-input-border-warning-hover);--border-warning-color-pressed:var(--ic-date-input-border-warning-pressed)}:host(.ic-date-input-disabled){--ic-input-label-text-color:var(--ic-date-input-label-disabled);--ic-input-label-helper-text-color:var(--ic-date-input-subtitle-disabled)}input{border:0;height:100%;padding:0;outline:none;background:none;-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield;color:var(--ic-date-input-text-filled);caret-color:var(--ic-date-input-typing-cursor)}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}input:-webkit-autofill{box-shadow:0 0 0 var(--ic-space-sm) var(--ic-color-background-primary) inset;-webkit-text-fill-color:var(--ic-date-input-text-filled) !important}input::-moz-placeholder{color:var(--ic-date-input-text-placeholder)}input::placeholder{color:var(--ic-date-input-text-placeholder)}ic-input-component-container{cursor:text}ic-input-component-container .focus-indicator{padding:var(--ic-space-xxxs) var(--ic-space-xs);align-items:center}.date-inputs{color:var(--ic-date-input-text-placeholder)}.day-input{width:1.438rem}.month-input{width:1.813rem}.year-input,.year-input.fit-to-value{width:2.313rem}.fit-to-value{width:1.25rem}.sr-only{position:absolute;left:-9999px}.input-container{width:100%;display:flex;justify-content:space-between;align-items:center;position:relative}.action-buttons{display:flex;align-items:center}.show-calendar-button-wrapper{display:flex;justify-content:center;align-items:center}.clear-button,.calendar-button{border-radius:var(--ic-border-radius);transition:box-shadow var(--ic-easing-transition),\n border-radius var(--ic-easing-transition);margin:0}.clear-button.hidden{display:none}.clear-button:focus,.calendar-button:focus,.clear-button:active,.calendar-button:active{background-color:var(--ic-color-focus-inner) !important;box-shadow:inset 0 0 0 0.125rem var(--ic-color-focus-outer) !important;border-radius:0.25rem}.calendar-button:focus,.calendar-button:active{--ic-button-tertiary-text-active:var(--ic-atoms-input-clear-button-focus);--ic-button-tertiary-text-hover-active:var(\n --ic-atoms-input-clear-button-focus\n );--ic-button-tertiary-text-pressed-active:var(\n --ic-atoms-input-clear-button-focus\n )}.clear-button:focus,.calendar-button:focus,.clear-button:active *,.calendar-button:active *{fill:var(--ic-atoms-input-clear-button-focus)}.clear-button svg{color:var(--ic-date-input-clear-icon)}.clear-button:focus svg{color:var(--ic-atoms-input-clear-button-focus)}.divider{margin:0 var(--ic-space-xxs);width:var(--ic-space-1px);background-color:var(--ic-atoms-input-divider);border-radius:var(--ic-space-1px)}.divider.small{height:var(--ic-space-md)}.divider.medium{height:calc(var(--ic-space-sm) + var(--ic-space-xs))}.divider.large{height:var(--ic-space-lg)}ic-input-validation{--ic-input-validation-status-text-color:var(--ic-date-input-status-text);--ic-input-validation-error:var(--ic-date-input-icon-error);--ic-input-validation-warning-icon-color:var(--ic-date-input-icon-warning);--ic-input-validation-success-icon-color:var(--ic-date-input-icon-success)}';const z=Y;let M=0;const H=class{constructor(e){t(this,e);this.calendarButtonClicked=i(this,"calendarButtonClicked",7);this.icBlur=i(this,"icBlur",7);this.icChange=i(this,"icChange",7);this.icFocus=i(this,"icFocus",7);this.ARIA_INVALID="aria-invalid";this.ARIA_LABEL="aria-label";this.ARIA_LABELLED_BY="aria-labelledby";this.EVENT_OBJECT_STRING="[object Event]";this.FIT_TO_VALUE="fit-to-value";this.initialValue=this.value;this.INPUT_EVENT_OBJECT_STRING="[object InputEvent]";this.inputsInOrder=[];this.isAfterMax=false;this.isBeforeMin=false;this.isDateSetFromKeyboardEvent=false;this.isDisabledDate=false;this.isValidDay=true;this.isValidMonth=true;this.isValidDate=true;this.isZuluTime=false;this.KEYBOARD_EVENT_OBJECT_STRING="[object KeyboardEvent]";this.MAX_DAY=31;this.MAX_MONTH=12;this.previousEmittedDate=undefined;this.previousSelectedDate=null;this.selectedDate=null;this.day="";this.month="";this.year="";this.calendarFocused=false;this.clearButtonFocused=false;this.removeLabelledBy=false;this.dateFormat="DD/MM/YYYY";this.disabled=false;this.disableDays=[];this.disableDaysMessage="The date you have selected is on a day of the week that is not allowed. Please select another date.";this.disableFuture=false;this.disableFutureMessage="Dates in the future are not allowed. Please select a date in the past.";this.disablePast=false;this.disablePastMessage="Dates in the past are not allowed. Please select a date in the future.";this.hideHelperText=false;this.hideLabel=false;this.inputId=`ic-date-input-${M++}`;this.invalidDateMessage="Please enter a valid date.";this.max="";this.min="";this.name=this.inputId;this.required=false;this.showCalendarButton=false;this.showClearButton=true;this.size="medium";this.theme="inherit";this.value="";this.validationStatus="";this.validationText="";this.setInputPasteValue=(t,i)=>{const s=t;s.value=i;s.classList.add(this.FIT_TO_VALUE)};this.checkSingleCopiedValueIsValid=(t,i)=>{let s=false;const e=Number(i);switch(t){case this.dayInputEl:s=e>=1&&e<=this.MAX_DAY;break;case this.monthInputEl:s=e>=1&&e<=this.MAX_MONTH;break;case this.yearInputEl:s=true;break;default:s=false;break}return s};this.isKeyboardOrEvent=t=>Object.prototype.toString.call(t)===this.EVENT_OBJECT_STRING||Object.prototype.toString.call(t)===this.KEYBOARD_EVENT_OBJECT_STRING;this.setDateValidity=()=>{if(!h(this.day)){this.isValidDay=+this.day>this.MAX_DAY?false:true}else{this.isValidDay=true}if(!h(this.month)){this.isValidMonth=+this.month>this.MAX_MONTH?false:true}else{this.isValidMonth=true}};this.handleInput=t=>{const i=t;const s=t.target;if(s!==this.yearInputEl){if(i.inputType!=="deleteContentBackward"&&!this.preventAutoFormatting){if(s.value.length===1&&(s===this.dayInputEl&&+s.value>=4||s===this.monthInputEl&&+s.value>=2)&&+s.value<=9){this.setInputValue(s);this.notifyScreenReader(s,t);this.moveToNextInput(s)}if(s.value.length===2){if(+s.value===0){s.value="01"}this.setInputValue(s);this.setPreventInput(s,true);this.notifyScreenReader(s,t);this.moveToNextInput(s)}else{this.setPreventInput(s,false)}}else if(this.preventAutoFormatting){if(s.value.length===2&&!this.isKeyboardOrEvent(t)){this.setInputValue(s);this.setPreventInput(s,true);this.moveToNextInput(s)}else{this.setInputValue(s)}}if(s.value.length!==2){this.setPreventInput(s,false)}}else{if(s.value.length===4){this.setInputValue(s);if(Object.prototype.toString.call(t)!==this.EVENT_OBJECT_STRING){this.moveToNextInput(s)}this.setPreventInput(s,true)}else{this.setInputValue(s,true);this.setPreventInput(s,false)}}this.setFitToValueStyling(s);if(s.value.length===0){this.setInputValue(s,true);this.setValidationMessage()}this.notifyScreenReader(s,t)};this.handleKeyDown=(t,i)=>{var s;const e=t.target;const a=(s=t.key)===null||s===void 0?void 0:s.toLowerCase();const h=/-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;if(!h.test(a)&&!((t.ctrlKey||t.metaKey)&&(a==="v"||a==="c"))){t.preventDefault()}switch(a){case"/":case"-":case".":t.preventDefault();this.setPasteInvalidText();this.moveToNextInput(e);break;case"arrowright":case"arrowleft":t.preventDefault();this.handleLeftRightArrowKeyPress(e,a);break;case"arrowup":case"arrowdown":this.preventAutoFormatting=true;this.handleUpDownArrowKeyPress(e,t);break;case"backspace":if(e.value.length===0){t.preventDefault();this.moveToPreviousInput(e)}break}this.preventInput(t,i);this.isDateSetFromKeyboardEvent=true};this.handleFocus=t=>{const i=t.target;i.select()};this.handleBlur=t=>{const i=t.target;this.setPasteInvalidText();this.autocompleteInput(i)};this.handleLeftRightArrowKeyPress=(t,i)=>{if(i==="arrowright"){this.moveToNextInput(t)}else{this.moveToPreviousInput(t)}this.setPasteInvalidText()};this.notifyScreenReaderSelectedDate=()=>{const t=r(p);const i=r(v);this.selectedDateInfoEl.textContent=`Selected date: ${t[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${i[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`};this.handleUpDownArrowKeyPress=(t,i)=>{const s=t===this.yearInputEl?0:1;let e;switch(t){case this.dayInputEl:e=this.MAX_DAY;break;case this.monthInputEl:e=this.MAX_MONTH;break;case this.yearInputEl:e=9999}if(t===null||t===void 0?void 0:t.value){if(i.key==="ArrowUp"){if(+t.value===e){i.preventDefault();t.value=`0${s}`}else{t.value=+t.value+1<10?`0${+t.value+1}`:(+t.value+1).toString()}this.notifyScreenReader(t,i)}if(i.key==="ArrowDown"){if(+t.value===s){i.preventDefault();t.value=e.toString()}else{t.value=+t.value-1<10?`0${+t.value-1}`:(+t.value-1).toString()}this.notifyScreenReader(t,i)}}else{if(i.key==="ArrowDown"){i.preventDefault();if(t===this.yearInputEl){t.value=(new Date).getFullYear().toString()}else{t.value=e.toString()}this.notifyScreenReader(t,i)}else if(i.key==="ArrowUp"){i.preventDefault();if(t===this.yearInputEl){t.value=(new Date).getFullYear().toString()}else{t.value=`0${s}`}this.notifyScreenReader(t,i)}}this.setInputValue(t);this.setFitToValueStyling(t)};this.handleDateChange=t=>{if(t||!m(this.selectedDate,this.previousSelectedDate)){if(this.value){this.inputsInOrder.forEach((t=>{t.classList.add(this.FIT_TO_VALUE)}))}if(this.day&&this.month&&this.year&&this.invalidDateText===""){this.setValueAndEmitChange(this.selectedDate);this.notifyScreenReaderSelectedDate()}else if(!(this.selectedDate===null&&this.previousSelectedDate===null)){this.setValueAndEmitChange(null);this.selectedDateInfoEl.textContent=""}this.previousSelectedDate=this.selectedDate;if(!this.isDateSetFromKeyboardEvent){this.updateInputValues(this.day,this.month,this.year)}}};this.slicePastedDate=(t,i)=>i.length>t?i.slice(0,t):i;this.isPastedStringDateValid=t=>{if(/\d+-\d+-\d+$/.test(t)||/\d+\/\d+\/\d+/.test(t)||/\d+\.\d+\.\d+/.test(t)){return true}if(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(t)){this.isZuluTime=true;return true}return false};this.handlePaste=t=>{t.preventDefault();const i=t.clipboardData.getData("Text");const s=this.isPastedStringDateValid(i);this.setPastedValueAndValidation(s,i,t)};this.setDate=t=>{if(t===null||t===""||t===undefined){this.day=null;this.month=null;this.year=null;this.inputsInOrder.forEach((t=>{t.classList.remove(this.FIT_TO_VALUE);this.setPreventInput(t,false)}));this.handleDateChange(true)}else{if(w(t)){let i;if(typeof t==="string"){i=new Date(+t)}else{i=t}this.day=y(i.getDate());this.month=y(i.getMonth()+1);this.year=i.getFullYear().toString()}else if(typeof t==="string"){const i=g(t,this.dateFormat);this.year=i[0];this.month=i[1];this.day=i[2]}}this.setValidationMessage()};this.formatMinMax=t=>{let i;const s=y(t.getDate());const e=y(t.getMonth()+1);const a=t.getFullYear();switch(this.dateFormat){case"DD/MM/YYYY":i=`${s}/${e}/${a}`;break;case"MM/DD/YYYY":i=`${e}/${s}/${a}`;break;case"YYYY/MM/DD":i=`${a}/${e}/${s}`;break}return i};this.updateInputValues=(t,i,s)=>{this.dayInputEl.value=t;this.monthInputEl.value=i;this.yearInputEl.value=s};this.setInputValue=(t,i=false)=>{const s=i?"":t.value;switch(t){case this.dayInputEl:this.day=s;break;case this.monthInputEl:this.month=s;break;case this.yearInputEl:if(this.year!==s){this.year=s}}this.setValidationMessage()};this.setValidationMessage=()=>{this.setDateValidity();if(!h(this.day)&&!h(this.month)&&!h(this.year)){this.selectedDate=this.convertToDate(this.year,this.month,this.day);this.isValidDate=+this.selectedDate!==0&&this.selectedDate.getDate()==+this.day;this.isDisabledDate=this.isSelectedDateDisabled();if(!this.isValidDate||this.isDisabledDate){this.inputsInOrder.forEach((t=>t.setAttribute(this.ARIA_INVALID,"true")))}else{this.inputsInOrder.forEach((t=>t.removeAttribute(this.ARIA_INVALID)))}}else{this.selectedDate=null}if(!(this.isValidDay&&this.isValidMonth&&this.isValidDate)){this.invalidDateText=this.invalidDateMessage}else if(this.isDisabledDate&&this.selectedDate!==null){if(this.isBeforeMin){if(this.disablePast){this.invalidDateText=this.disablePastMessage}else{this.invalidDateText=`Please enter a date after ${this.formatMinMax(this.minDate)}.`}}else if(this.isAfterMax){if(this.disableFuture){this.invalidDateText=this.disableFutureMessage}else{this.invalidDateText=`Please enter a date before ${this.formatMinMax(this.maxDate)}.`}}else if(this.disableDays.length!==0){this.invalidDateText=this.disableDaysMessage}else{if(this.disablePast){this.invalidDateText=this.disablePastMessage}if(this.disableFuture){this.invalidDateText=this.disableFutureMessage}}}else{this.invalidDateText=""}};this.setInputsInOrder=()=>{const t=this.el.shadowRoot.querySelectorAll("input");t.forEach((t=>this.inputsInOrder.push(t)))};this.setAriaLabelledBy=()=>{var t,i;if(this.disabled&&!h((t=this.inputCompContainerEl)===null||t===void 0?void 0:t.getAttribute(this.ARIA_LABELLED_BY))){this.removeAriaLabelledBy();return}if(this.disabled){return}const s=this.el.shadowRoot.querySelector("label");const e=`${this.inputId}-label`;if(s!==null&&s!==undefined){s.id=e}const a=!h(this.validationStatus)||!h(this.invalidDateText);const r=`${(i=s===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:""} ${this.screenReaderInfoId} ${n(this.inputId,this.helperText!==""&&this.helperText!==this.defaultHelperText,a)} ${this.selectedDate?this.selectedDateInfoId:""} ${this.assistiveHintId}`;this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY,r)};this.setPreventInput=(t,i)=>{switch(t){case this.dayInputEl:this.preventDayInput=i;break;case this.monthInputEl:this.preventMonthInput=i;break;case this.yearInputEl:this.preventYearInput=i}};this.getInputFromDatePart=t=>{const i=s("input",{class:"day-input",id:"day-input",ref:t=>this.dayInputEl=t,"aria-label":"day",placeholder:"DD",disabled:this.disabled,onPaste:this.handlePaste,inputmode:"number",pattern:"[0-9]*",onKeyDown:t=>this.handleKeyDown(t,this.preventDayInput)});const e=s("input",{id:"month-input",class:"month-input",ref:t=>this.monthInputEl=t,"aria-label":"month",placeholder:"MM",disabled:this.disabled,onPaste:this.handlePaste,inputmode:"number",pattern:"[0-9]*",onKeyDown:t=>this.handleKeyDown(t,this.preventMonthInput)});const a=s("input",{id:"year-input",class:"year-input",ref:t=>this.yearInputEl=t,"aria-label":"year",placeholder:"YYYY",maxLength:4,disabled:this.disabled,onPaste:this.handlePaste,inputmode:"number",pattern:"[0-9]*",onKeyDown:t=>this.handleKeyDown(t,this.preventYearInput)});let h;switch(t){case"D":h=i;break;case"M":h=e;break;case"Y":h=a}return h};this.getInputsInOrder=()=>{const t=this.dateFormat.split("/");const i=[];t.forEach((t=>{i.push(this.getInputFromDatePart(t.substring(0,1)))}));return i};this.getDescOfInputsOrder=()=>{let t;switch(this.dateFormat){case"DD/MM/YYYY":t="day, month, and year";break;case"MM/DD/YYYY":t="month, day, and year";break;case"YYYY/MM/DD":t="year, month, and day"}return t};this.getScreenReaderInfo=t=>{let i="";if(this.required){i+="required"}if(t===f.Error){i+=" invalid data"}return i===""?"":i+", "};this.preventInput=(t,i)=>{const s=t.key;const e=t.target;let a;if(e){a=e.value.substring(e.selectionStart,e.selectionEnd)}if(s==="e"||s==="."||s==="-"||t.key>="0"&&t.key<="9"&&i&&!a){t.preventDefault()}};this.isSelectedDateDisabled=()=>{const t=new Date;this.isAfterMax=false;this.isBeforeMin=false;let i=false;const s=this.selectedDate.toDateString()!==t.toDateString();if(this.minDate&&this.selectedDate<this.minDate&&s){this.isBeforeMin=true;i=true}if(this.maxDate&&this.selectedDate>this.maxDate&&s){this.isAfterMax=true;i=true}if(this.disableDays.includes(this.selectedDate.getDay())){i=true}if((this.disablePast&&this.selectedDate<t||this.disableFuture&&this.selectedDate>t)&&s){i=true}return i};this.moveToNextInput=t=>{const i=this.inputsInOrder.findIndex((i=>i===t));const s=this.inputsInOrder[i+1];this.preventAutoFormatting=false;if(s){s.focus()}};this.moveToPreviousInput=t=>{const i=this.inputsInOrder.findIndex((i=>i===t));this.preventAutoFormatting=false;if(this.inputsInOrder[i-1]){this.inputsInOrder[i-1].focus()}};this.autocompleteInput=t=>{if(t===this.yearInputEl){this.autocompleteYear()}else{const i=t.value;if(i.length===1){if(+i===0){t.value="01"}else{t.value=`0${i}`}}}if(t.value){this.setInputValue(t)}};this.autocompleteYear=()=>{const t=this.yearInputEl.value;const i=["2","0","0"];let s="";if(t){i.forEach(((i,e)=>{if(t.length+e<=3){s+=i}}));this.yearInputEl.value=`${s}${t}`}};this.convertToDate=(t,i,s)=>{if(!h(t)&&!h(i)&&!h(s)){return new Date(+t,+i-1,+s)}else{return null}};this.handleHostBlur=()=>{this.removeLabelledBy=false;this.icBlur.emit({value:this.selectedDate})};this.handleHostFocus=()=>{var t;if((t=this.el.shadowRoot.activeElement)===null||t===void 0?void 0:t.id.match(/(day|month|year)-input$/)){this.removeLabelledBy=false}else{this.removeLabelledBy=true}this.icFocus.emit({value:this.selectedDate})};this.handleFormReset=()=>{this.setDate(this.initialValue);this.setValidationMessage();this.handleDateChange(false)};this.getAriaLabel=t=>t.getAttribute(this.ARIA_LABEL);this.notifyScreenReaderArrowKeys=t=>{const i=this.el.shadowRoot.querySelector("#live-region");let s="";const e=this.getAriaLabel(t);if(i&&t.value){if(t===this.monthInputEl&&!!v[+t.value-1]){s=`${t.value} - ${v[+t.value-1]}, ${e}`}if(t===this.dayInputEl||t===this.yearInputEl){s=`${t.value}, ${e}`}i.textContent=s}};this.notifyScreenReaderInput=(t,i)=>{let s="";const e=this.getAriaLabel(t);if(t===this.dayInputEl||t===this.monthInputEl){if(t.value.length===2){if(t===this.monthInputEl&&!!v[+t.value-1]&&this.isValidMonth){s=`${t.value} - ${v[+t.value-1]}, ${e}`}if(t===this.dayInputEl&&this.isValidDay){s=`${t.value}, ${e}`}}else{s=""}}else{if(t.value.length===4){s=`${t.value}, ${e}`}else{s=""}}i.textContent=s};this.setFitToValueStyling=t=>{if(t.value){t.classList.add(this.FIT_TO_VALUE)}else{t.classList.remove(this.FIT_TO_VALUE)}};this.setAriaInvalid=(t,i,s,e)=>{if(this.inputsInOrder.length){this.inputsInOrder.forEach((t=>{t.removeAttribute(this.ARIA_INVALID)}));if(!t){this.dayInputEl.setAttribute(this.ARIA_INVALID,"true")}if(!i){this.monthInputEl.setAttribute(this.ARIA_INVALID,"true")}if(!s||e){this.inputsInOrder.forEach((t=>{t.setAttribute(this.ARIA_INVALID,"true")}))}}};this.handleClear=()=>{this.inputsInOrder.forEach((t=>{t.classList.remove(this.FIT_TO_VALUE);this.setInputValue(t,true);this.setPreventInput(t,false)}));this.isDateSetFromKeyboardEvent=false;this.setValidationMessage();this.handleDateChange(true);this.inputsInOrder[0].focus()};this.handleCalendarOpen=t=>{var i,s;t.stopImmediatePropagation();(i=this.calendarButtonEl)===null||i===void 0?void 0:i.shadowRoot.querySelector("ic-tooltip").displayTooltip(false);this.calendarButtonClicked.emit({value:this.selectedDate});(s=this.calendarButtonEl)===null||s===void 0?void 0:s.shadowRoot.querySelector("ic-tooltip").displayTooltip(false);this.isDateSetFromKeyboardEvent=false};this.setValueAndEmitChange=t=>{if(!m(new Date(this.value),t)){this.emitIcChange(t);this.value=t}};this.handleCalendarFocus=()=>{this.calendarFocused=true};this.handleCalendarBlur=()=>{this.calendarFocused=false};this.handleClearFocus=()=>{this.removeLabelledBy=true;this.clearButtonFocused=true};this.handleClearBlur=t=>{var i;this.clearButtonFocused=false;if((i=t.relatedTarget)===null||i===void 0?void 0:i.id.match(/(day|year)-input$/)){this.removeLabelledBy=false;return}this.removeLabelledBy=true};this.emitIcChange=t=>{if(!(t===null&&this.previousEmittedDate===null)&&!m(t,this.previousEmittedDate)){this.previousEmittedDate=t;this.icChange.emit({value:t})}}}watchDisabledHandler(){o(this.disabled,this.el)}watchDisableFutureHandler(){this.watchMaxHandler()}watchDisablePastHandler(){this.watchMinHandler()}watchMaxHandler(){if(this.disableFuture){this.maxDate=new Date}else{this.maxDate=k(this.max,this.dateFormat)}}watchMinHandler(){if(this.disablePast){this.minDate=new Date}else{this.minDate=k(this.min,this.dateFormat)}}watchRequiredHandler(){const t=this.el.shadowRoot.querySelector("label");if(this.required){const i=document.createElement("span");i.setAttribute("id","asterisk-span");i.setAttribute("aria-hidden","true");i.textContent=" *";t===null||t===void 0?void 0:t.appendChild(i)}else{const t=this.el.shadowRoot.querySelector("#asterisk-span");if(t){t.remove()}}}disconnectedCallback(){l(this.el,this.handleFormReset)}componentWillLoad(){this.defaultHelperText=`Use format ${this.dateFormat}`;if(h(this.helperText))this.helperText=this.defaultHelperText;this.watchMinHandler();this.watchMaxHandler();if(this.value){this.setDate(this.value);this.previousEmittedDate=this.selectedDate}else{this.previousEmittedDate=null}this.screenReaderInfoId=`${this.inputId}-screen-reader-info`;this.assistiveHintId=`${this.inputId}-assistive-hint`;this.selectedDateInfoId=`${this.inputId}-selected-date-info`;c(this.el,this.handleFormReset);o(this.disabled,this.el)}componentDidLoad(){this.setInputsInOrder();d([{prop:this.label,propName:"label"}],"Date Input");if(this.value){this.updateInputValues(this.day,this.month,this.year);this.inputsInOrder.forEach((t=>{t.classList.add(this.FIT_TO_VALUE)}))}this.setAriaInvalid(this.isValidDay,this.isValidMonth,this.isValidDate,this.isDisabledDate);if(this.value){this.notifyScreenReaderSelectedDate()}this.inputsInOrder.forEach((t=>{t.addEventListener("input",this.handleInput);t.addEventListener("focus",this.handleFocus);t.addEventListener("blur",this.handleBlur)}));this.watchRequiredHandler()}componentWillUpdate(){if(h(this.helperText))this.helperText=this.defaultHelperText;if(!this.isDateSetFromKeyboardEvent)this.setDate(this.value);this.setAriaInvalid(this.isValidDay,this.isValidMonth,this.isValidDate,this.isDisabledDate);this.handleDateChange(false);this.isDateSetFromKeyboardEvent=false}componentDidRender(){if(this.removeLabelledBy){this.removeAriaLabelledBy();return}this.setAriaLabelledBy()}async getDate(){return this.selectedDate}async setCalendarFocus(){if(this.calendarButtonEl){this.calendarButtonEl.focus()}}async setDisableDays(t){this.disableDays=t}async triggerIcChange(t){this.emitIcChange(t)}removeAriaLabelledBy(){this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY)}setPastedValueAndValidation(t,i,s){switch(true){case t:{const t=this.isZuluTime?x(i):i;const s=t.split(/-|\/|\./);this.inputsInOrder.forEach(((t,i)=>{t.classList.add(this.FIT_TO_VALUE);if(this.isZuluTime){this.pasteZuluDateTime(s,i)}else{let e;if(t===this.dayInputEl||t===this.monthInputEl){e=this.slicePastedDate(2,s[i])}else{e=this.slicePastedDate(4,s[i])}t.value=e;this.setInputValue(t);this.autocompleteInput(t)}}));this.isZuluTime=false;break}case(i.length===1||i.length===2||i.length===4)&&u(i):if(this.checkSingleCopiedValueIsValid(s.target,i)){this.setInputPasteValue(s.target,i);this.setInputValue(s.target)}else{this.displayPastedValidation(s)}break;case i.length===3&&u(i):if(s.target!==this.yearInputEl){this.displayPastedValidation(s)}else{this.setInputPasteValue(s.target,i);this.setInputValue(s.target)}break;case i.length>=5&&u(i):this.displayPastedValidation(s)}}pasteZuluDateTime(t,i){if(i===0){const s=this.slicePastedDate(4,t[i]);this.yearInputEl.value=s;this.setInputValue(this.yearInputEl)}else if(i===1){const s=this.slicePastedDate(2,t[i]);this.monthInputEl.value=s;this.setInputValue(this.monthInputEl)}else{const s=this.slicePastedDate(2,t[i]);this.dayInputEl.value=s;this.setInputValue(this.dayInputEl)}}displayPastedValidation(t){var i;if(((i=this.invalidDateText)===null||i===void 0?void 0:i.length)>0){this.previousInvalidDateTest=this.invalidDateText}this.invalidDateText=`Please paste a valid ${this.getAriaLabel(t.target)}`;this.validationStatus=f.Error;this.isPasteValidationDisplayed=true}setPasteInvalidText(){var t;if(this.isPasteValidationDisplayed){this.invalidDateText=(t=this.previousInvalidDateTest)!==null&&t!==void 0?t:"";this.isPasteValidationDisplayed=false;this.isDateSetFromKeyboardEvent=true}}notifyScreenReader(t,i){const s=this.el.shadowRoot.querySelector("#live-region");if(s){if(this.isKeyboardOrEvent(i)){this.notifyScreenReaderArrowKeys(t)}else if(Object.prototype.toString.call(i)===this.INPUT_EVENT_OBJECT_STRING){this.notifyScreenReaderInput(t,s)}}}render(){const{inputId:t,label:i,disabled:a,helperText:r,hideHelperText:n,hideLabel:o,showClearButton:l,showCalendarButton:c,size:d,theme:u}=this;const p=!h(this.validationStatus);const v=p?this.validationStatus:!h(this.invalidDateText)?f.Error:"";const m=`Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;b(true,this.el,this.name,this.convertToDate(this.year,this.month,this.day),this.disabled);return s(e,{key:"08b8f65934b55fd86e9abe2fad8f232af68b3754",class:{[`ic-theme-${u}`]:u!=="inherit",[`ic-date-input-disabled`]:a},onBlur:this.handleHostBlur,onFocus:this.handleHostFocus},s("ic-input-container",{key:"285bb0e746630a08c3e4e29bc8a24f5d97b4b4e5",disabled:a},!(o&&n)&&s("ic-input-label",{key:"f1facdecd84445133a67c87a2d6e5ba4dfbfbceb",for:t,label:i,hideLabel:o,helperText:!n?r:"",disabled:a}),s("span",{key:"25ae3fae1dc4f2862ec14e348138adfadf0dc3c7",id:this.screenReaderInfoId,class:"sr-only","aria-hidden":"true"},this.getScreenReaderInfo(v),o&&`${i}\n`,n&&`${r}\n`,`${this.defaultHelperText}.`),s("span",{key:"d3c34084b3b846795063f799720b7d918f10f5a9",id:this.assistiveHintId,class:"sr-only","aria-hidden":"true"},m),s("span",{key:"37ecdc3ee7ced98dac405591cb106e1a03add976",id:"live-region","aria-live":"assertive",class:"sr-only"}),s("ic-input-component-container",{key:"cfcfae24a49a49e0f2a878a7c024818e1cce125a",id:t,ref:t=>this.inputCompContainerEl=t,disabled:a,validationStatus:v,size:d,role:"group",class:{[`ic-theme-${u}`]:u!=="inherit"}},s("div",{key:"4d090542f2fb72fae8cda326af45278552707cd6",class:"input-container"},s("div",{key:"4eef737c2a8d25353a41ea31b2e8bc21ec55ff9a",class:"date-inputs"},this.getInputsInOrder()[0],"/",this.getInputsInOrder()[1],"/",this.getInputsInOrder()[2]),s("div",{key:"bc1cb74a96f75b4018f2e39f8712a870f5f4bf6e",class:"action-buttons"},l&&s("ic-button",{key:"e58854f9e3b74a7f46a253a8421c8c9775047069",id:"clear-button","aria-label":"Clear input",class:{["clear-button"]:true,["hidden"]:h(this.day)&&h(this.month)&&h(this.year)},disabled:this.disabled,innerHTML:$,onClick:this.handleClear,onFocus:this.handleClearFocus,onBlur:this.handleClearBlur,variant:"icon-tertiary",theme:this.clearButtonFocused?"light":"dark",size:d}),c&&s("div",{key:"d7e3f4e87e69d949a1c9e56230ae78b22dfd23f8",class:"show-calendar-button-wrapper"},s("div",{key:"21bcae037bcb6d81bd89ba1eb51f279f048fa2df",class:{divider:true,[d]:true}}),s("ic-button",{key:"3bad8c476367e3aac94092078fe9d8aa52f396ff",id:"calendar-button",ref:t=>this.calendarButtonEl=t,"aria-label":"Display calendar","aria-haspopup":"dialog",class:"calendar-button",disabled:this.disabled,innerHTML:D,onClick:this.handleCalendarOpen,variant:"icon-tertiary",size:d,onFocus:this.handleCalendarFocus,onBlur:this.handleCalendarBlur,theme:this.calendarFocused?"light":"dark"}))))),s("span",{key:"c11a9f0fc1eae4efc3a3a29ebdd1eb65a6de7630",id:this.selectedDateInfoId,class:"sr-only","aria-live":"polite"},s("span",{key:"2930c304db0ad50b6991454d9375fdc2e1a4547a",ref:t=>this.selectedDateInfoEl=t,role:"status"})),(p||!h(this.invalidDateText))&&s("ic-input-validation",{key:"5fc1473b568a1f82c3c1ee9f73e20a19f7c28d85",status:v,message:p?this.validationText:this.invalidDateText,for:t})))}static get delegatesFocus(){return true}get el(){return a(this)}static get watchers(){return{disabled:["watchDisabledHandler"],disableFuture:["watchDisableFutureHandler"],disablePast:["watchDisablePastHandler"],max:["watchMaxHandler"],min:["watchMinHandler"],required:["watchRequiredHandler"]}}};H.style=z;export{H as ic_date_input};
2
- //# sourceMappingURL=p-b84213d1.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["icDateInputCss","IcDateInputStyle0","inputIds","DateInput","constructor","hostRef","this","ARIA_INVALID","ARIA_LABEL","ARIA_LABELLED_BY","EVENT_OBJECT_STRING","FIT_TO_VALUE","initialValue","value","INPUT_EVENT_OBJECT_STRING","inputsInOrder","isAfterMax","isBeforeMin","isDateSetFromKeyboardEvent","isDisabledDate","isValidDay","isValidMonth","isValidDate","isZuluTime","KEYBOARD_EVENT_OBJECT_STRING","MAX_DAY","MAX_MONTH","previousEmittedDate","undefined","previousSelectedDate","selectedDate","day","month","year","calendarFocused","clearButtonFocused","removeLabelledBy","dateFormat","disabled","disableDays","disableDaysMessage","disableFuture","disableFutureMessage","disablePast","disablePastMessage","hideHelperText","hideLabel","inputId","invalidDateMessage","max","min","name","required","showCalendarButton","showClearButton","size","theme","validationStatus","validationText","setInputPasteValue","input","pastedValue","inputEl","classList","add","checkSingleCopiedValueIsValid","isValid","Number","dayInputEl","monthInputEl","yearInputEl","isKeyboardOrEvent","event","Object","prototype","toString","call","setDateValidity","isEmptyString","handleInput","inputEvent","target","inputType","preventAutoFormatting","length","setInputValue","notifyScreenReader","moveToNextInput","setPreventInput","setFitToValueStyling","setValidationMessage","handleKeyDown","isInputPrevented","eventKey","_a","key","toLowerCase","regex","test","ctrlKey","metaKey","preventDefault","setPasteInvalidText","handleLeftRightArrowKeyPress","handleUpDownArrowKeyPress","moveToPreviousInput","preventInput","handleFocus","select","handleBlur","autocompleteInput","notifyScreenReaderSelectedDate","dayNames","stringEnumToArray","IcDayNames","months","IcDateInputMonths","selectedDateInfoEl","textContent","getDay","getDate","getMonth","getFullYear","minValue","maxValue","Date","handleDateChange","force","dateMatches","forEach","invalidDateText","setValueAndEmitChange","updateInputValues","slicePastedDate","valueLength","datePart","slice","isPastedStringDateValid","handlePaste","clipboardData","getData","setPastedValueAndValidation","setDate","date","remove","isDateOrEpoch","newDate","convertToDoubleDigits","defaultDateArray","splitStringDate","formatMinMax","formattedDate","clear","newValue","convertToDate","isSelectedDateDisabled","setAttribute","removeAttribute","minDate","maxDate","setInputsInOrder","inputs","el","shadowRoot","querySelectorAll","push","setAriaLabelledBy","inputCompContainerEl","getAttribute","removeAriaLabelledBy","labelEl","querySelector","labelId","id","hasValidation","labelledBy","_b","screenReaderInfoId","getInputDescribedByText","helperText","defaultHelperText","selectedDateInfoId","assistiveHintId","isPrevented","preventDayInput","preventMonthInput","preventYearInput","getInputFromDatePart","dayInput","h","class","ref","placeholder","onPaste","inputmode","pattern","onKeyDown","monthInput","yearInput","maxLength","getInputsInOrder","dateParts","split","part","substring","getDescOfInputsOrder","description","getScreenReaderInfo","inputDescriptors","IcInformationStatus","Error","selectedString","selectionStart","selectionEnd","currentDate","isNotToday","toDateString","includes","currentInput","currentInputPos","findIndex","nextInput","focus","autocompleteYear","inputValue","yearNumbers","autocompletedInput","number","index","handleHostBlur","icBlur","emit","handleHostFocus","activeElement","match","icFocus","handleFormReset","getAriaLabel","notifyScreenReaderArrowKeys","liveRegion","announcement","ariaLabel","notifyScreenReaderInput","setAriaInvalid","validDay","validMonth","validDate","disabledDate","handleClear","handleCalendarOpen","ev","stopImmediatePropagation","calendarButtonEl","displayTooltip","calendarButtonClicked","emitIcChange","handleCalendarFocus","handleCalendarBlur","handleClearFocus","handleClearBlur","relatedTarget","d","icChange","watchDisabledHandler","removeDisabledFalse","watchDisableFutureHandler","watchMaxHandler","watchDisablePastHandler","watchMinHandler","createDate","watchRequiredHandler","asteriskSpan","document","createElement","appendChild","disconnectedCallback","removeFormResetListener","componentWillLoad","addFormResetListener","componentDidLoad","onComponentRequiredPropUndefined","prop","label","propName","addEventListener","componentWillUpdate","componentDidRender","setCalendarFocus","setDisableDays","days","triggerIcChange","nextParsedValue","extractDateFromZuluDateTime","pasteZuluDateTime","dateValue","isNumeric","displayPastedValidation","previousInvalidDateTest","isPasteValidationDisplayed","render","hasCustomValidation","assistiveHint","renderHiddenInput","Host","onBlur","onFocus","for","role","innerHTML","Clear","onClick","variant","divider","Calendar","status","message"],"sources":["src/components/ic-date-input/ic-date-input.css?tag=ic-date-input&encapsulation=shadow","src/components/ic-date-input/ic-date-input.tsx"],"sourcesContent":["@import \"../../global/normalize.css\";\n\n:host {\n --ic-input-label-helpertext-padding: var(--ic-space-xxs);\n --input-bg-color: var(--ic-date-input-bg);\n --ic-input-label-text-color: var(--ic-date-input-label);\n --ic-input-label-helper-text-color: var(--ic-date-input-subtitle);\n --border-color: var(--ic-date-input-border);\n --border-color-disabled: var(--ic-date-input-border-disabled);\n --border-color-hover: var(--ic-date-input-border-default-hover);\n --border-color-pressed: var(--ic-date-input-border-default-pressed);\n --border-error-color: var(--ic-date-input-border-error);\n --border-error-color-hover: var(--ic-date-input-border-error-hover);\n --border-error-color-pressed: var(--ic-date-input-border-error-pressed);\n --border-success-color: var(--ic-date-input-border-success);\n --border-success-color-hover: var(--ic-date-input-border-success-hover);\n --border-success-color-pressed: var(--ic-date-input-border-success-pressed);\n --border-warning-color: var(--ic-date-input-border-warning);\n --border-warning-color-hover: var(--ic-date-input-border-warning-hover);\n --border-warning-color-pressed: var(--ic-date-input-border-warning-pressed);\n}\n\n:host(.ic-date-input-disabled) {\n --ic-input-label-text-color: var(--ic-date-input-label-disabled);\n --ic-input-label-helper-text-color: var(--ic-date-input-subtitle-disabled);\n}\n\ninput {\n border: 0;\n height: 100%;\n padding: 0;\n outline: none;\n background: none;\n -moz-appearance: textfield;\n appearance: textfield;\n color: var(--ic-date-input-text-filled);\n caret-color: var(--ic-date-input-typing-cursor);\n}\n\ninput::-webkit-outer-spin-button,\ninput::-webkit-inner-spin-button {\n -webkit-appearance: none;\n}\n\ninput:-webkit-autofill {\n box-shadow: 0 0 0 var(--ic-space-sm) var(--ic-color-background-primary) inset;\n -webkit-text-fill-color: var(--ic-date-input-text-filled) !important;\n}\n\ninput::placeholder {\n color: var(--ic-date-input-text-placeholder);\n}\n\nic-input-component-container {\n cursor: text;\n}\n\nic-input-component-container .focus-indicator {\n padding: var(--ic-space-xxxs) var(--ic-space-xs);\n align-items: center;\n}\n\n.date-inputs {\n color: var(--ic-date-input-text-placeholder);\n}\n\n.day-input {\n width: 1.438rem;\n}\n\n.month-input {\n width: 1.813rem;\n}\n\n.year-input,\n.year-input.fit-to-value {\n width: 2.313rem;\n}\n\n.fit-to-value {\n width: 1.25rem;\n}\n\n.sr-only {\n position: absolute;\n left: -9999px;\n}\n\n.input-container {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n position: relative;\n}\n\n.action-buttons {\n display: flex;\n align-items: center;\n}\n\n.show-calendar-button-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.clear-button,\n.calendar-button {\n border-radius: var(--ic-border-radius);\n transition: box-shadow var(--ic-easing-transition),\n border-radius var(--ic-easing-transition);\n margin: 0;\n}\n\n.clear-button.hidden {\n display: none;\n}\n\n.clear-button:focus,\n.calendar-button:focus,\n.clear-button:active,\n.calendar-button:active {\n background-color: var(--ic-color-focus-inner) !important;\n box-shadow: inset 0 0 0 0.125rem var(--ic-color-focus-outer) !important;\n border-radius: 0.25rem;\n}\n\n.calendar-button:focus,\n.calendar-button:active {\n --ic-button-tertiary-text-active: var(--ic-atoms-input-clear-button-focus);\n --ic-button-tertiary-text-hover-active: var(\n --ic-atoms-input-clear-button-focus\n );\n --ic-button-tertiary-text-pressed-active: var(\n --ic-atoms-input-clear-button-focus\n );\n}\n\n.clear-button:focus,\n.calendar-button:focus,\n.clear-button:active *,\n.calendar-button:active * {\n fill: var(--ic-atoms-input-clear-button-focus);\n}\n\n.clear-button svg {\n color: var(--ic-date-input-clear-icon);\n}\n\n.clear-button:focus svg {\n color: var(--ic-atoms-input-clear-button-focus);\n}\n\n.divider {\n margin: 0 var(--ic-space-xxs);\n width: var(--ic-space-1px);\n background-color: var(--ic-atoms-input-divider);\n border-radius: var(--ic-space-1px);\n}\n\n.divider.small {\n height: var(--ic-space-md);\n}\n\n.divider.medium {\n height: calc(var(--ic-space-sm) + var(--ic-space-xs));\n}\n\n.divider.large {\n height: var(--ic-space-lg);\n}\n\nic-input-validation {\n --ic-input-validation-status-text-color: var(--ic-date-input-status-text);\n --ic-input-validation-error: var(--ic-date-input-icon-error);\n --ic-input-validation-warning-icon-color: var(--ic-date-input-icon-warning);\n --ic-input-validation-success-icon-color: var(--ic-date-input-icon-success);\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Host,\n Method,\n Watch,\n} from \"@stencil/core\";\nimport {\n IcInformationStatus,\n IcInformationStatusOrEmpty,\n IcSizes,\n IcDateFormat,\n IcDateInputMonths,\n IcDayNames,\n IcWeekDays,\n IcThemeMode,\n} from \"../../utils/types\";\nimport {\n convertToDoubleDigits,\n createDate,\n dateMatches,\n extractDateFromZuluDateTime,\n isDateOrEpoch,\n splitStringDate,\n} from \"../../utils/date-helpers\";\nimport {\n addFormResetListener,\n getInputDescribedByText,\n isEmptyString,\n isNumeric,\n onComponentRequiredPropUndefined,\n removeDisabledFalse,\n removeFormResetListener,\n renderHiddenInput,\n stringEnumToArray,\n} from \"../../utils/helpers\";\nimport Clear from \"../../assets/clear-icon.svg\";\nimport Calendar from \"../../assets/calendar.svg\";\n\nlet inputIds = 0;\n\n@Component({\n tag: \"ic-date-input\",\n styleUrl: \"ic-date-input.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class DateInput {\n private ARIA_INVALID = \"aria-invalid\";\n private ARIA_LABEL = \"aria-label\";\n private ARIA_LABELLED_BY = \"aria-labelledby\";\n private assistiveHintId: string;\n private calendarButtonEl: HTMLIcButtonElement;\n private dayInputEl: HTMLInputElement;\n private defaultHelperText: string;\n private EVENT_OBJECT_STRING = \"[object Event]\";\n private FIT_TO_VALUE = \"fit-to-value\";\n\n private initialValue = this.value;\n private inputCompContainerEl: HTMLIcInputComponentContainerElement;\n private INPUT_EVENT_OBJECT_STRING = \"[object InputEvent]\";\n private inputsInOrder: HTMLInputElement[] = [];\n\n private isAfterMax: boolean = false;\n private isBeforeMin: boolean = false;\n private isDateSetFromKeyboardEvent: boolean = false;\n private isDisabledDate: boolean = false;\n private isPasteValidationDisplayed: boolean;\n private isValidDay: boolean = true;\n private isValidMonth: boolean = true;\n private isValidDate: boolean = true;\n private isZuluTime: boolean = false;\n\n private KEYBOARD_EVENT_OBJECT_STRING = \"[object KeyboardEvent]\";\n private MAX_DAY = 31;\n private MAX_MONTH = 12;\n private monthInputEl: HTMLInputElement;\n\n private preventAutoFormatting: boolean;\n private preventDayInput: boolean;\n private preventMonthInput: boolean;\n private preventYearInput: boolean;\n\n private previousInvalidDateTest: string;\n private previousEmittedDate: Date = undefined;\n private previousSelectedDate: Date = null;\n\n private selectedDate: Date = null;\n private selectedDateInfoEl: HTMLSpanElement;\n private screenReaderInfoId: string;\n private selectedDateInfoId: string;\n\n private yearInputEl: HTMLInputElement;\n\n @Element() el: HTMLIcDateInputElement;\n\n @State() day: string = \"\";\n @State() invalidDateText: string;\n @State() maxDate: Date;\n @State() minDate: Date;\n @State() month: string = \"\";\n @State() year: string = \"\";\n @State() calendarFocused: boolean = false;\n @State() clearButtonFocused: boolean = false;\n @State() removeLabelledBy: boolean = false;\n\n /**\n * The format in which the date will be displayed.\n */\n // eslint-disable-next-line sonarjs/no-duplicate-string\n @Prop() dateFormat?: IcDateFormat = \"DD/MM/YYYY\";\n\n /**\n * If `true`, the disabled state will be set.\n */\n @Prop() disabled?: boolean = false;\n @Watch(\"disabled\")\n watchDisabledHandler(): void {\n removeDisabledFalse(this.disabled, this.el);\n }\n\n /**\n * The days of the week to disable.\n */\n @Prop({ mutable: true }) disableDays?: IcWeekDays[] = [];\n\n /**\n * The text to display as the validation message when `disableDays` is set and a disabled date is entered.\n */\n @Prop() disableDaysMessage?: string =\n \"The date you have selected is on a day of the week that is not allowed. Please select another date.\";\n\n /**\n * If `true`, dates in the future are not allowed. A validation message will appear if a date in the future is entered.\n */\n @Prop() disableFuture?: boolean = false;\n\n @Watch(\"disableFuture\")\n watchDisableFutureHandler(): void {\n this.watchMaxHandler();\n }\n\n /**\n * The text to display as the validation message when `disableFuture` is true and a date in the future is entered.\n */\n @Prop() disableFutureMessage?: string =\n \"Dates in the future are not allowed. Please select a date in the past.\";\n\n /**\n * If `true`, dates in the past are not allowed. A validation message will appear if a date in the past is entered.\n */\n @Prop() disablePast?: boolean = false;\n\n @Watch(\"disablePast\")\n watchDisablePastHandler(): void {\n this.watchMinHandler();\n }\n\n /**\n * The text to display as the validation message when `disablePast` is true and a date in the past is entered.\n */\n @Prop() disablePastMessage?: string =\n \"Dates in the past are not allowed. Please select a date in the future.\";\n\n /**\n * The helper text that will be displayed for additional field guidance. This will default to the text \"Use format\" along with the `dateFormat` value.\n */\n @Prop({ mutable: true }) helperText?: string;\n\n /**\n * If `true`, the helper text will be visually hidden, but still read out by screenreaders.\n */\n @Prop() hideHelperText: boolean = false;\n\n /**\n * If `true`, the label will be visually hidden, but will still be read out by screen readers.\n */\n @Prop() hideLabel?: boolean = false;\n\n /**\n * The ID for the input.\n */\n @Prop() inputId?: string = `ic-date-input-${inputIds++}`;\n\n /**\n * The text to display as the validation message when an invalid date is entered.\n */\n @Prop() invalidDateMessage?: string = \"Please enter a valid date.\";\n\n /**\n * The label for the date input.\n */\n @Prop() label!: string;\n\n /**\n * The latest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.\n * The value of this prop is ignored if `disableFuture` is set to `true`.\n */\n @Prop() max?: string | Date = \"\";\n\n @Watch(\"max\")\n watchMaxHandler(): void {\n if (this.disableFuture) {\n this.maxDate = new Date();\n } else {\n this.maxDate = createDate(this.max, this.dateFormat);\n }\n }\n\n /**\n * The earliest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.\n * The value of this prop is ignored if `disablePast` is set to `true`.\n */\n @Prop() min?: string | Date = \"\";\n\n @Watch(\"min\")\n watchMinHandler(): void {\n if (this.disablePast) {\n this.minDate = new Date();\n } else {\n this.minDate = createDate(this.min, this.dateFormat);\n }\n }\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * If `true`, the input will require a value.\n */\n @Prop() required?: boolean = false;\n\n @Watch(\"required\")\n watchRequiredHandler(): void {\n // Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)\n // Needed because label is included in 'aria-labelledby' instead of using 'aria-label'\n const labelEl = this.el.shadowRoot.querySelector(\"label\");\n if (this.required) {\n const asteriskSpan = document.createElement(\"span\");\n asteriskSpan.setAttribute(\"id\", \"asterisk-span\");\n asteriskSpan.setAttribute(\"aria-hidden\", \"true\");\n asteriskSpan.textContent = \" *\";\n labelEl?.appendChild(asteriskSpan);\n } else {\n const asteriskSpan = this.el.shadowRoot.querySelector(\"#asterisk-span\");\n if (asteriskSpan) {\n asteriskSpan.remove();\n }\n }\n }\n\n /**\n * @internal If `true`, a button which displays the calendar view when clicked will be displayed.\n */\n @Prop() showCalendarButton?: boolean = false;\n\n /**\n * If `true`, a button which clears the date input when clicked will be displayed.\n */\n @Prop() showClearButton?: boolean = true;\n\n /**\n * The size of the date input to be displayed.\n */\n @Prop() size?: IcSizes = \"medium\";\n\n /**\n * Sets the date picker to the dark or light theme colors. \"inherit\" will set the color based on the system settings or ic-theme component.\n */\n @Prop() theme?: IcThemeMode = \"inherit\";\n\n /**\n * The value of the date input. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.\n */\n @Prop({ mutable: true }) value?: string | Date | null | undefined = \"\";\n\n /**\n * The validation status - e.g. 'error' | 'warning' | 'success'. This will override the built-in date validation.\n */\n @Prop({ mutable: true }) validationStatus?: IcInformationStatusOrEmpty = \"\";\n\n /**\n * The text to display as the validation message. This will override the built-in date validation.\n */\n @Prop() validationText?: string = \"\";\n\n /**\n * @internal Emitted when the calendar is opened.\n */\n @Event() calendarButtonClicked: EventEmitter<{ value: Date }>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() icBlur: EventEmitter<{ value: Date }>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() icChange: EventEmitter<{ value: Date }>;\n\n /**\n * Emitted when the input gains focus.\n */\n @Event() icFocus: EventEmitter<{ value: Date }>;\n\n disconnectedCallback(): void {\n removeFormResetListener(this.el, this.handleFormReset);\n }\n\n componentWillLoad(): void {\n this.defaultHelperText = `Use format ${this.dateFormat}`;\n\n if (isEmptyString(this.helperText))\n this.helperText = this.defaultHelperText;\n\n this.watchMinHandler();\n this.watchMaxHandler();\n\n if (this.value) {\n this.setDate(this.value);\n this.previousEmittedDate = this.selectedDate;\n } else {\n this.previousEmittedDate = null;\n }\n\n this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;\n this.assistiveHintId = `${this.inputId}-assistive-hint`;\n this.selectedDateInfoId = `${this.inputId}-selected-date-info`;\n\n addFormResetListener(this.el, this.handleFormReset);\n removeDisabledFalse(this.disabled, this.el);\n }\n\n componentDidLoad(): void {\n this.setInputsInOrder();\n\n onComponentRequiredPropUndefined(\n [{ prop: this.label, propName: \"label\" }],\n \"Date Input\"\n );\n\n if (this.value) {\n this.updateInputValues(this.day, this.month, this.year);\n this.inputsInOrder.forEach((input) => {\n input.classList.add(this.FIT_TO_VALUE);\n });\n }\n\n this.setAriaInvalid(\n this.isValidDay,\n this.isValidMonth,\n this.isValidDate,\n this.isDisabledDate\n );\n\n if (this.value) {\n this.notifyScreenReaderSelectedDate();\n }\n\n this.inputsInOrder.forEach((input) => {\n input.addEventListener(\"input\", this.handleInput);\n input.addEventListener(\"focus\", this.handleFocus);\n input.addEventListener(\"blur\", this.handleBlur);\n });\n\n this.watchRequiredHandler();\n }\n\n componentWillUpdate(): void {\n if (isEmptyString(this.helperText))\n this.helperText = this.defaultHelperText;\n\n if (!this.isDateSetFromKeyboardEvent) this.setDate(this.value);\n\n this.setAriaInvalid(\n this.isValidDay,\n this.isValidMonth,\n this.isValidDate,\n this.isDisabledDate\n );\n this.handleDateChange(false);\n this.isDateSetFromKeyboardEvent = false;\n }\n\n componentDidRender(): void {\n if (this.removeLabelledBy) {\n this.removeAriaLabelledBy();\n return;\n }\n\n this.setAriaLabelledBy();\n }\n\n /**\n * Returns the value as a Date object\n * @returns Date\n */\n @Method()\n async getDate(): Promise<Date> {\n return this.selectedDate;\n }\n\n /**\n * @internal Sets focus on the calendar button.\n */\n @Method()\n async setCalendarFocus(): Promise<void> {\n if (this.calendarButtonEl) {\n this.calendarButtonEl.focus();\n }\n }\n\n /**\n * @internal Used to pass disabledDays from parent component.\n */\n @Method()\n async setDisableDays(days: IcWeekDays[]): Promise<void> {\n this.disableDays = days;\n }\n\n /**\n * @internal Used to enable other components to invoke an IcChange event from the input.\n */\n @Method()\n async triggerIcChange(d: Date): Promise<void> {\n this.emitIcChange(d);\n }\n\n private setInputPasteValue = (input: EventTarget, pastedValue: string) => {\n const inputEl = input as HTMLInputElement;\n\n inputEl.value = pastedValue;\n inputEl.classList.add(this.FIT_TO_VALUE);\n };\n\n private checkSingleCopiedValueIsValid = (\n input: EventTarget,\n pastedValue: string\n ) => {\n let isValid = false;\n const value = Number(pastedValue);\n\n switch (input) {\n case this.dayInputEl:\n isValid = value >= 1 && value <= this.MAX_DAY;\n break;\n case this.monthInputEl:\n isValid = value >= 1 && value <= this.MAX_MONTH;\n break;\n case this.yearInputEl:\n isValid = true;\n break;\n default:\n isValid = false;\n break;\n }\n\n return isValid;\n };\n\n /**\n * Using Object.prototype.string to determine type if event from user\n * @param event - event object used to differentiate keyboard, generic or input event\n * @returns boolean\n */\n private isKeyboardOrEvent = (event: Event) => {\n return (\n Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||\n Object.prototype.toString.call(event) ===\n this.KEYBOARD_EVENT_OBJECT_STRING\n );\n };\n\n private setDateValidity = () => {\n if (!isEmptyString(this.day)) {\n this.isValidDay = +this.day > this.MAX_DAY ? false : true;\n } else {\n this.isValidDay = true;\n }\n\n if (!isEmptyString(this.month)) {\n this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;\n } else {\n this.isValidMonth = true;\n }\n };\n\n private handleInput = (event: Event) => {\n const inputEvent = event as InputEvent;\n const input = event.target as HTMLInputElement;\n\n if (input !== this.yearInputEl) {\n // Only auto-format if input event is not a character being deleted\n // and not as user is changing value using up / down keys\n if (\n inputEvent.inputType !== \"deleteContentBackward\" &&\n !this.preventAutoFormatting\n ) {\n if (\n input.value.length === 1 &&\n ((input === this.dayInputEl && +input.value >= 4) ||\n (input === this.monthInputEl && +input.value >= 2)) &&\n +input.value <= 9\n ) {\n this.setInputValue(input);\n this.notifyScreenReader(input, event);\n this.moveToNextInput(input);\n }\n\n if (input.value.length === 2) {\n if (+input.value === 0) {\n input.value = \"01\";\n }\n this.setInputValue(input);\n this.setPreventInput(input, true);\n this.notifyScreenReader(input, event);\n this.moveToNextInput(input);\n } else {\n this.setPreventInput(input, false);\n }\n } else if (this.preventAutoFormatting) {\n /**\n * Using arrow keys prevents auto formatting so need to deal with\n * switching from arrow keys to inputting numbers\n **/\n if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {\n this.setInputValue(input);\n this.setPreventInput(input, true);\n this.moveToNextInput(input);\n } else {\n this.setInputValue(input);\n }\n }\n\n if (input.value.length !== 2) {\n this.setPreventInput(input, false);\n }\n } else {\n if (input.value.length === 4) {\n this.setInputValue(input);\n if (\n Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING\n ) {\n this.moveToNextInput(input);\n }\n this.setPreventInput(input, true);\n } else {\n this.setInputValue(input, true);\n this.setPreventInput(input, false);\n }\n }\n\n // Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year\n this.setFitToValueStyling(input);\n\n if (input.value.length === 0) {\n this.setInputValue(input, true);\n this.setValidationMessage();\n }\n\n this.notifyScreenReader(input, event);\n };\n\n private handleKeyDown = (event: KeyboardEvent, isInputPrevented: boolean) => {\n const input = event.target as HTMLInputElement;\n\n const eventKey = event.key?.toLowerCase();\n // Regex required due to FF allowing all characters as values for number text field.\n const regex =\n /-?\\d*\\.?\\d+(e[-+]?\\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;\n if (\n !regex.test(eventKey) &&\n !(\n (event.ctrlKey || event.metaKey) &&\n (eventKey === \"v\" || eventKey === \"c\")\n )\n ) {\n event.preventDefault();\n }\n\n switch (eventKey) {\n case \"/\":\n case \"-\":\n case \".\":\n event.preventDefault();\n this.setPasteInvalidText();\n this.moveToNextInput(input);\n break;\n case \"arrowright\":\n case \"arrowleft\":\n event.preventDefault();\n this.handleLeftRightArrowKeyPress(input, eventKey);\n break;\n case \"arrowup\":\n case \"arrowdown\":\n this.preventAutoFormatting = true;\n this.handleUpDownArrowKeyPress(input, event);\n break;\n case \"backspace\":\n if (input.value.length === 0) {\n event.preventDefault();\n this.moveToPreviousInput(input);\n }\n break;\n default:\n break;\n }\n\n this.preventInput(event, isInputPrevented);\n this.isDateSetFromKeyboardEvent = true;\n };\n\n private handleFocus = (event: FocusEvent) => {\n // Highlight / select all characters in input for easy replacement\n const input = event.target as HTMLInputElement;\n\n input.select();\n };\n\n private handleBlur = (event: FocusEvent) => {\n const input = event.target as HTMLInputElement;\n\n this.setPasteInvalidText();\n this.autocompleteInput(input);\n };\n\n private handleLeftRightArrowKeyPress = (\n input: HTMLInputElement,\n key: string\n ) => {\n if (key === \"arrowright\") {\n this.moveToNextInput(input);\n } else {\n this.moveToPreviousInput(input);\n }\n\n this.setPasteInvalidText();\n };\n\n private notifyScreenReaderSelectedDate = () => {\n const dayNames = stringEnumToArray(IcDayNames);\n const months = stringEnumToArray(IcDateInputMonths);\n\n this.selectedDateInfoEl.textContent = `Selected date: ${\n dayNames[this.selectedDate.getDay()]\n }, ${this.selectedDate.getDate()} ${\n months[this.selectedDate.getMonth()]\n } ${this.selectedDate.getFullYear()}`;\n };\n\n private handleUpDownArrowKeyPress = (\n input: HTMLInputElement,\n event: KeyboardEvent\n ) => {\n const minValue = input === this.yearInputEl ? 0 : 1;\n\n let maxValue;\n\n switch (input) {\n case this.dayInputEl:\n maxValue = this.MAX_DAY;\n break;\n case this.monthInputEl:\n maxValue = this.MAX_MONTH;\n break;\n case this.yearInputEl:\n maxValue = 9999;\n }\n\n // Make value loop round when min / max reached\n if (input?.value) {\n if (event.key === \"ArrowUp\") {\n if (+input.value === maxValue) {\n event.preventDefault();\n input.value = `0${minValue}`;\n } else {\n input.value =\n +input.value + 1 < 10\n ? `0${+input.value + 1}`\n : (+input.value + 1).toString();\n }\n this.notifyScreenReader(input, event);\n }\n\n if (event.key === \"ArrowDown\") {\n if (+input.value === minValue) {\n event.preventDefault();\n input.value = maxValue.toString();\n } else {\n input.value =\n +input.value - 1 < 10\n ? `0${+input.value - 1}`\n : (+input.value - 1).toString();\n }\n this.notifyScreenReader(input, event);\n }\n } else {\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n if (input === this.yearInputEl) {\n input.value = new Date().getFullYear().toString();\n } else {\n input.value = maxValue.toString();\n }\n this.notifyScreenReader(input, event);\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n if (input === this.yearInputEl) {\n input.value = new Date().getFullYear().toString();\n } else {\n input.value = `0${minValue}`;\n }\n this.notifyScreenReader(input, event);\n }\n }\n\n this.setInputValue(input);\n this.setFitToValueStyling(input);\n };\n\n private handleDateChange = (force: boolean) => {\n // Prevent icChange being emitted when each individual input is changed\n // This method is used within componentWillUpdate instead of using @Watch('value');\n if (force || !dateMatches(this.selectedDate, this.previousSelectedDate)) {\n if (this.value) {\n this.inputsInOrder.forEach((input) => {\n input.classList.add(this.FIT_TO_VALUE);\n });\n }\n if (this.day && this.month && this.year && this.invalidDateText === \"\") {\n this.setValueAndEmitChange(this.selectedDate);\n this.notifyScreenReaderSelectedDate();\n } else if (\n !(this.selectedDate === null && this.previousSelectedDate === null)\n ) {\n this.setValueAndEmitChange(null);\n this.selectedDateInfoEl.textContent = \"\";\n }\n this.previousSelectedDate = this.selectedDate;\n\n if (!this.isDateSetFromKeyboardEvent) {\n this.updateInputValues(this.day, this.month, this.year);\n }\n }\n };\n\n private slicePastedDate = (valueLength: number, datePart: string): string => {\n return datePart.length > valueLength\n ? datePart.slice(0, valueLength)\n : datePart;\n };\n\n private isPastedStringDateValid = (value: string) => {\n if (\n /\\d+-\\d+-\\d+$/.test(value) ||\n /\\d+\\/\\d+\\/\\d+/.test(value) ||\n /\\d+\\.\\d+\\.\\d+/.test(value)\n ) {\n return true;\n }\n\n if (\n /[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\\.\\d+)?)?Z/.test(\n value\n )\n ) {\n this.isZuluTime = true;\n return true;\n }\n\n return false;\n };\n\n // Set value of each input to value of pasted date part\n // Allows formats separated by '-' or '/'\n private handlePaste = (event: ClipboardEvent) => {\n event.preventDefault();\n\n const pastedValue = event.clipboardData.getData(\"Text\");\n const isValidDate = this.isPastedStringDateValid(pastedValue);\n\n this.setPastedValueAndValidation(isValidDate, pastedValue, event);\n };\n\n private setDate = (date: string | Date) => {\n if (date === null || date === \"\" || date === undefined) {\n this.day = null;\n this.month = null;\n this.year = null;\n this.inputsInOrder.forEach((input) => {\n input.classList.remove(this.FIT_TO_VALUE);\n this.setPreventInput(input, false);\n });\n this.handleDateChange(true);\n } else {\n if (isDateOrEpoch(date)) {\n let newDate;\n if (typeof date === \"string\") {\n // Checking if epoch date time\n newDate = new Date(+date);\n } else {\n newDate = date;\n }\n\n this.day = convertToDoubleDigits(newDate.getDate());\n this.month = convertToDoubleDigits(newDate.getMonth() + 1);\n this.year = newDate.getFullYear().toString();\n } else if (typeof date === \"string\") {\n const defaultDateArray = splitStringDate(date, this.dateFormat);\n this.year = defaultDateArray[0];\n this.month = defaultDateArray[1];\n this.day = defaultDateArray[2];\n }\n }\n\n this.setValidationMessage();\n };\n\n private formatMinMax = (date: Date) => {\n let formattedDate;\n\n const day = convertToDoubleDigits(date.getDate());\n const month = convertToDoubleDigits(date.getMonth() + 1);\n const year = date.getFullYear();\n\n switch (this.dateFormat) {\n case \"DD/MM/YYYY\":\n formattedDate = `${day}/${month}/${year}`;\n break;\n case \"MM/DD/YYYY\":\n formattedDate = `${month}/${day}/${year}`;\n break;\n case \"YYYY/MM/DD\":\n formattedDate = `${year}/${month}/${day}`;\n break;\n default:\n break;\n }\n return formattedDate;\n };\n private updateInputValues = (day: string, month: string, year: string) => {\n this.dayInputEl.value = day;\n this.monthInputEl.value = month;\n this.yearInputEl.value = year;\n };\n\n // Set value in state based on input\n private setInputValue = (input: HTMLInputElement, clear = false) => {\n const newValue = clear ? \"\" : input.value;\n\n switch (input) {\n case this.dayInputEl:\n this.day = newValue;\n break;\n case this.monthInputEl:\n this.month = newValue;\n break;\n case this.yearInputEl:\n if (this.year !== newValue) {\n this.year = newValue;\n }\n }\n\n this.setValidationMessage();\n };\n\n private setValidationMessage = () => {\n this.setDateValidity();\n\n if (\n !isEmptyString(this.day) &&\n !isEmptyString(this.month) &&\n !isEmptyString(this.year)\n ) {\n // Check whether date actually exists\n // (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)\n this.selectedDate = this.convertToDate(this.year, this.month, this.day);\n this.isValidDate =\n +this.selectedDate !== 0 && this.selectedDate.getDate() == +this.day;\n this.isDisabledDate = this.isSelectedDateDisabled();\n\n if (!this.isValidDate || this.isDisabledDate) {\n this.inputsInOrder.forEach((input) =>\n input.setAttribute(this.ARIA_INVALID, \"true\")\n );\n } else {\n this.inputsInOrder.forEach((input) =>\n input.removeAttribute(this.ARIA_INVALID)\n );\n }\n } else {\n this.selectedDate = null;\n }\n\n if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {\n this.invalidDateText = this.invalidDateMessage;\n } else if (this.isDisabledDate && this.selectedDate !== null) {\n if (this.isBeforeMin) {\n if (this.disablePast) {\n this.invalidDateText = this.disablePastMessage;\n } else {\n this.invalidDateText = `Please enter a date after ${this.formatMinMax(\n this.minDate\n )}.`;\n }\n } else if (this.isAfterMax) {\n if (this.disableFuture) {\n this.invalidDateText = this.disableFutureMessage;\n } else {\n this.invalidDateText = `Please enter a date before ${this.formatMinMax(\n this.maxDate\n )}.`;\n }\n } else if (this.disableDays.length !== 0) {\n this.invalidDateText = this.disableDaysMessage;\n } else {\n if (this.disablePast) {\n this.invalidDateText = this.disablePastMessage;\n }\n if (this.disableFuture) {\n this.invalidDateText = this.disableFutureMessage;\n }\n }\n } else {\n this.invalidDateText = \"\";\n }\n };\n\n // Set refs to the input elements in the order they are displayed (based on the dateFormat)\n private setInputsInOrder = () => {\n const inputs = this.el.shadowRoot.querySelectorAll(\"input\");\n inputs.forEach((input) => this.inputsInOrder.push(input));\n };\n\n // Includes text usually added using aria-describedby\n // (which doesn't work on input component container)\n private setAriaLabelledBy = () => {\n if (\n this.disabled &&\n !isEmptyString(\n this.inputCompContainerEl?.getAttribute(this.ARIA_LABELLED_BY)\n )\n ) {\n this.removeAriaLabelledBy();\n return;\n }\n\n if (this.disabled) {\n return;\n }\n\n const labelEl = this.el.shadowRoot.querySelector(\"label\");\n const labelId = `${this.inputId}-label`;\n\n if (labelEl !== null && labelEl !== undefined) {\n labelEl.id = labelId;\n }\n\n const hasValidation =\n !isEmptyString(this.validationStatus) ||\n !isEmptyString(this.invalidDateText);\n\n const labelledBy = `${labelEl?.id ?? \"\"} ${\n this.screenReaderInfoId\n } ${getInputDescribedByText(\n this.inputId,\n this.helperText !== \"\" && this.helperText !== this.defaultHelperText,\n hasValidation\n )} ${this.selectedDate ? this.selectedDateInfoId : \"\"} ${\n this.assistiveHintId\n }`;\n\n this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);\n };\n\n // Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)\n private setPreventInput = (input: HTMLInputElement, isPrevented: boolean) => {\n switch (input) {\n case this.dayInputEl:\n this.preventDayInput = isPrevented;\n break;\n case this.monthInputEl:\n this.preventMonthInput = isPrevented;\n break;\n case this.yearInputEl:\n this.preventYearInput = isPrevented;\n }\n };\n\n // Get input based on letter representing each date part (\"D\", \"M\" or \"Y\")\n // (retrieved from dateFormat)\n private getInputFromDatePart = (datePart: string) => {\n const dayInput = (\n <input\n class=\"day-input\"\n id=\"day-input\"\n ref={(el) => (this.dayInputEl = el)}\n aria-label=\"day\"\n placeholder=\"DD\"\n disabled={this.disabled}\n onPaste={this.handlePaste}\n inputmode=\"number\"\n pattern=\"[0-9]*\"\n onKeyDown={(event) => this.handleKeyDown(event, this.preventDayInput)}\n ></input>\n );\n\n const monthInput = (\n <input\n id=\"month-input\"\n class=\"month-input\"\n ref={(el) => (this.monthInputEl = el)}\n aria-label=\"month\"\n placeholder=\"MM\"\n disabled={this.disabled}\n onPaste={this.handlePaste}\n inputmode=\"number\"\n pattern=\"[0-9]*\"\n onKeyDown={(event) => this.handleKeyDown(event, this.preventMonthInput)}\n ></input>\n );\n\n const yearInput = (\n <input\n id=\"year-input\"\n class=\"year-input\"\n ref={(el) => (this.yearInputEl = el)}\n aria-label=\"year\"\n placeholder=\"YYYY\"\n maxLength={4}\n disabled={this.disabled}\n onPaste={this.handlePaste}\n inputmode=\"number\"\n pattern=\"[0-9]*\"\n onKeyDown={(event) => this.handleKeyDown(event, this.preventYearInput)}\n ></input>\n );\n\n let input;\n\n switch (datePart) {\n case \"D\":\n input = dayInput;\n break;\n case \"M\":\n input = monthInput;\n break;\n case \"Y\":\n input = yearInput;\n }\n\n return input;\n };\n\n // Get input elements in order of chosen date format\n private getInputsInOrder = () => {\n const dateParts = this.dateFormat.split(\"/\");\n\n const inputsInOrder: HTMLInputElement[] = [];\n\n dateParts.forEach((part: string) => {\n inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));\n });\n\n return inputsInOrder;\n };\n\n // To add to the end of assistive hint to make it clearer that each date part has its own input\n // that can be changed individually\n private getDescOfInputsOrder = () => {\n let description;\n\n switch (this.dateFormat) {\n case \"DD/MM/YYYY\":\n description = \"day, month, and year\";\n break;\n case \"MM/DD/YYYY\":\n description = \"month, day, and year\";\n break;\n case \"YYYY/MM/DD\":\n description = \"year, month, and day\";\n }\n\n return description;\n };\n\n // Add 'required' or 'invalid data' to span used in aria-labelledby\n // Many ARIA attributes aren't read out by screen reader when on the input component container\n private getScreenReaderInfo = (validationStatus: string) => {\n let inputDescriptors = \"\";\n\n if (this.required) {\n inputDescriptors += \"required\";\n }\n\n if (validationStatus === IcInformationStatus.Error) {\n inputDescriptors += \" invalid data\";\n }\n\n return inputDescriptors === \"\" ? \"\" : inputDescriptors + \", \";\n };\n\n // Prevent non-number characters being entered\n // ('e' or '.' - which are usually allowed in <input type=\"number\">)\n // And limit the number of characters within each field (2 for day / month, 4 for year)\n // (because 'maxlength' doesn't work on <input type=\"number\">)\n private preventInput = (event: KeyboardEvent, isInputPrevented: boolean) => {\n const key = event.key;\n const input = event.target as HTMLInputElement;\n let selectedString;\n\n if (input) {\n selectedString = input.value.substring(\n input.selectionStart,\n input.selectionEnd\n );\n }\n\n if (\n key === \"e\" ||\n key === \".\" ||\n key === \"-\" ||\n (event.key >= \"0\" &&\n event.key <= \"9\" &&\n isInputPrevented &&\n !selectedString)\n ) {\n event.preventDefault();\n }\n };\n\n // Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day\n // Consider using dateClamp and inDateRange\n private isSelectedDateDisabled = () => {\n const currentDate = new Date();\n this.isAfterMax = false;\n this.isBeforeMin = false;\n\n let disabled = false;\n const isNotToday =\n this.selectedDate.toDateString() !== currentDate.toDateString();\n\n if (this.minDate && this.selectedDate < this.minDate && isNotToday) {\n this.isBeforeMin = true;\n disabled = true;\n }\n\n if (this.maxDate && this.selectedDate > this.maxDate && isNotToday) {\n this.isAfterMax = true;\n disabled = true;\n }\n\n if (this.disableDays.includes(this.selectedDate.getDay())) {\n disabled = true;\n }\n\n if (\n ((this.disablePast && this.selectedDate < currentDate) ||\n (this.disableFuture && this.selectedDate > currentDate)) &&\n isNotToday\n ) {\n disabled = true;\n }\n\n return disabled;\n };\n\n private moveToNextInput = (currentInput: HTMLInputElement) => {\n const currentInputPos = this.inputsInOrder.findIndex(\n (input) => input === currentInput\n );\n const nextInput = this.inputsInOrder[currentInputPos + 1];\n\n this.preventAutoFormatting = false;\n\n if (nextInput) {\n nextInput.focus();\n }\n };\n\n private moveToPreviousInput = (currentInput: HTMLInputElement) => {\n const currentInputPos = this.inputsInOrder.findIndex(\n (input) => input === currentInput\n );\n\n this.preventAutoFormatting = false;\n\n if (this.inputsInOrder[currentInputPos - 1]) {\n this.inputsInOrder[currentInputPos - 1].focus();\n }\n };\n\n private autocompleteInput = (input: HTMLInputElement) => {\n if (input === this.yearInputEl) {\n this.autocompleteYear();\n } else {\n const inputValue = input.value;\n\n // Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)\n if (inputValue.length === 1) {\n if (+inputValue === 0) {\n input.value = \"01\";\n } else {\n input.value = `0${inputValue}`;\n }\n }\n }\n\n if (input.value) {\n this.setInputValue(input);\n }\n };\n\n // Autocomplete year as current millennium when fewer than 4 characters entered\n private autocompleteYear = () => {\n const inputValue = this.yearInputEl.value;\n const yearNumbers = [\"2\", \"0\", \"0\"];\n\n let autocompletedInput = \"\";\n\n if (inputValue) {\n yearNumbers.forEach((number, index) => {\n if (inputValue.length + index <= 3) {\n autocompletedInput += number;\n }\n });\n\n this.yearInputEl.value = `${autocompletedInput}${inputValue}`;\n }\n };\n\n private convertToDate = (\n year: string,\n month: string,\n day: string\n ): Date | null => {\n if (!isEmptyString(year) && !isEmptyString(month) && !isEmptyString(day)) {\n return new Date(+year, +month - 1, +day);\n } else {\n return null;\n }\n };\n\n private handleHostBlur = () => {\n this.removeLabelledBy = false;\n this.icBlur.emit({ value: this.selectedDate });\n };\n\n private handleHostFocus = () => {\n if (this.el.shadowRoot.activeElement?.id.match(/(day|month|year)-input$/)) {\n this.removeLabelledBy = false;\n } else {\n this.removeLabelledBy = true;\n }\n this.icFocus.emit({ value: this.selectedDate });\n };\n\n private handleFormReset = () => {\n // Get the initial value and populate day, month and year again.\n this.setDate(this.initialValue);\n this.setValidationMessage();\n this.handleDateChange(false);\n };\n\n private getAriaLabel = (input: HTMLInputElement): string => {\n return input.getAttribute(this.ARIA_LABEL);\n };\n\n private notifyScreenReaderArrowKeys = (input: HTMLInputElement) => {\n const liveRegion = this.el.shadowRoot.querySelector(\"#live-region\");\n let announcement = \"\";\n const ariaLabel = this.getAriaLabel(input);\n\n if (liveRegion && input.value) {\n if (\n input === this.monthInputEl &&\n !!IcDateInputMonths[+input.value - 1]\n ) {\n announcement = `${input.value} - ${\n IcDateInputMonths[+input.value - 1]\n }, ${ariaLabel}`;\n }\n\n if (input === this.dayInputEl || input === this.yearInputEl) {\n announcement = `${input.value}, ${ariaLabel}`;\n }\n\n liveRegion.textContent = announcement;\n }\n };\n\n private removeAriaLabelledBy() {\n this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);\n }\n\n private setPastedValueAndValidation(\n isValidDate: boolean,\n pastedValue: string,\n event: ClipboardEvent\n ) {\n switch (true) {\n case isValidDate: {\n const nextParsedValue = this.isZuluTime\n ? extractDateFromZuluDateTime(pastedValue)\n : pastedValue;\n const dateParts = nextParsedValue.split(/-|\\/|\\./);\n this.inputsInOrder.forEach((input, index) => {\n input.classList.add(this.FIT_TO_VALUE);\n\n if (this.isZuluTime) {\n this.pasteZuluDateTime(dateParts, index);\n } else {\n let dateValue;\n\n if (input === this.dayInputEl || input === this.monthInputEl) {\n dateValue = this.slicePastedDate(2, dateParts[index]);\n } else {\n dateValue = this.slicePastedDate(4, dateParts[index]);\n }\n\n input.value = dateValue;\n\n this.setInputValue(input);\n this.autocompleteInput(input);\n }\n });\n this.isZuluTime = false;\n break;\n }\n\n case (pastedValue.length === 1 ||\n pastedValue.length === 2 ||\n pastedValue.length === 4) &&\n isNumeric(pastedValue):\n if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {\n // Check if copied value can be pasted into input\n this.setInputPasteValue(event.target, pastedValue);\n this.setInputValue(event.target as HTMLInputElement);\n } else {\n this.displayPastedValidation(event);\n }\n break;\n\n case pastedValue.length === 3 && isNumeric(pastedValue):\n if (event.target !== this.yearInputEl) {\n this.displayPastedValidation(event);\n } else {\n this.setInputPasteValue(event.target, pastedValue);\n this.setInputValue(event.target as HTMLInputElement);\n }\n break;\n\n case pastedValue.length >= 5 && isNumeric(pastedValue):\n this.displayPastedValidation(event);\n }\n }\n\n private pasteZuluDateTime(dateParts: string[], index: number) {\n // ['YYYY', 'MM', 'DD']\n if (index === 0) {\n const dateValue = this.slicePastedDate(4, dateParts[index]);\n this.yearInputEl.value = dateValue;\n this.setInputValue(this.yearInputEl);\n } else if (index === 1) {\n // The month value is the second item in the array\n const dateValue = this.slicePastedDate(2, dateParts[index]);\n this.monthInputEl.value = dateValue;\n this.setInputValue(this.monthInputEl);\n } else {\n const dateValue = this.slicePastedDate(2, dateParts[index]);\n this.dayInputEl.value = dateValue;\n this.setInputValue(this.dayInputEl);\n }\n }\n\n private displayPastedValidation(event: ClipboardEvent) {\n if (this.invalidDateText?.length > 0) {\n this.previousInvalidDateTest = this.invalidDateText;\n }\n\n this.invalidDateText = `Please paste a valid ${this.getAriaLabel(\n event.target as HTMLInputElement\n )}`;\n\n this.validationStatus = IcInformationStatus.Error;\n this.isPasteValidationDisplayed = true;\n }\n\n private setPasteInvalidText() {\n if (this.isPasteValidationDisplayed) {\n this.invalidDateText = this.previousInvalidDateTest ?? \"\";\n this.isPasteValidationDisplayed = false;\n\n // This is to prevent setDate from triggering within componentWillUpdate\n this.isDateSetFromKeyboardEvent = true;\n }\n }\n\n private notifyScreenReader(input: HTMLInputElement, event: Event) {\n const liveRegion = this.el.shadowRoot.querySelector(\"#live-region\");\n\n if (liveRegion) {\n if (this.isKeyboardOrEvent(event)) {\n this.notifyScreenReaderArrowKeys(input);\n } else if (\n Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING\n ) {\n this.notifyScreenReaderInput(input, liveRegion as HTMLElement);\n }\n }\n }\n\n private notifyScreenReaderInput = (\n input: HTMLInputElement,\n liveRegion: HTMLElement\n ) => {\n let announcement = \"\";\n const ariaLabel = this.getAriaLabel(input);\n\n if (input === this.dayInputEl || input === this.monthInputEl) {\n if (input.value.length === 2) {\n if (\n input === this.monthInputEl &&\n !!IcDateInputMonths[+input.value - 1] &&\n this.isValidMonth\n ) {\n announcement = `${input.value} - ${\n IcDateInputMonths[+input.value - 1]\n }, ${ariaLabel}`;\n }\n\n if (input === this.dayInputEl && this.isValidDay) {\n announcement = `${input.value}, ${ariaLabel}`;\n }\n } else {\n announcement = \"\";\n }\n } else {\n if (input.value.length === 4) {\n announcement = `${input.value}, ${ariaLabel}`;\n } else {\n announcement = \"\";\n }\n }\n liveRegion.textContent = announcement;\n };\n\n private setFitToValueStyling = (input: HTMLInputElement) => {\n if (input.value) {\n input.classList.add(this.FIT_TO_VALUE);\n } else {\n input.classList.remove(this.FIT_TO_VALUE);\n }\n };\n\n private setAriaInvalid = (\n validDay: boolean,\n validMonth: boolean,\n validDate: boolean,\n disabledDate: boolean\n ) => {\n if (this.inputsInOrder.length) {\n this.inputsInOrder.forEach((input) => {\n input.removeAttribute(this.ARIA_INVALID);\n });\n\n if (!validDay) {\n this.dayInputEl.setAttribute(this.ARIA_INVALID, \"true\");\n }\n\n if (!validMonth) {\n this.monthInputEl.setAttribute(this.ARIA_INVALID, \"true\");\n }\n\n if (!validDate || disabledDate) {\n this.inputsInOrder.forEach((input) => {\n input.setAttribute(this.ARIA_INVALID, \"true\");\n });\n }\n }\n };\n\n private handleClear = () => {\n this.inputsInOrder.forEach((input) => {\n input.classList.remove(this.FIT_TO_VALUE);\n this.setInputValue(input, true);\n this.setPreventInput(input, false);\n });\n this.isDateSetFromKeyboardEvent = false;\n this.setValidationMessage();\n this.handleDateChange(true);\n\n this.inputsInOrder[0].focus();\n };\n\n private handleCalendarOpen = (ev: MouseEvent) => {\n ev.stopImmediatePropagation();\n this.calendarButtonEl?.shadowRoot\n .querySelector(\"ic-tooltip\")\n .displayTooltip(false);\n this.calendarButtonClicked.emit({ value: this.selectedDate });\n this.calendarButtonEl?.shadowRoot\n .querySelector(\"ic-tooltip\")\n .displayTooltip(false);\n this.isDateSetFromKeyboardEvent = false;\n };\n\n private setValueAndEmitChange = (value: Date) => {\n if (!dateMatches(new Date(this.value), value)) {\n this.emitIcChange(value);\n this.value = value;\n }\n };\n\n private handleCalendarFocus = () => {\n this.calendarFocused = true;\n };\n\n private handleCalendarBlur = () => {\n this.calendarFocused = false;\n };\n\n private handleClearFocus = () => {\n this.removeLabelledBy = true;\n this.clearButtonFocused = true;\n };\n\n private handleClearBlur = (ev: FocusEvent) => {\n this.clearButtonFocused = false;\n if ((ev.relatedTarget as HTMLElement)?.id.match(/(day|year)-input$/)) {\n this.removeLabelledBy = false;\n return;\n }\n\n this.removeLabelledBy = true;\n };\n\n private emitIcChange = (d: Date) => {\n if (\n !(d === null && this.previousEmittedDate === null) &&\n !dateMatches(d, this.previousEmittedDate)\n ) {\n this.previousEmittedDate = d;\n this.icChange.emit({ value: d });\n }\n };\n\n render() {\n const {\n inputId,\n label,\n disabled,\n helperText,\n hideHelperText,\n hideLabel,\n showClearButton,\n showCalendarButton,\n size,\n theme,\n } = this;\n\n const hasCustomValidation = !isEmptyString(this.validationStatus);\n\n const validationStatus = hasCustomValidation\n ? this.validationStatus\n : !isEmptyString(this.invalidDateText)\n ? IcInformationStatus.Error\n : \"\";\n\n const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;\n\n renderHiddenInput(\n true,\n this.el,\n this.name,\n this.convertToDate(this.year, this.month, this.day),\n this.disabled\n );\n\n return (\n <Host\n class={{\n [`ic-theme-${theme}`]: theme !== \"inherit\",\n [`ic-date-input-disabled`]: disabled,\n }}\n onBlur={this.handleHostBlur}\n onFocus={this.handleHostFocus}\n >\n <ic-input-container disabled={disabled}>\n {!(hideLabel && hideHelperText) && (\n <ic-input-label\n for={inputId}\n label={label}\n hideLabel={hideLabel}\n helperText={!hideHelperText ? helperText : \"\"}\n disabled={disabled}\n ></ic-input-label>\n )}\n <span id={this.screenReaderInfoId} class=\"sr-only\" aria-hidden=\"true\">\n {this.getScreenReaderInfo(validationStatus)}\n {hideLabel && `${label}\\n`}\n {hideHelperText && `${helperText}\\n`}\n {`${this.defaultHelperText}.`}\n </span>\n <span id={this.assistiveHintId} class=\"sr-only\" aria-hidden=\"true\">\n {assistiveHint}\n </span>\n <span id=\"live-region\" aria-live=\"assertive\" class=\"sr-only\"></span>\n <ic-input-component-container\n id={inputId}\n ref={(el: HTMLIcInputComponentContainerElement) =>\n (this.inputCompContainerEl = el)\n }\n disabled={disabled}\n validationStatus={validationStatus}\n size={size}\n role=\"group\"\n class={{ [`ic-theme-${theme}`]: theme !== \"inherit\" }}\n >\n <div class=\"input-container\">\n <div class=\"date-inputs\">\n {this.getInputsInOrder()[0]}/{this.getInputsInOrder()[1]}/\n {this.getInputsInOrder()[2]}\n </div>\n <div class=\"action-buttons\">\n {showClearButton && (\n <ic-button\n id=\"clear-button\"\n aria-label=\"Clear input\"\n class={{\n [\"clear-button\"]: true,\n [\"hidden\"]:\n isEmptyString(this.day) &&\n isEmptyString(this.month) &&\n isEmptyString(this.year),\n }}\n disabled={this.disabled}\n innerHTML={Clear}\n onClick={this.handleClear}\n onFocus={this.handleClearFocus}\n onBlur={this.handleClearBlur}\n variant=\"icon-tertiary\"\n theme={this.clearButtonFocused ? \"light\" : \"dark\"}\n size={size}\n ></ic-button>\n )}\n {showCalendarButton && (\n <div class=\"show-calendar-button-wrapper\">\n <div class={{ divider: true, [size]: true }}></div>\n <ic-button\n id=\"calendar-button\"\n ref={(el: HTMLIcButtonElement) =>\n (this.calendarButtonEl = el)\n }\n aria-label=\"Display calendar\"\n aria-haspopup=\"dialog\"\n class=\"calendar-button\"\n disabled={this.disabled}\n innerHTML={Calendar}\n onClick={this.handleCalendarOpen}\n variant=\"icon-tertiary\"\n size={size}\n onFocus={this.handleCalendarFocus}\n onBlur={this.handleCalendarBlur}\n theme={this.calendarFocused ? \"light\" : \"dark\"}\n ></ic-button>\n </div>\n )}\n </div>\n </div>\n </ic-input-component-container>\n <span id={this.selectedDateInfoId} class=\"sr-only\" aria-live=\"polite\">\n <span\n ref={(el) => (this.selectedDateInfoEl = el)}\n role=\"status\"\n ></span>\n </span>\n {(hasCustomValidation || !isEmptyString(this.invalidDateText)) && (\n <ic-input-validation\n status={validationStatus}\n message={\n hasCustomValidation ? this.validationText : this.invalidDateText\n }\n for={inputId}\n ></ic-input-validation>\n )}\n </ic-input-container>\n </Host>\n );\n }\n}\n"],"mappings":"ilCAAA,MAAMA,EAAiB,01MACvB,MAAAC,EAAeD,EC2Cf,IAAIE,EAAW,E,MASFC,EAAS,MAPtB,WAAAC,CAAAC,G,0KAQUC,KAAAC,aAAe,eACfD,KAAAE,WAAa,aACbF,KAAAG,iBAAmB,kBAKnBH,KAAAI,oBAAsB,iBACtBJ,KAAAK,aAAe,eAEfL,KAAAM,aAAeN,KAAKO,MAEpBP,KAAAQ,0BAA4B,sBAC5BR,KAAAS,cAAoC,GAEpCT,KAAAU,WAAsB,MACtBV,KAAAW,YAAuB,MACvBX,KAAAY,2BAAsC,MACtCZ,KAAAa,eAA0B,MAE1Bb,KAAAc,WAAsB,KACtBd,KAAAe,aAAwB,KACxBf,KAAAgB,YAA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]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["icPopoverMenuCss","IcPopoverMenuStyle0","PopoverMenu","constructor","hostRef","this","ARIA_LABEL","popoverMenuEls","openingFromChild","openingFromParent","submenuLevel","theme","open","undefined","setButtonFocus","_a","currentFocus","focus","findAnchorEl","anchor","anchorElement","submenuId","console","error","document","querySelector","indexOf","isNotPopoverMenuEl","ev","id","tagName","target","getNextItemToSelect","currentItem","movingDown","numButtons","length","nextItem","addMenuItems","elements","i","el","push","groupSlotWrapper","shadowRoot","menuGroupElements","getSlotElements","getMenuAriaLabel","ariaLabel","getAttribute","isPropDefined","parentLabel","handleBackButtonClick","parentPopover","openFromChild","initPopperJS","anchorEl","popperInstance","createPopper","placement","modifiers","name","options","offset","fallbackPlacements","rootBoundary","watchOpenHandler","popoverArr","parentElement","querySelectorAll","forEach","popover","some","menuItem","backButton","unshift","setTimeout","destroy","disconnectedCallback","componentDidLoad","slotWrapper","popoverMenuElements","componentWillRender","componentDidRender","handleMenuItemClick","detail","submenuTriggerFor","label","closeMenu","handleSubmenuChange","childEl","openFromParent","handleClick","handleKeyDown","key","preventDefault","blur","setFocusToAnchor","menuElement","icPopoverClosed","emit","render","h","Host","class","menu","role","ref","onClick","slot","viewBox","fill","xmlns","d","variant","delegatesFocus"],"sources":["../web-components/dist/collection/components/ic-popover-menu/ic-popover-menu.css?tag=ic-popover-menu&encapsulation=shadow","../web-components/dist/collection/components/ic-popover-menu/ic-popover-menu.js"],"sourcesContent":["/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the `main` element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on `h1` elements within `section` and\n * `article` contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput {\n /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect {\n /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type=\"button\"],\n[type=\"reset\"],\n[type=\"submit\"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type=\"button\"]::-moz-focus-inner,\n[type=\"reset\"]::-moz-focus-inner,\n[type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type=\"button\"]:-moz-focusring,\n[type=\"reset\"]:-moz-focusring,\n[type=\"submit\"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from `fieldset` elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * `fieldset` elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type=\"checkbox\"],\n[type=\"radio\"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type=\"number\"]::-webkit-inner-spin-button,\n[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type=\"search\"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to `inherit` in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n\nhtml,\nbody,\ndiv,\nspan,\napplet,\nobject,\niframe,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\np,\nblockquote,\npre,\na,\nabbr,\nacronym,\naddress,\nbig,\ncite,\ncode,\ndel,\ndfn,\nem,\nimg,\nins,\nkbd,\nq,\ns,\nsamp,\nsmall,\nstrike,\nstrong,\nsub,\nsup,\ntt,\nvar,\nb,\nu,\ni,\ncenter,\ndl,\ndt,\ndd,\nol,\nul,\nli,\nfieldset,\nform,\nlabel,\nlegend,\ntable,\ncaption,\ntbody,\ntfoot,\nthead,\ntr,\nth,\ntd,\narticle,\naside,\ncanvas,\ndetails,\nembed,\nfigure,\nfigcaption,\nfooter,\nheader,\nhgroup,\nmenu,\nnav,\noutput,\nruby,\nsection,\nsummary,\ntime,\nmark,\naudio,\nvideo {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font-style: inherit;\n vertical-align: baseline;\n}\n\n\n/**\n* @prop --ic-z-index-popover: z-index of popover menu. \n* @prop --max-height: Maximum height of the popover menu.\n* @prop --popover-width: Default width of the popover menu.\n*/\n\n@media (prefers-reduced-motion: no-preference) {\n :host .opening-from-parent {\n animation: slide-in var(--ic-transition-duration-slow) ease-in-out;\n }\n\n :host .opening-from-child {\n animation: slide-out var(--ic-transition-duration-slow) ease-in-out;\n }\n}\n\n:host {\n border-radius: var(--ic-border-radius);\n color: var(--ic-popover-nav-text);\n\n --ic-typography-color: var(--ic-popover-nav-text);\n\n position: relative;\n z-index: var(--ic-z-index-popover);\n box-sizing: border-box;\n box-shadow: var(--ic-elevation-overlay);\n display: none;\n}\n\n:host(.on-dialog) {\n inset: auto !important;\n}\n\n:host(.on-dialog-fix-translate) {\n transform: translate(0, var(--ic-space-xs)) !important;\n}\n\n:host(.on-dialog-translate-y) {\n transform: translate(0, calc(-1 * var(--translate-y))) !important;\n}\n\n.menu {\n border: var(--ic-border-default);\n border-color: var(--ic-popover-border);\n border-radius: var(--ic-border-radius);\n background-color: var(--ic-popover-background);\n visibility: hidden;\n height: 0;\n}\n\n.button {\n text-decoration: none;\n list-style-type: none;\n}\n\n:host(:focus-within) {\n box-shadow: var(--ic-border-focus);\n}\n\n.menu:focus-visible {\n outline: none;\n}\n\n:host(.ic-popover-menu-open) {\n display: block;\n min-width: calc(20rem - var(--ic-space-xl));\n width: var(--popover-width, 20rem);\n max-width: calc(100vw - var(--ic-space-xl));\n}\n\n:host(.ic-popover-menu-open) .menu {\n visibility: visible;\n height: -moz-fit-content;\n height: fit-content;\n max-height: var(--max-height, -moz-fit-content);\n max-height: var(--max-height, fit-content);\n overflow-y: auto;\n overflow-x: hidden;\n}\n\n.parent-label {\n --ic-typography-color: var(--ic-popover-parent-label);\n\n margin: var(--ic-space-xs) var(--ic-space-xs) 0;\n}\n\n@keyframes slide-in {\n from {\n opacity: 0;\n transform: translateX(10rem);\n }\n\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slide-out {\n from {\n opacity: 0;\n transform: translateX(-10rem);\n }\n\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n","import { Host, h, } from \"@stencil/core\";\nimport { getSlotElements, isPropDefined } from \"../../utils/helpers\";\nimport { createPopper } from \"@popperjs/core\";\nexport class PopoverMenu {\n constructor() {\n this.ARIA_LABEL = \"aria-label\";\n this.popoverMenuEls = [];\n this.openingFromChild = false;\n this.openingFromParent = false;\n /**\n * @internal The level of menu being displayed.\n */\n this.submenuLevel = 1;\n /**\n * Sets the theme color to the dark or light theme color. \"inherit\" will set the color based on the system settings or ic-theme component.\n */\n this.theme = \"inherit\";\n /**\n * If `true`, the popover menu will be displayed.\n */\n this.open = undefined;\n this.setButtonFocus = () => {\n var _a;\n (_a = this.popoverMenuEls[this.currentFocus]) === null || _a === void 0 ? void 0 : _a.focus();\n };\n // Checks that the popover menu has an anchor\n this.findAnchorEl = (anchor) => {\n let anchorElement = null;\n if (!anchor) {\n this.submenuId === undefined &&\n console.error(\"No anchor specified for popover component\");\n }\n else {\n anchorElement = document.querySelector(anchor.indexOf(\"#\") === 0 ? anchor : \"#\" + anchor);\n if (anchorElement === null) {\n console.error(`Popover anchor element '${anchor}' not found`);\n }\n }\n return anchorElement;\n };\n this.isNotPopoverMenuEl = (ev) => {\n const { id, tagName } = ev.target;\n return (id !== this.anchor &&\n tagName !== \"IC-MENU-ITEM\" &&\n tagName !== \"IC-MENU-GROUP\" &&\n tagName !== \"IC-POPOVER-MENU\");\n };\n this.getNextItemToSelect = (currentItem, movingDown) => {\n const numButtons = this.popoverMenuEls.length - 1;\n if (currentItem < 1) {\n currentItem = 0;\n }\n let nextItem = movingDown ? currentItem + 1 : currentItem - 1;\n // Check if wrap around necessary\n if (nextItem < 0) {\n nextItem = numButtons;\n }\n else if (nextItem > numButtons) {\n nextItem = 0;\n }\n return nextItem;\n };\n this.addMenuItems = (elements) => {\n var _a;\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n if (el.tagName === \"IC-MENU-ITEM\") {\n this.popoverMenuEls.push(el);\n }\n else if (el.tagName === \"IC-MENU-GROUP\") {\n const groupSlotWrapper = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(\".menu-items-wrapper\");\n if (groupSlotWrapper) {\n const menuGroupElements = getSlotElements(groupSlotWrapper);\n menuGroupElements && this.addMenuItems(menuGroupElements);\n }\n }\n }\n };\n this.getMenuAriaLabel = () => {\n const ariaLabel = this.el.getAttribute(this.ARIA_LABEL);\n if (isPropDefined(this.submenuId)) {\n return `${ariaLabel}, within nested level ${this.submenuLevel} ${this.parentLabel} submenu,`;\n }\n else {\n return ariaLabel;\n }\n };\n this.handleBackButtonClick = () => {\n var _a;\n (_a = this.parentPopover) === null || _a === void 0 ? void 0 : _a.openFromChild();\n this.open = false;\n };\n this.initPopperJS = () => {\n if (this.anchorEl) {\n this.popperInstance = createPopper(this.anchorEl, this.el, {\n placement: \"bottom-start\",\n modifiers: [\n {\n name: \"offset\",\n options: {\n offset: [0, 4],\n },\n },\n {\n name: \"flip\",\n options: {\n fallbackPlacements: [\"top-start\", \"top-end\", \"bottom-end\"],\n rootBoundary: \"viewport\",\n },\n },\n ],\n });\n }\n };\n }\n watchOpenHandler() {\n var _a;\n const popoverArr = (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`ic-popover-menu`);\n if (this.open) {\n if (popoverArr.length > 0) {\n popoverArr.forEach((popover) => {\n if (popover !== this.el) {\n popover.open = false;\n }\n });\n }\n if (this.parentPopover !== undefined &&\n !this.popoverMenuEls.some((menuItem) => menuItem.id)) {\n this.backButton && this.popoverMenuEls.unshift(this.backButton);\n }\n this.currentFocus = 0;\n // Needed so that anchorEl isn't always focused\n setTimeout(this.setButtonFocus, 50);\n }\n else if (this.popperInstance) {\n if (popoverArr.length > 0) {\n popoverArr.forEach((popover) => {\n if (popover !== this.el) {\n popover.open = false;\n }\n });\n }\n this.popperInstance.destroy();\n this.popperInstance = null;\n }\n }\n disconnectedCallback() {\n if (this.popperInstance) {\n this.popperInstance.destroy();\n this.popperInstance = null;\n }\n }\n componentDidLoad() {\n var _a;\n const slotWrapper = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(\"ul.button\");\n if (slotWrapper) {\n const popoverMenuElements = getSlotElements(slotWrapper);\n if (popoverMenuElements !== null) {\n this.addMenuItems(popoverMenuElements);\n }\n }\n if (this.submenuId === undefined &&\n this.el.getAttribute(this.ARIA_LABEL) === null) {\n console.error(`No aria-label specified for popover menu component - aria-label required`);\n }\n }\n componentWillRender() {\n this.anchorEl = this.findAnchorEl(this.anchor);\n }\n componentDidRender() {\n if (this.open && !this.popperInstance) {\n this.initPopperJS();\n }\n }\n handleMenuItemClick(ev) {\n if (!ev.detail.submenuTriggerFor && ev.detail.label !== \"Back\") {\n this.closeMenu(false, ev.detail);\n }\n }\n // This is listening for the event emitted when a menu item is acting as a trigger button\n handleSubmenuChange(ev) {\n // Finds the trigger menu item that has emitted the event\n const target = ev.target;\n this.open = false;\n // Find the popover menu that the menu item triggers (i.e. submenu-trigger-for === submenu-id).\n const childEl = document.querySelector(`ic-popover-menu[submenu-id=${target.submenuTriggerFor}]`);\n // Set the parent popover menu of the submenu and open the submenu\n childEl.parentPopover = this.el;\n childEl.anchor = this.anchor;\n childEl.ariaLabel = this.el.getAttribute(this.ARIA_LABEL);\n childEl.openFromParent();\n childEl.submenuLevel = this.submenuLevel + 1;\n // Set the label in the submenu using the label of the menu item that has emitted the event\n childEl.parentLabel = target.label;\n }\n handleClick(ev) {\n if (this.open && this.isNotPopoverMenuEl(ev)) {\n // If menu is open and the next click on the document is not a popover El, close the popover\n this.closeMenu();\n }\n }\n // Manages the keyboard navigation in the popover menu\n handleKeyDown(ev) {\n switch (ev.key) {\n case \"ArrowDown\":\n case \"ArrowUp\":\n ev.preventDefault();\n this.currentFocus = this.getNextItemToSelect(this.currentFocus, ev.key === \"ArrowDown\");\n this.setButtonFocus();\n break;\n case \"Home\":\n //Sets home focus as first element, or back button\n this.currentFocus = 0;\n this.setButtonFocus();\n break;\n case \"End\":\n //Sets end focus as last element\n this.currentFocus = this.popoverMenuEls.length - 1;\n this.setButtonFocus();\n break;\n case \"Escape\":\n case \"Tab\":\n ev.preventDefault();\n if (this.open) {\n this.closeMenu(true);\n this.el.blur();\n }\n break;\n }\n }\n /**\n * @internal Opens the menu from the child menu.\n */\n async openFromChild() {\n this.open = true;\n this.openingFromChild = true;\n setTimeout(() => (this.openingFromChild = false), 1000);\n }\n /**\n * @internal Opens the menu from the parent menu.\n */\n async openFromParent() {\n this.open = true;\n this.openingFromParent = true;\n setTimeout(() => (this.openingFromParent = false), 1000);\n }\n /**\n * @internal Close the menu, emit icPopoverClosed of the root popover\n * @param setFocusToAnchor when true return focus to anchor element when menu is closed\n */\n async closeMenu(setFocusToAnchor = false, menuElement) {\n var _a;\n this.open = false;\n if (this.parentPopover) {\n this.parentPopover.closeMenu(setFocusToAnchor, menuElement);\n }\n else {\n if (setFocusToAnchor) {\n (_a = this.anchorEl) === null || _a === void 0 ? void 0 : _a.focus();\n }\n this.icPopoverClosed.emit(menuElement);\n }\n }\n render() {\n return (h(Host, { key: '0d600ea25ae46dca927e100d1c0f321afff64b01', class: {\n [\"ic-popover-menu-open\"]: !!this.open,\n [`ic-theme-${this.theme}`]: this.theme !== \"inherit\",\n } }, h(\"div\", { key: 'c94ec7dcd89b7a9bcfed03d5def6cf1be0243d50', id: this.parentPopover === undefined\n ? `ic-popover-submenu-${this.submenuId}`\n : \"\", class: {\n menu: true,\n } }, h(\"span\", { key: 'a01071126c2bbd39f26e837988efabdd07fd3da8', class: {\n \"opening-from-parent\": this.openingFromParent,\n \"opening-from-child\": this.openingFromChild,\n } }, isPropDefined(this.submenuId) && (h(\"span\", { key: 'c5f225a965cb77832d77ad895e6feb070f61fc33' }, h(\"span\", { key: '1d5e3ff2f1c52e10bc8646ba04858be20b40c8c2', role: \"menu\" }, h(\"ic-menu-item\", { key: '4b3f0324f21ed33b24df68cb72ea16d5704b97b4', class: \"ic-popover-submenu-back-button\", ref: (el) => (this.backButton = el), label: \"Back\", onClick: this.handleBackButtonClick, id: `ic-popover-submenu-back-button-${this.submenuLevel}` }, h(\"svg\", { key: 'cb9d8fdcef344a5d8659516de8baac5856b776bf', slot: \"icon\", viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", class: \"submenu-back-icon\" }, h(\"path\", { key: '1d79d4c02b06b5651878ebf11d4a6d6428a6f45e', d: \"M20 11H7.83L13.42 5.41L12 4L4 12L12 20L13.41 18.59L7.83 13H20V11Z\", fill: \"currentColor\" })))), h(\"ic-typography\", { key: '594d0374d03ec7764afe48b2e8d5959f39eb761d', variant: \"subtitle-small\", class: \"parent-label\" }, this.parentLabel))), h(\"ul\", { key: '7fa43dcda50ed5740f3922955e26c08946377f2e', class: \"button\", \"aria-label\": this.getMenuAriaLabel(), role: \"menu\" }, h(\"slot\", { key: '25da236864fe2afd3f94fe53a41b180566490e1f' }))))));\n }\n static get is() { return \"ic-popover-menu\"; }\n static get encapsulation() { return \"shadow\"; }\n static get delegatesFocus() { return true; }\n static get originalStyleUrls() {\n return {\n \"$\": [\"ic-popover-menu.css\"]\n };\n }\n static get styleUrls() {\n return {\n \"$\": [\"ic-popover-menu.css\"]\n };\n }\n static get properties() {\n return {\n \"anchor\": {\n \"type\": \"string\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"string\",\n \"resolved\": \"string | undefined\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": true,\n \"docs\": {\n \"tags\": [],\n \"text\": \"The ID of the element the popover menu will anchor itself to. This is required unless the popover is a submenu.\"\n },\n \"getter\": false,\n \"setter\": false,\n \"attribute\": \"anchor\",\n \"reflect\": false\n },\n \"parentLabel\": {\n \"type\": \"string\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"string\",\n \"resolved\": \"string | undefined\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": true,\n \"docs\": {\n \"tags\": [{\n \"name\": \"internal\",\n \"text\": \"The parent popover menu of a child popover menu.\"\n }],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false,\n \"attribute\": \"parent-label\",\n \"reflect\": false\n },\n \"parentPopover\": {\n \"type\": \"unknown\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"HTMLIcPopoverMenuElement\",\n \"resolved\": \"HTMLIcPopoverMenuElement | undefined\",\n \"references\": {\n \"HTMLIcPopoverMenuElement\": {\n \"location\": \"global\",\n \"id\": \"global::HTMLIcPopoverMenuElement\"\n }\n }\n },\n \"required\": false,\n \"optional\": true,\n \"docs\": {\n \"tags\": [{\n \"name\": \"internal\",\n \"text\": \"The parent popover menu of a child popover menu.\"\n }],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false\n },\n \"submenuId\": {\n \"type\": \"string\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"string\",\n \"resolved\": \"string | undefined\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": true,\n \"docs\": {\n \"tags\": [],\n \"text\": \"The unique identifier for a popover submenu.\"\n },\n \"getter\": false,\n \"setter\": false,\n \"attribute\": \"submenu-id\",\n \"reflect\": false\n },\n \"submenuLevel\": {\n \"type\": \"number\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"number\",\n \"resolved\": \"number | undefined\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": true,\n \"docs\": {\n \"tags\": [{\n \"name\": \"internal\",\n \"text\": \"The level of menu being displayed.\"\n }],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false,\n \"attribute\": \"submenu-level\",\n \"reflect\": false,\n \"defaultValue\": \"1\"\n },\n \"theme\": {\n \"type\": \"string\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"IcThemeMode\",\n \"resolved\": \"\\\"dark\\\" | \\\"inherit\\\" | \\\"light\\\" | undefined\",\n \"references\": {\n \"IcThemeMode\": {\n \"location\": \"import\",\n \"path\": \"../../utils/types\",\n \"id\": \"src/utils/types.ts::IcThemeMode\"\n }\n }\n },\n \"required\": false,\n \"optional\": true,\n \"docs\": {\n \"tags\": [],\n \"text\": \"Sets the theme color to the dark or light theme color. \\\"inherit\\\" will set the color based on the system settings or ic-theme component.\"\n },\n \"getter\": false,\n \"setter\": false,\n \"attribute\": \"theme\",\n \"reflect\": false,\n \"defaultValue\": \"\\\"inherit\\\"\"\n },\n \"open\": {\n \"type\": \"boolean\",\n \"mutable\": true,\n \"complexType\": {\n \"original\": \"boolean | undefined\",\n \"resolved\": \"boolean | undefined\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": true,\n \"docs\": {\n \"tags\": [],\n \"text\": \"If `true`, the popover menu will be displayed.\"\n },\n \"getter\": false,\n \"setter\": false,\n \"attribute\": \"open\",\n \"reflect\": true,\n \"defaultValue\": \"undefined\"\n }\n };\n }\n static get states() {\n return {\n \"openingFromChild\": {},\n \"openingFromParent\": {}\n };\n }\n static get events() {\n return [{\n \"method\": \"icPopoverClosed\",\n \"name\": \"icPopoverClosed\",\n \"bubbles\": true,\n \"cancelable\": true,\n \"composed\": true,\n \"docs\": {\n \"tags\": [],\n \"text\": \"Emitted when the popover menu is closed.\"\n },\n \"complexType\": {\n \"original\": \"HTMLIcMenuItemElement\",\n \"resolved\": \"HTMLIcMenuItemElement\",\n \"references\": {\n \"HTMLIcMenuItemElement\": {\n \"location\": \"global\",\n \"id\": \"global::HTMLIcMenuItemElement\"\n }\n }\n }\n }];\n }\n static get methods() {\n return {\n \"openFromChild\": {\n \"complexType\": {\n \"signature\": \"() => Promise<void>\",\n \"parameters\": [],\n \"references\": {\n \"Promise\": {\n \"location\": \"global\",\n \"id\": \"global::Promise\"\n }\n },\n \"return\": \"Promise<void>\"\n },\n \"docs\": {\n \"text\": \"\",\n \"tags\": [{\n \"name\": \"internal\",\n \"text\": \"Opens the menu from the child menu.\"\n }]\n }\n },\n \"openFromParent\": {\n \"complexType\": {\n \"signature\": \"() => Promise<void>\",\n \"parameters\": [],\n \"references\": {\n \"Promise\": {\n \"location\": \"global\",\n \"id\": \"global::Promise\"\n }\n },\n \"return\": \"Promise<void>\"\n },\n \"docs\": {\n \"text\": \"\",\n \"tags\": [{\n \"name\": \"internal\",\n \"text\": \"Opens the menu from the parent menu.\"\n }]\n }\n },\n \"closeMenu\": {\n \"complexType\": {\n \"signature\": \"(setFocusToAnchor?: boolean, menuElement?: HTMLIcMenuItemElement) => Promise<void>\",\n \"parameters\": [{\n \"name\": \"setFocusToAnchor\",\n \"type\": \"boolean\",\n \"docs\": \"when true return focus to anchor element when menu is closed\"\n }, {\n \"name\": \"menuElement\",\n \"type\": \"HTMLIcMenuItemElement | undefined\",\n \"docs\": \"\"\n }],\n \"references\": {\n \"Promise\": {\n \"location\": \"global\",\n \"id\": \"global::Promise\"\n },\n \"HTMLIcMenuItemElement\": {\n \"location\": \"global\",\n \"id\": \"global::HTMLIcMenuItemElement\"\n }\n },\n \"return\": \"Promise<void>\"\n },\n \"docs\": {\n \"text\": \"\",\n \"tags\": [{\n \"name\": \"internal\",\n \"text\": \"Close the menu, emit icPopoverClosed of the root popover\"\n }, {\n \"name\": \"param\",\n \"text\": \"setFocusToAnchor when true return focus to anchor element when menu is closed\"\n }]\n }\n }\n };\n }\n static get elementRef() { return \"el\"; }\n static get watchers() {\n return [{\n \"propName\": \"open\",\n \"methodName\": \"watchOpenHandler\"\n }];\n }\n static get listeners() {\n return [{\n \"name\": \"handleMenuItemClick\",\n \"method\": \"handleMenuItemClick\",\n \"target\": undefined,\n \"capture\": false,\n \"passive\": false\n }, {\n \"name\": \"triggerPopoverMenuInstance\",\n \"method\": \"handleSubmenuChange\",\n \"target\": undefined,\n \"capture\": true,\n \"passive\": false\n }, {\n \"name\": \"click\",\n \"method\": \"handleClick\",\n \"target\": \"document\",\n \"capture\": false,\n \"passive\": false\n }, {\n \"name\": \"keydown\",\n \"method\": \"handleKeyDown\",\n \"target\": undefined,\n \"capture\": false,\n \"passive\": false\n }];\n }\n}\n//# sourceMappingURL=ic-popover-menu.js.map\n"],"mappings":"+IAAA,MAAMA,EAAmB,yiIACzB,MAAAC,EAAeD,E,MCEFE,EAAW,MACpB,WAAAC,CAAAC,G,2DACIC,KAAKC,WAAa,aAClBD,KAAKE,eAAiB,GACtBF,KAAKG,iBAAmB,MACxBH,KAAKI,kBAAoB,MAIzBJ,KAAKK,aAAe,EAIpBL,KAAKM,MAAQ,UAIbN,KAAKO,KAAOC,UACZR,KAAKS,eAAiB,KAClB,IAAIC,GACHA,EAAKV,KAAKE,eAAeF,KAAKW,iBAAmB,MAAQD,SAAY,OAAS,EAAIA,EAAGE,OAAO,EAGjGZ,KAAKa,aAAgBC,IACjB,IAAIC,EAAgB,KACpB,IAAKD,EAAQ,CACTd,KAAKgB,YAAcR,WACfS,QAAQC,MAAM,4C,KAEjB,CACDH,EAAgBI,SAASC,cAAcN,EAAOO,QAAQ,OAAS,EAAIP,EAAS,IAAMA,GAClF,GAAIC,IAAkB,KAAM,CACxBE,QAAQC,MAAM,2BAA2BJ,e,EAGjD,OAAOC,CAAa,EAExBf,KAAKsB,mBAAsBC,IACvB,MAAMC,GAAEA,EAAEC,QAAEA,GAAYF,EAAGG,OAC3B,OAAQF,IAAOxB,KAAKc,QAChBW,IAAY,gBACZA,IAAY,iBACZA,IAAY,iBAAiB,EAErCzB,KAAK2B,oBAAsB,CAACC,EAAaC,KACrC,MAAMC,EAAa9B,KAAKE,eAAe6B,OAAS,EAChD,GAAIH,EAAc,EAAG,CACjBA,EAAc,C,CAElB,IAAII,EAAWH,EAAaD,EAAc,EAAIA,EAAc,EAE5D,GAAII,EAAW,EAAG,CACdA,EAAWF,C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,0 @@
1
- import{r as e,h as i,H as t,g as s}from"./p-00135a74.js";import{q as a,i as c,a as r}from"./p-afde50b8.js";const h=':host{display:block;width:var(--tree-view-width, 100%);background-color:var(--ic-tree-view-background)}:host .heading-area-container{border-bottom:var(--ic-space-1px) solid var(--ic-tree-view-divider);display:flex;align-items:center;min-height:calc(\n var(--ic-space-xl) + var(--ic-space-xs) - var(--ic-space-1px)\n );padding:0 var(--ic-space-xs);--ic-typography-color:var(--ic-tree-view-text)}:host(.ic-tree-view-small) .heading-area-container{min-height:calc(var(--ic-space-xl) - var(--ic-space-1px))}:host(.ic-tree-view-large) .heading-area-container{min-height:calc(var(--ic-space-xxl) - var(--ic-space-1px))}:host(.ic-tree-view-truncate) .heading-area-container{height:calc(var(--ic-space-xl) + var(--ic-space-xs) - var(--ic-space-1px))}:host(.ic-tree-view-truncate.ic-tree-view-small) .heading-area-container{height:calc(var(--ic-space-xl) - var(--ic-space-1px))}:host(.ic-tree-view-truncate.ic-tree-view-large) .heading-area-container{height:calc(var(--ic-space-xxl) - var(--ic-space-1px))}.icon-container{width:var(--ic-space-lg);min-width:var(--ic-space-lg);height:var(--ic-space-lg);margin:0 var(--ic-space-xs) 0 0}:host(.ic-tree-view-small) .icon-container{margin:0 var(--ic-space-xxs) 0 0}.ic-text-overflow{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.ic-tooltip-overflow{overflow:hidden}.tree-view-header.with-padding{padding-right:var(--ic-space-xs)}.tree-items-container-hidden{visibility:hidden}::slotted([slot="icon"]){fill:var(--ic-tree-view-icon)}@media (forced-colors: active){::slotted([slot="icon"]){fill:currentcolor}}';const n=h;let o=0;const l=class{constructor(i){e(this,i);this.treeViewId=`ic-tree-view-${o++}`;this.treeItemTag="IC-TREE-ITEM";this.hostMutationObserver=null;this.isLoaded=false;this.focusInset=false;this.heading="";this.size="medium";this.theme="inherit";this.truncateHeading=false;this.truncateTreeItems=false;this.handleKeyDown=e=>{var i;const t=this.treeItems.indexOf(this.treeItems.filter((e=>e===document.activeElement))[0]);const s=(i=this.treeItems[t])===null||i===void 0?void 0:i.expanded;switch(e.key){case"ArrowDown":this.treeItems[this.getNextItemToSelect(t,true)].setFocus();if(t!==this.treeItems.length-1){e.preventDefault()}break;case"ArrowUp":this.treeItems[this.getNextItemToSelect(t,false)].setFocus();if(t!==0){e.preventDefault()}break;case"ArrowRight":if(this.treeItems[t].isParent&&!s){this.treeItems[t].expanded=true;this.treeItems[t].hasParentExpanded=true;this.treeItems[t].updateAriaLabel()}else if(this.treeItems[t].isParent&&s){this.treeItems[t].children[0].setFocus()}e.preventDefault();break;case"ArrowLeft":if(this.treeItems[t].isParent&&s){this.treeItems[t].expanded=false;this.treeItems[t].hasParentExpanded=false;this.treeItems[t].updateAriaLabel()}else if(this.treeItems[t].parentElement.tagName===this.treeItemTag){this.treeItems[t].parentElement.setFocus()}e.preventDefault();break}};this.getNextItemToSelect=(e,i)=>{const t=this.treeItems.length-1;if(e<1){e=0}let s=i?e+1:e-1;if(s<0){s=0}else if(s>t){s=t}const a=t+1;let c=0;while(c<a){if(s<0||s>t){return e}if(!this.treeItems[s].disabled&&(this.treeItems[s].parentElement.tagName!==this.treeItemTag||this.treeItems[s].parentElement.expanded)){return s}if(s===t&&this.treeItems[s].disabled){return e}s=i?s+1:s-1;c++}return e};this.linkTreeItems=()=>{this.treeItems.forEach((e=>{e.setAttribute("context-id",this.treeViewId)}))};this.setTreeItems=()=>{this.treeItems=this.getAllTreeItems(this.el);this.linkTreeItems()};this.addSlotChangeListener=()=>{this.el.addEventListener("slotchange",this.setTreeItems)};this.truncateTreeViewHeading=()=>{const e=this.el.shadowRoot.querySelector(".tree-view-header");const i=e===null||e===void 0?void 0:e.closest("ic-tooltip");const t=this.el.shadowRoot.querySelector(".heading-area-container");if((e===null||e===void 0?void 0:e.scrollHeight)>(t===null||t===void 0?void 0:t.clientHeight)){e.classList.add("ic-text-overflow");if(!i){const i=document.createElement("ic-tooltip");i.setAttribute("target",this.el.id);i.setAttribute("label",e.textContent);i.classList.add("ic-tooltip-overflow");i.setAttribute("placement","right");t.appendChild(i);i.appendChild(e)}}};this.isHeadingDefined=()=>a(this.heading)&&this.heading!==null;this.hasHeadingAreaContent=()=>c(this.el,"heading")||this.isHeadingDefined()||c(this.el,"icon")}watchFocusInsetHandler(){this.treeItems.forEach((e=>{e.focusInset=this.focusInset}))}watchSizeHandler(){this.treeItems.forEach((e=>{e.size=this.size}))}watchThemeHandler(){this.treeItems.forEach((e=>{e.theme=this.theme}))}watchTruncateTreeItemsHandler(){this.treeItems.forEach((e=>{if(e.truncateTreeItem===undefined){e.truncateTreeItem=this.truncateTreeItems}}))}disconnectedCallback(){var e,i;(e=this.el)===null||e===void 0?void 0:e.removeEventListener("slotchange",this.setTreeItems);(i=this.hostMutationObserver)===null||i===void 0?void 0:i.disconnect()}componentWillLoad(){this.setTreeItems();this.watchSizeHandler();this.watchFocusInsetHandler();this.watchThemeHandler();this.watchTruncateTreeItemsHandler()}componentDidRender(){this.truncateHeading&&this.truncateTreeViewHeading()}componentDidLoad(){this.addSlotChangeListener();this.hostMutationObserver=new MutationObserver((e=>r(e,"icon",this)));this.hostMutationObserver.observe(this.el,{childList:true});this.isLoaded=true}handleTreeItemSelected(e){this.treeItems.forEach((i=>{if(i.selected&&i.id!==e.detail.id){i.selected=false}}))}getAllTreeItems(e){const i=[];const t=e=>{Array.from(e.children).forEach((e=>{if(e.tagName===this.treeItemTag){i.push(e)}t(e)}))};t(e);return i}render(){const{heading:e,isLoaded:s,size:a,theme:r,truncateHeading:h}=this;return i(t,{key:"e0979a6b323b02bc65afceea69ee953527d269f1","context-id":this.treeViewId,class:{[`ic-tree-view-${a}`]:a!=="medium",[`ic-theme-${r}`]:r!=="inherit","ic-tree-view-truncate":h},onKeyDown:this.handleKeyDown,"aria-label":this.isHeadingDefined()?e:null},this.hasHeadingAreaContent()&&i("div",{key:"b72efd1f1be26cd539fac41f436deda54eb4b6ed",class:"heading-area-container"},c(this.el,"icon")&&i("div",{key:"e3d21bac85aa59bd1adabd18c20a9c7afd20ccb4",class:"icon-container"},i("slot",{key:"972af4222049f8b197832a42f3620f43544215d1",name:"icon"})),i("ic-typography",{key:"905866b6d0606c26b6910c9b725f0ff66948f069",variant:"subtitle-large",class:{"tree-view-header":true,"with-padding":this.truncateHeading&&!s}},c(this.el,"heading")?i("slot",{name:"heading"}):e)),i("slot",{key:"4d4337a008d71ca0be19f05510539480eb7de290"}))}get el(){return s(this)}static get watchers(){return{focusInset:["watchFocusInsetHandler"],size:["watchSizeHandler"],theme:["watchThemeHandler"],truncateTreeItems:["watchTruncateTreeItemsHandler"]}}};l.style=n;export{l as ic_tree_view};
2
- //# sourceMappingURL=p-cd59dc16.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["icTreeViewCss","IcTreeViewStyle0","treeViewIds","TreeView","constructor","hostRef","this","treeViewId","treeItemTag","hostMutationObserver","isLoaded","focusInset","heading","size","theme","truncateHeading","truncateTreeItems","handleKeyDown","event","focussedChild","treeItems","indexOf","filter","el","document","activeElement","expanded","_a","key","getNextItemToSelect","setFocus","length","preventDefault","isParent","hasParentExpanded","updateAriaLabel","children","parentElement","tagName","currentItem","movingDown","numItems","nextItem","maxAttempts","attempts","disabled","linkTreeItems","forEach","treeItem","setAttribute","setTreeItems","getAllTreeItems","addSlotChangeListener","addEventListener","truncateTreeViewHeading","typographyEl","shadowRoot","querySelector","tooltip","closest","headingContainer","scrollHeight","clientHeight","classList","add","tooltipEl","createElement","id","textContent","appendChild","isHeadingDefined","isPropDefined","hasHeadingAreaContent","isSlotUsed","watchFocusInsetHandler","watchSizeHandler","watchThemeHandler","watchTruncateTreeItemsHandler","truncateTreeItem","undefined","disconnectedCallback","removeEventListener","_b","disconnect","componentWillLoad","componentDidRender","componentDidLoad","MutationObserver","mutationList","renderDynamicChildSlots","observe","childList","handleTreeItemSelected","selected","detail","element","collectTreeItems","Array","from","child","push","render","h","Host","class","onKeyDown","name","variant"],"sources":["src/components/ic-tree-view/ic-tree-view.css?tag=ic-tree-view&encapsulation=shadow","src/components/ic-tree-view/ic-tree-view.tsx"],"sourcesContent":["/**\n* @prop --tree-view-width: Width of the tree view\n*/\n\n:host {\n display: block;\n width: var(--tree-view-width, 100%);\n background-color: var(--ic-tree-view-background);\n}\n\n:host .heading-area-container {\n border-bottom: var(--ic-space-1px) solid var(--ic-tree-view-divider);\n display: flex;\n align-items: center;\n min-height: calc(\n var(--ic-space-xl) + var(--ic-space-xs) - var(--ic-space-1px)\n );\n padding: 0 var(--ic-space-xs);\n\n --ic-typography-color: var(--ic-tree-view-text);\n}\n\n:host(.ic-tree-view-small) .heading-area-container {\n min-height: calc(var(--ic-space-xl) - var(--ic-space-1px));\n}\n\n:host(.ic-tree-view-large) .heading-area-container {\n min-height: calc(var(--ic-space-xxl) - var(--ic-space-1px));\n}\n\n:host(.ic-tree-view-truncate) .heading-area-container {\n height: calc(var(--ic-space-xl) + var(--ic-space-xs) - var(--ic-space-1px));\n}\n\n:host(.ic-tree-view-truncate.ic-tree-view-small) .heading-area-container {\n height: calc(var(--ic-space-xl) - var(--ic-space-1px));\n}\n\n:host(.ic-tree-view-truncate.ic-tree-view-large) .heading-area-container {\n height: calc(var(--ic-space-xxl) - var(--ic-space-1px));\n}\n\n.icon-container {\n width: var(--ic-space-lg);\n min-width: var(--ic-space-lg);\n height: var(--ic-space-lg);\n margin: 0 var(--ic-space-xs) 0 0;\n}\n\n:host(.ic-tree-view-small) .icon-container {\n margin: 0 var(--ic-space-xxs) 0 0;\n}\n\n.ic-text-overflow {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ic-tooltip-overflow {\n overflow: hidden;\n}\n\n/* Ensures truncation works - accounts for text width increase as component hydrates */\n.tree-view-header.with-padding {\n padding-right: var(--ic-space-xs);\n}\n\n.tree-items-container-hidden {\n visibility: hidden;\n}\n\n::slotted([slot=\"icon\"]) {\n fill: var(--ic-tree-view-icon);\n}\n\n/** High Contrast **/\n@media (forced-colors: active) {\n ::slotted([slot=\"icon\"]) {\n fill: currentcolor;\n }\n}\n","import {\n Component,\n h,\n Prop,\n Element,\n Host,\n Watch,\n State,\n Listen,\n} from \"@stencil/core\";\nimport { IcSizes, IcThemeMode } from \"../../utils/types\";\nimport {\n isPropDefined,\n isSlotUsed,\n renderDynamicChildSlots,\n} from \"../../utils/helpers\";\n\nlet treeViewIds = 0;\n\n/**\n * @slot heading - Content is set as the tree view heading.\n * @slot icon - Content is placed to the left of the heading.\n */\n\n@Component({\n tag: \"ic-tree-view\",\n styleUrl: \"ic-tree-view.css\",\n shadow: true,\n})\nexport class TreeView {\n private treeViewId = `ic-tree-view-${treeViewIds++}`;\n private treeItemTag = \"IC-TREE-ITEM\";\n private hostMutationObserver: MutationObserver = null;\n private isLoaded = false;\n\n @Element() el: HTMLIcTreeViewElement;\n\n @State() treeItems: HTMLIcTreeItemElement[];\n\n /**\n * If `true`, tree items will have inset focus.\n */\n @Prop() focusInset?: boolean = false;\n @Watch(\"focusInset\")\n watchFocusInsetHandler(): void {\n this.treeItems.forEach((treeItem) => {\n treeItem.focusInset = this.focusInset;\n });\n }\n\n /**\n * The heading of the tree view.\n */\n @Prop() heading?: string = \"\";\n\n /**\n * The size of the tree view.\n */\n @Prop() size?: IcSizes = \"medium\";\n @Watch(\"size\")\n watchSizeHandler(): void {\n this.treeItems.forEach((treeItem) => {\n treeItem.size = this.size;\n });\n }\n\n /**\n * Sets the theme color to the dark or light theme color. \"inherit\" will set the color based on the system settings or ic-theme component.\n */\n @Prop() theme?: IcThemeMode = \"inherit\";\n @Watch(\"theme\")\n watchThemeHandler(): void {\n this.treeItems.forEach((treeItem) => {\n treeItem.theme = this.theme;\n });\n }\n\n /**\n * If `true`, the tree view heading will be truncated instead of text wrapping.\n */\n @Prop() truncateHeading?: boolean = false;\n\n /**\n * If `true`, tree items will be truncated, unless they are individually overridden.\n */\n @Prop() truncateTreeItems?: boolean = false;\n @Watch(\"truncateTreeItems\")\n watchTruncateTreeItemsHandler(): void {\n this.treeItems.forEach((treeItem) => {\n if (treeItem.truncateTreeItem === undefined) {\n treeItem.truncateTreeItem = this.truncateTreeItems;\n }\n });\n }\n\n disconnectedCallback(): void {\n this.el?.removeEventListener(\"slotchange\", this.setTreeItems);\n\n this.hostMutationObserver?.disconnect();\n }\n componentWillLoad(): void {\n this.setTreeItems();\n\n this.watchSizeHandler();\n this.watchFocusInsetHandler();\n this.watchThemeHandler();\n this.watchTruncateTreeItemsHandler();\n }\n\n componentDidRender(): void {\n this.truncateHeading && this.truncateTreeViewHeading();\n }\n\n componentDidLoad(): void {\n this.addSlotChangeListener();\n\n this.hostMutationObserver = new MutationObserver((mutationList) =>\n renderDynamicChildSlots(mutationList, \"icon\", this)\n );\n this.hostMutationObserver.observe(this.el, {\n childList: true,\n });\n\n this.isLoaded = true;\n }\n\n @Listen(\"icTreeItemSelected\")\n handleTreeItemSelected(event: CustomEvent): void {\n this.treeItems.forEach((treeItem) => {\n if (treeItem.selected && treeItem.id !== event.detail.id) {\n treeItem.selected = false;\n }\n });\n }\n\n private handleKeyDown = (event: KeyboardEvent): void => {\n const focussedChild = this.treeItems.indexOf(\n this.treeItems.filter((el) => el === document.activeElement)[0]\n );\n const expanded = this.treeItems[focussedChild]?.expanded;\n switch (event.key) {\n case \"ArrowDown\":\n this.treeItems[\n this.getNextItemToSelect(focussedChild, true)\n ].setFocus();\n if (focussedChild !== this.treeItems.length - 1) {\n event.preventDefault();\n }\n break;\n case \"ArrowUp\":\n this.treeItems[\n this.getNextItemToSelect(focussedChild, false)\n ].setFocus();\n if (focussedChild !== 0) {\n event.preventDefault();\n }\n break;\n case \"ArrowRight\":\n if (this.treeItems[focussedChild].isParent && !expanded) {\n this.treeItems[focussedChild].expanded = true;\n this.treeItems[focussedChild].hasParentExpanded = true;\n this.treeItems[focussedChild].updateAriaLabel();\n } else if (this.treeItems[focussedChild].isParent && expanded) {\n (\n this.treeItems[focussedChild].children[0] as HTMLIcTreeItemElement\n ).setFocus();\n }\n event.preventDefault();\n break;\n case \"ArrowLeft\":\n if (this.treeItems[focussedChild].isParent && expanded) {\n this.treeItems[focussedChild].expanded = false;\n this.treeItems[focussedChild].hasParentExpanded = false;\n this.treeItems[focussedChild].updateAriaLabel();\n } else if (\n this.treeItems[focussedChild].parentElement.tagName ===\n this.treeItemTag\n ) {\n (\n this.treeItems[focussedChild].parentElement as HTMLIcTreeItemElement\n ).setFocus();\n }\n event.preventDefault();\n break;\n }\n };\n\n private getNextItemToSelect = (\n currentItem: number,\n movingDown: boolean\n ): number => {\n const numItems = this.treeItems.length - 1;\n\n if (currentItem < 1) {\n currentItem = 0;\n }\n\n let nextItem = movingDown ? currentItem + 1 : currentItem - 1;\n if (nextItem < 0) {\n nextItem = 0;\n } else if (nextItem > numItems) {\n nextItem = numItems;\n }\n\n const maxAttempts = numItems + 1;\n let attempts = 0;\n\n while (attempts < maxAttempts) {\n if (nextItem < 0 || nextItem > numItems) {\n return currentItem;\n }\n\n if (\n !this.treeItems[nextItem].disabled &&\n (this.treeItems[nextItem].parentElement.tagName !== this.treeItemTag ||\n (this.treeItems[nextItem].parentElement as HTMLIcTreeItemElement)\n .expanded)\n ) {\n return nextItem;\n }\n\n if (nextItem === numItems && this.treeItems[nextItem].disabled) {\n return currentItem;\n }\n\n nextItem = movingDown ? nextItem + 1 : nextItem - 1;\n attempts++;\n }\n\n return currentItem;\n };\n\n private linkTreeItems = () => {\n this.treeItems.forEach((treeItem) => {\n treeItem.setAttribute(\"context-id\", this.treeViewId);\n });\n };\n\n private setTreeItems = () => {\n this.treeItems = this.getAllTreeItems(this.el as HTMLElement);\n\n this.linkTreeItems();\n };\n\n private getAllTreeItems(element: HTMLElement): HTMLIcTreeItemElement[] {\n const treeItems: HTMLIcTreeItemElement[] = [];\n\n const collectTreeItems = (el: HTMLElement) => {\n Array.from(el.children).forEach((child) => {\n if (child.tagName === this.treeItemTag) {\n treeItems.push(child as HTMLIcTreeItemElement);\n }\n\n collectTreeItems(child as HTMLElement);\n });\n };\n\n collectTreeItems(element);\n return treeItems;\n }\n\n private addSlotChangeListener = () => {\n this.el.addEventListener(\"slotchange\", this.setTreeItems);\n };\n\n private truncateTreeViewHeading = () => {\n const typographyEl: HTMLIcTypographyElement =\n this.el.shadowRoot.querySelector(\".tree-view-header\");\n const tooltip = typographyEl?.closest(\"ic-tooltip\");\n const headingContainer: HTMLElement = this.el.shadowRoot.querySelector(\n \".heading-area-container\"\n );\n\n if (typographyEl?.scrollHeight > headingContainer?.clientHeight) {\n typographyEl.classList.add(\"ic-text-overflow\");\n\n if (!tooltip) {\n const tooltipEl = document.createElement(\"ic-tooltip\");\n tooltipEl.setAttribute(\"target\", this.el.id);\n tooltipEl.setAttribute(\"label\", typographyEl.textContent);\n tooltipEl.classList.add(\"ic-tooltip-overflow\");\n tooltipEl.setAttribute(\"placement\", \"right\");\n headingContainer.appendChild(tooltipEl);\n tooltipEl.appendChild(typographyEl);\n }\n }\n };\n\n private isHeadingDefined = () =>\n isPropDefined(this.heading) && this.heading !== null;\n\n private hasHeadingAreaContent = (): boolean => {\n return (\n isSlotUsed(this.el, \"heading\") ||\n this.isHeadingDefined() ||\n isSlotUsed(this.el, \"icon\")\n );\n };\n\n render() {\n const { heading, isLoaded, size, theme, truncateHeading } = this;\n\n return (\n <Host\n context-id={this.treeViewId}\n class={{\n [`ic-tree-view-${size}`]: size !== \"medium\",\n [`ic-theme-${theme}`]: theme !== \"inherit\",\n \"ic-tree-view-truncate\": truncateHeading,\n }}\n onKeyDown={this.handleKeyDown}\n aria-label={this.isHeadingDefined() ? heading : null}\n >\n {this.hasHeadingAreaContent() && (\n <div class=\"heading-area-container\">\n {isSlotUsed(this.el, \"icon\") && (\n <div class=\"icon-container\">\n <slot name=\"icon\" />\n </div>\n )}\n <ic-typography\n variant=\"subtitle-large\"\n class={{\n \"tree-view-header\": true,\n \"with-padding\": this.truncateHeading && !isLoaded,\n }}\n >\n {isSlotUsed(this.el, \"heading\") ? (\n <slot name=\"heading\" />\n ) : (\n heading\n )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