@itwin/appui-react 5.15.2 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/lib/appui-react/accudraw/AccuDrawFieldContainer.js.map +1 -1
  3. package/lib/appui-react/configurableui/ConfigurableUiContent.d.ts +1 -1
  4. package/lib/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
  5. package/lib/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
  6. package/lib/appui-react/content/ContentGroup.js +1 -1
  7. package/lib/appui-react/content/ContentGroup.js.map +1 -1
  8. package/lib/appui-react/content/FloatingViewportContent.js +1 -1
  9. package/lib/appui-react/content/FloatingViewportContent.js.map +1 -1
  10. package/lib/appui-react/content/split-pane/Pane.d.ts +1 -1
  11. package/lib/appui-react/content/split-pane/Pane.d.ts.map +1 -1
  12. package/lib/appui-react/content/split-pane/Pane.js.map +1 -1
  13. package/lib/appui-react/content/split-pane/SplitPane.js +1 -1
  14. package/lib/appui-react/content/split-pane/SplitPane.js.map +1 -1
  15. package/lib/appui-react/cursor/cursormenu/CursorMenu.js +1 -1
  16. package/lib/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
  17. package/lib/appui-react/cursor/cursorprompt/CursorPrompt.js +1 -1
  18. package/lib/appui-react/cursor/cursorprompt/CursorPrompt.js.map +1 -1
  19. package/lib/appui-react/dialog/UiDataProvidedDialog.js +2 -2
  20. package/lib/appui-react/dialog/UiDataProvidedDialog.js.map +1 -1
  21. package/lib/appui-react/framework/FrameworkFrontstages.d.ts +5 -0
  22. package/lib/appui-react/framework/FrameworkFrontstages.d.ts.map +1 -1
  23. package/lib/appui-react/framework/FrameworkFrontstages.js.map +1 -1
  24. package/lib/appui-react/hooks/useLatestRef.d.ts +1 -1
  25. package/lib/appui-react/hooks/useLatestRef.d.ts.map +1 -1
  26. package/lib/appui-react/layout/StandardLayout.scss +0 -1
  27. package/lib/appui-react/layout/tool-settings/Docked.js.map +1 -1
  28. package/lib/appui-react/layout/widget/Tab.js +2 -2
  29. package/lib/appui-react/layout/widget/Tab.js.map +1 -1
  30. package/lib/appui-react/layout/widget/TabBar.js +1 -1
  31. package/lib/appui-react/layout/widget/TabBar.js.map +1 -1
  32. package/lib/appui-react/layout/widget-panels/Grip.js +1 -1
  33. package/lib/appui-react/layout/widget-panels/Grip.js.map +1 -1
  34. package/lib/appui-react/layout/widget-panels/useAnimatePanel.d.ts +1 -1
  35. package/lib/appui-react/layout/widget-panels/useAnimatePanel.d.ts.map +1 -1
  36. package/lib/appui-react/layout/widget-panels/useAnimatePanel.js +3 -3
  37. package/lib/appui-react/layout/widget-panels/useAnimatePanel.js.map +1 -1
  38. package/lib/appui-react/messages/MessageRenderer.d.ts.map +1 -1
  39. package/lib/appui-react/messages/MessageRenderer.js +1 -1
  40. package/lib/appui-react/messages/MessageRenderer.js.map +1 -1
  41. package/lib/appui-react/pickers/ListPicker.d.ts.map +1 -1
  42. package/lib/appui-react/pickers/ListPicker.js +1 -1
  43. package/lib/appui-react/pickers/ListPicker.js.map +1 -1
  44. package/lib/appui-react/pickers/ListPicker.scss +10 -0
  45. package/lib/appui-react/settings/quantityformatting/QuantityFormat.d.ts.map +1 -1
  46. package/lib/appui-react/settings/quantityformatting/QuantityFormat.js +1 -1
  47. package/lib/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
  48. package/lib/appui-react/statusbar/popup/Popup.js +1 -1
  49. package/lib/appui-react/statusbar/popup/Popup.js.map +1 -1
  50. package/lib/appui-react/statusbar/popup/StatusBarPopover.js +1 -1
  51. package/lib/appui-react/statusbar/popup/StatusBarPopover.js.map +1 -1
  52. package/lib/appui-react/statusfields/SnapMode.js +1 -1
  53. package/lib/appui-react/statusfields/SnapMode.js.map +1 -1
  54. package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
  55. package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.scss +1 -1
  56. package/lib/appui-react/toolbar/new-toolbars/ToolGroup.js.map +1 -1
  57. package/lib/appui-react/toolbar/new-toolbars/useOverflow.js +2 -2
  58. package/lib/appui-react/toolbar/new-toolbars/useOverflow.js.map +1 -1
  59. package/lib/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
  60. package/lib/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
  61. package/lib/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
  62. package/lib/appui-react/widget-panels/ToolSettings.d.ts +1 -1
  63. package/lib/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
  64. package/lib/appui-react/widget-panels/ToolSettings.js.map +1 -1
  65. package/lib/cjs/appui-react/layout/StandardLayout.scss +0 -1
  66. package/lib/cjs/appui-react/pickers/ListPicker.scss +10 -0
  67. package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.scss +1 -1
  68. package/lib/esm/appui-react/layout/StandardLayout.scss +0 -1
  69. package/lib/esm/appui-react/pickers/ListPicker.scss +10 -0
  70. package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.scss +1 -1
  71. package/package.json +16 -16
@@ -134,7 +134,7 @@ function ListPickerPopupItem(props) {
134
134
  return (React.createElement(ToolbarDragInteractionContext.Consumer, null, (isEnabled) => {
135
135
  return props.panelOnly === true ? (getListPanel(props)) : (
136
136
  // eslint-disable-next-line @typescript-eslint/no-deprecated
137
- React.createElement(PopupItem, { hideIndicator: isEnabled, icon: icon, title: props.title, panel: getListPanel(props) }));
137
+ React.createElement(PopupItem, { className: "ListPicker-button", hideIndicator: isEnabled, icon: icon, title: props.title, panel: getListPanel(props) }));
138
138
  }));
139
139
  }
