Skip to content

Commit 0536045

Browse files
committed
Merge branch 'Konradox-feature/icon-picker' into dev
2 parents 198f9a8 + 0d59b2e commit 0536045

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2192
-43
lines changed
58.9 KB
Loading
492 KB
Loading

docs/documentation/docs/controls/FolderExplorer.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@ import { FolderExplorer, IFolder } from "@pnp/spfx-controls-react/lib/FolderExpl
2323
- Use the `FolderExplorer` control in your code as follows:
2424

2525
```TypeScript
26-
<FolderExplorer
27-
context={this.props.context}
28-
rootFolder={{
29-
Name: 'Documents',
30-
ServerRelativeUrl: `/sites/TestSite/Shared Documents`
31-
}}
32-
defaultFolder={{
33-
Name: 'Documents',
34-
ServerRelativeUrl: `/sites/TestSite/Shared Documents`
35-
}}
36-
onSelect={this._onFolderSelect}
37-
canCreateFolders={true}
38-
/>
26+
<FolderExplorer context={this.props.context}
27+
rootFolder={{
28+
Name: 'Documents',
29+
ServerRelativeUrl: `/sites/TestSite/Shared Documents`
30+
}}
31+
defaultFolder={{
32+
Name: 'Documents',
33+
ServerRelativeUrl: `/sites/TestSite/Shared Documents`
34+
}}
35+
onSelect={this._onFolderSelect}
36+
canCreateFolders={true} />
3937
```
4038

4139
- The `onSelect` change event returns the selected folder and can be implemented as follows:
@@ -60,6 +58,4 @@ The `FolderExplorer` control can be configured with the following properties:
6058
| hiddenFilterBox | boolean | no | Hide the filter box |
6159
| onSelect | (folder: IFolder): void | no | Callback function called after a folder is selected. |
6260

63-
64-
6561
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/FolderExplorer)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# IconPicker control
2+
3+
Control that allows to search and select an icon from office-ui-fabric-react icons.
4+
5+
## Overview
6+
The control allows selecting an icon from the list of icons available in the office-ui-fabric-react library. Icon list is a static copy of available icons. Currently, only one icon selection is supported.
7+
![Icon Picker overview](../assets/IconPickerOverview.png)
8+
9+
10+
## Displayed in the panel
11+
Icon picker always opens a new panel where you can pick an icon. The panel displays all the icons and maintains readability. Picker does not displays selected icon outside the panel.
12+
![Icon Picker panel](../assets/IconPickerPanel.gif)
13+
14+
15+
## How to use this control
16+
17+
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../../#getting-started) page for more information about installing the dependency.
18+
- Import the following module to your component:
19+
20+
```TypeScript
21+
import { IconPicker } from '@pnp/spfx-controls-react/lib/IconPicker';
22+
```
23+
24+
- Use the `IconPicker` control in your code as follows:
25+
26+
```TypeScript
27+
<IconPicker buttonLabel={'Icon'}
28+
onChange={(iconName: string) => { this.setState({icon: iconName}); }}
29+
onSave={(iconName: string) => { this.setState({icon: iconName}); }} />
30+
```
31+
32+
## Implementation
33+
34+
The IconPicker component can be configured with the following properties:
35+
36+
| Property | Type | Required | Description |
37+
| ---- | ---- | ---- | ---- |
38+
| buttonLabel | string | no | Specifies the label of the icon picker button. |
39+
| onSave | (iconName: string) => void | yes | Handler when the icon has been selected and picker has been closed. |
40+
| onChange | (iconName: string) => void | no | Handler when the icon selection has been changed. |
41+
| disabled | boolean | no | Specifies if the picker button is disabled |
42+
| buttonClassName | boolean | no | If provided, additional class name will be added to the picker button |
43+
| panelClassName | boolean | no | If provided, additional class name will be added to the picker panel |
44+
| currentIcon | boolean | no | Specifies default selected icon |
45+
46+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/IconPicker)

docs/documentation/docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ The following controls are currently available:
4141
- [FileTypeIcon](./controls/FileTypeIcon) (Control that shows the icon of a specified file path or application)
4242
- [FolderExplorer](./controls/FolderExplorer) (Control that allows to browse the folders and sub-folders from a root folder)
4343
- [GridLayout](./controls/GridLayout) (control that renders a responsive grid layout for your web parts)
44+
- [IconPicker](./controls/IconPicker) (control that allows to search and select an icon from office-ui-fabric icons)
4445
- [IFrameDialog](./controls/IFrameDialog) (renders a Dialog with an iframe as a content)
4546
- [ListItemPicker](./controls/ListItemPicker) (allows to select one or more items from a list)
4647
- [ListPicker](./controls/ListPicker) (allows to select one or multiple available lists/libraries of the current site)

docs/documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ nav:
1818
- FileTypeIcon: 'controls/FileTypeIcon.md'
1919
- FolderExplorer: 'controls/FolderExplorer.md'
2020
- GridLayout: 'controls/GridLayout.md'
21+
- IconPicker: 'controls/IconPicker.md'
2122
- IFrameDialog: 'controls/IFrameDialog.md'
2223
- IFramePanel: 'controls/IFramePanel.md'
2324
- ListItemAttachments: 'controls/ListItemAttachments.md'

src/IconPicker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './controls/iconPicker/index';
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export interface IIconPickerProps {
2+
/**
3+
* call-back function when icon selection has been confirmed
4+
*/
5+
onSave(iconName: string): void;
6+
/**
7+
* call-back function when icon has changed
8+
*/
9+
onChange?(iconName: string): void;
10+
/**
11+
* Specifies the label of the icon picker button
12+
*/
13+
buttonLabel?: string;
14+
/**
15+
* Specifies if the picker button is disabled
16+
*/
17+
disabled?: boolean;
18+
/**
19+
* Specifies a custom className for the picker button
20+
*/
21+
buttonClassName?: string;
22+
/**
23+
* Specifies a custom className for the panel element
24+
*/
25+
panelClassName?: string;
26+
/**
27+
* initially selected icon
28+
*/
29+
currentIcon?: string;
30+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface IIconPickerState {
2+
items: string[];
3+
currentIcon?: string;
4+
isPanelOpen: boolean;
5+
}

0 commit comments

Comments
 (0)