@itwin/components-react 4.14.0 → 4.15.0

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 (212) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/lib/cjs/components-react/common/ImageRenderer.d.ts.map +1 -1
  3. package/lib/cjs/components-react/common/ImageRenderer.js +5 -1
  4. package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
  5. package/lib/cjs/components-react/datepicker/DateField.d.ts.map +1 -1
  6. package/lib/cjs/components-react/datepicker/DateField.js.map +1 -1
  7. package/lib/cjs/components-react/datepicker/DatePicker.d.ts +2 -2
  8. package/lib/cjs/components-react/datepicker/DatePicker.js +1 -1
  9. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  10. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts +2 -2
  11. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  12. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +1 -1
  13. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  14. package/lib/cjs/components-react/datepicker/IntlFormatter.d.ts +1 -1
  15. package/lib/cjs/components-react/datepicker/IntlFormatter.js +1 -1
  16. package/lib/cjs/components-react/datepicker/IntlFormatter.js.map +1 -1
  17. package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
  18. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  19. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  20. package/lib/cjs/components-react/editors/PopupButton.js +2 -1
  21. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  22. package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
  23. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  24. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +2 -2
  25. package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
  26. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +20 -5
  27. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  28. package/lib/cjs/components-react/filtering/FilteringInput.d.ts.map +1 -1
  29. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  30. package/lib/cjs/components-react/filtering/ResultSelector.d.ts.map +1 -1
  31. package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
  32. package/lib/cjs/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
  33. package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
  34. package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
  35. package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
  36. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
  37. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  38. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  39. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  40. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  41. package/lib/cjs/components-react/propertygrid/component/PropertyList.js.map +1 -1
  42. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts +4 -3
  43. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  44. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +10 -3
  45. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  46. package/lib/cjs/components-react/toolbar/Item.d.ts.map +1 -1
  47. package/lib/cjs/components-react/toolbar/Item.js.map +1 -1
  48. package/lib/cjs/components-react/toolbar/ItemWrapper.d.ts.map +1 -1
  49. package/lib/cjs/components-react/toolbar/ItemWrapper.js.map +1 -1
  50. package/lib/cjs/components-react/toolbar/Items.d.ts.map +1 -1
  51. package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
  52. package/lib/cjs/components-react/toolbar/Overflow.d.ts +2 -1
  53. package/lib/cjs/components-react/toolbar/Overflow.d.ts.map +1 -1
  54. package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
  55. package/lib/cjs/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
  56. package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
  57. package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
  58. package/lib/cjs/components-react/toolbar/PopupItem.js +3 -1
  59. package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
  60. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -1
  61. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  62. package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  63. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +1 -0
  64. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  65. package/lib/cjs/components-react/toolbar/Toolbar.d.ts +2 -2
  66. package/lib/cjs/components-react/toolbar/Toolbar.js +1 -1
  67. package/lib/cjs/components-react/toolbar/Toolbar.js.map +1 -1
  68. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +2 -2
  69. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  70. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +1 -1
  71. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  72. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.d.ts.map +1 -1
  73. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.js.map +1 -1
  74. package/lib/cjs/components-react/toolbar/groupPanel/Column.d.ts.map +1 -1
  75. package/lib/cjs/components-react/toolbar/groupPanel/Column.js.map +1 -1
  76. package/lib/cjs/components-react/toolbar/groupPanel/Columns.d.ts.map +1 -1
  77. package/lib/cjs/components-react/toolbar/groupPanel/Columns.js.map +1 -1
  78. package/lib/cjs/components-react/toolbar/groupPanel/Panel.d.ts.map +1 -1
  79. package/lib/cjs/components-react/toolbar/groupPanel/Panel.js.map +1 -1
  80. package/lib/cjs/components-react/toolbar/groupPanel/Title.d.ts.map +1 -1
  81. package/lib/cjs/components-react/toolbar/groupPanel/Title.js.map +1 -1
  82. package/lib/cjs/components-react/toolbar/groupPanel/tool/Expander.d.ts +1 -1
  83. package/lib/cjs/components-react/toolbar/groupPanel/tool/Expander.d.ts.map +1 -1
  84. package/lib/cjs/components-react/toolbar/groupPanel/tool/Expander.js.map +1 -1
  85. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
  86. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  87. package/lib/cjs/components-react/toolbar/useDragInteraction.d.ts.map +1 -1
  88. package/lib/cjs/components-react/toolbar/useDragInteraction.js +1 -0
  89. package/lib/cjs/components-react/toolbar/useDragInteraction.js.map +1 -1
  90. package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
  91. package/lib/cjs/components-react/tree/controlled/TreeHooks.js +1 -0
  92. package/lib/cjs/components-react/tree/controlled/TreeHooks.js.map +1 -1
  93. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  94. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  95. package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
  96. package/lib/cjs/components-react/tree/controlled/component/NodeContent.js +3 -1
  97. package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  98. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  99. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +6 -2
  100. package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  101. package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js +6 -1
  102. package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  103. package/lib/cjs/components-react.d.ts +0 -1
  104. package/lib/cjs/components-react.d.ts.map +1 -1
  105. package/lib/cjs/components-react.js +0 -1
  106. package/lib/cjs/components-react.js.map +1 -1
  107. package/lib/esm/components-react/common/ImageRenderer.d.ts.map +1 -1
  108. package/lib/esm/components-react/common/ImageRenderer.js +5 -1
  109. package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
  110. package/lib/esm/components-react/datepicker/DateField.d.ts.map +1 -1
  111. package/lib/esm/components-react/datepicker/DateField.js.map +1 -1
  112. package/lib/esm/components-react/datepicker/DatePicker.d.ts +2 -2
  113. package/lib/esm/components-react/datepicker/DatePicker.js +1 -1
  114. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  115. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts +2 -2
  116. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  117. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +1 -1
  118. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  119. package/lib/esm/components-react/datepicker/IntlFormatter.d.ts +1 -1
  120. package/lib/esm/components-react/datepicker/IntlFormatter.js +1 -1
  121. package/lib/esm/components-react/datepicker/IntlFormatter.js.map +1 -1
  122. package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
  123. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  124. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  125. package/lib/esm/components-react/editors/PopupButton.js +2 -1
  126. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  127. package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
  128. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  129. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +2 -2
  130. package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
  131. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +20 -5
  132. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  133. package/lib/esm/components-react/filtering/FilteringInput.d.ts.map +1 -1
  134. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  135. package/lib/esm/components-react/filtering/ResultSelector.d.ts.map +1 -1
  136. package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
  137. package/lib/esm/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
  138. package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
  139. package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
  140. package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
  141. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
  142. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  143. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  144. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  145. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  146. package/lib/esm/components-react/propertygrid/component/PropertyList.js.map +1 -1
  147. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts +4 -3
  148. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  149. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +10 -3
  150. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  151. package/lib/esm/components-react/toolbar/Item.d.ts.map +1 -1
  152. package/lib/esm/components-react/toolbar/Item.js.map +1 -1
  153. package/lib/esm/components-react/toolbar/ItemWrapper.d.ts.map +1 -1
  154. package/lib/esm/components-react/toolbar/ItemWrapper.js.map +1 -1
  155. package/lib/esm/components-react/toolbar/Items.d.ts.map +1 -1
  156. package/lib/esm/components-react/toolbar/Items.js.map +1 -1
  157. package/lib/esm/components-react/toolbar/Overflow.d.ts +2 -1
  158. package/lib/esm/components-react/toolbar/Overflow.d.ts.map +1 -1
  159. package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
  160. package/lib/esm/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
  161. package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
  162. package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
  163. package/lib/esm/components-react/toolbar/PopupItem.js +3 -1
  164. package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
  165. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +1 -1
  166. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  167. package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  168. package/lib/esm/components-react/toolbar/PopupItemsPanel.js +1 -0
  169. package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  170. package/lib/esm/components-react/toolbar/Toolbar.d.ts +2 -2
  171. package/lib/esm/components-react/toolbar/Toolbar.js +1 -1
  172. package/lib/esm/components-react/toolbar/Toolbar.js.map +1 -1
  173. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +2 -2
  174. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  175. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +1 -1
  176. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  177. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.d.ts.map +1 -1
  178. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.js.map +1 -1
  179. package/lib/esm/components-react/toolbar/groupPanel/Column.d.ts.map +1 -1
  180. package/lib/esm/components-react/toolbar/groupPanel/Column.js.map +1 -1
  181. package/lib/esm/components-react/toolbar/groupPanel/Columns.d.ts.map +1 -1
  182. package/lib/esm/components-react/toolbar/groupPanel/Columns.js.map +1 -1
  183. package/lib/esm/components-react/toolbar/groupPanel/Panel.d.ts.map +1 -1
  184. package/lib/esm/components-react/toolbar/groupPanel/Panel.js.map +1 -1
  185. package/lib/esm/components-react/toolbar/groupPanel/Title.d.ts.map +1 -1
  186. package/lib/esm/components-react/toolbar/groupPanel/Title.js.map +1 -1
  187. package/lib/esm/components-react/toolbar/groupPanel/tool/Expander.d.ts +1 -1
  188. package/lib/esm/components-react/toolbar/groupPanel/tool/Expander.d.ts.map +1 -1
  189. package/lib/esm/components-react/toolbar/groupPanel/tool/Expander.js.map +1 -1
  190. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
  191. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  192. package/lib/esm/components-react/toolbar/useDragInteraction.d.ts.map +1 -1
  193. package/lib/esm/components-react/toolbar/useDragInteraction.js +1 -0
  194. package/lib/esm/components-react/toolbar/useDragInteraction.js.map +1 -1
  195. package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
  196. package/lib/esm/components-react/tree/controlled/TreeHooks.js +1 -0
  197. package/lib/esm/components-react/tree/controlled/TreeHooks.js.map +1 -1
  198. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  199. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  200. package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
  201. package/lib/esm/components-react/tree/controlled/component/NodeContent.js +3 -1
  202. package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  203. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
  204. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +6 -2
  205. package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
  206. package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js +6 -1
  207. package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  208. package/lib/esm/components-react.d.ts +0 -1
  209. package/lib/esm/components-react.d.ts.map +1 -1
  210. package/lib/esm/components-react.js +0 -1
  211. package/lib/esm/components-react.js.map +1 -1
  212. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ImageRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/ImageRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EACV,KAAK,EAIN,MAAM,gBAAgB,CAAC;AAGxB;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAkC;IAE1D,OAAO,CAAC,WAAW;IAanB,8BAA8B;IAC9B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,KAAK;IAab,OAAO,CAAC,mBAAmB;IAS3B,iCAAiC;IACjC,OAAO,CAAC,SAAS;IAcjB,+BAA+B;IAC/B,OAAO,CAAC,SAAS;IAIjB,sCAAsC;IACtC,OAAO,CAAC,cAAc;IAItB,sDAAsD;IACtD,OAAO,CAAC,0BAA0B;IAIlC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAKzB,yDAAyD;IAClD,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS;CA2BnD"}