140
140
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ListPicker.js","sourceRoot":"","sources":["../../../src/appui-react/pickers/ListPicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,M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I,CAAC,KAAK,CAAC,QAAQ,EAC7B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GACrB,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Picker\n */\n\nimport \"./ListPicker.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PopupItem } from \"@itwin/components-react\";\nimport {\n Columns,\n GroupColumn,\n Panel,\n Title,\n} from \"@itwin/components-react/internal\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon, SearchBox } from \"@itwin/core-react\";\nimport { ToolbarDragInteractionContext } from \"../toolbar/DragInteraction.js\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport {\n SvgChevronDown,\n SvgChevronRight,\n SvgList,\n} from \"@itwin/itwinui-icons-react\";\nimport type { SizeProps } from \"../utils/SizeProps.js\";\n\n/** Enum for the list picker item type\n * @beta\n */\nexport enum ListItemType {\n Item = 0,\n Separator = 1,\n Container = 2,\n}\n\n/** List picker item\n * @beta\n */\nexport interface ListItem {\n [key: string]: any;\n id?: string;\n name?: string;\n enabled: boolean;\n type?: ListItemType;\n children?: ListItem[];\n}\n\n/** Properties for the [[ListPicker]] component\n * @beta\n */\nexport interface ListPickerProps {\n title: string;\n items: ListItem[];\n /** @deprecated in 4.16.0. Use {@link ListPickerProps.icon} instead. */\n iconSpec?: string | React.ReactNode;\n icon?: React.ReactNode;\n setEnabled: (item: ListItem, enabled: boolean) => any;\n onExpanded?: (expand: boolean) => void;\n onSizeKnown?: (size: SizeProps) => void;\n searchBox?: boolean;\n onSearchValueChange?: (search: string) => void;\n panelOnly?: boolean;\n expanded?: boolean;\n}\n\n/** Properties for the [[ListPickerItem]] component\n * @beta\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ListPickerItemProps extends CommonProps {\n key: any;\n isActive?: boolean;\n isFocused?: boolean;\n onClick?: () => void;\n label?: string;\n}\n\n/** List Picker Item React component\n * @beta\n */\nexport class ListPickerItem extends React.PureComponent<ListPickerItemProps> {\n /** Renders ListPickerItem */\n public override render() {\n const itemClassName = classnames(\n \"ListPicker-item\",\n this.props.isActive && \"is-active\",\n this.props.isFocused && \"is-focused\",\n this.props.className\n );\n // TODO - if cut off, show a title\n const title: string | undefined =\n this.props.label && this.props.label.length > 25\n ? this.props.label\n : undefined;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n className={itemClassName}\n onClick={this.props.onClick}\n role=\"button\"\n tabIndex={-1}\n >\n <div className=\"label\" title={title}>\n {this.props.label}\n </div>\n </div>\n );\n }\n}\n\n/** Properties for the [[ExpandableSection]] component\n * @beta\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ExpandableSectionProps extends CommonProps {\n title?: string;\n expanded?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** State for the [[ExpandableSection]] component\n * @internal\n */\ninterface ExpandableSectionState {\n expanded: boolean;\n}\n\n/** Expandable Section React component\n * @beta\n */\nexport class ExpandableSection extends React.PureComponent<\n ExpandableSectionProps,\n ExpandableSectionState\n> {\n /** Creates an ExpandableSection */\n constructor(props: ExpandableSectionProps) {\n super(props);\n this.state = { expanded: !!this.props.expanded };\n }\n\n /** @internal */\n public override async componentDidUpdate(\n prevProps: Readonly<ExpandableSectionProps>\n ) {\n if (this.props.expanded !== prevProps.expanded) {\n this.setState({ expanded: true });\n }\n }\n\n private _onClick = () => {\n this.setState((prevState) => ({ expanded: !prevState.expanded }));\n };\n\n /** Renders ExpandableSection */\n public override render() {\n const className = classnames(\n \"nz-toolbar-item-expandable-group-group\",\n this.props.className\n );\n\n const icon = this.state.expanded ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={<SvgChevronDown />} />\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={<SvgChevronRight />} />\n );\n\n return (\n <Panel\n className={className}\n style={this.props.style}\n key={this.props.title}\n >\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n onClick={this._onClick}\n className={\n this.state.expanded\n ? \"ListPickerInnerContainer-header-expanded\"\n : \"ListPickerInnerContainer-header\"\n }\n role=\"button\"\n tabIndex={-1}\n aria-expanded={this.state.expanded}\n >\n <div className=\"ListPickerInnerContainer-header-content\">\n <div className=\"ListPickerInnerContainer-expander\">{icon}</div>\n <div className=\"ListPickerInnerContainer-title\">\n {this.props.title}\n </div>\n </div>\n </div>\n {this.state.expanded ? (\n <GroupColumn>{this.props.children}</GroupColumn>\n ) : (\n <div />\n )}\n </Panel>\n );\n }\n}\n\n/** @beta */\nexport function getListPanel(props: ListPickerProps): React.ReactNode {\n const expandSingleSection = (): boolean => {\n const populatedContainers = props.items.filter((item: ListItem) => {\n return (\n item.type === ListItemType.Container && item.children!.length !== 0\n );\n });\n return populatedContainers.length === 1;\n };\n\n const listItemToElement = (item: ListItem, itemIndex: number) => {\n switch (item.type) {\n case ListItemType.Item:\n return (\n <ListPickerItem\n {...props}\n key={itemIndex.toString()}\n label={item.name}\n isActive={item.enabled}\n onClick={() => {\n props.setEnabled(item, !item.enabled);\n }}\n />\n );\n case ListItemType.Separator:\n return (\n <div key={itemIndex.toString()} className=\"ListPicker-separator\" />\n );\n case ListItemType.Container:\n if (item.children!.length !== 0) {\n return (\n <ExpandableSection\n key={itemIndex.toString()}\n title={item.name}\n className=\"ListPickerInnerContainer\"\n expanded={\n props.expanded === true\n ? !expandSingleSection()\n : expandSingleSection()\n }\n >\n <GroupColumn>{item.children!.map(listItemToElement)}</GroupColumn>\n </ExpandableSection>\n );\n } else {\n return <div key={itemIndex.toString()} />;\n }\n default:\n return <div key={itemIndex.toString()} />;\n }\n };\n\n return (\n <Panel className=\"ListPickerContainer\">\n <Title>{props.title}</Title>\n {props.searchBox && props.onSearchValueChange && (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <SearchBox\n className=\"ListPickerSearchBox\"\n onValueChanged={props.onSearchValueChange}\n />\n )}\n <Columns>\n <GroupColumn className=\"ListPicker-column\">\n {props.items.map(listItemToElement)}\n </GroupColumn>\n </Columns>\n </Panel>\n );\n}\n\n/**\n * List picker toolbar popup item.\n * Used to provide an expandable list of items to enable/disable items.\n * @beta\n */\nfunction ListPickerPopupItem(props: ListPickerProps) {\n const icon =\n props.icon ??\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (props.iconSpec ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof props.iconSpec === \"string\" ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={props.iconSpec} />\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <i className=\"icon uifw-item-svg-icon\">{props.iconSpec}</i>\n )\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={<SvgList />} />\n ));\n\n return (\n <ToolbarDragInteractionContext.Consumer>\n {(isEnabled) => {\n return props.panelOnly === true ? (\n getListPanel(props)\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <PopupItem\n hideIndicator={isEnabled}\n icon={icon}\n title={props.title}\n panel={getListPanel(props)}\n />\n );\n }}\n </ToolbarDragInteractionContext.Consumer>\n );\n}\n\n/** Properties for the [[ListPicker]] component\n * @beta\n */\nexport interface ListPickerPropsExtended extends ListPickerProps {\n enableAllFunc?: () => void;\n disableAllFunc?: () => void;\n invertFunc?: () => void;\n}\n\n/**\n * List Picker that lets the user pick from a list of items to enable/disable\n * It also provides options to enable all, disable all and invert selection\n * @beta\n */\nexport class ListPicker extends React.Component<ListPickerPropsExtended> {\n public static get Key_All() {\n return -3;\n }\n public static get Key_None() {\n return -2;\n }\n public static get Key_Invert() {\n return -1;\n }\n public static get Key_Separator() {\n return -4;\n }\n\n /** Creates a ListPicker */\n constructor(props: ListPickerPropsExtended) {\n super(props);\n }\n\n // Creates an array of items containing the separator and special requests (all, none, invert)\n private createItems(items: ListItem[]): ListItem[] {\n const newItems: ListItem[] = [];\n\n // Create special buttons (All/None/Invert)\n if (this.props.enableAllFunc) {\n let allEnabled = true;\n items.map((item: ListItem) => {\n allEnabled = allEnabled && item.enabled;\n });\n newItems.push({\n key: ListPicker.Key_All,\n name: UiFramework.translate(\"pickerButtons.all\"),\n enabled: allEnabled,\n type: ListItemType.Item,\n });\n }\n if (this.props.disableAllFunc) {\n let allDisabled = false;\n items.map((item: ListItem) => {\n allDisabled = allDisabled || item.enabled;\n });\n newItems.push({\n key: ListPicker.Key_None,\n name: UiFramework.translate(\"pickerButtons.none\"),\n enabled: !allDisabled,\n type: ListItemType.Item,\n });\n }\n if (this.props.invertFunc) {\n newItems.push({\n key: ListPicker.Key_Invert,\n name: UiFramework.translate(\"pickerButtons.invert\"),\n enabled: false,\n type: ListItemType.Item,\n });\n }\n if (\n this.props.enableAllFunc ||\n this.props.disableAllFunc ||\n this.props.invertFunc\n ) {\n newItems.push({\n key: ListPicker.Key_Separator,\n name: UiFramework.translate(\"pickerButtons.separator\"),\n enabled: false,\n type: ListItemType.Separator,\n });\n }\n\n // Push items\n items.map((item) => {\n newItems.push(item);\n });\n return newItems;\n }\n\n /**\n * Checks if item is a special item.\n * @param item Item to check\n */\n public isSpecialItem(item: ListItem) {\n return (\n item.key === ListPicker.Key_All ||\n item.key === ListPicker.Key_Invert ||\n item.key === ListPicker.Key_None ||\n item.type !== ListItemType.Item ||\n item.key === ListPicker.Key_Separator\n );\n }\n\n // Handle enabling/disabling the items\n // This will call the this.props.setEnabled function to provide the parent with a chance to process it\n private _setEnabled = (item: ListItem, enabled: boolean) => {\n if (this.isSpecialItem(item)) {\n switch (item.key) {\n case ListPicker.Key_All: {\n if (this.props.enableAllFunc) this.props.enableAllFunc();\n return;\n }\n case ListPicker.Key_None: {\n if (this.props.disableAllFunc) this.props.disableAllFunc();\n return;\n }\n case ListPicker.Key_Invert: {\n if (this.props.invertFunc) this.props.invertFunc();\n return;\n }\n }\n }\n\n // Call on parent to do processing of the item\n this.props.setEnabled(item, enabled);\n };\n\n /** Renders ListPicker */\n public override render() {\n return (\n <ListPickerPopupItem\n {...this.props}\n title={this.props.title}\n setEnabled={this._setEnabled}\n onExpanded={this.props.onExpanded}\n items={this.createItems(this.props.items)}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iconSpec={this.props.iconSpec}\n icon={this.props.icon}\n />\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ListPicker.js","sourceRoot":"","sources":["../../../src/appui-react/pickers/ListPicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EACL,OAAO,EACP,WAAW,EACX,KAAK,EACL,KAAK,GACN,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,eAAe,EACf,OAAO,GACR,MAAM,4BAA4B,CAAC;AAGpC;;GAEG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;AACf,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AA4CD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK,CAAC,aAAkC;IAC1E,6BAA6B;IACb,MAAM;QACpB,MAAM,aAAa,GAAG,UAAU,CAC9B,iBAAiB,EACjB,IAAI,CAAC,KAAK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CAAC,UAAU;YAClC,IAAI,CAAC,GAAG,KAAK,UAAU,CAAC,QAAQ;YAChC,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI;YAC/B,IAAI,CAAC,GAAG,KAAK,UAAU,CAAC,aAAa,CACtC,CAAC;IACJ,CAAC;IA0BD,yBAAyB;IACT,MAAM;QACpB,OAAO,CACL,oBAAC,mBAAmB,OACd,IAAI,CAAC,KAAK,EACd,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,UAAU,EAAE,IAAI,CAAC,WAAW,EAC5B,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YACzC,4DAA4D;YAC5D,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GACrB,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Picker\n */\n\nimport \"./ListPicker.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PopupItem } from \"@itwin/components-react\";\nimport {\n Columns,\n GroupColumn,\n Panel,\n Title,\n} from \"@itwin/components-react/internal\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon, SearchBox } from \"@itwin/core-react\";\nimport { ToolbarDragInteractionContext } from \"../toolbar/DragInteraction.js\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport {\n SvgChevronDown,\n SvgChevronRight,\n SvgList,\n} from \"@itwin/itwinui-icons-react\";\nimport type { SizeProps } from \"../utils/SizeProps.js\";\n\n/** Enum for the list picker item type\n * @beta\n */\nexport enum ListItemType {\n Item = 0,\n Separator = 1,\n Container = 2,\n}\n\n/** List picker item\n * @beta\n */\nexport interface ListItem {\n [key: string]: any;\n id?: string;\n name?: string;\n enabled: boolean;\n type?: ListItemType;\n children?: ListItem[];\n}\n\n/** Properties for the [[ListPicker]] component\n * @beta\n */\nexport interface ListPickerProps {\n title: string;\n items: ListItem[];\n /** @deprecated in 4.16.0. Use {@link ListPickerProps.icon} instead. */\n iconSpec?: string | React.ReactNode;\n icon?: React.ReactNode;\n setEnabled: (item: ListItem, enabled: boolean) => any;\n onExpanded?: (expand: boolean) => void;\n onSizeKnown?: (size: SizeProps) => void;\n searchBox?: boolean;\n onSearchValueChange?: (search: string) => void;\n panelOnly?: boolean;\n expanded?: boolean;\n}\n\n/** Properties for the [[ListPickerItem]] component\n * @beta\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ListPickerItemProps extends CommonProps {\n key: any;\n isActive?: boolean;\n isFocused?: boolean;\n onClick?: () => void;\n label?: string;\n}\n\n/** List Picker Item React component\n * @beta\n */\nexport class ListPickerItem extends React.PureComponent<ListPickerItemProps> {\n /** Renders ListPickerItem */\n public override render() {\n const itemClassName = classnames(\n \"ListPicker-item\",\n this.props.isActive && \"is-active\",\n this.props.isFocused && \"is-focused\",\n this.props.className\n );\n // TODO - if cut off, show a title\n const title: string | undefined =\n this.props.label && this.props.label.length > 25\n ? this.props.label\n : undefined;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n className={itemClassName}\n onClick={this.props.onClick}\n role=\"button\"\n tabIndex={-1}\n >\n <div className=\"label\" title={title}>\n {this.props.label}\n </div>\n </div>\n );\n }\n}\n\n/** Properties for the [[ExpandableSection]] component\n * @beta\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ExpandableSectionProps extends CommonProps {\n title?: string;\n expanded?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** State for the [[ExpandableSection]] component\n * @internal\n */\ninterface ExpandableSectionState {\n expanded: boolean;\n}\n\n/** Expandable Section React component\n * @beta\n */\nexport class ExpandableSection extends React.PureComponent<\n ExpandableSectionProps,\n ExpandableSectionState\n> {\n /** Creates an ExpandableSection */\n constructor(props: ExpandableSectionProps) {\n super(props);\n this.state = { expanded: !!this.props.expanded };\n }\n\n /** @internal */\n public override async componentDidUpdate(\n prevProps: Readonly<ExpandableSectionProps>\n ) {\n if (this.props.expanded !== prevProps.expanded) {\n this.setState({ expanded: true });\n }\n }\n\n private _onClick = () => {\n this.setState((prevState) => ({ expanded: !prevState.expanded }));\n };\n\n /** Renders ExpandableSection */\n public override render() {\n const className = classnames(\n \"nz-toolbar-item-expandable-group-group\",\n this.props.className\n );\n\n const icon = this.state.expanded ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={<SvgChevronDown />} />\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={<SvgChevronRight />} />\n );\n\n return (\n <Panel\n className={className}\n style={this.props.style}\n key={this.props.title}\n >\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n onClick={this._onClick}\n className={\n this.state.expanded\n ? \"ListPickerInnerContainer-header-expanded\"\n : \"ListPickerInnerContainer-header\"\n }\n role=\"button\"\n tabIndex={-1}\n aria-expanded={this.state.expanded}\n >\n <div className=\"ListPickerInnerContainer-header-content\">\n <div className=\"ListPickerInnerContainer-expander\">{icon}</div>\n <div className=\"ListPickerInnerContainer-title\">\n {this.props.title}\n </div>\n </div>\n </div>\n {this.state.expanded ? (\n <GroupColumn>{this.props.children}</GroupColumn>\n ) : (\n <div />\n )}\n </Panel>\n );\n }\n}\n\n/** @beta */\nexport function getListPanel(props: ListPickerProps): React.ReactNode {\n const expandSingleSection = (): boolean => {\n const populatedContainers = props.items.filter((item: ListItem) => {\n return (\n item.type === ListItemType.Container && item.children!.length !== 0\n );\n });\n return populatedContainers.length === 1;\n };\n\n const listItemToElement = (item: ListItem, itemIndex: number) => {\n switch (item.type) {\n case ListItemType.Item:\n return (\n <ListPickerItem\n {...props}\n key={itemIndex.toString()}\n label={item.name}\n isActive={item.enabled}\n onClick={() => {\n props.setEnabled(item, !item.enabled);\n }}\n />\n );\n case ListItemType.Separator:\n return (\n <div key={itemIndex.toString()} className=\"ListPicker-separator\" />\n );\n case ListItemType.Container:\n if (item.children!.length !== 0) {\n return (\n <ExpandableSection\n key={itemIndex.toString()}\n title={item.name}\n className=\"ListPickerInnerContainer\"\n expanded={\n props.expanded === true\n ? !expandSingleSection()\n : expandSingleSection()\n }\n >\n <GroupColumn>{item.children!.map(listItemToElement)}</GroupColumn>\n </ExpandableSection>\n );\n } else {\n return <div key={itemIndex.toString()} />;\n }\n default:\n return <div key={itemIndex.toString()} />;\n }\n };\n\n return (\n <Panel className=\"ListPickerContainer\">\n <Title>{props.title}</Title>\n {props.searchBox && props.onSearchValueChange && (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <SearchBox\n className=\"ListPickerSearchBox\"\n onValueChanged={props.onSearchValueChange}\n />\n )}\n <Columns>\n <GroupColumn className=\"ListPicker-column\">\n {props.items.map(listItemToElement)}\n </GroupColumn>\n </Columns>\n </Panel>\n );\n}\n\n/**\n * List picker toolbar popup item.\n * Used to provide an expandable list of items to enable/disable items.\n * @beta\n */\nfunction ListPickerPopupItem(props: ListPickerProps) {\n const icon =\n props.icon ??\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (props.iconSpec ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n typeof props.iconSpec === \"string\" ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={props.iconSpec} />\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <i className=\"icon uifw-item-svg-icon\">{props.iconSpec}</i>\n )\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={<SvgList />} />\n ));\n\n return (\n <ToolbarDragInteractionContext.Consumer>\n {(isEnabled): React.ReactNode => {\n return props.panelOnly === true ? (\n getListPanel(props)\n ) : (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <PopupItem\n className=\"ListPicker-button\"\n hideIndicator={isEnabled}\n icon={icon}\n title={props.title}\n panel={getListPanel(props)}\n />\n );\n }}\n </ToolbarDragInteractionContext.Consumer>\n );\n}\n\n/** Properties for the [[ListPicker]] component\n * @beta\n */\nexport interface ListPickerPropsExtended extends ListPickerProps {\n enableAllFunc?: () => void;\n disableAllFunc?: () => void;\n invertFunc?: () => void;\n}\n\n/**\n * List Picker that lets the user pick from a list of items to enable/disable\n * It also provides options to enable all, disable all and invert selection\n * @beta\n */\nexport class ListPicker extends React.Component<ListPickerPropsExtended> {\n public static get Key_All() {\n return -3;\n }\n public static get Key_None() {\n return -2;\n }\n public static get Key_Invert() {\n return -1;\n }\n public static get Key_Separator() {\n return -4;\n }\n\n /** Creates a ListPicker */\n constructor(props: ListPickerPropsExtended) {\n super(props);\n }\n\n // Creates an array of items containing the separator and special requests (all, none, invert)\n private createItems(items: ListItem[]): ListItem[] {\n const newItems: ListItem[] = [];\n\n // Create special buttons (All/None/Invert)\n if (this.props.enableAllFunc) {\n let allEnabled = true;\n items.map((item: ListItem) => {\n allEnabled = allEnabled && item.enabled;\n });\n newItems.push({\n key: ListPicker.Key_All,\n name: UiFramework.translate(\"pickerButtons.all\"),\n enabled: allEnabled,\n type: ListItemType.Item,\n });\n }\n if (this.props.disableAllFunc) {\n let allDisabled = false;\n items.map((item: ListItem) => {\n allDisabled = allDisabled || item.enabled;\n });\n newItems.push({\n key: ListPicker.Key_None,\n name: UiFramework.translate(\"pickerButtons.none\"),\n enabled: !allDisabled,\n type: ListItemType.Item,\n });\n }\n if (this.props.invertFunc) {\n newItems.push({\n key: ListPicker.Key_Invert,\n name: UiFramework.translate(\"pickerButtons.invert\"),\n enabled: false,\n type: ListItemType.Item,\n });\n }\n if (\n this.props.enableAllFunc ||\n this.props.disableAllFunc ||\n this.props.invertFunc\n ) {\n newItems.push({\n key: ListPicker.Key_Separator,\n name: UiFramework.translate(\"pickerButtons.separator\"),\n enabled: false,\n type: ListItemType.Separator,\n });\n }\n\n // Push items\n items.map((item) => {\n newItems.push(item);\n });\n return newItems;\n }\n\n /**\n * Checks if item is a special item.\n * @param item Item to check\n */\n public isSpecialItem(item: ListItem) {\n return (\n item.key === ListPicker.Key_All ||\n item.key === ListPicker.Key_Invert ||\n item.key === ListPicker.Key_None ||\n item.type !== ListItemType.Item ||\n item.key === ListPicker.Key_Separator\n );\n }\n\n // Handle enabling/disabling the items\n // This will call the this.props.setEnabled function to provide the parent with a chance to process it\n private _setEnabled = (item: ListItem, enabled: boolean) => {\n if (this.isSpecialItem(item)) {\n switch (item.key) {\n case ListPicker.Key_All: {\n if (this.props.enableAllFunc) this.props.enableAllFunc();\n return;\n }\n case ListPicker.Key_None: {\n if (this.props.disableAllFunc) this.props.disableAllFunc();\n return;\n }\n case ListPicker.Key_Invert: {\n if (this.props.invertFunc) this.props.invertFunc();\n return;\n }\n }\n }\n\n // Call on parent to do processing of the item\n this.props.setEnabled(item, enabled);\n };\n\n /** Renders ListPicker */\n public override render() {\n return (\n <ListPickerPopupItem\n {...this.props}\n title={this.props.title}\n setEnabled={this._setEnabled}\n onExpanded={this.props.onExpanded}\n items={this.createItems(this.props.items)}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iconSpec={this.props.iconSpec}\n icon={this.props.icon}\n />\n );\n }\n}\n"]}
@@ -14,6 +14,9 @@ $space-before-label: 16px;
14
14
  $label-color: var(--iui-color-text);
