@itwin/components-react 4.0.0-dev.10 → 4.0.0-dev.12

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 (179) hide show
  1. package/lib/cjs/components-react/datepicker/DateField.scss +1 -1
  2. package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
  3. package/lib/cjs/components-react/datepicker/DatePicker.js +4 -3
  4. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  5. package/lib/cjs/components-react/datepicker/DatePicker.scss +9 -9
  6. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  7. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +2 -1
  8. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  9. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.scss +4 -4
  10. package/lib/cjs/components-react/datepicker/TimeField.scss +4 -4
  11. package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -2
  12. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  13. package/lib/cjs/components-react/editors/EditorContainer.d.ts +10 -0
  14. package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
  15. package/lib/cjs/components-react/editors/EditorContainer.js +1 -0
  16. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  17. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.d.ts +1 -0
  18. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
  19. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +3 -1
  20. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  21. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.scss +16 -57
  22. package/lib/cjs/components-react/editors/IconEditor.scss +1 -1
  23. package/lib/cjs/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  24. package/lib/cjs/components-react/editors/NumericInputEditor.js +1 -1
  25. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  26. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  27. package/lib/cjs/components-react/editors/PopupButton.js +5 -3
  28. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  29. package/lib/cjs/components-react/editors/PopupButton.scss +10 -10
  30. package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
  31. package/lib/cjs/components-react/editors/TextEditor.js +7 -0
  32. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  33. package/lib/cjs/components-react/editors/TextareaEditor.d.ts +1 -1
  34. package/lib/cjs/components-react/editors/TextareaEditor.js +1 -1
  35. package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
  36. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +0 -6
  37. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -11
  38. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  39. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +1 -0
  40. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  41. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
  42. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  43. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  44. package/lib/cjs/components-react/filtering/FilteringInput.d.ts.map +1 -1
  45. package/lib/cjs/components-react/filtering/FilteringInput.js +12 -5
  46. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  47. package/lib/cjs/components-react/filtering/FilteringInput.scss +2 -11
  48. package/lib/cjs/components-react/filtering/ResultSelector.d.ts.map +1 -1
  49. package/lib/cjs/components-react/filtering/ResultSelector.js +6 -2
  50. package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
  51. package/lib/cjs/components-react/filtering/ResultSelector.scss +3 -8
  52. package/lib/cjs/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
  53. package/lib/cjs/components-react/iconpicker/IconPickerButton.js +5 -1
  54. package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
  55. package/lib/cjs/components-react/iconpicker/IconPickerButton.scss +5 -5
  56. package/lib/cjs/components-react/inputs/ParsedInput.scss +2 -2
  57. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +3 -3
  58. package/lib/cjs/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.d.ts.map +1 -1
  59. package/lib/cjs/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js +3 -1
  60. package/lib/cjs/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js.map +1 -1
  61. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.scss +2 -2
  62. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  63. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +4 -0
  64. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  65. package/lib/cjs/components-react/propertygrid/component/PropertyGrid.scss +8 -7
  66. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +1 -1
  67. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  68. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +14 -16
  69. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts.map +1 -1
  70. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  71. package/lib/cjs/components-react/table/TableDataProvider.d.ts +2 -1
  72. package/lib/cjs/components-react/table/TableDataProvider.d.ts.map +1 -1
  73. package/lib/cjs/components-react/table/TableDataProvider.js +2 -1
  74. package/lib/cjs/components-react/table/TableDataProvider.js.map +1 -1
  75. package/lib/cjs/components-react/toolbar/Item.scss +20 -51
  76. package/lib/cjs/components-react/toolbar/Items.scss +2 -3
  77. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  78. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +3 -1
  79. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  80. package/lib/cjs/components-react/toolbar/_variables.scss +4 -4
  81. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.scss +2 -2
  82. package/lib/cjs/components-react/toolbar/groupPanel/Panel.scss +2 -4
  83. package/lib/cjs/components-react/toolbar/groupPanel/Title.scss +1 -2
  84. package/lib/cjs/components-react/toolbar/groupPanel/_variables.scss +1 -1
  85. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.scss +9 -38
  86. package/lib/cjs/components-react/tree/controlled/TreeModel.js +2 -5
  87. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  88. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.scss +7 -7
  89. package/lib/cjs/components-react/tree/controlled/component/NodeContent.scss +1 -2
  90. package/lib/esm/components-react/datepicker/DateField.scss +1 -1
  91. package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
  92. package/lib/esm/components-react/datepicker/DatePicker.js +4 -3
  93. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  94. package/lib/esm/components-react/datepicker/DatePicker.scss +9 -9
  95. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  96. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +3 -2
  97. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  98. package/lib/esm/components-react/datepicker/DatePickerPopupButton.scss +4 -4
  99. package/lib/esm/components-react/datepicker/TimeField.scss +4 -4
  100. package/lib/esm/components-react/editors/DateTimeEditor.js +2 -2
  101. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  102. package/lib/esm/components-react/editors/EditorContainer.d.ts +10 -0
  103. package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
  104. package/lib/esm/components-react/editors/EditorContainer.js +1 -0
  105. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  106. package/lib/esm/components-react/editors/EnumButtonGroupEditor.d.ts +1 -0
  107. package/lib/esm/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
  108. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +4 -2
  109. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  110. package/lib/esm/components-react/editors/EnumButtonGroupEditor.scss +16 -57
  111. package/lib/esm/components-react/editors/IconEditor.scss +1 -1
  112. package/lib/esm/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  113. package/lib/esm/components-react/editors/NumericInputEditor.js +1 -1
  114. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  115. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  116. package/lib/esm/components-react/editors/PopupButton.js +5 -3
  117. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  118. package/lib/esm/components-react/editors/PopupButton.scss +10 -10
  119. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  120. package/lib/esm/components-react/editors/TextEditor.js +7 -0
  121. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  122. package/lib/esm/components-react/editors/TextareaEditor.d.ts +1 -1
  123. package/lib/esm/components-react/editors/TextareaEditor.js +1 -1
  124. package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
  125. package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +0 -6
  126. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -11
  127. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  128. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +1 -0
  129. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  130. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
  131. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  132. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.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 +13 -6
  135. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  136. package/lib/esm/components-react/filtering/FilteringInput.scss +2 -11
  137. package/lib/esm/components-react/filtering/ResultSelector.d.ts.map +1 -1
  138. package/lib/esm/components-react/filtering/ResultSelector.js +6 -2
  139. package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
  140. package/lib/esm/components-react/filtering/ResultSelector.scss +3 -8
  141. package/lib/esm/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
  142. package/lib/esm/components-react/iconpicker/IconPickerButton.js +5 -1
  143. package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
  144. package/lib/esm/components-react/iconpicker/IconPickerButton.scss +5 -5
  145. package/lib/esm/components-react/inputs/ParsedInput.scss +2 -2
  146. package/lib/esm/components-react/properties/renderers/PropertyView.scss +3 -3
  147. package/lib/esm/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.d.ts.map +1 -1
  148. package/lib/esm/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js +3 -1
  149. package/lib/esm/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js.map +1 -1
  150. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.scss +2 -2
  151. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  152. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +4 -0
  153. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  154. package/lib/esm/components-react/propertygrid/component/PropertyGrid.scss +8 -7
  155. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +1 -1
  156. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  157. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +14 -16
  158. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts.map +1 -1
  159. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  160. package/lib/esm/components-react/table/TableDataProvider.d.ts +2 -1
  161. package/lib/esm/components-react/table/TableDataProvider.d.ts.map +1 -1
  162. package/lib/esm/components-react/table/TableDataProvider.js +2 -1
  163. package/lib/esm/components-react/table/TableDataProvider.js.map +1 -1
  164. package/lib/esm/components-react/toolbar/Item.scss +20 -51
  165. package/lib/esm/components-react/toolbar/Items.scss +2 -3
  166. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  167. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +4 -2
  168. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  169. package/lib/esm/components-react/toolbar/_variables.scss +4 -4
  170. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.scss +2 -2
  171. package/lib/esm/components-react/toolbar/groupPanel/Panel.scss +2 -4
  172. package/lib/esm/components-react/toolbar/groupPanel/Title.scss +1 -2
  173. package/lib/esm/components-react/toolbar/groupPanel/_variables.scss +1 -1
  174. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.scss +9 -38
  175. package/lib/esm/components-react/tree/controlled/TreeModel.js +2 -2
  176. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  177. package/lib/esm/components-react/tree/controlled/component/ControlledTree.scss +7 -7
  178. package/lib/esm/components-react/tree/controlled/component/NodeContent.scss +1 -2
  179. package/package.json +16 -32