1
+ {"version":3,"file":"ImageRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/ImageRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EACV,KAAK,EAIN,MAAM,gBAAgB,CAAC;AAGxB;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAkC;IAE1D,OAAO,CAAC,WAAW;IAanB,8BAA8B;IAC9B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,KAAK;IAab,OAAO,CAAC,mBAAmB;IAS3B,iCAAiC;IACjC,OAAO,CAAC,SAAS;IAcjB,+BAA+B;IAC/B,OAAO,CAAC,SAAS;IAIjB,sCAAsC;IACtC,OAAO,CAAC,cAAc;IAKtB,sDAAsD;IACtD,OAAO,CAAC,0BAA0B;IAIlC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAiB/B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAMzB,yDAAyD;IAClD,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS;CA2BnD"}
@@ -62,6 +62,7 @@ export class ImageRenderer {
62
62
  }
63
63
  /** Render image as core-react icon */
64
64
  renderCoreIcon(iconName) {
65
+ // eslint-disable-next-line deprecation/deprecation
65
66
  return React.createElement(WebFontIcon, { iconName: iconName });
66
67
  }
67
68
  /** Replaces the escaped instances of "\:" with ":" */
@@ -72,7 +73,9 @@ export class ImageRenderer {
72
73
  * Extract class and name from icon name, if the name follows format "{className}:{fontName}".
73
74
  * className and fontName can be escaped using \ if : is needed.
74
75
  */
75
- extractIconClassAndName(iconName) {
76
+ extractIconClassAndName(iconName
77
+ // eslint-disable-next-line deprecation/deprecation
78
+ ) {
76
79
  const matches = iconName.match(/(\\.|[^:])+/g);
77
80
  if (!matches || matches.length !== 2)
78
81
  return {
@@ -90,6 +93,7 @@ export class ImageRenderer {
90
93
  */
91
94
  renderWebfontIcon(iconName) {
92
95
  const iconInfo = this.extractIconClassAndName(iconName);
96
+ // eslint-disable-next-line deprecation/deprecation
93
97
  return React.createElement(WebFontIcon, { ...iconInfo });
94
98
  }
95
99
  /** Render image from data provided by an image loader */
@@ -1 +1 @@
1
- {"version":3,"file":"ImageRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/common/ImageRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,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,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1D,QAAQ,EAAE,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACtD,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,iBAAiB,CAAC,QAAgB;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;QACxD,OAAO,oBAAC,WAAW,OAAK,QAAQ,GAAI,CAAC;IACvC,CAAC;IAED,yDAAyD;IAClD,MAAM,CAAC,WAAkB;QAC9B,QAAQ,WAAW,CAAC,UAAU,EAAE,CAAC;YAC/B,KAAK,QAAQ;gBACX,MAAM,KAAK,GAAG,WAAgC,CAAC;gBAC/C,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;YAE1D,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,SAAS,CAAE,WAA2B,CAAC,KAAK,CAAC,CAAC;YAE5D,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,SAAS,CAAE,WAA2B,CAAC,KAAK,CAAC,CAAC;YAE5D,KAAK,WAAW;gBACd,OAAO,IAAI,CAAC,cAAc,CAAE,WAA2B,CAAC,KAAK,CAAC,CAAC;YAEjE,KAAK,cAAc;gBACjB,OAAO,IAAI,CAAC,iBAAiB,CAAE,WAA2B,CAAC,KAAK,CAAC,CAAC;YAEpE;gBACE,MAAM,mBAAmB,GAAU,WAAW,CAAC,UAAU,CAAC,CAAC,gDAAgD;gBAC3G,mDAAmD;gBACnD,MAAM,IAAI,OAAO,CACf,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EACjC,6BAA6B,mBAAmB,GAAG,CACpD,CAAC;QACN,CAAC;IACH,CAAC;;AAlIc,uBAAS,GAAwB,IAAI,GAAG,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport * as React from \"react\";\nimport type { WebFontIconProps } from \"@itwin/core-react\";\nimport { Icon, WebFontIcon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport type {\n Image,\n ImageFileFormat,\n LoadedBinaryImage,\n LoadedImage,\n} from \"./IImageLoader\";\nimport { UiError } from \"@itwin/appui-abstract\";\n\n/** A class that renders images from data provided by an image loader\n * @internal\n */\nexport class ImageRenderer {\n private static _svgCache: Map<string, string> = new Map();\n\n private hexToBase64(hexstring: string) {\n const match = hexstring.match(/\\w{2}/g);\n if (!match) return \"\";\n\n return window.btoa(\n match\n .map((a) => {\n return String.fromCharCode(parseInt(a, 16));\n })\n .join(\"\")\n );\n }\n\n /** Render raw binary image */\n private renderBinary(data: string, format: ImageFileFormat) {\n // Convert binary to base64\n const dataAsBase64 = this.hexToBase64(data);\n return <img src={`data:image/${format};base64,${dataAsBase64}`} alt=\"\" />;\n }\n\n private isSvg(input: string): boolean {\n const parser = new DOMParser();\n const doc = parser.parseFromString(input, \"application/xml\");\n\n const errorNode = doc.querySelector(\"parsererror\");\n if (errorNode) {\n return false;\n }\n\n const rootNode = doc.documentElement.nodeName.toLowerCase();\n return \"svg\" === rootNode;\n }\n\n private convertSvgToDataUri(svg: string) {\n if (!this.isSvg(svg)) {\n return \"\";\n }\n\n const svgAsBase64 = window.btoa(svg);\n return `data:image/svg+xml;base64,${svgAsBase64}`;\n }\n\n /** Render svg string into JSX */\n private renderSvg(svg: string) {\n let svgAsDataUri = ImageRenderer._svgCache.get(svg);\n if (undefined === svgAsDataUri) {\n svgAsDataUri = this.convertSvgToDataUri(svg.trim());\n ImageRenderer._svgCache.set(svg, svgAsDataUri);\n }\n\n return (\n <div>\n <Icon iconSpec={svgAsDataUri} />\n </div>\n );\n }\n\n /** Render image from an url */\n private renderUrl(url: string) {\n return <img src={url} alt=\"\" />;\n }\n\n /** Render image as core-react icon */\n private renderCoreIcon(iconName: string) {\n return <WebFontIcon iconName={iconName} />;\n }\n\n /** Replaces the escaped instances of \"\\:\" with \":\" */\n private normalizeEscapedIconString(escapedIconString: string) {\n return escapedIconString.replace(/\\\\:/g, \":\");\n }\n\n /**\n * Extract class and name from icon name, if the name follows format \"{className}:{fontName}\".\n * className and fontName can be escaped using \\ if : is needed.\n */\n private extractIconClassAndName(\n iconName: string\n ): Pick<WebFontIconProps, \"iconClassName\" | \"iconName\"> {\n const matches = iconName.match(/(\\\\.|[^:])+/g);\n if (!matches || matches.length !== 2)\n return {\n iconClassName: undefined,\n iconName,\n };\n\n return {\n iconClassName: this.normalizeEscapedIconString(matches[0]),\n iconName: this.normalizeEscapedIconString(matches[1]),\n };\n }\n\n /**\n * Render image as provided webfont icon.\n * Defaults to core-react icon if iconName does not contain className.\n */\n private renderWebfontIcon(iconName: string) {\n const iconInfo = this.extractIconClassAndName(iconName);\n return <WebFontIcon {...iconInfo} />;\n }\n\n /** Render image from data provided by an image loader */\n public render(loadedImage: Image): React.ReactNode {\n switch (loadedImage.sourceType) {\n case \"binary\":\n const image = loadedImage as LoadedBinaryImage;\n return this.renderBinary(image.value, image.fileFormat);\n\n case \"url\":\n return this.renderUrl((loadedImage as LoadedImage).value);\n\n case \"svg\":\n return this.renderSvg((loadedImage as LoadedImage).value);\n\n case \"core-icon\":\n return this.renderCoreIcon((loadedImage as LoadedImage).value);\n\n case \"webfont-icon\":\n return this.renderWebfontIcon((loadedImage as LoadedImage).value);\n\n default:\n const unhandledSourceType: never = loadedImage.sourceType; // Compile time check that all cases are handled\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiComponents.loggerCategory(this),\n `Can't handle sourceType: \"${unhandledSourceType}\"`\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ImageRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/common/ImageRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAE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,6BAA6B,mBAAmB,GAAG,CACpD,CAAC;QACN,CAAC;IACH,CAAC;;AArIc,uBAAS,GAAwB,IAAI,GAAG,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport * as React from \"react\";\nimport type { WebFontIconProps } from \"@itwin/core-react\";\nimport { Icon, WebFontIcon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport type {\n Image,\n ImageFileFormat,\n LoadedBinaryImage,\n LoadedImage,\n} from \"./IImageLoader\";\nimport { UiError } from \"@itwin/appui-abstract\";\n\n/** A class that renders images from data provided by an image loader\n * @internal\n */\nexport class ImageRenderer {\n private static _svgCache: Map<string, string> = new Map();\n\n private hexToBase64(hexstring: string) {\n const match = hexstring.match(/\\w{2}/g);\n if (!match) return \"\";\n\n return window.btoa(\n match\n .map((a) => {\n return String.fromCharCode(parseInt(a, 16));\n })\n .join(\"\")\n );\n }\n\n /** Render raw binary image */\n private renderBinary(data: string, format: ImageFileFormat) {\n // Convert binary to base64\n const dataAsBase64 = this.hexToBase64(data);\n return <img src={`data:image/${format};base64,${dataAsBase64}`} alt=\"\" />;\n }\n\n private isSvg(input: string): boolean {\n const parser = new DOMParser();\n const doc = parser.parseFromString(input, \"application/xml\");\n\n const errorNode = doc.querySelector(\"parsererror\");\n if (errorNode) {\n return false;\n }\n\n const rootNode = doc.documentElement.nodeName.toLowerCase();\n return \"svg\" === rootNode;\n }\n\n private convertSvgToDataUri(svg: string) {\n if (!this.isSvg(svg)) {\n return \"\";\n }\n\n const svgAsBase64 = window.btoa(svg);\n return `data:image/svg+xml;base64,${svgAsBase64}`;\n }\n\n /** Render svg string into JSX */\n private renderSvg(svg: string) {\n let svgAsDataUri = ImageRenderer._svgCache.get(svg);\n if (undefined === svgAsDataUri) {\n svgAsDataUri = this.convertSvgToDataUri(svg.trim());\n ImageRenderer._svgCache.set(svg, svgAsDataUri);\n }\n\n return (\n <div>\n <Icon iconSpec={svgAsDataUri} />\n </div>\n );\n }\n\n /** Render image from an url */\n private renderUrl(url: string) {\n return <img src={url} alt=\"\" />;\n }\n\n /** Render image as core-react icon */\n private renderCoreIcon(iconName: string) {\n // eslint-disable-next-line deprecation/deprecation\n return <WebFontIcon iconName={iconName} />;\n }\n\n /** Replaces the escaped instances of \"\\:\" with \":\" */\n private normalizeEscapedIconString(escapedIconString: string) {\n return escapedIconString.replace(/\\\\:/g, \":\");\n }\n\n /**\n * Extract class and name from icon name, if the name follows format \"{className}:{fontName}\".\n * className and fontName can be escaped using \\ if : is needed.\n */\n private extractIconClassAndName(\n iconName: string\n // eslint-disable-next-line deprecation/deprecation\n ): Pick<WebFontIconProps, \"iconClassName\" | \"iconName\"> {\n const matches = iconName.match(/(\\\\.|[^:])+/g);\n if (!matches || matches.length !== 2)\n return {\n iconClassName: undefined,\n iconName,\n };\n\n return {\n iconClassName: this.normalizeEscapedIconString(matches[0]),\n iconName: this.normalizeEscapedIconString(matches[1]),\n };\n }\n\n /**\n * Render image as provided webfont icon.\n * Defaults to core-react icon if iconName does not contain className.\n */\n private renderWebfontIcon(iconName: string) {\n const iconInfo = this.extractIconClassAndName(iconName);\n // eslint-disable-next-line deprecation/deprecation\n return <WebFontIcon {...iconInfo} />;\n }\n\n /** Render image from data provided by an image loader */\n public render(loadedImage: Image): React.ReactNode {\n switch (loadedImage.sourceType) {\n case \"binary\":\n const image = loadedImage as LoadedBinaryImage;\n return this.renderBinary(image.value, image.fileFormat);\n\n case \"url\":\n return this.renderUrl((loadedImage as LoadedImage).value);\n\n case \"svg\":\n return this.renderSvg((loadedImage as LoadedImage).value);\n\n case \"core-icon\":\n return this.renderCoreIcon((loadedImage as LoadedImage).value);\n\n case \"webfont-icon\":\n return this.renderWebfontIcon((loadedImage as LoadedImage).value);\n\n default:\n const unhandledSourceType: never = loadedImage.sourceType; // Compile time check that all cases are handled\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiComponents.loggerCategory(this),\n `Can't handle sourceType: \"${unhandledSourceType}\"`\n );\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DateField.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,mDAAmD;IACnD,WAAW,EAAE,IAAI,CAAC;IAClB,yDAAyD;IACzD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC;kHAC8G;IAC9G,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,2JAA2J;IAC3J,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,IAAI,EACf,WAAW,CAAC,EAAE,WAAW,EACzB,eAAe,CAAC,EAAE,aAAa,EAC/B,mBAAmB,CAAC,EAAE,oBAAoB,GACzC,MAAM,GAAG,SAAS,CAkEpB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EACxB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,KAAK,EACL,SAAS,GACV,EAAE,cAAc,qBA2FhB"}
1
+ {"version":3,"file":"DateField.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DateField.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AAEH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,mDAAmD;IACnD,WAAW,EAAE,IAAI,CAAC;IAClB,yDAAyD;IACzD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC;kHAC8G;IAC9G,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,2JAA2J;IAC3J,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,IAAI,EACf,WAAW,CAAC,EAAE,WAAW,EACzB,eAAe,CAAC,EAAE,aAAa,EAC/B,mBAAmB,CAAC,EAAE,oBAAoB,GACzC,MAAM,GAAG,SAAS,CAkEpB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EACxB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,KAAK,EACL,SAAS,GACV,EAAE,cAAc,qBA2FhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateField.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DateField.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,WAA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AAC,KAAK,mBACQ,uBAAuB,EACnC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,QAAQ,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,EACjE,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport \"./DateField.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type { DateFormatter } from \"@itwin/appui-abstract\";\nimport { AlternateDateFormats, TimeDisplay } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { Logger } from \"@itwin/core-bentley\";\n\n/** Props for [[DateField]] Component.\n * @internal\n */\nexport interface DateFieldProps extends CommonProps {\n /** Defines initial date and time for component. */\n initialDate: Date;\n /** Function to call when the date or time is changed. */\n onDateChange?: (day: Date) => void;\n /** Optional value to define if edit field allows editing. If a DateFormatter is provided\n * it must provide a parseData function or the field will be read only no matter the setting of this value. */\n readOnly?: boolean;\n /** Optional date formatter that produces an explicit date display */\n dateFormatter?: DateFormatter;\n /** This property has two purposes, the first is specify that the display of time is desired and the second is to define the format of the time display. */\n timeDisplay?: TimeDisplay;\n}\n\n/** Function to format a Date object that is used in control, type editor, and type converter\n * to produce a consistent formatted Date string.\n * @internal\n */\nexport function formatInputDate(\n inputDate: Date,\n timeDisplay?: TimeDisplay,\n customFormatter?: DateFormatter,\n alternateDateFormat?: AlternateDateFormats\n): string | undefined {\n if (customFormatter) {\n return customFormatter.formateDate(inputDate);\n }\n\n if (alternateDateFormat) {\n switch (alternateDateFormat) {\n case AlternateDateFormats.IsoDateTime:\n return inputDate.toISOString();\n case AlternateDateFormats.IsoShort:\n return inputDate.toISOString().slice(0, 10);\n case AlternateDateFormats.UtcDateTime:\n return inputDate.toUTCString().slice(5);\n case AlternateDateFormats.UtcShort:\n return inputDate.toUTCString().slice(5, 16);\n case AlternateDateFormats.UtcDateTimeWithDay:\n return inputDate.toUTCString();\n case AlternateDateFormats.UtcShortWithDay:\n return inputDate.toUTCString().slice(0, 16);\n }\n } else {\n const dateString = inputDate.toLocaleDateString(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n year: \"numeric\",\n });\n let timeString: string = \"\";\n\n if (timeDisplay) {\n switch (timeDisplay) {\n case TimeDisplay.H12MC:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: true,\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n break;\n case TimeDisplay.H12MSC:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: true,\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n break;\n case TimeDisplay.H24M:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: false,\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n if (timeString === \"24:00\") timeString = \"00:00\";\n break;\n case TimeDisplay.H24MS:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: false,\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n if (timeString === \"24:00:00\") timeString = \"00:00:00\";\n break;\n }\n }\n return timeString.length ? `${dateString}, ${timeString}` : dateString;\n }\n}\n\n/** Date input component. This component is typically used by the [[DatePickerPopupButton]] to display and edit date and time.\n * @internal\n */\nexport function DateField({\n initialDate,\n onDateChange,\n readOnly,\n dateFormatter,\n timeDisplay,\n style,\n className,\n}: DateFieldProps) {\n const initialDateRef = React.useRef(initialDate);\n const [hasBadInput, setHasBadInput] = React.useState(false);\n const [inputValue, setInputValue] = React.useState(\n formatInputDate(initialDate, timeDisplay, dateFormatter)\n );\n\n // See if new initialDate props have changed since component mounted\n React.useEffect(() => {\n if (initialDate.getTime() !== initialDateRef.current.getTime()) {\n initialDateRef.current = initialDate;\n }\n setInputValue(formatInputDate(initialDate, timeDisplay, dateFormatter));\n }, [initialDate, dateFormatter, timeDisplay]);\n\n const handleInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setInputValue(event.currentTarget.value);\n },\n []\n );\n\n const parseDate = React.useCallback(\n (dateString: string) => {\n try {\n if (dateFormatter && dateFormatter.parseDate)\n return dateFormatter.parseDate(dateString);\n\n const newDateValue = Date.parse(dateString);\n if (newDateValue) return new Date(newDateValue);\n } catch (_error) {\n Logger.logInfo(\n \"DateField\",\n `Encountered error parsing input value '${dateString}' as a date.`\n );\n return undefined;\n }\n return undefined;\n },\n [dateFormatter]\n );\n\n const updateInputDate = React.useCallback(\n (dateString: string) => {\n try {\n const newDateValue = parseDate(dateString);\n if (newDateValue) {\n const newDate = new Date(newDateValue);\n onDateChange && onDateChange(newDate);\n setHasBadInput(false);\n } else {\n setHasBadInput(true);\n }\n } catch (_error) {\n setHasBadInput(true);\n }\n },\n [onDateChange, parseDate]\n );\n\n const handleOnBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n updateInputDate(event.target.value);\n },\n [updateInputDate]\n );\n\n function onInputKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n if (event.key === \"Enter\") {\n updateInputDate(event.currentTarget.value);\n event.preventDefault();\n }\n }\n const classNames = classnames(\n className,\n \"components-date-input\",\n hasBadInput && \"components-date-has-error\"\n );\n return (\n <Input\n data-testid=\"components-date-input\"\n style={style}\n className={classNames}\n onKeyDown={onInputKeyDown}\n onBlur={handleOnBlur}\n onChange={handleInputChange}\n value={inputValue}\n disabled={readOnly || (dateFormatter && !dateFormatter.parseDate)}\n size=\"small\"\n />\n );\n}\n"]}
1
+ {"version":3,"file":"DateField.js","sourceRoot":"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,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC3C,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IACD,MAAM,UAAU,GAAG,UAAU,CAC3B,SAAS,EACT,uBAAuB,EACvB,WAAW,IAAI,2BAA2B,CAC3C,CAAC;IACF,OAAO,CACL,oBAAC,KAAK,mBACQ,uBAAuB,EACnC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,QAAQ,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,EACjE,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport \"./DateField.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type { DateFormatter } from \"@itwin/appui-abstract\";\nimport { AlternateDateFormats, TimeDisplay } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { Logger } from \"@itwin/core-bentley\";\n\n/** Props for [[DateField]] Component.\n * @internal\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface DateFieldProps extends CommonProps {\n /** Defines initial date and time for component. */\n initialDate: Date;\n /** Function to call when the date or time is changed. */\n onDateChange?: (day: Date) => void;\n /** Optional value to define if edit field allows editing. If a DateFormatter is provided\n * it must provide a parseData function or the field will be read only no matter the setting of this value. */\n readOnly?: boolean;\n /** Optional date formatter that produces an explicit date display */\n dateFormatter?: DateFormatter;\n /** This property has two purposes, the first is specify that the display of time is desired and the second is to define the format of the time display. */\n timeDisplay?: TimeDisplay;\n}\n\n/** Function to format a Date object that is used in control, type editor, and type converter\n * to produce a consistent formatted Date string.\n * @internal\n */\nexport function formatInputDate(\n inputDate: Date,\n timeDisplay?: TimeDisplay,\n customFormatter?: DateFormatter,\n alternateDateFormat?: AlternateDateFormats\n): string | undefined {\n if (customFormatter) {\n return customFormatter.formateDate(inputDate);\n }\n\n if (alternateDateFormat) {\n switch (alternateDateFormat) {\n case AlternateDateFormats.IsoDateTime:\n return inputDate.toISOString();\n case AlternateDateFormats.IsoShort:\n return inputDate.toISOString().slice(0, 10);\n case AlternateDateFormats.UtcDateTime:\n return inputDate.toUTCString().slice(5);\n case AlternateDateFormats.UtcShort:\n return inputDate.toUTCString().slice(5, 16);\n case AlternateDateFormats.UtcDateTimeWithDay:\n return inputDate.toUTCString();\n case AlternateDateFormats.UtcShortWithDay:\n return inputDate.toUTCString().slice(0, 16);\n }\n } else {\n const dateString = inputDate.toLocaleDateString(undefined, {\n day: \"2-digit\",\n month: \"2-digit\",\n year: \"numeric\",\n });\n let timeString: string = \"\";\n\n if (timeDisplay) {\n switch (timeDisplay) {\n case TimeDisplay.H12MC:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: true,\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n break;\n case TimeDisplay.H12MSC:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: true,\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n break;\n case TimeDisplay.H24M:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: false,\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n if (timeString === \"24:00\") timeString = \"00:00\";\n break;\n case TimeDisplay.H24MS:\n timeString = inputDate.toLocaleTimeString(undefined, {\n hour12: false,\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n if (timeString === \"24:00:00\") timeString = \"00:00:00\";\n break;\n }\n }\n return timeString.length ? `${dateString}, ${timeString}` : dateString;\n }\n}\n\n/** Date input component. This component is typically used by the [[DatePickerPopupButton]] to display and edit date and time.\n * @internal\n */\nexport function DateField({\n initialDate,\n onDateChange,\n readOnly,\n dateFormatter,\n timeDisplay,\n style,\n className,\n}: DateFieldProps) {\n const initialDateRef = React.useRef(initialDate);\n const [hasBadInput, setHasBadInput] = React.useState(false);\n const [inputValue, setInputValue] = React.useState(\n formatInputDate(initialDate, timeDisplay, dateFormatter)\n );\n\n // See if new initialDate props have changed since component mounted\n React.useEffect(() => {\n if (initialDate.getTime() !== initialDateRef.current.getTime()) {\n initialDateRef.current = initialDate;\n }\n setInputValue(formatInputDate(initialDate, timeDisplay, dateFormatter));\n }, [initialDate, dateFormatter, timeDisplay]);\n\n const handleInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setInputValue(event.currentTarget.value);\n },\n []\n );\n\n const parseDate = React.useCallback(\n (dateString: string) => {\n try {\n if (dateFormatter && dateFormatter.parseDate)\n return dateFormatter.parseDate(dateString);\n\n const newDateValue = Date.parse(dateString);\n if (newDateValue) return new Date(newDateValue);\n } catch (_error) {\n Logger.logInfo(\n \"DateField\",\n `Encountered error parsing input value '${dateString}' as a date.`\n );\n return undefined;\n }\n return undefined;\n },\n [dateFormatter]\n );\n\n const updateInputDate = React.useCallback(\n (dateString: string) => {\n try {\n const newDateValue = parseDate(dateString);\n if (newDateValue) {\n const newDate = new Date(newDateValue);\n onDateChange && onDateChange(newDate);\n setHasBadInput(false);\n } else {\n setHasBadInput(true);\n }\n } catch (_error) {\n setHasBadInput(true);\n }\n },\n [onDateChange, parseDate]\n );\n\n const handleOnBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n updateInputDate(event.target.value);\n },\n [updateInputDate]\n );\n\n function onInputKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n if (event.key === \"Enter\") {\n updateInputDate(event.currentTarget.value);\n event.preventDefault();\n }\n }\n const classNames = classnames(\n className,\n \"components-date-input\",\n hasBadInput && \"components-date-has-error\"\n );\n return (\n <Input\n data-testid=\"components-date-input\"\n style={style}\n className={classNames}\n onKeyDown={onInputKeyDown}\n onBlur={handleOnBlur}\n onChange={handleInputChange}\n value={inputValue}\n disabled={readOnly || (dateFormatter && !dateFormatter.parseDate)}\n size=\"small\"\n />\n );\n}\n"]}
@@ -6,7 +6,7 @@ import "./DatePicker.scss";
6
6
  /**
7
7
  * Props for [[DatePicker]] component.
8
8
  * @alpha
9
- * @deprecated in 4.11.x. Props of deprecated component {@link DatePicker}.
9
+ * @deprecated in 4.11.0. Props of deprecated component {@link DatePicker}.
10
10
  */
11
11
  export interface DatePickerProps {
12
12
  /** defines both date and time */
@@ -18,7 +18,7 @@ export interface DatePickerProps {
18
18
  }
19
19
  /** DatePicker component. Show a month selector and a day calendar to select a specific date.
20
20
  * @alpha
21
- * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
21
+ * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
22
22
  */
23
23
  export declare function DatePicker(props: DatePickerProps): React.JSX.Element;
24
24
  //# sourceMappingURL=DatePicker.d.ts.map
@@ -21,7 +21,7 @@ function isSameDay(a, b) {
21
21
  }
22
22
  /** DatePicker component. Show a month selector and a day calendar to select a specific date.
23
23
  * @alpha
24
- * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
24
+ * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
25
25
  */
26
26
  // eslint-disable-next-line deprecation/deprecation
27
27
  export function DatePicker(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UA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a,CAClB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport \"./DatePicker.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n * @deprecated in 4.11.x. Props of deprecated component {@link DatePicker}.\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function DatePicker(props: DatePickerProps) {\n const { translate } = useTranslation();\n const previousMonthLabel = translate(\"datepicker.previousMonth\");\n const nextMonthLabel = translate(\"datepicker.nextMonth\");\n const monthsLong = [\n translate(\"month.long.january\"),\n translate(\"month.long.february\"),\n translate(\"month.long.march\"),\n translate(\"month.long.april\"),\n translate(\"month.long.may\"),\n translate(\"month.long.june\"),\n translate(\"month.long.july\"),\n translate(\"month.long.august\"),\n translate(\"month.long.september\"),\n translate(\"month.long.october\"),\n translate(\"month.long.november\"),\n translate(\"month.long.december\"),\n ];\n\n const daysLong = [\n translate(\"days.long.sunday\"),\n translate(\"days.long.monday\"),\n translate(\"days.long.tuesday\"),\n translate(\"days.long.wednesday\"),\n translate(\"days.long.thursday\"),\n translate(\"days.long.friday\"),\n translate(\"days.long.saturday\"),\n ];\n\n const daysShort = [\n translate(\"days.short.sunday\"),\n translate(\"days.short.monday\"),\n translate(\"days.short.tuesday\"),\n translate(\"days.short.wednesday\"),\n translate(\"days.short.thursday\"),\n translate(\"days.short.friday\"),\n translate(\"days.short.saturday\"),\n ];\n\n const [selectedDay, setSelectedDay] = React.useState(\n new Date(props.selected.getTime())\n );\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(\n selectedDay.getMonth()\n );\n const [displayedYear, setDisplayedYear] = React.useState(\n selectedDay.getFullYear()\n );\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n React.useEffect(() => {\n const newSelectedDay = new Date(props.selected);\n setSelectedDay(new Date(props.selected));\n setDisplayedMonthIndex(newSelectedDay.getMonth());\n setDisplayedYear(newSelectedDay.getFullYear());\n setFocusedDay(newSelectedDay);\n }, [props.selected]);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(\n displayedYear,\n displayedMonthIndex,\n 1\n ).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst) offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(\n new Date(displayedYear, displayedMonthIndex, adjustedDay)\n );\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback(\n (newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (\n selectedDay.getFullYear() === newYear &&\n selectedDay.getMonth() === newMonth\n ) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n },\n [focusedDay, selectedDay]\n );\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear =\n displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear =\n displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback(\n (day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n },\n [props]\n );\n\n const handleCalendarKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === Key.ArrowDown.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 7 > 41) setFocusedDay(days[focusedDayIndex % 7]);\n else setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowUp.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 7 < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowLeft.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 1 >= 0) setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowRight.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 1 <= 41) setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === Key.Enter.valueOf() || event.key === \" \") {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n },\n [days, focusedDay, handleOnDayChange]\n );\n\n const previousButtonClass = classnames(\n \"components-previous-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const nextButtonClass = classnames(\n \"components-next-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const calendarClass = classnames(\n \"components-date-picker-calendar-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button\n className={previousButtonClass}\n title={previousMonthLabel}\n onClick={handleMoveToPreviousMonth}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">\n {monthsLong[displayedMonthIndex]} {displayedYear}\n </span>\n <button\n className={nextButtonClass}\n title={nextMonthLabel}\n onClick={handleMoveToNextMonth}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (\n <div\n key={`day-${dayOfWeek}`}\n className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong[dayOfWeek]}\n >\n <span>{daysShort[dayOfWeek]}</span>\n </div>\n ))}\n </div>\n <ul\n tabIndex={0}\n onKeyDown={handleCalendarKeyDown}\n data-testid=\"components-date-picker-calendar-list\"\n className={calendarClass}\n role=\"listbox\"\n >\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive =\n selectedDay && day && isSameDay(selectedDay, day);\n const isFocused =\n focusedDay &&\n day &&\n isSameDay(focusedDay, day) &&\n props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\n \"components-date-picker-calendar-day\",\n isActive && \"selected\",\n !isCurrentMonth && \"notCurrentMonth\",\n isFocused && \"focused\"\n );\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li\n className={classNames}\n key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)}\n role=\"option\"\n aria-selected={isActive}\n data-value={day.getTime()}\n >\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.Fragment>\n ))}\n </ul>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,SAAS,SAAS,CAAC,CAAO,EAAE,CAAO;IACjC,OAAO,CACL,CAAC;QACD,CAAC;QACD,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE;QACnC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC7B,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAC5B,CAAC;AACJ,CAAC;AAgBD;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MAAM,SAAS,GACb,UAAU;gBACV,GAAG;gBACH,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC;gBAC1B,KAAK,CAAC,gBAAgB,CAAC;YACzB,MAAM,cAAc,GAAG,GAAG,CAAC,QAAQ,EAAE,KAAK,mBAAmB,CAAC;YAC9D,MAAM,UAAU,GAAG,UAAU,CAC3B,qCAAqC,EACrC,QAAQ,IAAI,UAAU,EACtB,CAAC,cAAc,IAAI,iBAAiB,EACpC,SAAS,IAAI,SAAS,CACvB,CAAC;YACF,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,OAAO;YACL,oEAAoE;YACpE,4BACE,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,GAAG,aAAa,IAAI,mBAAmB,QAAQ,QAAQ,EAAE,EAC9D,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAC/B,IAAI,EAAC,QAAQ,mBACE,QAAQ,gBACX,GAAG,CAAC,OAAO,EAAE;gBAEzB,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAClB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport \"./DatePicker.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n * @deprecated in 4.11.0. Props of deprecated component {@link DatePicker}.\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function DatePicker(props: DatePickerProps) {\n const { translate } = useTranslation();\n const previousMonthLabel = translate(\"datepicker.previousMonth\");\n const nextMonthLabel = translate(\"datepicker.nextMonth\");\n const monthsLong = [\n translate(\"month.long.january\"),\n translate(\"month.long.february\"),\n translate(\"month.long.march\"),\n translate(\"month.long.april\"),\n translate(\"month.long.may\"),\n translate(\"month.long.june\"),\n translate(\"month.long.july\"),\n translate(\"month.long.august\"),\n translate(\"month.long.september\"),\n translate(\"month.long.october\"),\n translate(\"month.long.november\"),\n translate(\"month.long.december\"),\n ];\n\n const daysLong = [\n translate(\"days.long.sunday\"),\n translate(\"days.long.monday\"),\n translate(\"days.long.tuesday\"),\n translate(\"days.long.wednesday\"),\n translate(\"days.long.thursday\"),\n translate(\"days.long.friday\"),\n translate(\"days.long.saturday\"),\n ];\n\n const daysShort = [\n translate(\"days.short.sunday\"),\n translate(\"days.short.monday\"),\n translate(\"days.short.tuesday\"),\n translate(\"days.short.wednesday\"),\n translate(\"days.short.thursday\"),\n translate(\"days.short.friday\"),\n translate(\"days.short.saturday\"),\n ];\n\n const [selectedDay, setSelectedDay] = React.useState(\n new Date(props.selected.getTime())\n );\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(\n selectedDay.getMonth()\n );\n const [displayedYear, setDisplayedYear] = React.useState(\n selectedDay.getFullYear()\n );\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n React.useEffect(() => {\n const newSelectedDay = new Date(props.selected);\n setSelectedDay(new Date(props.selected));\n setDisplayedMonthIndex(newSelectedDay.getMonth());\n setDisplayedYear(newSelectedDay.getFullYear());\n setFocusedDay(newSelectedDay);\n }, [props.selected]);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(\n displayedYear,\n displayedMonthIndex,\n 1\n ).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst) offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(\n new Date(displayedYear, displayedMonthIndex, adjustedDay)\n );\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback(\n (newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (\n selectedDay.getFullYear() === newYear &&\n selectedDay.getMonth() === newMonth\n ) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n },\n [focusedDay, selectedDay]\n );\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear =\n displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear =\n displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback(\n (day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n },\n [props]\n );\n\n const handleCalendarKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === Key.ArrowDown.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 7 > 41) setFocusedDay(days[focusedDayIndex % 7]);\n else setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowUp.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 7 < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowLeft.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 1 >= 0) setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowRight.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 1 <= 41) setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === Key.Enter.valueOf() || event.key === \" \") {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n },\n [days, focusedDay, handleOnDayChange]\n );\n\n const previousButtonClass = classnames(\n \"components-previous-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const nextButtonClass = classnames(\n \"components-next-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const calendarClass = classnames(\n \"components-date-picker-calendar-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button\n className={previousButtonClass}\n title={previousMonthLabel}\n onClick={handleMoveToPreviousMonth}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">\n {monthsLong[displayedMonthIndex]} {displayedYear}\n </span>\n <button\n className={nextButtonClass}\n title={nextMonthLabel}\n onClick={handleMoveToNextMonth}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (\n <div\n key={`day-${dayOfWeek}`}\n className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong[dayOfWeek]}\n >\n <span>{daysShort[dayOfWeek]}</span>\n </div>\n ))}\n </div>\n <ul\n tabIndex={0}\n onKeyDown={handleCalendarKeyDown}\n data-testid=\"components-date-picker-calendar-list\"\n className={calendarClass}\n role=\"listbox\"\n >\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive =\n selectedDay && day && isSameDay(selectedDay, day);\n const isFocused =\n focusedDay &&\n day &&\n isSameDay(focusedDay, day) &&\n props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\n \"components-date-picker-calendar-day\",\n isActive && \"selected\",\n !isCurrentMonth && \"notCurrentMonth\",\n isFocused && \"focused\"\n );\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li\n className={classNames}\n key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)}\n role=\"option\"\n aria-selected={isActive}\n data-value={day.getTime()}\n >\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.Fragment>\n ))}\n </ul>\n </div>\n );\n}\n"]}