15
15
  $border-color: var(--iui-color-background-disabled);
16
16
  $item-height: 32px;
17
+ $button-inline-padding: 8px;
18
+ $button-block-padding: 8px;
19
+ $button-border-width: 1px;
17
20
 
18
21
  .ListPicker-separator {
19
22
  height: 1px;
@@ -29,6 +32,13 @@ $item-height: 32px;
29
32
  @include uicore-scrollbar();
30
33
  }
31
34
 
35
+ .ListPicker-button {
36
+ padding-block: $button-block-padding;
37
+ padding-inline: $button-inline-padding;
38
+
39
+ border-width: $button-border-width;
40
+ }
41
+
32
42
  .ListPickerInnerContainer {
33
43
  border: 1px solid $border-color;
34
44
  margin-left: 10px;
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityFormat.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/settings/quantityformatting/QuantityFormat.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAM7E,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,sBAAsB,CAAC;AAgB9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO9D;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,mBAAmB,EAAE,eAAe,CAAC;IACrC,oBAAoB,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,OAAO,CAAC,gCAAgC,CAAC,GAC/C,gBAAgB,CAqBlB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,mBAAmB,EACnB,oBAAoB,GACrB,EAAE,gCAAgC,qBAkSlC"}
1
+ {"version":3,"file":"QuantityFormat.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/settings/quantityformatting/QuantityFormat.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAM7E,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,sBAAsB,CAAC;AAgB9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO9D;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,mBAAmB,EAAE,eAAe,CAAC;IACrC,oBAAoB,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,OAAO,CAAC,gCAAgC,CAAC,GAC/C,gBAAgB,CAqBlB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,mBAAmB,EACnB,oBAAoB,GACrB,EAAE,gCAAgC,qBAoSlC"}
@@ -51,7 +51,7 @@ export function QuantityFormatSettingsPage({ initialQuantityType, availableUnitS
51
51
  const [activeFormatterSpec, setActiveFormatterSpec] = React.useState(IModelApp.quantityFormatter.findFormatterSpecByQuantityType(getQuantityTypeKey(activeQuantityType)));
52
52
  const [saveEnabled, setSaveEnabled] = React.useState(false);
53
53
  const [clearEnabled, setClearEnabled] = React.useState(IModelApp.quantityFormatter.hasActiveOverride(initialQuantityType, true));
54
- const newQuantityTypeRef = React.useRef();
54
+ const newQuantityTypeRef = React.useRef(undefined);
55
55
  React.useEffect(() => {
56
56
  return IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {
57
57
  if (activeUnitSystemKey !== IModelApp.quantityFormatter.activeUnitSystem) {
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityFormat.js","sourceRoot":"","sources":["../../../../src/appui-react/settings/quantityformatting/QuantityFormat.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,YAAY,GACb,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,YAAY,EACZ,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,EACP,WAAW,EACX,qCAAqC,EACrC,qCAAqC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,oBAAC,MAAM,CAAC,QAAQ,IAAC,SAAS,EAAE,qBAAqB,GAAI;YACrD,oBAAC,MAAM,CAAC,OAAO,iFAEE;YACjB,oBAAC,MAAM,CAAC,SAAS;gBACf,oBAAC,MAAM,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,QAAQ,IAClD,SAAS,CAAC,YAAY,CAAC,CACjB;gBACT,oBAAC,MAAM,IAAC,OAAO,EAAE,YAAY,IAAG,SAAS,CAAC,WAAW,CAAC,CAAU,CAC/C,CACP,CACP,CACV,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Settings\n */\n\nimport \"./QuantityFormat.scss\";\nimport * as React from \"react\";\nimport { DeepCompare } from \"@itwin/core-geometry\";\nimport type { QuantityTypeArg, QuantityTypeKey } from \"@itwin/core-frontend\";\nimport {\n getQuantityTypeKey,\n IModelApp,\n QuantityType,\n} from \"@itwin/core-frontend\";\nimport type {\n FormatProps,\n FormatterSpec,\n UnitSystemKey,\n} from \"@itwin/core-quantity\";\nimport {\n FormatSample,\n QuantityFormatPanel,\n} from \"@itwin/imodel-components-react\";\nimport {\n Listbox,\n ListboxItem,\n useSaveBeforeActivatingNewSettingsTab,\n useSaveBeforeClosingSettingsContainer,\n} from \"@itwin/core-react\";\nimport { UiFramework } from \"../../UiFramework.js\";\nimport { UnitSystemSelector } from \"./UnitSystemSelector.js\";\nimport { Button, Dialog } from \"@itwin/itwinui-react\";\nimport { SvgMeasure } from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../../hooks/useTranslation.js\";\nimport type { SettingsTabEntry } from \"../SettingsManager.js\";\n\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\n const compare = new DeepCompare();\n return compare.compare(obj1, obj2);\n}\n\n/** Options to initialize the settings page that allows users to set Quantity formatting overrides.\n * @beta\n */\nexport interface QuantityFormatterSettingsOptions {\n initialQuantityType: QuantityTypeArg;\n availableUnitSystems: Set<UnitSystemKey>;\n}\n\n/**\n * Return a SettingsTabEntry that can be used to define the available settings that can be set for an application.\n * @param itemPriority - Used to define the order of the entry in the Settings Stage\n * @param opts - Options to initialize the settings page that allows users to set Quantity formatting overrides.\n * @beta\n */\nexport function getQuantityFormatsSettingsManagerEntry(\n itemPriority: number,\n opts?: Partial<QuantityFormatterSettingsOptions>\n): SettingsTabEntry {\n const { availableUnitSystems, initialQuantityType } = { ...opts };\n return {\n itemPriority,\n tabId: \"uifw:Quantity\",\n label: UiFramework.translate(\"settings.quantity-formatting.label\"),\n subLabel: UiFramework.translate(\"settings.quantity-formatting.subLabel\"),\n page: (\n <QuantityFormatSettingsPage\n initialQuantityType={initialQuantityType ?? QuantityType.Length}\n availableUnitSystems={\n availableUnitSystems ??\n new Set([\"metric\", \"imperial\", \"usCustomary\", \"usSurvey\"])\n }\n />\n ),\n isDisabled: false,\n icon: <SvgMeasure />,\n tooltip: UiFramework.translate(\"settings.quantity-formatting.tooltip\"),\n pageWillHandleCloseRequest: true,\n };\n}\n\n/** UI Component shown in settings page to set the active Presentation Unit System and to set format overrides.\n * @beta\n */\nexport function QuantityFormatSettingsPage({\n initialQuantityType,\n availableUnitSystems,\n}: QuantityFormatterSettingsOptions) {\n const { translate } = useTranslation();\n const [activeUnitSystemKey, setActiveUnitSystemKey] = React.useState(\n IModelApp.quantityFormatter.activeUnitSystem\n );\n const [activeQuantityType, setActiveQuantityType] = React.useState(\n getQuantityTypeKey(initialQuantityType)\n );\n const [activeFormatterSpec, setActiveFormatterSpec] = React.useState<\n FormatterSpec | undefined\n >(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n getQuantityTypeKey(activeQuantityType)\n )\n );\n const [saveEnabled, setSaveEnabled] = React.useState(false);\n const [clearEnabled, setClearEnabled] = React.useState(\n IModelApp.quantityFormatter.hasActiveOverride(initialQuantityType, true)\n );\n const newQuantityTypeRef = React.useRef<QuantityTypeKey>();\n\n React.useEffect(() => {\n return IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(\n () => {\n if (\n activeUnitSystemKey !== IModelApp.quantityFormatter.activeUnitSystem\n ) {\n setActiveUnitSystemKey(IModelApp.quantityFormatter.activeUnitSystem);\n setActiveFormatterSpec(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n activeQuantityType\n )\n );\n setSaveEnabled(false);\n setClearEnabled(\n IModelApp.quantityFormatter.hasActiveOverride(\n activeQuantityType,\n true\n )\n );\n }\n }\n );\n }, [activeQuantityType, activeUnitSystemKey]);\n\n React.useEffect(() => {\n return IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(\n (args) => {\n if (!newQuantityTypeRef.current) {\n const quantityKey =\n IModelApp.quantityFormatter.getQuantityTypeKey(activeQuantityType);\n if (args.quantityType === quantityKey) {\n setActiveFormatterSpec(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n activeQuantityType\n )\n );\n setSaveEnabled(false);\n setClearEnabled(\n IModelApp.quantityFormatter.hasActiveOverride(\n activeQuantityType,\n true\n )\n );\n }\n }\n newQuantityTypeRef.current = undefined;\n }\n );\n }, [activeQuantityType]);\n\n const saveChanges = React.useCallback(\n (afterSaveFunction: (args: any) => void, args?: any) => {\n if (activeFormatterSpec) {\n const formatProps = activeFormatterSpec.format.toJSON();\n const formatPropsInUse = IModelApp.quantityFormatter\n .findFormatterSpecByQuantityType(activeQuantityType)!\n .format.toJSON();\n if (\n formatPropsInUse &&\n !formatAreEqual(formatProps, formatPropsInUse)\n ) {\n UiFramework.dialogs.modal.open(\n <SaveFormatModalDialog\n formatProps={formatProps}\n quantityType={activeQuantityType}\n onDialogCloseArgs={args}\n onDialogClose={afterSaveFunction}\n />,\n \"saveQuantityFormat\"\n );\n return;\n }\n }\n afterSaveFunction(args);\n },\n [activeFormatterSpec, activeQuantityType]\n );\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n useSaveBeforeActivatingNewSettingsTab(\n UiFramework.settingsManager,\n saveChanges\n );\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n useSaveBeforeClosingSettingsContainer(\n UiFramework.settingsManager,\n saveChanges\n );\n\n const processListboxValueChange = React.useCallback(\n (newQuantityType: QuantityTypeKey) => {\n const volumeFormatterSpec =\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n newQuantityType\n );\n setActiveFormatterSpec(volumeFormatterSpec);\n setActiveQuantityType(newQuantityType);\n setSaveEnabled(false);\n setClearEnabled(\n IModelApp.quantityFormatter.hasActiveOverride(newQuantityType, true)\n );\n },\n []\n );\n\n const onListboxValueChange = React.useCallback(\n (newQuantityType: string) => {\n if (activeFormatterSpec) {\n const formatProps = activeFormatterSpec.format.toJSON();\n const formatPropsInUse = IModelApp.quantityFormatter\n .findFormatterSpecByQuantityType(activeQuantityType)!\n .format.toJSON();\n if (\n formatPropsInUse &&\n !formatAreEqual(formatProps, formatPropsInUse)\n ) {\n newQuantityTypeRef.current = newQuantityType;\n UiFramework.dialogs.modal.open(\n <SaveFormatModalDialog\n formatProps={formatProps}\n quantityType={activeQuantityType}\n onDialogCloseArgs={newQuantityType}\n onDialogClose={processListboxValueChange}\n />,\n \"saveQuantityFormat\"\n );\n return;\n }\n }\n processListboxValueChange(newQuantityType);\n },\n [activeFormatterSpec, activeQuantityType, processListboxValueChange]\n );\n\n const handleOnFormatChanged = React.useCallback(\n async (formatProps: FormatProps) => {\n if (activeFormatterSpec) {\n const newSpec =\n await IModelApp.quantityFormatter.generateFormatterSpecByType(\n activeQuantityType,\n formatProps\n );\n const formatPropsInUse =\n IModelApp.quantityFormatter.getFormatPropsByQuantityType(\n activeQuantityType\n );\n if (formatPropsInUse)\n setSaveEnabled(!formatAreEqual(formatProps, formatPropsInUse));\n setActiveFormatterSpec(newSpec);\n }\n },\n [activeFormatterSpec, activeQuantityType]\n );\n\n const handleOnFormatSave = React.useCallback(async () => {\n if (activeFormatterSpec) {\n const format = activeFormatterSpec.format.toJSON();\n await IModelApp.quantityFormatter.setOverrideFormat(\n activeQuantityType,\n format\n );\n setClearEnabled(true);\n }\n }, [activeFormatterSpec, activeQuantityType]);\n\n const handleOnFormatReset = React.useCallback(async () => {\n await IModelApp.quantityFormatter.clearOverrideFormats(activeQuantityType);\n setClearEnabled(false);\n }, [activeQuantityType]);\n\n const processNewUnitSystem = React.useCallback(\n async (unitSystem: UnitSystemKey) => {\n await IModelApp.quantityFormatter.setActiveUnitSystem(unitSystem);\n },\n []\n );\n\n const handleUnitSystemSelected = React.useCallback(\n async (unitSystem: UnitSystemKey) => {\n if (unitSystem === activeUnitSystemKey) return;\n saveChanges(processNewUnitSystem, unitSystem);\n },\n [activeUnitSystemKey, processNewUnitSystem, saveChanges]\n );\n\n return (\n <div className=\"quantity-formatting-container\">\n <UnitSystemSelector\n selectedUnitSystemKey={activeUnitSystemKey}\n availableUnitSystems={availableUnitSystems}\n onUnitSystemSelected={handleUnitSystemSelected}\n />\n <span className=\"uifw-quantity-format-section-label\">\n {translate(\"settings.quantity-formatting.formatSectionLabel\")}\n </span>\n <div className=\"uifw-quantity-types-container\">\n <div className=\"left-panel\">\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Listbox\n id=\"uifw-quantity-types-list\"\n className=\"uifw-quantity-types\"\n onListboxValueChange={onListboxValueChange}\n selectedValue={activeQuantityType}\n >\n {[...IModelApp.quantityFormatter.quantityTypesRegistry.keys()].map(\n (key) => {\n const entry =\n IModelApp.quantityFormatter.quantityTypesRegistry.get(key)!;\n const description = entry.description;\n const label = entry.label;\n return (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <ListboxItem\n key={entry.key}\n className=\"quantity-type-list-entry\"\n value={entry.key}\n >\n <span\n className=\"map-source-list-entry-name\"\n title={description}\n >\n {label}\n </span>\n </ListboxItem>\n );\n }\n )}\n </Listbox>\n </div>\n <div className=\"right-panel\">\n {activeFormatterSpec && (\n <>\n <div className=\"uifw-quantity-types-right-top\">\n <div className=\"uifw-quantity-types-right-top-sample\">\n <FormatSample\n formatSpec={activeFormatterSpec}\n initialMagnitude={1234.56}\n hideLabels\n />\n </div>\n </div>\n <div className=\"uifw-quantity-types-formats\">\n <QuantityFormatPanel\n onFormatChange={handleOnFormatChanged}\n quantityType={activeQuantityType}\n />\n </div>\n <div className=\"components-button-panel\">\n <Button\n styleType=\"cta\"\n onClick={handleOnFormatSave}\n disabled={!saveEnabled}\n >\n {translate(\"settings.quantity-formatting.setButtonLabel\")}\n </Button>\n <Button\n styleType=\"default\"\n onClick={handleOnFormatReset}\n disabled={!clearEnabled}\n >\n {translate(\"settings.quantity-formatting.clearButtonLabel\")}\n </Button>\n </div>\n </>\n )}\n </div>\n </div>\n </div>\n );\n}\n\nfunction SaveFormatModalDialog({\n formatProps,\n quantityType,\n onDialogCloseArgs,\n onDialogClose,\n}: {\n formatProps: FormatProps;\n quantityType: QuantityTypeKey;\n onDialogCloseArgs?: any;\n onDialogClose: (args?: any) => void;\n}) {\n const { translate } = useTranslation();\n const [isOpen, setIsOpen] = React.useState(true);\n\n const handleClose = React.useCallback(() => {\n setIsOpen(false);\n UiFramework.dialogs.modal.close();\n onDialogClose && onDialogClose(onDialogCloseArgs);\n }, [onDialogClose, onDialogCloseArgs]);\n\n const handleOK = React.useCallback(() => {\n void IModelApp.quantityFormatter.setOverrideFormat(\n quantityType,\n formatProps\n );\n handleClose();\n }, [formatProps, handleClose, quantityType]);\n\n const handleCancel = React.useCallback(() => {\n handleClose();\n }, [handleClose]);\n\n return (\n <Dialog\n isOpen={isOpen}\n onClose={handleCancel}\n className=\"uifw-settings-quantityFormatting-saveFormatModalDialog\"\n closeOnEsc\n closeOnExternalClick\n preventDocumentScroll\n >\n <Dialog.Backdrop />\n <Dialog.Main\n style={{ minWidth: 200, maxWidth: 400, minHeight: 150, maxHeight: 400 }}\n >\n <Dialog.TitleBar titleText={\"Save Format Changes\"} />\n <Dialog.Content>\n Do you want to save changes to format before changing to another type?\n </Dialog.Content>\n <Dialog.ButtonBar>\n <Button styleType=\"high-visibility\" onClick={handleOK}>\n {translate(\"dialog.yes\")}\n </Button>\n <Button onClick={handleCancel}>{translate(\"dialog.no\")}</Button>\n </Dialog.ButtonBar>\n </Dialog.Main>\n </Dialog>\n );\n}\n"]}
1
+ {"version":3,"file":"QuantityFormat.js","sourceRoot":"","sources":["../../../../src/appui-react/settings/quantityformatting/QuantityFormat.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,YAAY,GACb,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,YAAY,EACZ,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,OAAO,EACP,WAAW,EACX,qCAAqC,EACrC,qCAAqC,GACtC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,SAAS,cAAc,CAAC,IAAiB,EAAE,IAAiB;IAC1D,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC;AAUD;;;;;GAKG;AACH,MAAM,UAAU,sCAAsC,CACpD,YAAoB,EACpB,IAAgD;IAEhD,MAAM,EAAE,oBAAoB,EAAE,mB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,GAAG,EAAE;QACtC,KAAK,SAAS,CAAC,iBAAiB,CAAC,iBAAiB,CAChD,YAAY,EACZ,WAAW,CACZ,CAAC;QACF,WAAW,EAAE,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IAE7C,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC1C,WAAW,EAAE,CAAC;IAChB,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,CACL,oBAAC,MAAM,IACL,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,EACrB,SAAS,EAAC,wDAAwD,EAClE,UAAU,QACV,oBAAoB,QACpB,qBAAqB;QAErB,oBAAC,MAAM,CAAC,QAAQ,OAAG;QACnB,oBAAC,MAAM,CAAC,IAAI,IACV,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE;YAEvE,oBAAC,MAAM,CAAC,QAAQ,IAAC,SAAS,EAAE,qBAAqB,GAAI;YACrD,oBAAC,MAAM,CAAC,OAAO,iFAEE;YACjB,oBAAC,MAAM,CAAC,SAAS;gBACf,oBAAC,MAAM,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,QAAQ,IAClD,SAAS,CAAC,YAAY,CAAC,CACjB;gBACT,oBAAC,MAAM,IAAC,OAAO,EAAE,YAAY,IAAG,SAAS,CAAC,WAAW,CAAC,CAAU,CAC/C,CACP,CACP,CACV,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Settings\n */\n\nimport \"./QuantityFormat.scss\";\nimport * as React from \"react\";\nimport { DeepCompare } from \"@itwin/core-geometry\";\nimport type { QuantityTypeArg, QuantityTypeKey } from \"@itwin/core-frontend\";\nimport {\n getQuantityTypeKey,\n IModelApp,\n QuantityType,\n} from \"@itwin/core-frontend\";\nimport type {\n FormatProps,\n FormatterSpec,\n UnitSystemKey,\n} from \"@itwin/core-quantity\";\nimport {\n FormatSample,\n QuantityFormatPanel,\n} from \"@itwin/imodel-components-react\";\nimport {\n Listbox,\n ListboxItem,\n useSaveBeforeActivatingNewSettingsTab,\n useSaveBeforeClosingSettingsContainer,\n} from \"@itwin/core-react\";\nimport { UiFramework } from \"../../UiFramework.js\";\nimport { UnitSystemSelector } from \"./UnitSystemSelector.js\";\nimport { Button, Dialog } from \"@itwin/itwinui-react\";\nimport { SvgMeasure } from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../../hooks/useTranslation.js\";\nimport type { SettingsTabEntry } from \"../SettingsManager.js\";\n\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\n const compare = new DeepCompare();\n return compare.compare(obj1, obj2);\n}\n\n/** Options to initialize the settings page that allows users to set Quantity formatting overrides.\n * @beta\n */\nexport interface QuantityFormatterSettingsOptions {\n initialQuantityType: QuantityTypeArg;\n availableUnitSystems: Set<UnitSystemKey>;\n}\n\n/**\n * Return a SettingsTabEntry that can be used to define the available settings that can be set for an application.\n * @param itemPriority - Used to define the order of the entry in the Settings Stage\n * @param opts - Options to initialize the settings page that allows users to set Quantity formatting overrides.\n * @beta\n */\nexport function getQuantityFormatsSettingsManagerEntry(\n itemPriority: number,\n opts?: Partial<QuantityFormatterSettingsOptions>\n): SettingsTabEntry {\n const { availableUnitSystems, initialQuantityType } = { ...opts };\n return {\n itemPriority,\n tabId: \"uifw:Quantity\",\n label: UiFramework.translate(\"settings.quantity-formatting.label\"),\n subLabel: UiFramework.translate(\"settings.quantity-formatting.subLabel\"),\n page: (\n <QuantityFormatSettingsPage\n initialQuantityType={initialQuantityType ?? QuantityType.Length}\n availableUnitSystems={\n availableUnitSystems ??\n new Set([\"metric\", \"imperial\", \"usCustomary\", \"usSurvey\"])\n }\n />\n ),\n isDisabled: false,\n icon: <SvgMeasure />,\n tooltip: UiFramework.translate(\"settings.quantity-formatting.tooltip\"),\n pageWillHandleCloseRequest: true,\n };\n}\n\n/** UI Component shown in settings page to set the active Presentation Unit System and to set format overrides.\n * @beta\n */\nexport function QuantityFormatSettingsPage({\n initialQuantityType,\n availableUnitSystems,\n}: QuantityFormatterSettingsOptions) {\n const { translate } = useTranslation();\n const [activeUnitSystemKey, setActiveUnitSystemKey] = React.useState(\n IModelApp.quantityFormatter.activeUnitSystem\n );\n const [activeQuantityType, setActiveQuantityType] = React.useState(\n getQuantityTypeKey(initialQuantityType)\n );\n const [activeFormatterSpec, setActiveFormatterSpec] = React.useState<\n FormatterSpec | undefined\n >(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n getQuantityTypeKey(activeQuantityType)\n )\n );\n const [saveEnabled, setSaveEnabled] = React.useState(false);\n const [clearEnabled, setClearEnabled] = React.useState(\n IModelApp.quantityFormatter.hasActiveOverride(initialQuantityType, true)\n );\n const newQuantityTypeRef = React.useRef<QuantityTypeKey | undefined>(\n undefined\n );\n\n React.useEffect(() => {\n return IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(\n () => {\n if (\n activeUnitSystemKey !== IModelApp.quantityFormatter.activeUnitSystem\n ) {\n setActiveUnitSystemKey(IModelApp.quantityFormatter.activeUnitSystem);\n setActiveFormatterSpec(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n activeQuantityType\n )\n );\n setSaveEnabled(false);\n setClearEnabled(\n IModelApp.quantityFormatter.hasActiveOverride(\n activeQuantityType,\n true\n )\n );\n }\n }\n );\n }, [activeQuantityType, activeUnitSystemKey]);\n\n React.useEffect(() => {\n return IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(\n (args) => {\n if (!newQuantityTypeRef.current) {\n const quantityKey =\n IModelApp.quantityFormatter.getQuantityTypeKey(activeQuantityType);\n if (args.quantityType === quantityKey) {\n setActiveFormatterSpec(\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n activeQuantityType\n )\n );\n setSaveEnabled(false);\n setClearEnabled(\n IModelApp.quantityFormatter.hasActiveOverride(\n activeQuantityType,\n true\n )\n );\n }\n }\n newQuantityTypeRef.current = undefined;\n }\n );\n }, [activeQuantityType]);\n\n const saveChanges = React.useCallback(\n (afterSaveFunction: (args: any) => void, args?: any) => {\n if (activeFormatterSpec) {\n const formatProps = activeFormatterSpec.format.toJSON();\n const formatPropsInUse = IModelApp.quantityFormatter\n .findFormatterSpecByQuantityType(activeQuantityType)!\n .format.toJSON();\n if (\n formatPropsInUse &&\n !formatAreEqual(formatProps, formatPropsInUse)\n ) {\n UiFramework.dialogs.modal.open(\n <SaveFormatModalDialog\n formatProps={formatProps}\n quantityType={activeQuantityType}\n onDialogCloseArgs={args}\n onDialogClose={afterSaveFunction}\n />,\n \"saveQuantityFormat\"\n );\n return;\n }\n }\n afterSaveFunction(args);\n },\n [activeFormatterSpec, activeQuantityType]\n );\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n useSaveBeforeActivatingNewSettingsTab(\n UiFramework.settingsManager,\n saveChanges\n );\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n useSaveBeforeClosingSettingsContainer(\n UiFramework.settingsManager,\n saveChanges\n );\n\n const processListboxValueChange = React.useCallback(\n (newQuantityType: QuantityTypeKey) => {\n const volumeFormatterSpec =\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(\n newQuantityType\n );\n setActiveFormatterSpec(volumeFormatterSpec);\n setActiveQuantityType(newQuantityType);\n setSaveEnabled(false);\n setClearEnabled(\n IModelApp.quantityFormatter.hasActiveOverride(newQuantityType, true)\n );\n },\n []\n );\n\n const onListboxValueChange = React.useCallback(\n (newQuantityType: string) => {\n if (activeFormatterSpec) {\n const formatProps = activeFormatterSpec.format.toJSON();\n const formatPropsInUse = IModelApp.quantityFormatter\n .findFormatterSpecByQuantityType(activeQuantityType)!\n .format.toJSON();\n if (\n formatPropsInUse &&\n !formatAreEqual(formatProps, formatPropsInUse)\n ) {\n newQuantityTypeRef.current = newQuantityType;\n UiFramework.dialogs.modal.open(\n <SaveFormatModalDialog\n formatProps={formatProps}\n quantityType={activeQuantityType}\n onDialogCloseArgs={newQuantityType}\n onDialogClose={processListboxValueChange}\n />,\n \"saveQuantityFormat\"\n );\n return;\n }\n }\n processListboxValueChange(newQuantityType);\n },\n [activeFormatterSpec, activeQuantityType, processListboxValueChange]\n );\n\n const handleOnFormatChanged = React.useCallback(\n async (formatProps: FormatProps) => {\n if (activeFormatterSpec) {\n const newSpec =\n await IModelApp.quantityFormatter.generateFormatterSpecByType(\n activeQuantityType,\n formatProps\n );\n const formatPropsInUse =\n IModelApp.quantityFormatter.getFormatPropsByQuantityType(\n activeQuantityType\n );\n if (formatPropsInUse)\n setSaveEnabled(!formatAreEqual(formatProps, formatPropsInUse));\n setActiveFormatterSpec(newSpec);\n }\n },\n [activeFormatterSpec, activeQuantityType]\n );\n\n const handleOnFormatSave = React.useCallback(async () => {\n if (activeFormatterSpec) {\n const format = activeFormatterSpec.format.toJSON();\n await IModelApp.quantityFormatter.setOverrideFormat(\n activeQuantityType,\n format\n );\n setClearEnabled(true);\n }\n }, [activeFormatterSpec, activeQuantityType]);\n\n const handleOnFormatReset = React.useCallback(async () => {\n await IModelApp.quantityFormatter.clearOverrideFormats(activeQuantityType);\n setClearEnabled(false);\n }, [activeQuantityType]);\n\n const processNewUnitSystem = React.useCallback(\n async (unitSystem: UnitSystemKey) => {\n await IModelApp.quantityFormatter.setActiveUnitSystem(unitSystem);\n },\n []\n );\n\n const handleUnitSystemSelected = React.useCallback(\n async (unitSystem: UnitSystemKey) => {\n if (unitSystem === activeUnitSystemKey) return;\n saveChanges(processNewUnitSystem, unitSystem);\n },\n [activeUnitSystemKey, processNewUnitSystem, saveChanges]\n );\n\n return (\n <div className=\"quantity-formatting-container\">\n <UnitSystemSelector\n selectedUnitSystemKey={activeUnitSystemKey}\n availableUnitSystems={availableUnitSystems}\n onUnitSystemSelected={handleUnitSystemSelected}\n />\n <span className=\"uifw-quantity-format-section-label\">\n {translate(\"settings.quantity-formatting.formatSectionLabel\")}\n </span>\n <div className=\"uifw-quantity-types-container\">\n <div className=\"left-panel\">\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Listbox\n id=\"uifw-quantity-types-list\"\n className=\"uifw-quantity-types\"\n onListboxValueChange={onListboxValueChange}\n selectedValue={activeQuantityType}\n >\n {[...IModelApp.quantityFormatter.quantityTypesRegistry.keys()].map(\n (key) => {\n const entry =\n IModelApp.quantityFormatter.quantityTypesRegistry.get(key)!;\n const description = entry.description;\n const label = entry.label;\n return (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <ListboxItem\n key={entry.key}\n className=\"quantity-type-list-entry\"\n value={entry.key}\n >\n <span\n className=\"map-source-list-entry-name\"\n title={description}\n >\n {label}\n </span>\n </ListboxItem>\n );\n }\n )}\n </Listbox>\n </div>\n <div className=\"right-panel\">\n {activeFormatterSpec && (\n <>\n <div className=\"uifw-quantity-types-right-top\">\n <div className=\"uifw-quantity-types-right-top-sample\">\n <FormatSample\n formatSpec={activeFormatterSpec}\n initialMagnitude={1234.56}\n hideLabels\n />\n </div>\n </div>\n <div className=\"uifw-quantity-types-formats\">\n <QuantityFormatPanel\n onFormatChange={handleOnFormatChanged}\n quantityType={activeQuantityType}\n />\n </div>\n <div className=\"components-button-panel\">\n <Button\n styleType=\"cta\"\n onClick={handleOnFormatSave}\n disabled={!saveEnabled}\n >\n {translate(\"settings.quantity-formatting.setButtonLabel\")}\n </Button>\n <Button\n styleType=\"default\"\n onClick={handleOnFormatReset}\n disabled={!clearEnabled}\n >\n {translate(\"settings.quantity-formatting.clearButtonLabel\")}\n </Button>\n </div>\n </>\n )}\n </div>\n </div>\n </div>\n );\n}\n\nfunction SaveFormatModalDialog({\n formatProps,\n quantityType,\n onDialogCloseArgs,\n onDialogClose,\n}: {\n formatProps: FormatProps;\n quantityType: QuantityTypeKey;\n onDialogCloseArgs?: any;\n onDialogClose: (args?: any) => void;\n}) {\n const { translate } = useTranslation();\n const [isOpen, setIsOpen] = React.useState(true);\n\n const handleClose = React.useCallback(() => {\n setIsOpen(false);\n UiFramework.dialogs.modal.close();\n onDialogClose && onDialogClose(onDialogCloseArgs);\n }, [onDialogClose, onDialogCloseArgs]);\n\n const handleOK = React.useCallback(() => {\n void IModelApp.quantityFormatter.setOverrideFormat(\n quantityType,\n formatProps\n );\n handleClose();\n }, [formatProps, handleClose, quantityType]);\n\n const handleCancel = React.useCallback(() => {\n handleClose();\n }, [handleClose]);\n\n return (\n <Dialog\n isOpen={isOpen}\n onClose={handleCancel}\n className=\"uifw-settings-quantityFormatting-saveFormatModalDialog\"\n closeOnEsc\n closeOnExternalClick\n preventDocumentScroll\n >\n <Dialog.Backdrop />\n <Dialog.Main\n style={{ minWidth: 200, maxWidth: 400, minHeight: 150, maxHeight: 400 }}\n >\n <Dialog.TitleBar titleText={\"Save Format Changes\"} />\n <Dialog.Content>\n Do you want to save changes to format before changing to another type?\n </Dialog.Content>\n <Dialog.ButtonBar>\n <Button styleType=\"high-visibility\" onClick={handleOK}>\n {translate(\"dialog.yes\")}\n </Button>\n <Button onClick={handleCancel}>{translate(\"dialog.no\")}</Button>\n </Dialog.ButtonBar>\n </Dialog.Main>\n </Dialog>\n );\n}\n"]}
@@ -19,6 +19,6 @@ export function StatusBarPopup(props) {
19
19
  const { className, offset, ...other } = props;
20
20
  return (
21
21
  // eslint-disable-next-line @typescript-eslint/no-deprecated
22
- React.createElement(Popup, { className: classnames("nz-status-bar-popup", className), position: RelativePosition.Top, showShadow: true, ...other, showArrow: false }));
22
+ React.createElement(Popup, { className: classnames("nz-status-bar-popup", className), position: RelativePosition.TopLeft, showShadow: true, ...other, showArrow: false }));
23
23
  }
24
24
  //# sourceMappingURL=Popup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAE9C,OAAO;IACL,4DAA4D;IAC5D,oBAAC,KAAK,IACJ,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EACvD,QAAQ,EAAE,gBAAgB,CAAC,GAAG,EAC9B,UAAU,EAAE,IAAI,KACZ,KAAK,EACT,SAAS,EAAE,KAAK,GAChB,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport \"./Popup.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type { PopupProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { StatusBarPopover } from \"./StatusBarPopover.js\";\n\n/** Popup component used in [[StatusBar]] component.\n * @beta\n * @deprecated in 4.13.0. Use {@link StatusBarPopover} instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function StatusBarPopup(props: Partial<PopupProps>) {\n const { className, offset, ...other } = props;\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Popup\n className={classnames(\"nz-status-bar-popup\", className)}\n position={RelativePosition.Top}\n showShadow={true}\n {...other}\n showArrow={false}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAE9C,OAAO;IACL,4DAA4D;IAC5D,oBAAC,KAAK,IACJ,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EACvD,QAAQ,EAAE,gBAAgB,CAAC,OAAO,EAClC,UAAU,EAAE,IAAI,KACZ,KAAK,EACT,SAAS,EAAE,KAAK,GAChB,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport \"./Popup.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport type { PopupProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { StatusBarPopover } from \"./StatusBarPopover.js\";\n\n/** Popup component used in [[StatusBar]] component.\n * @beta\n * @deprecated in 4.13.0. Use {@link StatusBarPopover} instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function StatusBarPopup(props: Partial<PopupProps>) {\n const { className, offset, ...other } = props;\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Popup\n className={classnames(\"nz-status-bar-popup\", className)}\n position={RelativePosition.TopLeft}\n showShadow={true}\n {...other}\n showArrow={false}\n />\n );\n}\n"]}
@@ -16,7 +16,7 @@ import { PopupContext } from "@itwin/core-react/internal";
16
16
  */
17
17
  export function StatusBarPopover({ content, middleware, ...other }) {
18
18
  const [portalTarget, setPortalTarget] = React.useState(undefined);
19
- return (React.createElement(Popover, { ...other, content: React.createElement(PopupContext.Provider, { value: portalTarget }, content), placement: "top", applyBackground: true, middleware: {
19
+ return (React.createElement(Popover, { ...other, content: React.createElement(PopupContext.Provider, { value: portalTarget }, content), placement: "top-start", applyBackground: true, middleware: {
20
20
  ...middleware,
21
21
  offset: 4,
22
22
  }, ref: (el) => {
@@ -1 +1 @@
1
- {"version":3,"file":"StatusBarPopover.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/popup/StatusBarPopover.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,GAAG,KAAK,EAC6B;IACrC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAEpD,SAAS,CAAC,CAAC;IACb,OAAO,CACL,oBAAC,OAAO,OACF,KAAK,EACT,OAAO,EACL,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IACvC,OAAO,CACc,EAE1B,SAAS,EAAC,KAAK,EACf,eAAe,QACf,UAAU,EAAE;YACV,GAAG,UAAU;YACb,MAAM,EAAE,CAAC;SACV,EACD,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;YACV,eAAe,CAAC,EAAE,IAAI,SAAS,CAAC,CAAC;QACnC,CAAC,GACD,CACH,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,WAAiB,gBAAgB;IAC/B;;OAEG;IACU,gCAAe,GAAG,qBAAqB,CAAC;AACvD,CAAC,EALgB,gBAAgB,KAAhB,gBAAgB,QAKhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport * as React from \"react\";\nimport { Popover } from \"@itwin/itwinui-react\";\nimport { ButtonExpandIndicator } from \"./ExpandIndicator.js\";\nimport { PopupContext } from \"@itwin/core-react/internal\";\n\n/** Popover component used in `StatusBar` component.\n * This component should wrap the element that triggers the popover.\n * @note Add the `StatusBarPopover.ExpandIndicator` to popover trigger buttons.\n * @public\n */\nexport function StatusBarPopover({\n content,\n middleware,\n ...other\n}: React.ComponentProps<typeof Popover>) {\n const [portalTarget, setPortalTarget] = React.useState<\n HTMLElement | undefined\n >(undefined);\n return (\n <Popover\n {...other}\n content={\n <PopupContext.Provider value={portalTarget}>\n {content}\n </PopupContext.Provider>\n }\n placement=\"top\"\n applyBackground\n middleware={{\n ...middleware,\n offset: 4,\n }}\n ref={(el) => {\n setPortalTarget(el ?? undefined);\n }}\n />\n );\n}\n\n/** Components used in `StatusBarPopover`.\n * @public\n */\nexport namespace StatusBarPopover {\n /** Indicator to be used in popover trigger buttons to show expandable content.\n * @public\n */\n export const ExpandIndicator = ButtonExpandIndicator;\n}\n"]}
1
+ {"version":3,"file":"StatusBarPopover.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/popup/StatusBarPopover.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,GAAG,KAAK,EAC6B;IACrC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAEpD,SAAS,CAAC,CAAC;IACb,OAAO,CACL,oBAAC,OAAO,OACF,KAAK,EACT,OAAO,EACL,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IACvC,OAAO,CACc,EAE1B,SAAS,EAAC,WAAW,EACrB,eAAe,QACf,UAAU,EAAE;YACV,GAAG,UAAU;YACb,MAAM,EAAE,CAAC;SACV,EACD,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;YACV,eAAe,CAAC,EAAE,IAAI,SAAS,CAAC,CAAC;QACnC,CAAC,GACD,CACH,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,WAAiB,gBAAgB;IAC/B;;OAEG;IACU,gCAAe,GAAG,qBAAqB,CAAC;AACvD,CAAC,EALgB,gBAAgB,KAAhB,gBAAgB,QAKhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport * as React from \"react\";\nimport { Popover } from \"@itwin/itwinui-react\";\nimport { ButtonExpandIndicator } from \"./ExpandIndicator.js\";\nimport { PopupContext } from \"@itwin/core-react/internal\";\n\n/** Popover component used in `StatusBar` component.\n * This component should wrap the element that triggers the popover.\n * @note Add the `StatusBarPopover.ExpandIndicator` to popover trigger buttons.\n * @public\n */\nexport function StatusBarPopover({\n content,\n middleware,\n ...other\n}: React.ComponentProps<typeof Popover>) {\n const [portalTarget, setPortalTarget] = React.useState<\n HTMLElement | undefined\n >(undefined);\n return (\n <Popover\n {...other}\n content={\n <PopupContext.Provider value={portalTarget}>\n {content}\n </PopupContext.Provider>\n }\n placement=\"top-start\"\n applyBackground\n middleware={{\n ...middleware,\n offset: 4,\n }}\n ref={(el) => {\n setPortalTarget(el ?? undefined);\n }}\n />\n );\n}\n\n/** Components used in `StatusBarPopover`.\n * @public\n */\nexport namespace StatusBarPopover {\n /** Indicator to be used in popover trigger buttons to show expandable content.\n * @public\n */\n export const ExpandIndicator = ButtonExpandIndicator;\n}\n"]}
@@ -112,7 +112,7 @@ export function SnapModeField(props) {
112
112
  // eslint-disable-next-line @typescript-eslint/no-deprecated
113
113
  UiFramework.setAccudrawSnapMode(entry.value);
114
114
  }, isActive: (snapMode & entry.value) === entry.value, icon: React.createElement(Icon, null, entry.icon) }, translate(entry.labelKey))))) },
115
- React.createElement(Button, { styleType: "borderless", title: title, endIcon: enabledSnaps.length === 1 ? enabledSnaps[0].icon : React.createElement(SvgSnaps, null) },
115
+ React.createElement(Button, { styleType: "borderless", title: title, startIcon: enabledSnaps.length === 1 ? enabledSnaps[0].icon : React.createElement(SvgSnaps, null) },
116
116
  title,
117
117
  React.createElement(StatusBarPopover.ExpandIndicator, null))));
118
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SnapMode.js","sourceRoot":"","sources":["../../../src/appui-react/statusfields/SnapMode.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAA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R,CAAC,CACY;QAGlB,oBAAC,MAAM,IACL,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,KAAK,EACZ,OAAO,EACL,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,QAAQ,OAAG;YAGhE,KAAK;YACN,oBAAC,gBAAgB,CAAC,eAAe,OAAG,CAC7B,CACQ,CACpB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport { SnapMode } from \"@itwin/core-frontend\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport { SnapModePanel } from \"../layout/footer/snap-mode/Panel.js\";\nimport { Snap } from \"../layout/footer/snap-mode/Snap.js\";\nimport { useTranslation } from \"../hooks/useTranslation.js\";\nimport { useReduxFrameworkState } from \"../uistate/useReduxFrameworkState.js\";\nimport { Button, Icon } from \"@itwin/itwinui-react\";\nimport { StatusBarPopover } from \"../statusbar/popup/StatusBarPopover.js\";\nimport { SvgSnapsBisector } from \"../icons/snaps/SvgSnapsBisector.js\";\nimport { SvgSnapsCenter } from \"../icons/snaps/SvgSnapsCenter.js\";\nimport { SvgSnapsIntersection } from \"../icons/snaps/SvgSnapsIntersection.js\";\nimport { SvgSnapsMidpoint } from \"../icons/snaps/SvgSnapsMidpoint.js\";\nimport { SvgSnapsNearest } from \"../icons/snaps/SvgSnapsNearest.js\";\nimport { SvgSnapsOrigin } from \"../icons/snaps/SvgSnapsOrigin.js\";\nimport { SvgSnaps } from \"../icons/snaps/SvgSnaps.js\";\nimport { SvgSnapsPerpendicular } from \"../icons/snaps/SvgSnapsPerpendicular.js\";\nimport { SvgSnapsTangent } from \"../icons/snaps/SvgSnapsTangent.js\";\n\n/** Define the properties that will be used to represent the available snap modes. */\ninterface SnapModeFieldEntry {\n labelKey: string;\n value: number;\n icon: React.ReactElement;\n}\n\n// Field entry of all possible snap modes.\nconst allSnapModeFieldEntries: SnapModeFieldEntry[] = [\n {\n labelKey: \"snapModeField.keypoint\",\n value: SnapMode.NearestKeypoint as number,\n icon: <SvgSnaps />,\n },\n {\n labelKey: \"snapModeField.intersection\",\n value: SnapMode.Intersection as number,\n icon: <SvgSnapsIntersection />,\n },\n {\n labelKey: \"snapModeField.center\",\n value: SnapMode.Center as number,\n icon: <SvgSnapsCenter />,\n },\n {\n labelKey: \"snapModeField.nearest\",\n value: SnapMode.Nearest as number,\n icon: <SvgSnapsNearest />,\n },\n {\n labelKey: \"snapModeField.origin\",\n value: SnapMode.Origin as number,\n icon: <SvgSnapsOrigin />,\n },\n {\n labelKey: \"snapModeField.midpoint\",\n value: SnapMode.MidPoint as number,\n icon: <SvgSnapsMidpoint />,\n },\n {\n labelKey: \"snapModeField.bisector\",\n value: SnapMode.Bisector as number,\n icon: <SvgSnapsBisector />,\n },\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n ...(SnapMode.PerpendicularPoint === undefined\n ? []\n : [\n {\n labelKey: \"snapModeField.perpendicularPoint\",\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n value: SnapMode.PerpendicularPoint as number,\n icon: <SvgSnapsPerpendicular />,\n },\n ]),\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n ...(SnapMode.TangentPoint === undefined\n ? []\n : [\n {\n labelKey: \"snapModeField.tangentPoint\",\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n value: SnapMode.TangentPoint as number,\n icon: <SvgSnapsTangent />,\n },\n ]),\n];\n\n/** Defines properties supported by the SnapMode Field Component. */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\ninterface SnapModeFieldProps extends CommonProps {\n /** Uses redux store as a fallback. Defaults to {@link SnapMode.NearestKeypoint}.\n * @note Enum flags are supported.\n */\n snapMode?: SnapMode;\n /** The list of snap modes available for selection. Defaults to all the modes.*/\n availableSnapModes?: SnapMode[];\n onChange?: (newSnapMode: SnapMode) => void;\n}\n\n/** `SnapModeField` component designed to be specified in a status bar. It will\n * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.\n * @public\n */\nexport function SnapModeField(props: SnapModeFieldProps) {\n const { translate } = useTranslation();\n const snapModeEntries: SnapModeFieldEntry[] = props.availableSnapModes\n ? allSnapModeFieldEntries.filter((entry) => {\n return (\n props.availableSnapModes &&\n props.availableSnapModes.some(\n (availableSnap) => availableSnap === (entry.value as SnapMode)\n )\n );\n })\n : allSnapModeFieldEntries;\n\n const reduxSnapMode = useReduxFrameworkState(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (state) => state?.configurableUiState.snapMode\n );\n const snapMode = props.snapMode ?? reduxSnapMode ?? SnapMode.NearestKeypoint;\n\n // Get all the modes present in the bitmask.\n const enabledSnaps: SnapModeFieldEntry[] = allSnapModeFieldEntries.filter(\n (entry) => {\n return (entry.value & snapMode) === entry.value;\n }\n );\n\n const title = translate(\"snapModeField.snapMode\");\n return (\n <StatusBarPopover\n content={\n <SnapModePanel title={title}>\n {snapModeEntries.map((entry, index) => (\n <Snap\n key={`SM_${index}`}\n onClick={() => {\n if (props.onChange) {\n props.onChange(entry.value);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n UiFramework.setAccudrawSnapMode(entry.value);\n }}\n isActive={(snapMode & entry.value) === entry.value}\n icon={<Icon>{entry.icon}</Icon>}\n >\n {translate(entry.labelKey)}\n </Snap>\n ))}\n </SnapModePanel>\n }\n >\n <Button\n styleType=\"borderless\"\n title={title}\n endIcon={\n enabledSnaps.length === 1 ? enabledSnaps[0].icon : <SvgSnaps />\n }\n >\n {title}\n <StatusBarPopover.ExpandIndicator />\n </Button>\n </StatusBarPopover>\n );\n}\n"]}
1
+ {"version":3,"file":"SnapMode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D;gBAC5D,WAAW,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC/C,CAAC,EACD,QAAQ,EAAE,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,EAClD,IAAI,EAAE,oBAAC,IAAI,QAAE,KAAK,CAAC,IAAI,CAAQ,IAE9B,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CACrB,CACR,CAAC,CACY;QAGlB,oBAAC,MAAM,IACL,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,KAAK,EACZ,SAAS,EACP,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,QAAQ,OAAG;YAGhE,KAAK;YACN,oBAAC,gBAAgB,CAAC,eAAe,OAAG,CAC7B,CACQ,CACpB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport { SnapMode } from \"@itwin/core-frontend\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport { SnapModePanel } from \"../layout/footer/snap-mode/Panel.js\";\nimport { Snap } from \"../layout/footer/snap-mode/Snap.js\";\nimport { useTranslation } from \"../hooks/useTranslation.js\";\nimport { useReduxFrameworkState } from \"../uistate/useReduxFrameworkState.js\";\nimport { Button, Icon } from \"@itwin/itwinui-react\";\nimport { StatusBarPopover } from \"../statusbar/popup/StatusBarPopover.js\";\nimport { SvgSnapsBisector } from \"../icons/snaps/SvgSnapsBisector.js\";\nimport { SvgSnapsCenter } from \"../icons/snaps/SvgSnapsCenter.js\";\nimport { SvgSnapsIntersection } from \"../icons/snaps/SvgSnapsIntersection.js\";\nimport { SvgSnapsMidpoint } from \"../icons/snaps/SvgSnapsMidpoint.js\";\nimport { SvgSnapsNearest } from \"../icons/snaps/SvgSnapsNearest.js\";\nimport { SvgSnapsOrigin } from \"../icons/snaps/SvgSnapsOrigin.js\";\nimport { SvgSnaps } from \"../icons/snaps/SvgSnaps.js\";\nimport { SvgSnapsPerpendicular } from \"../icons/snaps/SvgSnapsPerpendicular.js\";\nimport { SvgSnapsTangent } from \"../icons/snaps/SvgSnapsTangent.js\";\n\n/** Define the properties that will be used to represent the available snap modes. */\ninterface SnapModeFieldEntry {\n labelKey: string;\n value: number;\n icon: React.ReactElement;\n}\n\n// Field entry of all possible snap modes.\nconst allSnapModeFieldEntries: SnapModeFieldEntry[] = [\n {\n labelKey: \"snapModeField.keypoint\",\n value: SnapMode.NearestKeypoint as number,\n icon: <SvgSnaps />,\n },\n {\n labelKey: \"snapModeField.intersection\",\n value: SnapMode.Intersection as number,\n icon: <SvgSnapsIntersection />,\n },\n {\n labelKey: \"snapModeField.center\",\n value: SnapMode.Center as number,\n icon: <SvgSnapsCenter />,\n },\n {\n labelKey: \"snapModeField.nearest\",\n value: SnapMode.Nearest as number,\n icon: <SvgSnapsNearest />,\n },\n {\n labelKey: \"snapModeField.origin\",\n value: SnapMode.Origin as number,\n icon: <SvgSnapsOrigin />,\n },\n {\n labelKey: \"snapModeField.midpoint\",\n value: SnapMode.MidPoint as number,\n icon: <SvgSnapsMidpoint />,\n },\n {\n labelKey: \"snapModeField.bisector\",\n value: SnapMode.Bisector as number,\n icon: <SvgSnapsBisector />,\n },\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n ...(SnapMode.PerpendicularPoint === undefined\n ? []\n : [\n {\n labelKey: \"snapModeField.perpendicularPoint\",\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n value: SnapMode.PerpendicularPoint as number,\n icon: <SvgSnapsPerpendicular />,\n },\n ]),\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n ...(SnapMode.TangentPoint === undefined\n ? []\n : [\n {\n labelKey: \"snapModeField.tangentPoint\",\n // @ts-ignore Introduced in @itwin/core-frontend@5.0.0\n value: SnapMode.TangentPoint as number,\n icon: <SvgSnapsTangent />,\n },\n ]),\n];\n\n/** Defines properties supported by the SnapMode Field Component. */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\ninterface SnapModeFieldProps extends CommonProps {\n /** Uses redux store as a fallback. Defaults to {@link SnapMode.NearestKeypoint}.\n * @note Enum flags are supported.\n */\n snapMode?: SnapMode;\n /** The list of snap modes available for selection. Defaults to all the modes.*/\n availableSnapModes?: SnapMode[];\n onChange?: (newSnapMode: SnapMode) => void;\n}\n\n/** `SnapModeField` component designed to be specified in a status bar. It will\n * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.\n * @public\n */\nexport function SnapModeField(props: SnapModeFieldProps) {\n const { translate } = useTranslation();\n const snapModeEntries: SnapModeFieldEntry[] = props.availableSnapModes\n ? allSnapModeFieldEntries.filter((entry) => {\n return (\n props.availableSnapModes &&\n props.availableSnapModes.some(\n (availableSnap) => availableSnap === (entry.value as SnapMode)\n )\n );\n })\n : allSnapModeFieldEntries;\n\n const reduxSnapMode = useReduxFrameworkState(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (state) => state?.configurableUiState.snapMode\n );\n const snapMode = props.snapMode ?? reduxSnapMode ?? SnapMode.NearestKeypoint;\n\n // Get all the modes present in the bitmask.\n const enabledSnaps: SnapModeFieldEntry[] = allSnapModeFieldEntries.filter(\n (entry) => {\n return (entry.value & snapMode) === entry.value;\n }\n );\n\n const title = translate(\"snapModeField.snapMode\");\n return (\n <StatusBarPopover\n content={\n <SnapModePanel title={title}>\n {snapModeEntries.map((entry, index) => (\n <Snap\n key={`SM_${index}`}\n onClick={() => {\n if (props.onChange) {\n props.onChange(entry.value);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n UiFramework.setAccudrawSnapMode(entry.value);\n }}\n isActive={(snapMode & entry.value) === entry.value}\n icon={<Icon>{entry.icon}</Icon>}\n >\n {translate(entry.labelKey)}\n </Snap>\n ))}\n </SnapModePanel>\n }\n >\n <Button\n styleType=\"borderless\"\n title={title}\n startIcon={\n enabledSnaps.length === 1 ? enabledSnaps[0].icon : <SvgSnaps />\n }\n >\n {title}\n <StatusBarPopover.ExpandIndicator />\n </Button>\n </StatusBarPopover>\n );\n}\n"]}