@@ -1 +1 @@
1
- {"version":3,"file":"TreeModel.js","sourceRoot":"","sources":["../../../../../src/components-react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CAAC,WAAW,KAAK,SAAS,EAAE;oBAC/D,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;iBACjD;aACF;SACF;QACD,EAAE,KAAK,CAAC;KACT;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA9BD,sDA8BC;AAED,SAAS,WAAW,CAAC,MAAiB,EAAE,MAAwB,EAAE,QAA4B;;IAC5F,MAAM,CAAC,cAAc,CACnB,QAAQ,EACR,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAE,CAAC,CAAC,WAAW,CACxF,CAAC;IACF,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAA,MAAA,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,0CAAE,aAAa,EAAE,mCAAI,EAAE,EAAE;QAClF,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAE,CAAC;QACtC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAChF,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tree\r\n */\r\n\r\nimport { immerable } from \"immer\";\r\nimport _ from \"lodash\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { CheckBoxState } from \"@itwin/core-react\";\r\nimport { DelayLoadedTreeNodeItem, ImmediatelyLoadedTreeNodeItem, TreeNodeItem } from \"../TreeDataProvider\";\r\nimport { SparseArray, SparseTree } from \"./internal/SparseTree\";\r\n\r\n/**\r\n * Immutable data structure that describes tree node.\r\n * @public\r\n */\r\nexport interface TreeModelNode {\r\n readonly id: string;\r\n readonly parentId: string | undefined;\r\n readonly depth: number;\r\n\r\n readonly isLoading?: boolean;\r\n readonly numChildren: number | undefined;\r\n\r\n readonly description: string | undefined;\r\n readonly isExpanded: boolean;\r\n readonly label: PropertyRecord;\r\n readonly isSelected: boolean;\r\n readonly isSelectionDisabled?: boolean;\r\n\r\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\r\n readonly editingInfo?: TreeModelNodeEditingInfo;\r\n\r\n readonly checkbox: CheckBoxInfo;\r\n\r\n readonly item: TreeNodeItem;\r\n}\r\n\r\n/**\r\n * Immutable data structure that describes checkbox info.\r\n * @public\r\n */\r\nexport interface CheckBoxInfo {\r\n readonly state: CheckBoxState;\r\n readonly tooltip?: string;\r\n readonly isDisabled: boolean;\r\n readonly isVisible: boolean;\r\n}\r\n\r\n/**\r\n * Mutable data structure that describes tree node.\r\n * @public\r\n */\r\nexport interface MutableTreeModelNode extends TreeModelNode {\r\n isLoading: boolean;\r\n\r\n description: string;\r\n isExpanded: boolean;\r\n label: PropertyRecord;\r\n isSelected: boolean;\r\n isSelectionDisabled?: boolean;\r\n\r\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\r\n editingInfo?: TreeModelNodeEditingInfo;\r\n\r\n checkbox: MutableCheckBoxInfo;\r\n\r\n item: TreeNodeItem;\r\n}\r\n\r\n/**\r\n * Data structure that holds callbacks used for tree node editing.\r\n * @public\r\n */\r\nexport interface TreeModelNodeEditingInfo {\r\n onCommit: (node: TreeModelNode, newValue: string) => void;\r\n onCancel: () => void;\r\n}\r\n\r\n/**\r\n * Mutable data structure that describes checkbox info.\r\n * @public\r\n */\r\nexport interface MutableCheckBoxInfo extends CheckBoxInfo {\r\n state: CheckBoxState;\r\n tooltip?: string;\r\n isDisabled: boolean;\r\n isVisible: boolean;\r\n}\r\n\r\n/**\r\n * Data structure that describes tree node placeholder.\r\n * @public\r\n */\r\nexport interface TreeModelNodePlaceholder {\r\n readonly childIndex: number;\r\n readonly depth: number;\r\n readonly parentId?: string;\r\n}\r\n\r\n/**\r\n * Data structure that describes tree root node.\r\n * @public\r\n */\r\nexport interface TreeModelRootNode {\r\n readonly depth: -1;\r\n readonly id: undefined;\r\n readonly numChildren: number | undefined;\r\n}\r\n\r\n/**\r\n * Data structure that describes input used to create tree node.\r\n * @public\r\n */\r\nexport interface TreeModelNodeInput {\r\n readonly description?: string;\r\n readonly isExpanded: boolean;\r\n readonly id: string;\r\n readonly item: TreeNodeItem;\r\n readonly label: PropertyRecord;\r\n readonly isLoading: boolean;\r\n readonly numChildren?: number;\r\n readonly isSelected: boolean;\r\n}\r\n\r\n/**\r\n * Type definition of all tree model nodes.\r\n * @public\r\n */\r\nexport type TreeModelNodeType = TreeModelNode | TreeModelNodePlaceholder | TreeModelRootNode;\r\n\r\n/**\r\n * Checks if object is [[TreeModelNode]]\r\n * @public\r\n */\r\nexport function isTreeModelNode(obj: TreeModelNodeType | undefined): obj is TreeModelNode {\r\n return obj !== undefined && !isTreeModelNodePlaceholder(obj) && !isTreeModelRootNode(obj);\r\n}\r\n\r\n/**\r\n * Checks if object is [[TreeModelNodePlaceholder]]\r\n * @public\r\n */\r\nexport function isTreeModelNodePlaceholder(obj: TreeModelNodeType | undefined): obj is TreeModelNodePlaceholder {\r\n return obj !== undefined && \"childIndex\" in obj;\r\n}\r\n\r\n/**\r\n * Checks if object is [[TreeModelRootNode]]\r\n * @public\r\n */\r\nexport function isTreeModelRootNode(obj: TreeModelNodeType | undefined): obj is TreeModelRootNode {\r\n return obj !== undefined && (obj as TreeModelRootNode).id === undefined && !(\"childIndex\" in obj);\r\n}\r\n\r\n/**\r\n * Type definition of tree node item data.\r\n * @public\r\n */\r\nexport type TreeNodeItemData = ImmediatelyLoadedTreeNodeItem & DelayLoadedTreeNodeItem;\r\n\r\n/**\r\n * Data structure that describes set of visible tree nodes as a flat list.\r\n * @public\r\n */\r\nexport interface VisibleTreeNodes extends Iterable<TreeModelNode | TreeModelNodePlaceholder> {\r\n getNumNodes(): number;\r\n getAtIndex(index: number): TreeModelNode | TreeModelNodePlaceholder | undefined;\r\n getModel(): TreeModel;\r\n getNumRootNodes(): number | undefined;\r\n getIndexOfNode(nodeId: string): number;\r\n}\r\n\r\n/**\r\n * Data structure that describes tree model.\r\n * @public\r\n */\r\nexport interface TreeModel {\r\n getRootNode(): TreeModelRootNode;\r\n\r\n getNode(id: string): TreeModelNode | undefined;\r\n getNode(parentId: string | undefined, childIndex: number): TreeModelNode | TreeModelNodePlaceholder | undefined;\r\n getNode(nodeId: string | undefined, childIndex?: number): TreeModelNode | TreeModelNodePlaceholder | TreeModelRootNode | undefined;\r\n\r\n getChildren(parentId: string | undefined): SparseArray<string> | undefined;\r\n getChildOffset(parentId: string | undefined, childId: string): number | undefined;\r\n\r\n iterateTreeModelNodes(parentId?: string): IterableIterator<TreeModelNode>;\r\n}\r\n\r\n/**\r\n * Mutable tree model which holds nodes and allows adding or removing them.\r\n * @public\r\n */\r\nexport class MutableTreeModel implements TreeModel {\r\n public [immerable] = true;\r\n\r\n private _tree = new SparseTree<MutableTreeModelNode>();\r\n private _rootNode: TreeModelRootNode = { depth: -1, id: undefined, numChildren: undefined };\r\n\r\n public constructor(seed?: TreeModel) {\r\n if (!seed) {\r\n return;\r\n }\r\n\r\n cloneSubree(seed, this, undefined);\r\n }\r\n\r\n /** Returns root node of a tree. This node is not visible and is there to allow having multiple visible root nodes. */\r\n public getRootNode(): TreeModelRootNode {\r\n return this._rootNode;\r\n }\r\n\r\n /** Returns tree node or placeholder for node that is not loaded yet.\r\n * @returns node, node placeholder or undefined if node is not found in model.\r\n */\r\n public getNode(id: string): MutableTreeModelNode | undefined;\r\n public getNode(parentId: string | undefined, childIndex: number): MutableTreeModelNode | TreeModelNodePlaceholder | undefined;\r\n public getNode(nodeId: string | undefined, childIndex?: number): MutableTreeModelNode | TreeModelNodePlaceholder | undefined {\r\n if (childIndex === undefined) {\r\n return this._tree.getNode(nodeId!);\r\n }\r\n\r\n const children = this._tree.getChildren(nodeId);\r\n const childId = children !== undefined ? children.get(childIndex) : undefined;\r\n if (childId !== undefined) {\r\n return this._tree.getNode(childId);\r\n }\r\n\r\n const parentNode = nodeId === undefined ? this._rootNode : this._tree.getNode(nodeId);\r\n if (parentNode !== undefined) {\r\n return {\r\n childIndex,\r\n depth: parentNode.depth + 1,\r\n parentId: nodeId,\r\n };\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Returns children for specific parent.\r\n * @param parentId id of parent node.\r\n * @returns children of parent node or root nodes if undefined is passed as parent id.\r\n */\r\n public getChildren(parentId: string | undefined): SparseArray<string> | undefined {\r\n return this._tree.getChildren(parentId);\r\n }\r\n\r\n /** Returns children offset in children array for specific parent. */\r\n public getChildOffset(parentId: string | undefined, childId: string): number | undefined {\r\n return this._tree.getChildOffset(parentId, childId);\r\n }\r\n\r\n /**\r\n * Sets children for parent node starting from the specific offset.\r\n * If offset overlaps with already added nodes, the overlapping nodes are overwritten.\r\n */\r\n public setChildren(parentId: string | undefined, nodeInputs: TreeModelNodeInput[], offset: number): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode === undefined)\r\n return;\r\n\r\n const children: MutableTreeModelNode[] = [];\r\n for (const input of nodeInputs) {\r\n const child = MutableTreeModel.createTreeModelNode(parentNode, input);\r\n children.push(child);\r\n }\r\n\r\n this._tree.setChildren(parentNode.id, children, offset);\r\n MutableTreeModel.setNumChildrenForNode(parentNode, this._tree.getChildren(parentNode.id));\r\n }\r\n\r\n /**\r\n * Inserts child in the specified position.\r\n * If offset is higher then current length of children array, the length is increased.\r\n */\r\n public insertChild(parentId: string | undefined, childNodeInput: TreeModelNodeInput, offset: number): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode === undefined)\r\n return;\r\n\r\n const child = MutableTreeModel.createTreeModelNode(parentNode, childNodeInput);\r\n\r\n this._tree.insertChild(parentNode.id, child, offset);\r\n MutableTreeModel.setNumChildrenForNode(parentNode, this._tree.getChildren(parentNode.id));\r\n }\r\n\r\n /**\r\n * Changes the id of target node.\r\n * @returns `true` on success, `false` otherwise.\r\n */\r\n public changeNodeId(currentId: string, newId: string): boolean {\r\n const node = this.getNode(currentId);\r\n if (node === undefined) {\r\n return false;\r\n }\r\n\r\n if (currentId === newId) {\r\n return true;\r\n }\r\n\r\n const index = this.getChildOffset(node.parentId, currentId);\r\n assert(index !== undefined);\r\n\r\n if (!this._tree.setNodeId(node.parentId, index, newId)) {\r\n return false;\r\n }\r\n\r\n (node.id as string) = newId; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion\r\n for (const [childId] of this.getChildren(newId)?.iterateValues() ?? []) {\r\n const child = this.getNode(childId);\r\n assert(child !== undefined);\r\n (child.parentId as string) = newId;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Transfers node along with its children to a new location. Fails if destination has undefined child count.\r\n * @param sourceNodeId Node that is being moved.\r\n * @param targetParentId Node that will receive a new child.\r\n * @param targetIndex Insertion location among target's *current* children.\r\n * @returns `true` on success, `false` otherwise.\r\n */\r\n public moveNode(sourceNodeId: string, targetParentId: string | undefined, targetIndex: number): boolean {\r\n const sourceNode = this.getNode(sourceNodeId);\r\n if (sourceNode === undefined) {\r\n return false;\r\n }\r\n\r\n const targetParent = targetParentId === undefined ? this._rootNode : this.getNode(targetParentId);\r\n if (targetParent === undefined || targetParent.numChildren === undefined) {\r\n return false;\r\n }\r\n\r\n if (targetParentId !== undefined && this.areNodesRelated(sourceNodeId, targetParentId)) {\r\n return false;\r\n }\r\n\r\n this._tree.moveNode(sourceNode.parentId, sourceNodeId, targetParentId, targetIndex);\r\n\r\n const sourceParent = sourceNode.parentId === undefined ? this._rootNode : this.getNode(sourceNode.parentId);\r\n assert(sourceParent !== undefined);\r\n MutableTreeModel.setNumChildrenForNode(sourceParent, this._tree.getChildren(sourceNode.parentId));\r\n MutableTreeModel.setNumChildrenForNode(targetParent, this._tree.getChildren(targetParentId));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (sourceNode.parentId as string | undefined) = targetParentId;\r\n\r\n const updateDepths = (parentId: string, depth: number) => {\r\n const node = this.getNode(parentId);\r\n assert(node !== undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (node.depth as number) = depth;\r\n for (const [nodeId] of this.getChildren(parentId)?.iterateValues() ?? []) {\r\n updateDepths(nodeId, depth + 1);\r\n }\r\n };\r\n\r\n updateDepths(sourceNodeId, targetParent.depth + 1);\r\n return true;\r\n }\r\n\r\n private areNodesRelated(ancestorNodeId: string, descendantNodeId: string): boolean {\r\n const node = this.getNode(descendantNodeId);\r\n if (node === undefined || node.parentId === undefined) {\r\n return false;\r\n }\r\n\r\n return node.parentId === ancestorNodeId ? true : this.areNodesRelated(ancestorNodeId, node.parentId);\r\n }\r\n\r\n /**\r\n * Sets the number of child nodes a parent is expected to contain. All child nodes of this parent will be subsequently\r\n * removed.\r\n */\r\n public setNumChildren(parentId: string | undefined, numChildren: number | undefined): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode === undefined) {\r\n return;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (parentNode.numChildren as number | undefined) = numChildren;\r\n this._tree.setNumChildren(parentId, numChildren ?? 0);\r\n }\r\n\r\n /** Removes children specified by id.\r\n * @param parentId id of the parent node.\r\n * @param child child node id or index that should be removed.\r\n */\r\n public removeChild(parentId: string | undefined, child: string | number): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n this._tree.removeChild(parentId, child);\r\n\r\n // istanbul ignore else\r\n if (parentNode)\r\n MutableTreeModel.setNumChildrenForNode(parentNode, this._tree.getChildren(parentNode.id));\r\n }\r\n\r\n /** Removes all children for parent specified by id.\r\n * @param parentId id of parent node or undefined to remove root nodes.\r\n */\r\n public clearChildren(parentId: string | undefined) {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode !== undefined) {\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (parentNode.numChildren as number | undefined) = undefined;\r\n }\r\n this._tree.deleteSubtree(parentId, false);\r\n }\r\n\r\n /** Iterates over all nodes present in the tree model. */\r\n public * iterateTreeModelNodes(parentId?: string): IterableIterator<MutableTreeModelNode> {\r\n // eslint-disable-next-line @typescript-eslint/no-this-alias\r\n const _this = this;\r\n function* iterateDescendants(subParentId: string | undefined): IterableIterator<MutableTreeModelNode> {\r\n const children = _this.getChildren(subParentId);\r\n if (children === undefined) {\r\n return;\r\n }\r\n\r\n for (const [nodeId] of children.iterateValues()) {\r\n const node = _this.getNode(nodeId);\r\n if (node !== undefined) {\r\n yield node;\r\n yield* iterateDescendants(nodeId);\r\n }\r\n }\r\n }\r\n\r\n yield* iterateDescendants(parentId);\r\n }\r\n\r\n private static setNumChildrenForNode(node: TreeModelRootNode | MutableTreeModelNode, children: SparseArray<string> | undefined) {\r\n const numChildren = children ? children.getLength() : undefined;\r\n if (node.numChildren === numChildren)\r\n return;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (node.numChildren as number | undefined) = numChildren;\r\n }\r\n\r\n private static createTreeModelNode(parentNode: TreeModelNode | TreeModelRootNode, input: TreeModelNodeInput): MutableTreeModelNode {\r\n return {\r\n id: input.id,\r\n parentId: parentNode.id,\r\n depth: parentNode.depth + 1,\r\n\r\n isLoading: input.isLoading,\r\n numChildren: input.numChildren,\r\n\r\n description: input.description || \"\",\r\n isExpanded: input.isExpanded,\r\n label: input.label,\r\n isSelected: input.isSelected,\r\n isSelectionDisabled: input.item.isSelectionDisabled,\r\n\r\n checkbox: {\r\n state: input.item.checkBoxState || CheckBoxState.Off,\r\n isDisabled: !!input.item.isCheckboxDisabled,\r\n isVisible: !!input.item.isCheckboxVisible,\r\n },\r\n\r\n item: _.cloneDeep(input.item),\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Generates flat list of visible nodes in the tree model.\r\n * @public\r\n */\r\nexport function computeVisibleNodes(model: TreeModel): VisibleTreeNodes {\r\n const result = getVisibleDescendants(model, model.getRootNode());\r\n return {\r\n getNumNodes: () => result.length,\r\n getAtIndex: (index: number): TreeModelNode | TreeModelNodePlaceholder | undefined => {\r\n return result[index];\r\n },\r\n getModel: () => model,\r\n getNumRootNodes: () => model.getRootNode().numChildren,\r\n [Symbol.iterator]: () => result[Symbol.iterator](),\r\n getIndexOfNode: (nodeId: string): number => {\r\n return result.findIndex((visibleNode) => (visibleNode as TreeModelNode).id === nodeId);\r\n },\r\n };\r\n}\r\n\r\n/**\r\n * Traverses the tree and collects visible descendants.\r\n * @public\r\n */\r\nexport function getVisibleDescendants(\r\n model: TreeModel,\r\n parentNode: TreeModelNode | TreeModelRootNode,\r\n result: Array<TreeModelNode | TreeModelNodePlaceholder> = [],\r\n): Array<TreeModelNode | TreeModelNodePlaceholder> {\r\n const children = model.getChildren(parentNode.id);\r\n if (!children) {\r\n return result;\r\n }\r\n\r\n let index = 0;\r\n for (const childId of children) {\r\n if (childId === undefined) {\r\n result.push({ parentId: parentNode.id, depth: parentNode.depth + 1, childIndex: index });\r\n } else {\r\n const childNode = model.getNode(childId);\r\n if (childNode === undefined) {\r\n // node was disposed\r\n result.push({ parentId: parentNode.id, depth: parentNode.depth + 1, childIndex: index });\r\n } else {\r\n result.push(childNode);\r\n if (childNode.isExpanded && childNode.numChildren !== undefined) {\r\n getVisibleDescendants(model, childNode, result);\r\n }\r\n }\r\n }\r\n ++index;\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction cloneSubree(source: TreeModel, target: MutableTreeModel, parentId: string | undefined): void {\r\n target.setNumChildren(\r\n parentId,\r\n (parentId === undefined ? source.getRootNode() : source.getNode(parentId)!).numChildren,\r\n );\r\n for (const [childId, index] of source.getChildren(parentId)?.iterateValues() ?? []) {\r\n const node = source.getNode(childId)!;\r\n target.setChildren(parentId, [{ ...node, isLoading: !!node.isLoading }], index);\r\n cloneSubree(source, target, childId);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TreeModel.js","sourceRoot":"","sources":["../../../../../src/components-react/tree/controlled/TreeModel.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,iCAAkC;AAClC,mCAAmC;AACnC,sDAA6C;AAE7C,kDAAkD;AAElD,sDAAgE;AAyHhE;;;GAGG;AACH,SAAgB,eAAe,CAAC,GAAkC;IAChE,OAAO,GAAG,KAAK,SAAS,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAC5F,CAAC;AAFD,0CAEC;AAED;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,GAAkC;IAC3E,OAAO,GAAG,KAAK,SAAS,IAAI,YAAY,IAAI,GAAG,CAAC;AAClD,CAAC;AAFD,gEAEC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,GAAkC;IACpE,OAAO,GAAG,KAAK,SAAS,IAAK,GAAyB,CAAC,EAAE,KAAK,SAAS,IAAI,CAAC,CAAC,YAAY,IAAI,GAAG,CAAC,CAAC;AACpG,CAAC;AAFD,kDAEC;AAqCD;;;GAGG;AACH,MAAa,gBAAgB;IAM3B,YAAmB,IAAgB;QAL5B,QAAW,GAAG,IAAI,CAAC;QAElB,UAAK,GAAG,IAAI,uBAAU,EAAwB,CAAC;QAC/C,cAAS,GAAsB,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;QAG1F,IAAI,CAAC,IAAI,EAAE;YACT,OAAO;SACR;QAED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3B,oBAAoB;gBACpB,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;aAC1F;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACvB,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE;oBAC/D,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;iBACjD;aACF;SACF;QACD,EAAE,KAAK,CAAC;KACT;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA9BD,sDA8BC;AAED,SAAS,WAAW,CAAC,MAAiB,EAAE,MAAwB,EAAE,QAA4B;;IAC5F,MAAM,CAAC,cAAc,CACnB,QAAQ,EACR,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAE,CAAC,CAAC,WAAW,CACxF,CAAC;IACF,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAA,MAAA,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,0CAAE,aAAa,EAAE,mCAAI,EAAE,EAAE;QAClF,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAE,CAAC;QACtC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAChF,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tree\r\n */\r\n\r\nimport { immerable } from \"immer\";\r\nimport { cloneDeep } from \"lodash\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { CheckBoxState } from \"@itwin/core-react\";\r\nimport { DelayLoadedTreeNodeItem, ImmediatelyLoadedTreeNodeItem, TreeNodeItem } from \"../TreeDataProvider\";\r\nimport { SparseArray, SparseTree } from \"./internal/SparseTree\";\r\n\r\n/**\r\n * Immutable data structure that describes tree node.\r\n * @public\r\n */\r\nexport interface TreeModelNode {\r\n readonly id: string;\r\n readonly parentId: string | undefined;\r\n readonly depth: number;\r\n\r\n readonly isLoading?: boolean;\r\n readonly numChildren: number | undefined;\r\n\r\n readonly description: string | undefined;\r\n readonly isExpanded: boolean;\r\n readonly label: PropertyRecord;\r\n readonly isSelected: boolean;\r\n readonly isSelectionDisabled?: boolean;\r\n\r\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\r\n readonly editingInfo?: TreeModelNodeEditingInfo;\r\n\r\n readonly checkbox: CheckBoxInfo;\r\n\r\n readonly item: TreeNodeItem;\r\n}\r\n\r\n/**\r\n * Immutable data structure that describes checkbox info.\r\n * @public\r\n */\r\nexport interface CheckBoxInfo {\r\n readonly state: CheckBoxState;\r\n readonly tooltip?: string;\r\n readonly isDisabled: boolean;\r\n readonly isVisible: boolean;\r\n}\r\n\r\n/**\r\n * Mutable data structure that describes tree node.\r\n * @public\r\n */\r\nexport interface MutableTreeModelNode extends TreeModelNode {\r\n isLoading: boolean;\r\n\r\n description: string;\r\n isExpanded: boolean;\r\n label: PropertyRecord;\r\n isSelected: boolean;\r\n isSelectionDisabled?: boolean;\r\n\r\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\r\n editingInfo?: TreeModelNodeEditingInfo;\r\n\r\n checkbox: MutableCheckBoxInfo;\r\n\r\n item: TreeNodeItem;\r\n}\r\n\r\n/**\r\n * Data structure that holds callbacks used for tree node editing.\r\n * @public\r\n */\r\nexport interface TreeModelNodeEditingInfo {\r\n onCommit: (node: TreeModelNode, newValue: string) => void;\r\n onCancel: () => void;\r\n}\r\n\r\n/**\r\n * Mutable data structure that describes checkbox info.\r\n * @public\r\n */\r\nexport interface MutableCheckBoxInfo extends CheckBoxInfo {\r\n state: CheckBoxState;\r\n tooltip?: string;\r\n isDisabled: boolean;\r\n isVisible: boolean;\r\n}\r\n\r\n/**\r\n * Data structure that describes tree node placeholder.\r\n * @public\r\n */\r\nexport interface TreeModelNodePlaceholder {\r\n readonly childIndex: number;\r\n readonly depth: number;\r\n readonly parentId?: string;\r\n}\r\n\r\n/**\r\n * Data structure that describes tree root node.\r\n * @public\r\n */\r\nexport interface TreeModelRootNode {\r\n readonly depth: -1;\r\n readonly id: undefined;\r\n readonly numChildren: number | undefined;\r\n}\r\n\r\n/**\r\n * Data structure that describes input used to create tree node.\r\n * @public\r\n */\r\nexport interface TreeModelNodeInput {\r\n readonly description?: string;\r\n readonly isExpanded: boolean;\r\n readonly id: string;\r\n readonly item: TreeNodeItem;\r\n readonly label: PropertyRecord;\r\n readonly isLoading: boolean;\r\n readonly numChildren?: number;\r\n readonly isSelected: boolean;\r\n}\r\n\r\n/**\r\n * Type definition of all tree model nodes.\r\n * @public\r\n */\r\nexport type TreeModelNodeType = TreeModelNode | TreeModelNodePlaceholder | TreeModelRootNode;\r\n\r\n/**\r\n * Checks if object is [[TreeModelNode]]\r\n * @public\r\n */\r\nexport function isTreeModelNode(obj: TreeModelNodeType | undefined): obj is TreeModelNode {\r\n return obj !== undefined && !isTreeModelNodePlaceholder(obj) && !isTreeModelRootNode(obj);\r\n}\r\n\r\n/**\r\n * Checks if object is [[TreeModelNodePlaceholder]]\r\n * @public\r\n */\r\nexport function isTreeModelNodePlaceholder(obj: TreeModelNodeType | undefined): obj is TreeModelNodePlaceholder {\r\n return obj !== undefined && \"childIndex\" in obj;\r\n}\r\n\r\n/**\r\n * Checks if object is [[TreeModelRootNode]]\r\n * @public\r\n */\r\nexport function isTreeModelRootNode(obj: TreeModelNodeType | undefined): obj is TreeModelRootNode {\r\n return obj !== undefined && (obj as TreeModelRootNode).id === undefined && !(\"childIndex\" in obj);\r\n}\r\n\r\n/**\r\n * Type definition of tree node item data.\r\n * @public\r\n */\r\nexport type TreeNodeItemData = ImmediatelyLoadedTreeNodeItem & DelayLoadedTreeNodeItem;\r\n\r\n/**\r\n * Data structure that describes set of visible tree nodes as a flat list.\r\n * @public\r\n */\r\nexport interface VisibleTreeNodes extends Iterable<TreeModelNode | TreeModelNodePlaceholder> {\r\n getNumNodes(): number;\r\n getAtIndex(index: number): TreeModelNode | TreeModelNodePlaceholder | undefined;\r\n getModel(): TreeModel;\r\n getNumRootNodes(): number | undefined;\r\n getIndexOfNode(nodeId: string): number;\r\n}\r\n\r\n/**\r\n * Data structure that describes tree model.\r\n * @public\r\n */\r\nexport interface TreeModel {\r\n getRootNode(): TreeModelRootNode;\r\n\r\n getNode(id: string): TreeModelNode | undefined;\r\n getNode(parentId: string | undefined, childIndex: number): TreeModelNode | TreeModelNodePlaceholder | undefined;\r\n getNode(nodeId: string | undefined, childIndex?: number): TreeModelNode | TreeModelNodePlaceholder | TreeModelRootNode | undefined;\r\n\r\n getChildren(parentId: string | undefined): SparseArray<string> | undefined;\r\n getChildOffset(parentId: string | undefined, childId: string): number | undefined;\r\n\r\n iterateTreeModelNodes(parentId?: string): IterableIterator<TreeModelNode>;\r\n}\r\n\r\n/**\r\n * Mutable tree model which holds nodes and allows adding or removing them.\r\n * @public\r\n */\r\nexport class MutableTreeModel implements TreeModel {\r\n public [immerable] = true;\r\n\r\n private _tree = new SparseTree<MutableTreeModelNode>();\r\n private _rootNode: TreeModelRootNode = { depth: -1, id: undefined, numChildren: undefined };\r\n\r\n public constructor(seed?: TreeModel) {\r\n if (!seed) {\r\n return;\r\n }\r\n\r\n cloneSubree(seed, this, undefined);\r\n }\r\n\r\n /** Returns root node of a tree. This node is not visible and is there to allow having multiple visible root nodes. */\r\n public getRootNode(): TreeModelRootNode {\r\n return this._rootNode;\r\n }\r\n\r\n /** Returns tree node or placeholder for node that is not loaded yet.\r\n * @returns node, node placeholder or undefined if node is not found in model.\r\n */\r\n public getNode(id: string): MutableTreeModelNode | undefined;\r\n public getNode(parentId: string | undefined, childIndex: number): MutableTreeModelNode | TreeModelNodePlaceholder | undefined;\r\n public getNode(nodeId: string | undefined, childIndex?: number): MutableTreeModelNode | TreeModelNodePlaceholder | undefined {\r\n if (childIndex === undefined) {\r\n return this._tree.getNode(nodeId!);\r\n }\r\n\r\n const children = this._tree.getChildren(nodeId);\r\n const childId = children !== undefined ? children.get(childIndex) : undefined;\r\n if (childId !== undefined) {\r\n return this._tree.getNode(childId);\r\n }\r\n\r\n const parentNode = nodeId === undefined ? this._rootNode : this._tree.getNode(nodeId);\r\n if (parentNode !== undefined) {\r\n return {\r\n childIndex,\r\n depth: parentNode.depth + 1,\r\n parentId: nodeId,\r\n };\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Returns children for specific parent.\r\n * @param parentId id of parent node.\r\n * @returns children of parent node or root nodes if undefined is passed as parent id.\r\n */\r\n public getChildren(parentId: string | undefined): SparseArray<string> | undefined {\r\n return this._tree.getChildren(parentId);\r\n }\r\n\r\n /** Returns children offset in children array for specific parent. */\r\n public getChildOffset(parentId: string | undefined, childId: string): number | undefined {\r\n return this._tree.getChildOffset(parentId, childId);\r\n }\r\n\r\n /**\r\n * Sets children for parent node starting from the specific offset.\r\n * If offset overlaps with already added nodes, the overlapping nodes are overwritten.\r\n */\r\n public setChildren(parentId: string | undefined, nodeInputs: TreeModelNodeInput[], offset: number): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode === undefined)\r\n return;\r\n\r\n const children: MutableTreeModelNode[] = [];\r\n for (const input of nodeInputs) {\r\n const child = MutableTreeModel.createTreeModelNode(parentNode, input);\r\n children.push(child);\r\n }\r\n\r\n this._tree.setChildren(parentNode.id, children, offset);\r\n MutableTreeModel.setNumChildrenForNode(parentNode, this._tree.getChildren(parentNode.id));\r\n }\r\n\r\n /**\r\n * Inserts child in the specified position.\r\n * If offset is higher then current length of children array, the length is increased.\r\n */\r\n public insertChild(parentId: string | undefined, childNodeInput: TreeModelNodeInput, offset: number): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode === undefined)\r\n return;\r\n\r\n const child = MutableTreeModel.createTreeModelNode(parentNode, childNodeInput);\r\n\r\n this._tree.insertChild(parentNode.id, child, offset);\r\n MutableTreeModel.setNumChildrenForNode(parentNode, this._tree.getChildren(parentNode.id));\r\n }\r\n\r\n /**\r\n * Changes the id of target node.\r\n * @returns `true` on success, `false` otherwise.\r\n */\r\n public changeNodeId(currentId: string, newId: string): boolean {\r\n const node = this.getNode(currentId);\r\n if (node === undefined) {\r\n return false;\r\n }\r\n\r\n if (currentId === newId) {\r\n return true;\r\n }\r\n\r\n const index = this.getChildOffset(node.parentId, currentId);\r\n assert(index !== undefined);\r\n\r\n if (!this._tree.setNodeId(node.parentId, index, newId)) {\r\n return false;\r\n }\r\n\r\n (node.id as string) = newId; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion\r\n for (const [childId] of this.getChildren(newId)?.iterateValues() ?? []) {\r\n const child = this.getNode(childId);\r\n assert(child !== undefined);\r\n (child.parentId as string) = newId;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Transfers node along with its children to a new location. Fails if destination has undefined child count.\r\n * @param sourceNodeId Node that is being moved.\r\n * @param targetParentId Node that will receive a new child.\r\n * @param targetIndex Insertion location among target's *current* children.\r\n * @returns `true` on success, `false` otherwise.\r\n */\r\n public moveNode(sourceNodeId: string, targetParentId: string | undefined, targetIndex: number): boolean {\r\n const sourceNode = this.getNode(sourceNodeId);\r\n if (sourceNode === undefined) {\r\n return false;\r\n }\r\n\r\n const targetParent = targetParentId === undefined ? this._rootNode : this.getNode(targetParentId);\r\n if (targetParent === undefined || targetParent.numChildren === undefined) {\r\n return false;\r\n }\r\n\r\n if (targetParentId !== undefined && this.areNodesRelated(sourceNodeId, targetParentId)) {\r\n return false;\r\n }\r\n\r\n this._tree.moveNode(sourceNode.parentId, sourceNodeId, targetParentId, targetIndex);\r\n\r\n const sourceParent = sourceNode.parentId === undefined ? this._rootNode : this.getNode(sourceNode.parentId);\r\n assert(sourceParent !== undefined);\r\n MutableTreeModel.setNumChildrenForNode(sourceParent, this._tree.getChildren(sourceNode.parentId));\r\n MutableTreeModel.setNumChildrenForNode(targetParent, this._tree.getChildren(targetParentId));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (sourceNode.parentId as string | undefined) = targetParentId;\r\n\r\n const updateDepths = (parentId: string, depth: number) => {\r\n const node = this.getNode(parentId);\r\n assert(node !== undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (node.depth as number) = depth;\r\n for (const [nodeId] of this.getChildren(parentId)?.iterateValues() ?? []) {\r\n updateDepths(nodeId, depth + 1);\r\n }\r\n };\r\n\r\n updateDepths(sourceNodeId, targetParent.depth + 1);\r\n return true;\r\n }\r\n\r\n private areNodesRelated(ancestorNodeId: string, descendantNodeId: string): boolean {\r\n const node = this.getNode(descendantNodeId);\r\n if (node === undefined || node.parentId === undefined) {\r\n return false;\r\n }\r\n\r\n return node.parentId === ancestorNodeId ? true : this.areNodesRelated(ancestorNodeId, node.parentId);\r\n }\r\n\r\n /**\r\n * Sets the number of child nodes a parent is expected to contain. All child nodes of this parent will be subsequently\r\n * removed.\r\n */\r\n public setNumChildren(parentId: string | undefined, numChildren: number | undefined): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode === undefined) {\r\n return;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (parentNode.numChildren as number | undefined) = numChildren;\r\n this._tree.setNumChildren(parentId, numChildren ?? 0);\r\n }\r\n\r\n /** Removes children specified by id.\r\n * @param parentId id of the parent node.\r\n * @param child child node id or index that should be removed.\r\n */\r\n public removeChild(parentId: string | undefined, child: string | number): void {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n this._tree.removeChild(parentId, child);\r\n\r\n // istanbul ignore else\r\n if (parentNode)\r\n MutableTreeModel.setNumChildrenForNode(parentNode, this._tree.getChildren(parentNode.id));\r\n }\r\n\r\n /** Removes all children for parent specified by id.\r\n * @param parentId id of parent node or undefined to remove root nodes.\r\n */\r\n public clearChildren(parentId: string | undefined) {\r\n const parentNode = parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\r\n if (parentNode !== undefined) {\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (parentNode.numChildren as number | undefined) = undefined;\r\n }\r\n this._tree.deleteSubtree(parentId, false);\r\n }\r\n\r\n /** Iterates over all nodes present in the tree model. */\r\n public * iterateTreeModelNodes(parentId?: string): IterableIterator<MutableTreeModelNode> {\r\n // eslint-disable-next-line @typescript-eslint/no-this-alias\r\n const _this = this;\r\n function* iterateDescendants(subParentId: string | undefined): IterableIterator<MutableTreeModelNode> {\r\n const children = _this.getChildren(subParentId);\r\n if (children === undefined) {\r\n return;\r\n }\r\n\r\n for (const [nodeId] of children.iterateValues()) {\r\n const node = _this.getNode(nodeId);\r\n if (node !== undefined) {\r\n yield node;\r\n yield* iterateDescendants(nodeId);\r\n }\r\n }\r\n }\r\n\r\n yield* iterateDescendants(parentId);\r\n }\r\n\r\n private static setNumChildrenForNode(node: TreeModelRootNode | MutableTreeModelNode, children: SparseArray<string> | undefined) {\r\n const numChildren = children ? children.getLength() : undefined;\r\n if (node.numChildren === numChildren)\r\n return;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n (node.numChildren as number | undefined) = numChildren;\r\n }\r\n\r\n private static createTreeModelNode(parentNode: TreeModelNode | TreeModelRootNode, input: TreeModelNodeInput): MutableTreeModelNode {\r\n return {\r\n id: input.id,\r\n parentId: parentNode.id,\r\n depth: parentNode.depth + 1,\r\n\r\n isLoading: input.isLoading,\r\n numChildren: input.numChildren,\r\n\r\n description: input.description || \"\",\r\n isExpanded: input.isExpanded,\r\n label: input.label,\r\n isSelected: input.isSelected,\r\n isSelectionDisabled: input.item.isSelectionDisabled,\r\n\r\n checkbox: {\r\n state: input.item.checkBoxState || CheckBoxState.Off,\r\n isDisabled: !!input.item.isCheckboxDisabled,\r\n isVisible: !!input.item.isCheckboxVisible,\r\n },\r\n\r\n item: cloneDeep(input.item),\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Generates flat list of visible nodes in the tree model.\r\n * @public\r\n */\r\nexport function computeVisibleNodes(model: TreeModel): VisibleTreeNodes {\r\n const result = getVisibleDescendants(model, model.getRootNode());\r\n return {\r\n getNumNodes: () => result.length,\r\n getAtIndex: (index: number): TreeModelNode | TreeModelNodePlaceholder | undefined => {\r\n return result[index];\r\n },\r\n getModel: () => model,\r\n getNumRootNodes: () => model.getRootNode().numChildren,\r\n [Symbol.iterator]: () => result[Symbol.iterator](),\r\n getIndexOfNode: (nodeId: string): number => {\r\n return result.findIndex((visibleNode) => (visibleNode as TreeModelNode).id === nodeId);\r\n },\r\n };\r\n}\r\n\r\n/**\r\n * Traverses the tree and collects visible descendants.\r\n * @public\r\n */\r\nexport function getVisibleDescendants(\r\n model: TreeModel,\r\n parentNode: TreeModelNode | TreeModelRootNode,\r\n result: Array<TreeModelNode | TreeModelNodePlaceholder> = [],\r\n): Array<TreeModelNode | TreeModelNodePlaceholder> {\r\n const children = model.getChildren(parentNode.id);\r\n if (!children) {\r\n return result;\r\n }\r\n\r\n let index = 0;\r\n for (const childId of children) {\r\n if (childId === undefined) {\r\n result.push({ parentId: parentNode.id, depth: parentNode.depth + 1, childIndex: index });\r\n } else {\r\n const childNode = model.getNode(childId);\r\n if (childNode === undefined) {\r\n // node was disposed\r\n result.push({ parentId: parentNode.id, depth: parentNode.depth + 1, childIndex: index });\r\n } else {\r\n result.push(childNode);\r\n if (childNode.isExpanded && childNode.numChildren !== undefined) {\r\n getVisibleDescendants(model, childNode, result);\r\n }\r\n }\r\n }\r\n ++index;\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction cloneSubree(source: TreeModel, target: MutableTreeModel, parentId: string | undefined): void {\r\n target.setNumChildren(\r\n parentId,\r\n (parentId === undefined ? source.getRootNode() : source.getNode(parentId)!).numChildren,\r\n );\r\n for (const [childId, index] of source.getChildren(parentId)?.iterateValues() ?? []) {\r\n const node = source.getNode(childId)!;\r\n target.setChildren(parentId, [{ ...node, isLoading: !!node.isLoading }], index);\r\n cloneSubree(source, target, childId);\r\n }\r\n}\r\n"]}
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
5
  @import "~@itwin/core-react/lib/cjs/core-react/scrollbar";
7
6
 
8
7
  .components-controlledTree-loader {
@@ -16,14 +15,14 @@
16
15
 
17
16
  .components-controlledTree-errorMessage {
18
17
  font-style: italic;
19
- color: $buic-foreground-muted;
18
+ color: var(--iui-color-text-muted);
20
19
  margin: 0 20%;
21
20
  text-align: center;
22
21
  }
23
22
 
24
23
  .components-controlledTree {
25
- color: $buic-foreground-body;
26
- background-color: $buic-background-control;
24
+ color: var(--iui-color-text);
25
+ background-color: var(--iui-color-background);
27
26
 
28
27
  /**
29
28
  * Workaround for horizontal scroll issue.
@@ -71,25 +70,26 @@
71
70
  }
72
71
 
73
72
  @mixin enable-border($edge) {
74
- border-#{$edge}: 1px solid $buic-foreground-primary;
73
+ border-#{$edge}: 1px solid var(--iui-color-icon-accent);
75
74
  padding-#{$edge}: 0;
76
75
  }
77
76
 
78
77
  .node-wrapper.is-selected {
79
78
  .core-tree-node {
79
+ background: var(--iui-color-background-accent-muted);
80
80
  @include enable-border("left");
81
81
  @include enable-border("right");
82
82
  }
83
83
  }
84
84
 
85
85
  .node-wrapper.is-selected:first-child,
86
- .node-wrapper:not(.is-selected)+.node-wrapper.is-selected {
86
+ .node-wrapper:not(.is-selected) + .node-wrapper.is-selected {
87
87
  .core-tree-node {
88
88
  @include enable-border("top");
89
89
  }
90
90
  }
91
91
 
92
- .node-wrapper.is-selected+.node-wrapper:not(.is-selected) {
92
+ .node-wrapper.is-selected + .node-wrapper:not(.is-selected) {
93
93
  .core-tree-node {
94
94
  @include enable-border("top");
95
95
  }
@@ -2,10 +2,9 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
5
 
7
6
  .components-controlledTree-node-description {
8
- color: $buic-foreground-muted;
7
+ color: var(--iui-color-text-muted);
9
8
  font-size: var(--iui-font-size-0);
10
9
  margin-top: 4px;
11
10
 
@@ -9,7 +9,7 @@
9
9
  width: auto;
10
10
 
11
11
  &.components-date-has-error {
12
- color: $buic-foreground-alert;
12
+ color: var(--iui-color-text-negative);
13
13
  }
14
14
 
15
15
  &.iui-input {
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAQH,OAAO,mBAAmB,CAAC;AAY3B;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,QAAQ,EAAE,IAAI,CAAC;IACf,qDAAqD;IACrD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuLhD"}
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AASH,OAAO,mBAAmB,CAAC;AAY3B;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,QAAQ,EAAE,IAAI,CAAC;IACf,qDAAqD;IACrD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuLhD"}
@@ -8,8 +8,9 @@
8
8
  import * as React from "react";
9
9
  import classnames from "classnames";
10
10
  import { SpecialKey } from "@itwin/appui-abstract";
11
- import { WebFontIcon } from "@itwin/core-react";
12
11
  import { UiComponents } from "../UiComponents";
12
+ import { Icon } from "@itwin/core-react";
13
+ import { SvgChevronLeft, SvgChevronRight } from "@itwin/itwinui-icons-react";
13
14
  import "./DatePicker.scss";
14
15
  function isSameDay(a, b) {
15
16
  return (a &&
@@ -158,13 +159,13 @@ export function DatePicker(props) {
158
159
  return (React.createElement("div", { className: "components-date-picker-calendar" },
159
160
  React.createElement("div", { className: "components-date-picker-calendar-header-months" },
160
161
  React.createElement("button", { className: previousButtonClass, title: previousMonthLabel.current, onClick: handleMoveToPreviousMonth },
161
- React.createElement(WebFontIcon, { iconName: "icon-chevron-left" })),
162
+ React.createElement(Icon, { iconSpec: React.createElement(SvgChevronLeft, null) })),
162
163
  React.createElement("span", { className: "components-month-year" },
163
164
  monthsLong.current[displayedMonthIndex],
164
165
  " ",
165
166
  displayedYear),
166
167
  React.createElement("button", { className: nextButtonClass, title: nextMonthLabel.current, onClick: handleMoveToNextMonth },
167
- React.createElement(WebFontIcon, { iconName: "icon-chevron-right" }))),
168
+ React.createElement(Icon, { iconSpec: React.createElement(SvgChevronRight, null) }))),
168
169
  React.createElement("div", { className: "components-date-picker-calendar-header-weekdays" }, [0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => React.createElement("div", { key: `day-${dayOfWeek}`, className: "components-date-picker-calendar-header-day-short", title: daysLong.current[dayOfWeek] },
169
170
  React.createElement("span", null, daysShort.current[dayOfWeek])))),
170
171
  React.createElement("ul", { tabIndex: 0, onKeyDown: handleCalendarKeyDown, "data-testid": "components-date-picker-calendar-list", className: calendarClass, role: "listbox" }, weeks.map((weekdays, weekIndex) => (React.createElement(React.Fragment, { key: `week-${weekIndex}` }, weekdays.map((day, dayIndex) => {
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,mBAAmB,CAAC;AAE3B,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;AAeD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,kBAAkB,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gBAAc,GAAG,CAAC,OAAO,EAAE;gBACjG,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAAC,CACnB,CACE,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Date\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { WebFontIcon } from \"@itwin/core-react\";\r\nimport { UiComponents } from \"../UiComponents\";\r\n\r\nimport \"./DatePicker.scss\";\r\n\r\nfunction isSameDay(a: Date, b: Date) {\r\n return (\r\n a &&\r\n b &&\r\n a.getFullYear() === b.getFullYear() &&\r\n a.getMonth() === b.getMonth() &&\r\n a.getDate() === b.getDate()\r\n );\r\n}\r\n\r\n/**\r\n * Props for [[DatePicker]] component.\r\n * @alpha\r\n */\r\nexport interface DatePickerProps {\r\n /** defines both date and time */\r\n selected: Date;\r\n /** function to call when date or time has changed */\r\n onDateChange?: (day: Date) => void;\r\n /** show focus outlines, useful for keyboard navigation */\r\n showFocusOutline?: boolean;\r\n}\r\n\r\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\r\n * @alpha\r\n */\r\nexport function DatePicker(props: DatePickerProps) {\r\n const previousMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.previousMonth\"));\r\n const nextMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.nextMonth\"));\r\n const monthsLong = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.january\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.february\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.march\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.april\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.june\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.july\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.august\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.september\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.october\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.november\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.december\"),\r\n ]);\r\n\r\n const daysLong = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.sunday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.monday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.tuesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.wednesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.thursday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.friday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.saturday\"),\r\n ]);\r\n\r\n const daysShort = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.sunday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.monday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.tuesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.wednesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.thursday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.friday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.saturday\"),\r\n ]);\r\n\r\n const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));\r\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());\r\n const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());\r\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\r\n React.useEffect(() => {\r\n const newSelectedDay = new Date(props.selected);\r\n setSelectedDay(new Date(props.selected));\r\n setDisplayedMonthIndex(newSelectedDay.getMonth());\r\n setDisplayedYear(newSelectedDay.getFullYear());\r\n setFocusedDay(newSelectedDay);\r\n }, [props.selected]);\r\n const days = React.useMemo(() => {\r\n const msFirstDayOfMonth = new Date(displayedYear, displayedMonthIndex, 1).getTime();\r\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\r\n if (0 === offsetToFirst)\r\n offsetToFirst = 7;\r\n\r\n const daysInMonth: Date[] = [];\r\n // generate 6 weeks of dates\r\n for (let i = 0; i < 42; i++) {\r\n const adjustedDay = 1 + i - offsetToFirst;\r\n daysInMonth.push(new Date(displayedYear, displayedMonthIndex, adjustedDay));\r\n }\r\n return daysInMonth;\r\n }, [displayedMonthIndex, displayedYear]);\r\n\r\n const weeks = React.useMemo(() => {\r\n const weeksInMonth = [];\r\n const weekCount = Math.ceil(days.length / 7);\r\n for (let i = 0; i < weekCount; i++) {\r\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\r\n }\r\n return weeksInMonth;\r\n }, [days]);\r\n\r\n const setMonthAndYear = React.useCallback((newMonth: number, newYear: number) => {\r\n setDisplayedMonthIndex(newMonth);\r\n setDisplayedYear(newYear);\r\n if (selectedDay.getFullYear() === newYear && selectedDay.getMonth() === newMonth) {\r\n setFocusedDay(new Date(selectedDay.getTime()));\r\n } else {\r\n const newFocusDay = new Date(focusedDay.getTime());\r\n newFocusDay.setFullYear(newYear, newMonth, 1);\r\n setFocusedDay(newFocusDay);\r\n }\r\n }, [focusedDay, selectedDay]);\r\n\r\n const handleMoveToPreviousMonth = React.useCallback(() => {\r\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\r\n const newYear = displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\r\n setMonthAndYear(newMonth, newYear);\r\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\r\n\r\n const handleMoveToNextMonth = React.useCallback(() => {\r\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\r\n const newYear = displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\r\n setMonthAndYear(newMonth, newYear);\r\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\r\n\r\n // when invoked, it will return another function which can be used for the onClick React listener.\r\n const handleOnDayChange = React.useCallback((day: Date) => () => {\r\n setSelectedDay(day);\r\n setFocusedDay(day);\r\n props.onDateChange && props.onDateChange(day);\r\n }, [props]);\r\n\r\n const handleCalendarKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n if (event.key === SpecialKey.ArrowDown) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n if ((focusedDayIndex + 7) > 41)\r\n setFocusedDay(days[focusedDayIndex % 7]);\r\n else\r\n setFocusedDay(days[focusedDayIndex + 7]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowUp) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n if ((focusedDayIndex - 7) < 0)\r\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\r\n else\r\n setFocusedDay(days[focusedDayIndex - 7]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowLeft) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n // istanbul ignore else\r\n if ((focusedDayIndex - 1) >= 0)\r\n setFocusedDay(days[focusedDayIndex - 1]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowRight) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n // istanbul ignore else\r\n if ((focusedDayIndex + 1) <= 41)\r\n setFocusedDay(days[focusedDayIndex + 1]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.Enter || event.key === SpecialKey.Space) {\r\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\r\n event.preventDefault();\r\n }\r\n }, [days, focusedDay, handleOnDayChange]);\r\n\r\n const previousButtonClass = classnames(\"components-previous-month\", props.showFocusOutline && \"showFocusOutline\");\r\n const nextButtonClass = classnames(\"components-next-month\", props.showFocusOutline && \"showFocusOutline\");\r\n const calendarClass = classnames(\"components-date-picker-calendar-month\", props.showFocusOutline && \"showFocusOutline\");\r\n\r\n return (\r\n <div className=\"components-date-picker-calendar\">\r\n <div className=\"components-date-picker-calendar-header-months\">\r\n <button className={previousButtonClass} title={previousMonthLabel.current} onClick={handleMoveToPreviousMonth}>\r\n <WebFontIcon iconName={\"icon-chevron-left\"} />\r\n </button>\r\n <span className=\"components-month-year\">{monthsLong.current[displayedMonthIndex]} {displayedYear}</span>\r\n <button className={nextButtonClass} title={nextMonthLabel.current} onClick={handleMoveToNextMonth}>\r\n <WebFontIcon iconName={\"icon-chevron-right\"} />\r\n </button>\r\n </div>\r\n <div className=\"components-date-picker-calendar-header-weekdays\">\r\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) =>\r\n <div key={`day-${dayOfWeek}`} className=\"components-date-picker-calendar-header-day-short\"\r\n title={daysLong.current[dayOfWeek]}><span>{daysShort.current[dayOfWeek]}</span></div>)}\r\n </div>\r\n <ul tabIndex={0} onKeyDown={handleCalendarKeyDown} data-testid=\"components-date-picker-calendar-list\" className={calendarClass} role=\"listbox\">\r\n {weeks.map((weekdays, weekIndex) => (\r\n <React.Fragment key={`week-${weekIndex}`}>\r\n {weekdays.map((day: Date, dayIndex: number) => {\r\n const isActive = selectedDay && day && isSameDay(selectedDay, day);\r\n const isFocused = focusedDay && day && isSameDay(focusedDay, day) && props.showFocusOutline;\r\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\r\n const classNames = classnames(\"components-date-picker-calendar-day\", isActive && \"selected\", !isCurrentMonth && \"notCurrentMonth\", isFocused && \"focused\");\r\n const dateValue = day.getDate();\r\n return (\r\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\r\n <li className={classNames} key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\r\n onClick={handleOnDayChange(day)} role=\"option\" aria-selected={isActive} data-value={day.getTime()}>\r\n <span>{dateValue}</span>\r\n </li>\r\n );\r\n })}\r\n </React.Fragment>)\r\n )}\r\n </ul>\r\n </div>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,mBAAmB,CAAC;AAE3B,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;AAeD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAC/H,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,YAA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;QACJ,CAAC,CAAC,CACa,CAAC,CACnB,CACE,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Date\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { UiComponents } from \"../UiComponents\";\r\nimport { Icon } from \"@itwin/core-react\";\r\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\r\n\r\nimport \"./DatePicker.scss\";\r\n\r\nfunction isSameDay(a: Date, b: Date) {\r\n return (\r\n a &&\r\n b &&\r\n a.getFullYear() === b.getFullYear() &&\r\n a.getMonth() === b.getMonth() &&\r\n a.getDate() === b.getDate()\r\n );\r\n}\r\n\r\n/**\r\n * Props for [[DatePicker]] component.\r\n * @alpha\r\n */\r\nexport interface DatePickerProps {\r\n /** defines both date and time */\r\n selected: Date;\r\n /** function to call when date or time has changed */\r\n onDateChange?: (day: Date) => void;\r\n /** show focus outlines, useful for keyboard navigation */\r\n showFocusOutline?: boolean;\r\n}\r\n\r\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\r\n * @alpha\r\n */\r\nexport function DatePicker(props: DatePickerProps) {\r\n const previousMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.previousMonth\"));\r\n const nextMonthLabel = React.useRef(UiComponents.localization.getLocalizedString(\"UiComponents:datepicker.nextMonth\"));\r\n const monthsLong = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.january\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.february\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.march\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.april\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.june\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.july\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.august\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.september\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.october\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.november\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.december\"),\r\n ]);\r\n\r\n const daysLong = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.sunday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.monday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.tuesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.wednesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.thursday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.friday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.long.saturday\"),\r\n ]);\r\n\r\n const daysShort = React.useRef([\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.sunday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.monday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.tuesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.wednesday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.thursday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.friday\"),\r\n UiComponents.localization.getLocalizedString(\"UiComponents:days.short.saturday\"),\r\n ]);\r\n\r\n const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));\r\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());\r\n const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());\r\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\r\n React.useEffect(() => {\r\n const newSelectedDay = new Date(props.selected);\r\n setSelectedDay(new Date(props.selected));\r\n setDisplayedMonthIndex(newSelectedDay.getMonth());\r\n setDisplayedYear(newSelectedDay.getFullYear());\r\n setFocusedDay(newSelectedDay);\r\n }, [props.selected]);\r\n const days = React.useMemo(() => {\r\n const msFirstDayOfMonth = new Date(displayedYear, displayedMonthIndex, 1).getTime();\r\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\r\n if (0 === offsetToFirst)\r\n offsetToFirst = 7;\r\n\r\n const daysInMonth: Date[] = [];\r\n // generate 6 weeks of dates\r\n for (let i = 0; i < 42; i++) {\r\n const adjustedDay = 1 + i - offsetToFirst;\r\n daysInMonth.push(new Date(displayedYear, displayedMonthIndex, adjustedDay));\r\n }\r\n return daysInMonth;\r\n }, [displayedMonthIndex, displayedYear]);\r\n\r\n const weeks = React.useMemo(() => {\r\n const weeksInMonth = [];\r\n const weekCount = Math.ceil(days.length / 7);\r\n for (let i = 0; i < weekCount; i++) {\r\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\r\n }\r\n return weeksInMonth;\r\n }, [days]);\r\n\r\n const setMonthAndYear = React.useCallback((newMonth: number, newYear: number) => {\r\n setDisplayedMonthIndex(newMonth);\r\n setDisplayedYear(newYear);\r\n if (selectedDay.getFullYear() === newYear && selectedDay.getMonth() === newMonth) {\r\n setFocusedDay(new Date(selectedDay.getTime()));\r\n } else {\r\n const newFocusDay = new Date(focusedDay.getTime());\r\n newFocusDay.setFullYear(newYear, newMonth, 1);\r\n setFocusedDay(newFocusDay);\r\n }\r\n }, [focusedDay, selectedDay]);\r\n\r\n const handleMoveToPreviousMonth = React.useCallback(() => {\r\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\r\n const newYear = displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\r\n setMonthAndYear(newMonth, newYear);\r\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\r\n\r\n const handleMoveToNextMonth = React.useCallback(() => {\r\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\r\n const newYear = displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\r\n setMonthAndYear(newMonth, newYear);\r\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\r\n\r\n // when invoked, it will return another function which can be used for the onClick React listener.\r\n const handleOnDayChange = React.useCallback((day: Date) => () => {\r\n setSelectedDay(day);\r\n setFocusedDay(day);\r\n props.onDateChange && props.onDateChange(day);\r\n }, [props]);\r\n\r\n const handleCalendarKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n if (event.key === SpecialKey.ArrowDown) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n if ((focusedDayIndex + 7) > 41)\r\n setFocusedDay(days[focusedDayIndex % 7]);\r\n else\r\n setFocusedDay(days[focusedDayIndex + 7]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowUp) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n if ((focusedDayIndex - 7) < 0)\r\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\r\n else\r\n setFocusedDay(days[focusedDayIndex - 7]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowLeft) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n // istanbul ignore else\r\n if ((focusedDayIndex - 1) >= 0)\r\n setFocusedDay(days[focusedDayIndex - 1]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.ArrowRight) {\r\n const focusedDayIndex = days.findIndex((day) => isSameDay(day, focusedDay));\r\n // istanbul ignore else\r\n if ((focusedDayIndex + 1) <= 41)\r\n setFocusedDay(days[focusedDayIndex + 1]);\r\n event.preventDefault();\r\n }\r\n if (event.key === SpecialKey.Enter || event.key === SpecialKey.Space) {\r\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\r\n event.preventDefault();\r\n }\r\n }, [days, focusedDay, handleOnDayChange]);\r\n\r\n const previousButtonClass = classnames(\"components-previous-month\", props.showFocusOutline && \"showFocusOutline\");\r\n const nextButtonClass = classnames(\"components-next-month\", props.showFocusOutline && \"showFocusOutline\");\r\n const calendarClass = classnames(\"components-date-picker-calendar-month\", props.showFocusOutline && \"showFocusOutline\");\r\n\r\n return (\r\n <div className=\"components-date-picker-calendar\">\r\n <div className=\"components-date-picker-calendar-header-months\">\r\n <button className={previousButtonClass} title={previousMonthLabel.current} onClick={handleMoveToPreviousMonth}>\r\n <Icon iconSpec={<SvgChevronLeft />} />\r\n </button>\r\n <span className=\"components-month-year\">{monthsLong.current[displayedMonthIndex]} {displayedYear}</span>\r\n <button className={nextButtonClass} title={nextMonthLabel.current} onClick={handleMoveToNextMonth}>\r\n <Icon iconSpec={<SvgChevronRight />} />\r\n </button>\r\n </div>\r\n <div className=\"components-date-picker-calendar-header-weekdays\">\r\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) =>\r\n <div key={`day-${dayOfWeek}`} className=\"components-date-picker-calendar-header-day-short\"\r\n title={daysLong.current[dayOfWeek]}><span>{daysShort.current[dayOfWeek]}</span></div>)}\r\n </div>\r\n <ul tabIndex={0} onKeyDown={handleCalendarKeyDown} data-testid=\"components-date-picker-calendar-list\" className={calendarClass} role=\"listbox\">\r\n {weeks.map((weekdays, weekIndex) => (\r\n <React.Fragment key={`week-${weekIndex}`}>\r\n {weekdays.map((day: Date, dayIndex: number) => {\r\n const isActive = selectedDay && day && isSameDay(selectedDay, day);\r\n const isFocused = focusedDay && day && isSameDay(focusedDay, day) && props.showFocusOutline;\r\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\r\n const classNames = classnames(\"components-date-picker-calendar-day\", isActive && \"selected\", !isCurrentMonth && \"notCurrentMonth\", isFocused && \"focused\");\r\n const dateValue = day.getDate();\r\n return (\r\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\r\n <li className={classNames} key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\r\n onClick={handleOnDayChange(day)} role=\"option\" aria-selected={isActive} data-value={day.getTime()}>\r\n <span>{dateValue}</span>\r\n </li>\r\n );\r\n })}\r\n </React.Fragment>)\r\n )}\r\n </ul>\r\n </div>\r\n );\r\n}\r\n"]}
@@ -16,13 +16,13 @@ $date-picker-icons-color-actionable-hover: rgba(
16
16
  $buic-foreground-body,
17
17
  $uicore-opacity-1
18
18
  );
19
- $date-picker-outside-month-color: $buic-text-color-disabled;
19
+ $date-picker-outside-month-color: var(--iui-color-text-disabled);
20
20
  $outline-size: 2px;
21
21
 
22
22
  .components-date-picker-calendar {
23
23
  border-radius: var(--iui-border-radius-1) var(--iui-border-radius-1) 0 0;
24
24
  background-color: $buic-background-control;
25
- color: $buic-foreground-body;
25
+ color: var(--iui-color-text);
26
26
  font-size: 14px;
27
27
 
28
28
  * {
@@ -42,7 +42,7 @@ $outline-size: 2px;
42
42
  border: none;
43
43
  cursor: pointer;
44
44
  padding: 5px;
45
- font-size: $uicore-icons-small;
45
+ font-size: var(--iui-font-size-2);
46
46
  user-select: none;
47
47
  color: $date-picker-icons-color-actionable;
48
48
 
@@ -51,7 +51,7 @@ $outline-size: 2px;
51
51
 
52
52
  &.showFocusOutline {
53
53
  outline: 0px;
54
- border: 0px solid $buic-inputs-border;
54
+ border: 0px solid var(--iui-color-border-foreground);
55
55
  border-radius: var(--iui-border-radius-1);
56
56
  border-color: var(--buic-foreground-focus-border);
57
57
  box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
@@ -60,7 +60,7 @@ $outline-size: 2px;
60
60
  }
61
61
 
62
62
  &:hover {
63
- color: $buic-foreground-primary;
63
+ color: var(--iui-color-text-accent);
64
64
  }
65
65
  }
66
66
 
@@ -109,7 +109,7 @@ $outline-size: 2px;
109
109
  outline: 0px;
110
110
 
111
111
  &.showFocusOutline {
112
- border: 0px solid $buic-inputs-border;
112
+ border: 0px solid var(--iui-color-border-foreground);
113
113
  border-radius: var(--iui-border-radius-1);
114
114
  border-color: var(--buic-foreground-focus-border);
115
115
  box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
@@ -117,7 +117,7 @@ $outline-size: 2px;
117
117
 
118
118
  .components-date-picker-calendar-day.focused {
119
119
  outline: 0px;
120
- border: 1px solid $buic-inputs-border;
120
+ border: 1px solid var(--iui-color-border-foreground);
121
121
  border-radius: var(--iui-border-radius-1);
122
122
  border-color: var(--buic-foreground-focus-border);
123
123
  box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
@@ -150,13 +150,13 @@ $outline-size: 2px;
150
150
 
151
151
  &.selected {
152
152
  background-color: $buic-background-primary;
153
- color: $buic-foreground-accessory;
153
+ color: var(--iui-color-white);
154
154
  font-weight: var(--iui-font-weight-semibold);
155
155
  border-radius: var(--iui-border-radius-1);
156
156
 
157
157
  &:hover {
158
158
  background-color: $buic-row-hover;
159
- color: $buic-foreground-body;
159
+ color: var(--iui-color-text);
160
160
  }
161
161
  }
162
162
 
@@ -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,EAAE,aAAa,EAAgC,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAY,WAAW,EAAS,MAAM,mBAAmB,CAAC;AAKjE,OAAO,8BAA8B,CAAC;AAEtC;YACY;AACZ,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;;KAEK;AACL,wBAAgB,qBAAqB,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAC1G,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,0BAA0B,eAkF/E"}
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,EAAE,aAAa,EAAgC,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAS,MAAM,mBAAmB,CAAC;AAMvD,OAAO,8BAA8B,CAAC;AAEtC;YACY;AACZ,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;;KAEK;AACL,wBAAgB,qBAAqB,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAC1G,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,0BAA0B,eAkF/E"}
@@ -7,7 +7,8 @@
7
7
  */
8
8
  import * as React from "react";
9
9
  import { RelativePosition, SpecialKey } from "@itwin/appui-abstract";
10
- import { BodyText, Popup } from "@itwin/core-react";
10
+ import { Popup } from "@itwin/core-react";
11
+ import { Text } from "@itwin/itwinui-react";
11
12
  import { UiComponents } from "../UiComponents";
12
13
  import { DatePicker } from "./DatePicker";
13
14
  import { DateField } from "./DateField";
@@ -69,7 +70,7 @@ export function DatePickerPopupButton({ displayEditField, timeDisplay, selected,
69
70
  React.createElement(DatePicker, { selected: workingDate, onDateChange: handleOnDateChanged, showFocusOutline: showFocusOutline }),
70
71
  timeDisplay &&
71
72
  React.createElement("div", { className: "time-container" },
72
- React.createElement(BodyText, { className: "time-label" }, timeLabelRef.current),
73
+ React.createElement(Text, { variant: "body", className: "time-label" }, timeLabelRef.current),
73
74
  React.createElement(TimeField, { time: timeSpec, timeDisplay: timeDisplay, onTimeChange: handleOnTimeChanged })))),
74
75
  !!displayEditField && React.createElement(DateField, { style: fieldStyle, className: fieldClassName, initialDate: workingDate, timeDisplay: timeDisplay, dateFormatter: dateFormatter, onDateChange: handleOnDateChanged })));
75
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAiB,gBAAgB,EAAE,UAAU,EAAe,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAe,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,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ACV,6BAAK,SAAS,EAAC,gBAAgB;wBAC7B,oBAAC,QAAQ,IAAC,SAAS,EAAC,YAAY,IAAE,YAAY,CAAC,OAAO,CAAY;wBAClE,oBAAC,SAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtF,CAEJ,CACC;QACR,CAAC,CAAC,gBAAgB,IAAI,oBAAC,SAAS,IAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtM,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Date\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { DateFormatter, RelativePosition, SpecialKey, TimeDisplay } from \"@itwin/appui-abstract\";\r\nimport { BodyText, CommonProps, Popup } from \"@itwin/core-react\";\r\nimport { UiComponents } from \"../UiComponents\";\r\nimport { DatePicker } from \"./DatePicker\";\r\nimport { DateField } from \"./DateField\";\r\nimport { TimeField, TimeSpec } from \"./TimeField\";\r\nimport \"./DatePickerPopupButton.scss\";\r\n\r\n/** Props used by [[DatePickerPopupButton]] component.\r\n * @alpha */\r\nexport interface DatePickerPopupButtonProps extends CommonProps {\r\n /** Date to be shown as the selected date. */\r\n selected: Date;\r\n /** If true show the date (and optionally time) edit field next to button */\r\n displayEditField?: boolean;\r\n // If defined show time in popup and also display time if input field is shown\r\n timeDisplay?: TimeDisplay;\r\n /** Function called when Date changes. */\r\n onDateChange?: (day: Date) => void;\r\n /** Optional tooltip */\r\n buttonToolTip?: string;\r\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\r\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\r\n dateFormatter?: DateFormatter;\r\n /** User defined class name for edit field. */\r\n fieldClassName?: string;\r\n /** User defined style for edit field. */\r\n fieldStyle?: React.CSSProperties;\r\n}\r\n\r\n/** Component that displays a button used to pick a date and optionally a time.\r\n * @alpha\r\n * */\r\nexport function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter,\r\n buttonToolTip, fieldStyle, fieldClassName, style }: DatePickerPopupButtonProps) {\r\n const [workingDate, setWorkingDate] = React.useState(new Date(selected.getTime()));\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const timeLabelRef = React.useRef(UiComponents.translate(\"datepicker.time\"));\r\n const toolTipLabelRef = React.useRef(UiComponents.translate(\"datepicker.selectDate\"));\r\n const toolTipLabel = React.useMemo(() => buttonToolTip ? buttonToolTip : toolTipLabelRef.current, [buttonToolTip]);\r\n\r\n // See if props have changed since component mounted\r\n React.useEffect(() => {\r\n const newWorkingDate = new Date(selected.getTime());\r\n setWorkingDate(newWorkingDate);\r\n }, [selected]);\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setShowFocusOutline(false);\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleOnDateChanged = (day: Date) => {\r\n // combine current time into selected Date\r\n const newWorkingDate = new Date(day.getTime());\r\n newWorkingDate.setHours(workingDate.getHours(), workingDate.getMinutes(), workingDate.getSeconds());\r\n onDateChange && onDateChange(newWorkingDate);\r\n !timeDisplay && setIsSettingsOpen(false);\r\n };\r\n\r\n const handleOnTimeChanged = (time: TimeSpec) => {\r\n // Combine new time into selected Date\r\n const newWorkingDate = new Date(workingDate.getTime());\r\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\r\n setWorkingDate(newWorkingDate);\r\n onDateChange && onDateChange(newWorkingDate);\r\n };\r\n\r\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\r\n const handlePopupKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLButtonElement>) => {\r\n // istanbul ignore else\r\n if (event.key === SpecialKey.Space) {\r\n setShowFocusOutline(true);\r\n setIsSettingsOpen(true);\r\n }\r\n }, []);\r\n\r\n const timeSpec: TimeSpec = { hours: workingDate.getHours(), minutes: workingDate.getMinutes(), seconds: workingDate.getSeconds() };\r\n return (\r\n <>\r\n <button title={toolTipLabel} style={style} className=\"components-date-picker-calendar-popup-button\" onKeyDown={handlePopupKeyDown}\r\n data-testid=\"components-date-picker-calendar-popup-button\" onPointerDown={togglePopupDisplay} ref={buttonRef}>\r\n <div className=\"datepicker-button\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\r\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\" />\r\n </svg>\r\n </div>\r\n </button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomLeft}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n moveFocus={showFocusOutline}\r\n closeOnNestedPopupOutsideClick\r\n >\r\n <div className=\"components-date-picker-calendar-popup-panel\" data-testid=\"components-date-picker-calendar-popup-panel\">\r\n <DatePicker selected={workingDate} onDateChange={handleOnDateChanged} showFocusOutline={showFocusOutline} />\r\n {timeDisplay &&\r\n <div className=\"time-container\">\r\n <BodyText className=\"time-label\">{timeLabelRef.current}</BodyText>\r\n <TimeField time={timeSpec} timeDisplay={timeDisplay} onTimeChange={handleOnTimeChanged} />\r\n </div>\r\n }\r\n </div>\r\n </Popup >\r\n {!!displayEditField && <DateField style={fieldStyle} className={fieldClassName} initialDate={workingDate} timeDisplay={timeDisplay} dateFormatter={dateFormatter} onDateChange={handleOnDateChanged} />}\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAiB,gBAAgB,EAAE,UAAU,EAAe,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAe,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAY,MAAM,aAAa,CAAC;AAClD,OAAO,8BAA8B,CAAC;AAwBtC;;KAEK;AACL,MAAM,UAAU,qBAAqB,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAC1G,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAA8B;IAC9E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACnF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC7E,MAAM,eAA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K,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,6BAAK,SAAS,EAAC,6CAA6C,iBAAa,6CAA6C;gBACpH,oBAAC,UAAU,IAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,GAAI;gBAC3G,WAAW;oBACV,6BAAK,SAAS,EAAC,gBAAgB;wBAC7B,oBAAC,IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IAAE,YAAY,CAAC,OAAO,CAAQ;wBACzE,oBAAC,SAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtF,CAEJ,CACC;QACR,CAAC,CAAC,gBAAgB,IAAI,oBAAC,SAAS,IAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GAAI,CACtM,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Date\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { DateFormatter, RelativePosition, SpecialKey, TimeDisplay } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, Popup } from \"@itwin/core-react\";\r\nimport { Text } from \"@itwin/itwinui-react\";\r\nimport { UiComponents } from \"../UiComponents\";\r\nimport { DatePicker } from \"./DatePicker\";\r\nimport { DateField } from \"./DateField\";\r\nimport { TimeField, TimeSpec } from \"./TimeField\";\r\nimport \"./DatePickerPopupButton.scss\";\r\n\r\n/** Props used by [[DatePickerPopupButton]] component.\r\n * @alpha */\r\nexport interface DatePickerPopupButtonProps extends CommonProps {\r\n /** Date to be shown as the selected date. */\r\n selected: Date;\r\n /** If true show the date (and optionally time) edit field next to button */\r\n displayEditField?: boolean;\r\n // If defined show time in popup and also display time if input field is shown\r\n timeDisplay?: TimeDisplay;\r\n /** Function called when Date changes. */\r\n onDateChange?: (day: Date) => void;\r\n /** Optional tooltip */\r\n buttonToolTip?: string;\r\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\r\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\r\n dateFormatter?: DateFormatter;\r\n /** User defined class name for edit field. */\r\n fieldClassName?: string;\r\n /** User defined style for edit field. */\r\n fieldStyle?: React.CSSProperties;\r\n}\r\n\r\n/** Component that displays a button used to pick a date and optionally a time.\r\n * @alpha\r\n * */\r\nexport function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter,\r\n buttonToolTip, fieldStyle, fieldClassName, style }: DatePickerPopupButtonProps) {\r\n const [workingDate, setWorkingDate] = React.useState(new Date(selected.getTime()));\r\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\r\n const timeLabelRef = React.useRef(UiComponents.translate(\"datepicker.time\"));\r\n const toolTipLabelRef = React.useRef(UiComponents.translate(\"datepicker.selectDate\"));\r\n const toolTipLabel = React.useMemo(() => buttonToolTip ? buttonToolTip : toolTipLabelRef.current, [buttonToolTip]);\r\n\r\n // See if props have changed since component mounted\r\n React.useEffect(() => {\r\n const newWorkingDate = new Date(selected.getTime());\r\n setWorkingDate(newWorkingDate);\r\n }, [selected]);\r\n\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const togglePopupDisplay = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\r\n event.preventDefault();\r\n setShowFocusOutline(false);\r\n setIsSettingsOpen((prev) => !prev);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleCloseSetting = React.useCallback(() => {\r\n setIsSettingsOpen(false);\r\n }, [setIsSettingsOpen]);\r\n\r\n const handleOnDateChanged = (day: Date) => {\r\n // combine current time into selected Date\r\n const newWorkingDate = new Date(day.getTime());\r\n newWorkingDate.setHours(workingDate.getHours(), workingDate.getMinutes(), workingDate.getSeconds());\r\n onDateChange && onDateChange(newWorkingDate);\r\n !timeDisplay && setIsSettingsOpen(false);\r\n };\r\n\r\n const handleOnTimeChanged = (time: TimeSpec) => {\r\n // Combine new time into selected Date\r\n const newWorkingDate = new Date(workingDate.getTime());\r\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\r\n setWorkingDate(newWorkingDate);\r\n onDateChange && onDateChange(newWorkingDate);\r\n };\r\n\r\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\r\n const handlePopupKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLButtonElement>) => {\r\n // istanbul ignore else\r\n if (event.key === SpecialKey.Space) {\r\n setShowFocusOutline(true);\r\n setIsSettingsOpen(true);\r\n }\r\n }, []);\r\n\r\n const timeSpec: TimeSpec = { hours: workingDate.getHours(), minutes: workingDate.getMinutes(), seconds: workingDate.getSeconds() };\r\n return (\r\n <>\r\n <button title={toolTipLabel} style={style} className=\"components-date-picker-calendar-popup-button\" onKeyDown={handlePopupKeyDown}\r\n data-testid=\"components-date-picker-calendar-popup-button\" onPointerDown={togglePopupDisplay} ref={buttonRef}>\r\n <div className=\"datepicker-button\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\r\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\" />\r\n </svg>\r\n </div>\r\n </button>\r\n <Popup\r\n isOpen={isSettingsOpen}\r\n position={RelativePosition.BottomLeft}\r\n onClose={handleCloseSetting}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n moveFocus={showFocusOutline}\r\n closeOnNestedPopupOutsideClick\r\n >\r\n <div className=\"components-date-picker-calendar-popup-panel\" data-testid=\"components-date-picker-calendar-popup-panel\">\r\n <DatePicker selected={workingDate} onDateChange={handleOnDateChanged} showFocusOutline={showFocusOutline} />\r\n {timeDisplay &&\r\n <div className=\"time-container\">\r\n <Text variant=\"body\" className=\"time-label\">{timeLabelRef.current}</Text>\r\n <TimeField time={timeSpec} timeDisplay={timeDisplay} onTimeChange={handleOnTimeChanged} />\r\n </div>\r\n }\r\n </div>\r\n </Popup >\r\n {!!displayEditField && <DateField style={fieldStyle} className={fieldClassName} initialDate={workingDate} timeDisplay={timeDisplay} dateFormatter={dateFormatter} onDateChange={handleOnDateChanged} />}\r\n </>\r\n );\r\n}\r\n"]}
@@ -5,7 +5,7 @@
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/index";
6
6
 
7
7
  .components-date-picker-calendar-popup-button {
8
- color: $buic-foreground-body;
8
+ color: var(--iui-color-text);
9
9
  font-size: var(--iui-font-size-1);
10
10
  background-color: transparent;
11
11
  height: 2.2em;
@@ -18,11 +18,11 @@
18
18
  }
19
19
 
20
20
  svg {
21
- fill: $buic-foreground-body;
21
+ fill: var(--iui-color-icon);
22
22
  }
23
23
 
24
24
  &:hover {
25
- color: $buic-foreground-primary-tone;
25
+ color: var(--iui-color-text-accent-hover);
26
26
  cursor: auto;
27
27
 
28
28
  svg {
@@ -46,7 +46,7 @@
46
46
  flex-direction: row;
47
47
  align-items: center;
48
48
  justify-content: center;
49
- border-top: 2px solid $buic-inputs-border;
49
+ border-top: 2px solid var(--iui-color-border-foreground);
50
50
  padding-top: 8px;
51
51
  padding-bottom: 8px;
52
52
 
@@ -11,13 +11,13 @@
11
11
  align-items: center;
12
12
  justify-content: flex-start;
13
13
  background-color: $buic-background-control;
14
- border: 1px solid $buic-inputs-border;
14
+ border: 1px solid var(--iui-color-border-foreground);
15
15
  border-radius: var(--iui-border-radius-1);
16
16
  box-shadow: var(--buic-inputs-boxshadow) 0px 1px 1px inset;
17
17
  box-sizing: border-box;
18
18
 
19
19
  &.has-error {
20
- color: $buic-foreground-alert;
20
+ color: var(--iui-color-text-negative);
21
21
  }
22
22
 
23
23
  .components-time-input {
@@ -35,7 +35,7 @@
35
35
 
36
36
  &:focus {
37
37
  outline: 0px;
38
- border: 1px solid $buic-inputs-border;
38
+ border: 1px solid var(--iui-color-border-foreground);
39
39
  border-radius: var(--iui-border-radius-1);
40
40
  border-color: var(--buic-foreground-focus-border);
41
41
  box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
@@ -57,7 +57,7 @@
57
57
 
58
58
  &:focus {
59
59
  outline: 0px;
60
- border: 1px solid $buic-inputs-border;
60
+ border: 1px solid var(--iui-color-border-foreground);
61
61
  border-radius: var(--iui-border-radius-1);
62
62
  border-color: var(--buic-foreground-focus-border);
63
63
  box-shadow: var(--buic-focus-boxshadow-gradient1) 0px 1px 1px,
@@ -15,7 +15,7 @@ import { TimeField } from "../datepicker/TimeField";
15
15
  import { DatePicker } from "../datepicker/DatePicker";
16
16
  import { TypeConverterManager } from "../converters/TypeConverterManager";
17
17
  import { DateTimeTypeConverterBase } from "../converters/DateTimeTypeConverter";
18
- import { BodyText } from "@itwin/core-react";
18
+ import { Text } from "@itwin/itwinui-react";
19
19
  import { adjustDateToTimezone } from "../common/DateUtils";
20
20
  /** DateTimeEditor React component that is a property editor for selection of date and time.
21
21
  * @internal
@@ -239,7 +239,7 @@ export class DateTimeEditor extends React.PureComponent {
239
239
  React.createElement(DatePicker, { selected: date, onDateChange: this._handleChange, showFocusOutline: false }),
240
240
  this.state.timeDisplay &&
241
241
  React.createElement("div", { className: "time-container" },
242
- React.createElement(BodyText, { className: "time-label" }, "Time"),
242
+ React.createElement(Text, { variant: "body", className: "time-label" }, "Time"),
243
243
  React.createElement(TimeField, { time: timeSpec, timeDisplay: this.state.timeDisplay, onTimeChange: this._handleTimeChange })))),
244
244
  React.createElement(PopupOkCancelButtons, { onOk: this._handleOk, onCancel: this._handleCancel })))));
245
245
  }