@@ -7,7 +7,7 @@ import type { CommonProps } from "@itwin/core-react";
7
7
  import "./DatePickerPopupButton.scss";
8
8
  /** Props used by [[DatePickerPopupButton]] component.
9
9
  * @alpha
10
- * @deprecated in 4.11.x. Props of deprecated component {@link DatePickerPopupButton}.
10
+ * @deprecated in 4.11.0. Props of deprecated component {@link DatePickerPopupButton}.
11
11
  */
12
12
  export interface DatePickerPopupButtonProps extends CommonProps {
13
13
  /** Date to be shown as the selected date. */
@@ -27,7 +27,7 @@ export interface DatePickerPopupButtonProps extends CommonProps {
27
27
  }
28
28
  /** Component that displays a button used to pick a date and optionally a time.
29
29
  * @alpha
30
- * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
30
+ * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
31
31
  */
32
32
  export declare function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter, buttonToolTip, fieldStyle, fieldClassName, style, }: DatePickerPopupButtonProps): React.JSX.Element;
33
33
  //# sourceMappingURL=DatePickerPopupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,8BAA8B,CAAC;AAGtC;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,6CAA6C;IAC7C,QAAQ,EAAE,IAAI,CAAC;IACf,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACN,EACD,0BAA0B,qBA6HzB"}
