-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(KNO-7799): update Telegraph dependencies (#386)
- Loading branch information
1 parent
35b5cbd
commit 33c5cd8
Showing
7 changed files
with
100 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@knocklabs/react": patch | ||
--- | ||
|
||
Update Telegraph dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,6 @@ | ||
const SEARCHABLE_OPTION_DELIMITER = "::::"; | ||
|
||
type Option = { | ||
label: string; | ||
value: string; | ||
}; | ||
|
||
export const sortByDisplayName = <T extends { displayName: string }>( | ||
items: T[], | ||
) => | ||
items.sort((a, b) => | ||
a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()), | ||
); | ||
|
||
// Telegraph Combobox only supports searching by value, so we use this utility to make teams and channels searchable by their labels | ||
export const toLabelSearchableOption = (option: Option): Option => ({ | ||
value: `${option.label}${SEARCHABLE_OPTION_DELIMITER}${option.value}`, | ||
label: option.label, | ||
}); | ||
|
||
export const fromLabelSearchableOption = (option: Option): Option => { | ||
const [_, value] = option.value.split(SEARCHABLE_OPTION_DELIMITER); | ||
return { | ||
value: value!, | ||
label: option.label, | ||
}; | ||
}; |
Oops, something went wrong.