(function (Prism) {
Prism.languages.flow = Prism.languages.extend('javascript', {});
Prism.languages.insertBefore('flow', 'keyword', {
type: [
{
pattern:
/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|any|mixed|null|void)\b/,
alias: 'tag',
},
],
});
Prism.languages.flow['function-variable'].pattern =
/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i;
delete Prism.languages.flow['parameter'];
Prism.languages.insertBefore('flow', 'operator', {
'flow-punctuation': {
pattern: /\{\||\|\}/,
alias: 'punctuation',
},
});
if (!Array.isArray(Prism.languages.flow.keyword)) {
Prism.languages.flow.keyword = [Prism.languages.flow.keyword];
}
Prism.languages.flow.keyword.unshift(
{
pattern: /(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,
lookbehind: true,
},
{
pattern:
/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,
lookbehind: true,
}
);
})(Prism);
witch'/>
blob: 72cd576b617c27ffe436032408900aece15a92f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import Checkbox, { type CheckboxProps } from '@components/atoms/forms/checkbox';
import Label from '@components/atoms/forms/label';
import MagnifyingGlass from '@components/atoms/icons/magnifying-glass';
import { FC } from 'react';
import { useIntl } from 'react-intl';
import SearchModal, { type SearchModalProps } from '../modals/search-modal';
import searchStyles from './search.module.scss';
import sharedStyles from './toolbar-items.module.scss';
export type SearchProps = {
/**
* Set additional classnames to the modal wrapper.
*/
className?: SearchModalProps['className'];
/**
* The button state.
*/
isActive: CheckboxProps['value'];
/**
* A callback function to handle button state.
*/
setIsActive: CheckboxProps['setValue'];
};
const Search: FC<SearchProps> = ({ className = '', isActive, setIsActive }) => {
const intl = useIntl();
const label = isActive
? intl.formatMessage({
defaultMessage: 'Close search',
id: 'LDDUNO',
description: 'Search: Close label',
})
: intl.formatMessage({
defaultMessage: 'Open search',
id: 'Xj+WXB',
description: 'Search: Open label',
});
return (
<div className={`${sharedStyles.item} ${searchStyles.item}`}>
<Checkbox
id="search-button"
name="search-button"
value={isActive}
setValue={setIsActive}
className={`${sharedStyles.checkbox} ${searchStyles.checkbox}`}
/>
<Label
htmlFor="search-button"
aria-label={label}
className={`${sharedStyles.label} ${searchStyles.label}`}
>
<MagnifyingGlass />
</Label>
<SearchModal
className={`${sharedStyles.modal} ${searchStyles.modal} ${className}`}
/>
</div>
);
};
export default Search;
|