1
+ {"version":3,"file":"DatePickerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,8BAA8B,CAAC;AAGtC;;;GAGG;AAEH,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,6CAA6C;IAC7C,QAAQ,EAAE,IAAI,CAAC;IACf,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACN,EACD,0BAA0B,qBA8HzB"}
@@ -16,7 +16,7 @@ import "./DatePickerPopupButton.scss";
16
16
  import { useTranslation } from "../useTranslation";
17
17
  /** Component that displays a button used to pick a date and optionally a time.
18
18
  * @alpha
19
- * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
19
+ * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
20
20
  */
21
21
  export function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter, buttonToolTip, fieldStyle, fieldClassName, style, }) {
22
22
  const { translate } = useTranslation();
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA0BnD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,G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kBAAkB,iBACjB,8CAA8C,EAC1D,aAAa,EAAE,kBAAkB,EACjC,GAAG,EAAE,SAAS;YAEd,6BAAK,SAAS,EAAC,mBAAmB;gBAChC,6BAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW;oBACzD,8BAAM,CAAC,EAAC,qHAAqH,GAAG,CAC5H,CACF,CACC;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,gBAAgB,EAC3B,8BAA8B;YAE9B,6BACE,SAAS,EAAC,6CAA6C,iBAC3C,6CAA6C;gBAEzD,oBAAC,UAAU,CAAC,8CAA8C;oBACxD,QAAQ,EAAE,WAAW,EACrB,YAAY,EAAE,mBAAmB,EACjC,gBAAgB,EAAE,gBAAgB,GAClC;gBACD,WAAW,IAAI,CACd,6BAAK,SAAS,EAAC,gBAAgB;oBAC7B,oBAAC,IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IACxC,SAAS,CAAC,iBAAiB,CAAC,CACxB;oBACP,oBAAC,SAAS,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,mBAAmB,GACjC,CACE,CACP,CACG,CACA;QACP,CAAC,CAAC,gBAAgB,IAAI,CACrB,oBAAC,SAAS,IACR,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,mBAAmB,GACjC,CACH,CACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport type { DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport type { TimeSpec } from \"./TimeField\";\nimport { TimeField } from \"./TimeField\";\nimport \"./DatePickerPopupButton.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Props used by [[DatePickerPopupButton]] component.\n * @alpha\n * @deprecated in 4.11.x. Props of deprecated component {@link DatePickerPopupButton}.\n */\nexport interface DatePickerPopupButtonProps extends CommonProps {\n /** Date to be shown as the selected date. */\n selected: Date;\n /** If true show the date (and optionally time) edit field next to button */\n displayEditField?: boolean;\n // If defined show time in popup and also display time if input field is shown\n timeDisplay?: TimeDisplay;\n /** Function called when Date changes. */\n onDateChange?: (day: Date) => void;\n /** Optional tooltip */\n buttonToolTip?: string;\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\n dateFormatter?: DateFormatter;\n /** User defined class name for edit field. */\n fieldClassName?: string;\n /** User defined style for edit field. */\n fieldStyle?: React.CSSProperties;\n}\n\n/** Component that displays a button used to pick a date and optionally a time.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport function DatePickerPopupButton({\n displayEditField,\n timeDisplay,\n selected,\n onDateChange,\n dateFormatter,\n buttonToolTip,\n fieldStyle,\n fieldClassName,\n style,\n}: // eslint-disable-next-line deprecation/deprecation\nDatePickerPopupButtonProps) {\n const { translate } = useTranslation();\n const [workingDate, setWorkingDate] = React.useState(\n new Date(selected.getTime())\n );\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const toolTipLabel = buttonToolTip ?? translate(\"datepicker.selectDate\");\n\n // See if props have changed since component mounted\n React.useEffect(() => {\n const newWorkingDate = new Date(selected.getTime());\n setWorkingDate(newWorkingDate);\n }, [selected]);\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const togglePopupDisplay = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setShowFocusOutline(false);\n setIsSettingsOpen((prev) => !prev);\n },\n [setIsSettingsOpen]\n );\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const handleOnDateChanged = (day: Date) => {\n // combine current time into selected Date\n const newWorkingDate = new Date(day.getTime());\n newWorkingDate.setHours(\n workingDate.getHours(),\n workingDate.getMinutes(),\n workingDate.getSeconds()\n );\n onDateChange && onDateChange(newWorkingDate);\n !timeDisplay && setIsSettingsOpen(false);\n };\n\n const handleOnTimeChanged = (time: TimeSpec) => {\n // Combine new time into selected Date\n const newWorkingDate = new Date(workingDate.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n setWorkingDate(newWorkingDate);\n onDateChange && onDateChange(newWorkingDate);\n };\n\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\n const handlePopupKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === \" \") {\n setShowFocusOutline(true);\n setIsSettingsOpen(true);\n }\n },\n []\n );\n\n const timeSpec: TimeSpec = {\n hours: workingDate.getHours(),\n minutes: workingDate.getMinutes(),\n seconds: workingDate.getSeconds(),\n };\n return (\n <>\n <button\n title={toolTipLabel}\n style={style}\n className=\"components-date-picker-calendar-popup-button\"\n onKeyDown={handlePopupKeyDown}\n data-testid=\"components-date-picker-calendar-popup-button\"\n onPointerDown={togglePopupDisplay}\n ref={buttonRef}\n >\n <div className=\"datepicker-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M13,13H9V10h4ZM16,3V15a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V3A1,1,0,0,1,1,2H3V0H4V2h8V0h1V2h2A1,1,0,0,1,16,3ZM15,6H1v9H15Z\" />\n </svg>\n </div>\n </button>\n <Popup\n isOpen={isSettingsOpen}\n position={RelativePosition.BottomLeft}\n onClose={handleCloseSetting}\n target={buttonRef.current}\n closeOnEnter={false}\n moveFocus={showFocusOutline}\n closeOnNestedPopupOutsideClick\n >\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line deprecation/deprecation\n selected={workingDate}\n onDateChange={handleOnDateChanged}\n showFocusOutline={showFocusOutline}\n />\n {timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {translate(\"datepicker.time\")}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={timeDisplay}\n onTimeChange={handleOnTimeChanged}\n />\n </div>\n )}\n </div>\n </Popup>\n {!!displayEditField && (\n <DateField\n style={fieldStyle}\n className={fieldClassName}\n initialDate={workingDate}\n timeDisplay={timeDisplay}\n dateFormatter={dateFormatter}\n onDateChange={handleOnDateChanged}\n />\n )}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,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AS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,mBAAmB,GACjC,CACH,CACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport type { DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport type { TimeSpec } from \"./TimeField\";\nimport { TimeField } from \"./TimeField\";\nimport \"./DatePickerPopupButton.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Props used by [[DatePickerPopupButton]] component.\n * @alpha\n * @deprecated in 4.11.0. Props of deprecated component {@link DatePickerPopupButton}.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface DatePickerPopupButtonProps extends CommonProps {\n /** Date to be shown as the selected date. */\n selected: Date;\n /** If true show the date (and optionally time) edit field next to button */\n displayEditField?: boolean;\n // If defined show time in popup and also display time if input field is shown\n timeDisplay?: TimeDisplay;\n /** Function called when Date changes. */\n onDateChange?: (day: Date) => void;\n /** Optional tooltip */\n buttonToolTip?: string;\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\n dateFormatter?: DateFormatter;\n /** User defined class name for edit field. */\n fieldClassName?: string;\n /** User defined style for edit field. */\n fieldStyle?: React.CSSProperties;\n}\n\n/** Component that displays a button used to pick a date and optionally a time.\n * @alpha\n * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport function DatePickerPopupButton({\n displayEditField,\n timeDisplay,\n selected,\n onDateChange,\n dateFormatter,\n buttonToolTip,\n fieldStyle,\n fieldClassName,\n style,\n}: // eslint-disable-next-line deprecation/deprecation\nDatePickerPopupButtonProps) {\n const { translate } = useTranslation();\n const [workingDate, setWorkingDate] = React.useState(\n new Date(selected.getTime())\n );\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const toolTipLabel = buttonToolTip ?? translate(\"datepicker.selectDate\");\n\n // See if props have changed since component mounted\n React.useEffect(() => {\n const newWorkingDate = new Date(selected.getTime());\n setWorkingDate(newWorkingDate);\n }, [selected]);\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const togglePopupDisplay = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setShowFocusOutline(false);\n setIsSettingsOpen((prev) => !prev);\n },\n [setIsSettingsOpen]\n );\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const handleOnDateChanged = (day: Date) => {\n // combine current time into selected Date\n const newWorkingDate = new Date(day.getTime());\n newWorkingDate.setHours(\n workingDate.getHours(),\n workingDate.getMinutes(),\n workingDate.getSeconds()\n );\n onDateChange && onDateChange(newWorkingDate);\n !timeDisplay && setIsSettingsOpen(false);\n };\n\n const handleOnTimeChanged = (time: TimeSpec) => {\n // Combine new time into selected Date\n const newWorkingDate = new Date(workingDate.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n setWorkingDate(newWorkingDate);\n onDateChange && onDateChange(newWorkingDate);\n };\n\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\n const handlePopupKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === \" \") {\n setShowFocusOutline(true);\n setIsSettingsOpen(true);\n }\n },\n []\n );\n\n const timeSpec: TimeSpec = {\n hours: workingDate.getHours(),\n minutes: workingDate.getMinutes(),\n seconds: workingDate.getSeconds(),\n };\n return (\n <>\n <button\n title={toolTipLabel}\n style={style}\n className=\"components-date-picker-calendar-popup-button\"\n onKeyDown={handlePopupKeyDown}\n data-testid=\"components-date-picker-calendar-popup-button\"\n onPointerDown={togglePopupDisplay}\n ref={buttonRef}\n >\n <div className=\"datepicker-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M13,13H9V10h4ZM16,3V15a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V3A1,1,0,0,1,1,2H3V0H4V2h8V0h1V2h2A1,1,0,0,1,16,3ZM15,6H1v9H15Z\" />\n </svg>\n </div>\n </button>\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Popup\n isOpen={isSettingsOpen}\n position={RelativePosition.BottomLeft}\n onClose={handleCloseSetting}\n target={buttonRef.current}\n closeOnEnter={false}\n moveFocus={showFocusOutline}\n closeOnNestedPopupOutsideClick\n >\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line deprecation/deprecation\n selected={workingDate}\n onDateChange={handleOnDateChanged}\n showFocusOutline={showFocusOutline}\n />\n {timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {translate(\"datepicker.time\")}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={timeDisplay}\n onTimeChange={handleOnTimeChanged}\n />\n </div>\n )}\n </div>\n </Popup>\n {!!displayEditField && (\n <DateField\n style={fieldStyle}\n className={fieldClassName}\n initialDate={workingDate}\n timeDisplay={timeDisplay}\n dateFormatter={dateFormatter}\n onDateChange={handleOnDateChanged}\n />\n )}\n </>\n );\n}\n"]}
@@ -9,7 +9,7 @@ import type { DateFormatter } from "@itwin/appui-abstract";
9
9
  * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If
10
10
  * a parseData function is implemented then the edit field will be editable.
11
11
  * @alpha
12
- * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
12
+ * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
13
13
  */
14
14
  export declare class IntlFormatter implements DateFormatter {
15
15
  private _intlFormatter?;
@@ -12,7 +12,7 @@
12
12
  * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If
13
13
  * a parseData function is implemented then the edit field will be editable.
14
14
  * @alpha
15
- * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
15
+ * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
16
16
  */
17
17
  export class IntlFormatter {
18
18
  constructor(_intlFormatter) {
@@ -1 +1 @@
1
- {"version":3,"file":"IntlFormatter.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACxB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IAAG,CAAC;IAE5D,IAAW,SAAS;QAClB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,+DAA+D;YAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;gBACvD,OAAO,EAAE,OAAO,CAAC,+BAA+B;gBAChD,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,KAAK,EAAE,SAAS,CAAC,qDAAqD;gBACtE,GAAG,EAAE,SAAS,CAAC,0BAA0B;gBACzC,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,SAAS,CAAC,0BAA0B;gBAC5C,MAAM,EAAE,SAAS,CAAC,0BAA0B,CAAC,qBAAqB;gBAClE,4BAA4B;aAC7B,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,WAAW,CAAC,GAAS;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CAKF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport type { DateFormatter } from \"@itwin/appui-abstract\";\n\n/**\n * A basic class that allows user to provide an Intl.DateTimeFormat\n * that can be used to format the date and time display. If no format is\n * specified a default format will be used. This default implementation does not\n * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If\n * a parseData function is implemented then the edit field will be editable.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport class IntlFormatter implements DateFormatter {\n constructor(private _intlFormatter?: Intl.DateTimeFormat) {}\n\n public get formatter(): Intl.DateTimeFormat {\n if (!this._intlFormatter) {\n // https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor\n this._intlFormatter = new Intl.DateTimeFormat(undefined, {\n weekday: \"short\" /* \"narrow\", \"short\", \"long\" */,\n year: \"numeric\" /* \"2-digit\", \"numeric\" */,\n month: \"2-digit\" /* \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" */,\n day: \"2-digit\" /* \"2-digit\", \"numeric\" */,\n hour: \"numeric\" /* \"2-digit\", \"numeric\" */,\n hour12: true,\n minute: \"numeric\" /* \"2-digit\", \"numeric\" */,\n second: \"numeric\" /* \"2-digit\", \"numeric\" */ /* \"short\", \"long\" */,\n /* timeZoneName:\t\"short\", */\n });\n }\n return this._intlFormatter;\n }\n\n public formateDate(day: Date) {\n return this.formatter.format(day);\n }\n\n // The default implementation does not currently support parsing. If a derived class supports parsing then the\n // parseDate function must be implemented.\n // parseDate(dateString: string): Date|undefined {}\n}\n"]}
1
+ {"version":3,"file":"IntlFormatter.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACxB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IAAG,CAAC;IAE5D,IAAW,SAAS;QAClB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,+DAA+D;YAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;gBACvD,OAAO,EAAE,OAAO,CAAC,+BAA+B;gBAChD,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,KAAK,EAAE,SAAS,CAAC,qDAAqD;gBACtE,GAAG,EAAE,SAAS,CAAC,0BAA0B;gBACzC,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,SAAS,CAAC,0BAA0B;gBAC5C,MAAM,EAAE,SAAS,CAAC,0BAA0B,CAAC,qBAAqB;gBAClE,4BAA4B;aAC7B,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,WAAW,CAAC,GAAS;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CAKF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport type { DateFormatter } from \"@itwin/appui-abstract\";\n\n/**\n * A basic class that allows user to provide an Intl.DateTimeFormat\n * that can be used to format the date and time display. If no format is\n * specified a default format will be used. This default implementation does not\n * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If\n * a parseData function is implemented then the edit field will be editable.\n * @alpha\n * @deprecated in 4.11.0. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport class IntlFormatter implements DateFormatter {\n constructor(private _intlFormatter?: Intl.DateTimeFormat) {}\n\n public get formatter(): Intl.DateTimeFormat {\n if (!this._intlFormatter) {\n // https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor\n this._intlFormatter = new Intl.DateTimeFormat(undefined, {\n weekday: \"short\" /* \"narrow\", \"short\", \"long\" */,\n year: \"numeric\" /* \"2-digit\", \"numeric\" */,\n month: \"2-digit\" /* \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" */,\n day: \"2-digit\" /* \"2-digit\", \"numeric\" */,\n hour: \"numeric\" /* \"2-digit\", \"numeric\" */,\n hour12: true,\n minute: \"numeric\" /* \"2-digit\", \"numeric\" */,\n second: \"numeric\" /* \"2-digit\", \"numeric\" */ /* \"short\", \"long\" */,\n /* timeZoneName:\t\"short\", */\n });\n }\n return this._intlFormatter;\n }\n\n public formateDate(day: Date) {\n return this.formatter.format(day);\n }\n\n // The default implementation does not currently support parsing. If a derived class supports parsing then the\n // parseDate function must be implemented.\n // parseDate(dateString: string): Date|undefined {}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,sCAA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B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IAC3D,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBA2K1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAsEhE;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,gBAAgB,EAChB,KAAK,EACL,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAA0B,CAAC;IACzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAkC,CAAC;IAEzE,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACjE,MAAM,mBAAmB,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACzE,MAAM,kBAAkB,GAAG,CAAC,IAAyB,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,CAA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AAC,cAAc,CAC/B,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC;QAC1E,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC;QACtE,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,CACL,8BACE,SAAS,EAAC,6BAA6B,EACvC,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,WAAW,EAC1B,KAAK,EAAE,KAAK,iBACA,kBAAkB,EAC9B,IAAI,EAAC,cAAc,IAElB,UAAU,CACN,CACR,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { PropertyRecord, PropertyValue } from \"@itwin/appui-abstract\";\nimport { UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n */\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = () => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape();\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const newValue = args.newValue;\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAwEhE;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,gBAAgB,EAChB,KAAK,EACL,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAA0B,CAAC;IACzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAkC,CAAC;IAEzE,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,E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,GACd,eAAe,CAAC,MAAM,KAAK,SAAS;QAClC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI;QAC7B,CAAC,CAAC,SAAS,CAAC;IAEhB,iBAAiB,CAAC,OAAO,GAAG,qBAAqB,CAAC,YAAY,CAC5D,eAAe,CAAC,QAAQ,EACxB,UAAU,EACV,eAAe,CAAC,cAAc,CAC/B,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC;QAC1E,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC;QACtE,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,CACL,8BACE,SAAS,EAAC,6BAA6B,EACvC,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,WAAW,EAC1B,KAAK,EAAE,KAAK,iBACA,kBAAkB,EAC9B,IAAI,EAAC,cAAc,IAElB,UAAU,CACN,CACR,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { PropertyRecord, PropertyValue } from \"@itwin/appui-abstract\";\nimport { UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = () => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape();\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const newValue = args.newValue;\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUrE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAEjC,WAAW,CAAC,EAAE,MAAM,CAA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,IAAI,CAAC;IACrB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gBAAgB;AAChB,UAAU,gBAAgB;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK,CAAC,aAAa,CAClD,gBAAgB,EAChB,gBAAgB,CACjB;IACC,OAAO,CAAC,UAAU,CAAqC;IAEvD,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAExD;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,OAAO,CAAC,YAAY,CAKlB;IAEK,UAAU;IAIjB,OAAO,CAAC,WAAW,CAMjB;IAEF,OAAO,CAAC,cAAc,CAWpB;IAEF,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CAmE1C;AAED;;GAEG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,qBAGjD;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,qBA6BxD"}
@@ -68,12 +68,13 @@ export class PopupButton extends React.PureComponent {
68
68
  React.createElement("div", { className: "components-popup-button-arrow" },
69
69
  React.createElement("div", { className: classnames("components-popup-button-arrow-icon", "icon") },
70
70
  React.createElement(Icon, { iconSpec: React.createElement(SvgChevronDown, null) })))),
71
- React.createElement(Popup, { className: "components-popup-button-popup", isOpen: this.state.showPopup, position: RelativePosition.Bottom, onClose: this._closePopup, onEnter: this.props.onEnter, closeOnEnter: this.props.closeOnEnter, target: this._buttonRef.current, showArrow: showArrow, showShadow: showShadow, moveFocus: moveFocus, focusTarget: this.props.focusTarget }, this.props.children)));
71
+ React.createElement(Popup, { className: "components-popup-button-popup", isOpen: this.state.showPopup, position: RelativePosition.Bottom, onClose: this._closePopup, onEnter: this.props.onEnter, closeOnEnter: this.props.closeOnEnter, target: this._buttonRef.current, showArrow: showArrow, showShadow: showShadow, moveFocus: moveFocus, focusTarget: this.props.focusTarget, portalTarget: this._buttonRef.current?.ownerDocument.querySelector(".uifw-configurableui-portalContainer") ?? undefined }, this.props.children)));
72
72
  }
73
73
  }
74
74
  /** Popup content with padding
75
75
  * @alpha
76
76
  */
77
+ // eslint-disable-next-line deprecation/deprecation
77
78
  export function PopupContent(props) {
78
79
  // eslint-disable-next-line deprecation/deprecation
79
80
  return React.createElement(Div, { ...props, mainClassName: "components-editor-popup-content" });
@@ -1 +1 @@
1
- {"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,SAAS,GACV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA0CnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAGtC;IAHD;;QAIU,eAAU,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAEvD,gBAAgB;QACS,UAAK,GAA+B;YAC3D,SAAS,EAAE,KAAK;SACjB,CA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BACW,gCAAgC,EAC5C,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAEvB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,SAAS,OAAG,GAAI,CAC1B,CACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n /** @internal */\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n (event.key === Key.ArrowDown.valueOf() ||\n event.key === \" \" ||\n event.key === Key.Enter.valueOf()) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\nexport function PopupContent(props: CommonDivProps) {\n // eslint-disable-next-line deprecation/deprecation\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n const { translate } = useTranslation();\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;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IAGf,IAAI,CAAC,KAAK,CAAC,QAAQ,CACd,CACJ,CACP,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,mDAAmD;AACnD,MAAM,UAAU,YAAY,CAAC,KAAqB;IAChD,mDAAmD;IACnD,OAAO,oBAAC,GAAG,OAAK,KAAK,EAAE,aAAa,EAAC,iCAAiC,GAAG,CAAC;AAC5E,CAAC;AAUD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAoB;IACvD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,4BAA4B,CAC7B,iBACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,EAC7B,OAAO,EAAE,KAAK,CAAC,IAAI;YAEnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,YAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAEvB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,SAAS,OAAG,GAAI,CAC1B,CACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n /** @internal */\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n (event.key === Key.ArrowDown.valueOf() ||\n event.key === \" \" ||\n event.key === Key.Enter.valueOf()) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n portalTarget={\n this._buttonRef.current?.ownerDocument.querySelector(\n \".uifw-configurableui-portalContainer\"\n ) ?? undefined\n }\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function PopupContent(props: CommonDivProps) {\n // eslint-disable-next-line deprecation/deprecation\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n const { translate } = useTranslation();\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FavoritePropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,4BAwBpE"}
1
+ {"version":3,"file":"FavoritePropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,4BAyBpE"}