@grantbii/design-system 1.19.6 → 1.20.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.
@@ -1,6 +0,0 @@
1
- type SearchBarProps = {
2
- textSearchCallback?: () => void;
3
- openModalCallback?: () => void;
4
- };
5
- declare const SearchBar: ({ textSearchCallback, openModalCallback, }: SearchBarProps) => import("react/jsx-runtime").JSX.Element;
6
- export default SearchBar;
@@ -1,165 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import styled from "styled-components";
3
- import { applyTypography } from "../../integrations";
4
- import { Color, Responsive, SystemIcon, Typography } from "../../atoms";
5
- import { Button } from "../../molecules";
6
- import { useGrantMatchContext } from "./context";
7
- const SearchBar = ({ textSearchCallback, openModalCallback, }) => {
8
- const { activeQuery, queryText } = useGrantMatchContext();
9
- return (_jsxs(BaseSearchBar, { children: [_jsxs(TextSearchArea, { "$showBorder": activeQuery.text !== "", children: [_jsx(QueryTextInput, {}), queryText === "" ? (_jsx(ResetTextButtonPlaceholder, {})) : (_jsx(ResetTextButton, {}))] }), _jsx(TextSearchButton, { textSearchCallback: textSearchCallback }), _jsx(OpenModalButton, { openModalCallback: openModalCallback })] }));
10
- };
11
- export default SearchBar;
12
- const BaseSearchBar = styled.div `
13
- display: flex;
14
- align-items: center;
15
- justify-content: space-between;
16
-
17
- width: 100%;
18
-
19
- color: ${Color.typography.blackHigh};
20
- background-color: ${Color.neutral.white};
21
-
22
- @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
23
- gap: 8px;
24
- padding: 0px;
25
-
26
- box-shadow: none;
27
- border-radius: 0px;
28
- }
29
-
30
- @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
31
- gap: 16px;
32
- padding: 12px 16px;
33
-
34
- box-shadow: 0px 0px 40px 0px #00000008;
35
- border-radius: 12px;
36
- }
37
- `;
38
- const TextSearchArea = styled.div `
39
- display: flex;
40
- align-items: center;
41
-
42
- height: 40px;
43
- width: 100%;
44
-
45
- background-color: ${Color.neutral.grey4};
46
- border-radius: 8px;
47
-
48
- border: 1px solid
49
- ${({ $showBorder }) => $showBorder ? Color.accent.yellow1 : Color.neutral.grey2};
50
-
51
- &:focus-within {
52
- border: 1px solid ${Color.accent.yellow1};
53
- }
54
- `;
55
- const QueryTextInput = () => {
56
- const { activeQuery, updateActiveQuery, queryText, updateQueryText } = useGrantMatchContext();
57
- const onKeyDown = (event) => {
58
- if (event.key === "Enter" && !event.repeat) {
59
- event.preventDefault();
60
- updateActiveQuery({ files: activeQuery.files, text: queryText });
61
- }
62
- };
63
- return (_jsx(BaseQueryTextInput, { value: queryText, onChange: (event) => updateQueryText(event.target.value), onKeyDown: onKeyDown, placeholder: "Search grant or describe your project" }));
64
- };
65
- const BaseQueryTextInput = styled.input `
66
- width: 100%;
67
- margin-left: 16px;
68
- outline: none;
69
- border: none;
70
-
71
- background-color: ${Color.neutral.grey4};
72
- text-overflow: ellipsis;
73
- `;
74
- const ResetTextButton = () => {
75
- const { activeQuery, updateActiveQuery, updateQueryText } = useGrantMatchContext();
76
- const onClick = () => {
77
- updateQueryText("");
78
- updateActiveQuery({ files: activeQuery.files, text: "" });
79
- };
80
- return (_jsx(BaseResetTextButton, { type: "button", onClick: onClick, children: _jsx(SystemIcon.XIcon, { size: 14, color: Color.neutral.black }) }));
81
- };
82
- const BaseResetTextButton = styled.button `
83
- display: flex;
84
- align-items: center;
85
- justify-content: center;
86
-
87
- width: 38px;
88
- min-width: 38px;
89
- height: 38px;
90
-
91
- background-color: ${Color.neutral.grey4};
92
- border-radius: 8px;
93
- `;
94
- const ResetTextButtonPlaceholder = styled.div `
95
- width: 38px;
96
- height: 38px;
97
-
98
- border-radius: 8px;
99
- `;
100
- const TextSearchButton = ({ textSearchCallback }) => {
101
- const { activeQuery, updateActiveQuery, queryText } = useGrantMatchContext();
102
- const onClick = () => {
103
- if (textSearchCallback) {
104
- textSearchCallback();
105
- }
106
- updateActiveQuery({ files: activeQuery.files, text: queryText });
107
- };
108
- return (_jsx(Button, { Icon: SystemIcon.MagnifyingGlassIcon, onClick: onClick, size: "small" }));
109
- };
110
- const OpenModalButton = ({ openModalCallback }) => {
111
- const { openModal } = useGrantMatchContext();
112
- const onClickOpen = () => {
113
- if (openModalCallback) {
114
- openModalCallback();
115
- }
116
- openModal();
117
- };
118
- return (_jsxs(BaseOpenModalButton, { onClick: onClickOpen, children: [_jsx(SystemIcon.FileArrowUpIcon, { size: 20 }), _jsx(OpenModalButtonText, { children: "File Drop" })] }));
119
- };
120
- const BaseOpenModalButton = styled.button `
121
- display: flex;
122
- align-items: center;
123
- justify-content: center;
124
- gap: 10px;
125
-
126
- height: 40px;
127
-
128
- border-radius: 8px;
129
-
130
- background-color: ${Color.neutral.grey3};
131
- color: ${Color.typography.blackHigh};
132
-
133
- ${applyTypography(Typography.bodySecondaryRegular)}
134
-
135
- &:hover {
136
- background-color: ${Color.accent.blue3};
137
- }
138
-
139
- @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
140
- width: 40px;
141
- min-width: 40px;
142
- padding: 0px;
143
- }
144
-
145
- @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
146
- width: auto;
147
- min-width: 90px;
148
- padding: 2px 16px;
149
- }
150
- `;
151
- const OpenModalButtonText = styled.p `
152
- font-weight: 500;
153
- overflow: hidden;
154
- white-space: nowrap;
155
- text-overflow: ellipsis;
156
-
157
- @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
158
- display: none;
159
- }
160
-
161
- @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {
162
- display: inline;
163
- }
164
- `;
165
- //# sourceMappingURL=SearchBar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../../core/templates/GrantMatch/SearchBar.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,eA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AI,EAAE,EAAE,GAAI,EACxC,KAAC,mBAAmB,4BAAgC,IAChC,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;;sBAUnB,KAAK,CAAC,OAAO,CAAC,KAAK;WAC9B,KAAK,CAAC,UAAU,CAAC,SAAS;;IAEjC,eAAe,CAAC,UAAU,CAAC,oBAAoB,CAAC;;;wBAG5B,KAAK,CAAC,MAAM,CAAC,KAAK;;;oBAGtB,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;;;qBAMlC,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;;CAKvD,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;oBAMhB,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;qBAIlC,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;CAGvD,CAAC","sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport styled from \"styled-components\";\nimport { applyTypography } from \"../../integrations\";\nimport { Color, Responsive, SystemIcon, Typography } from \"../../atoms\";\nimport { Button } from \"../../molecules\";\nimport { useGrantMatchContext } from \"./context\";\n\ntype SearchBarProps = {\n textSearchCallback?: () => void;\n openModalCallback?: () => void;\n};\n\nconst SearchBar = ({\n textSearchCallback,\n openModalCallback,\n}: SearchBarProps) => {\n const { activeQuery, queryText } = useGrantMatchContext();\n\n return (\n <BaseSearchBar>\n <TextSearchArea $showBorder={activeQuery.text !== \"\"}>\n <QueryTextInput />\n\n {queryText === \"\" ? (\n <ResetTextButtonPlaceholder />\n ) : (\n <ResetTextButton />\n )}\n </TextSearchArea>\n\n <TextSearchButton textSearchCallback={textSearchCallback} />\n <OpenModalButton openModalCallback={openModalCallback} />\n </BaseSearchBar>\n );\n};\n\nexport default SearchBar;\n\nconst BaseSearchBar = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n width: 100%;\n\n color: ${Color.typography.blackHigh};\n background-color: ${Color.neutral.white};\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 8px;\n padding: 0px;\n\n box-shadow: none;\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 16px;\n padding: 12px 16px;\n\n box-shadow: 0px 0px 40px 0px #00000008;\n border-radius: 12px;\n }\n`;\n\nconst TextSearchArea = styled.div<{ $showBorder: boolean }>`\n display: flex;\n align-items: center;\n\n height: 40px;\n width: 100%;\n\n background-color: ${Color.neutral.grey4};\n border-radius: 8px;\n\n border: 1px solid\n ${({ $showBorder }) =>\n $showBorder ? Color.accent.yellow1 : Color.neutral.grey2};\n\n &:focus-within {\n border: 1px solid ${Color.accent.yellow1};\n }\n`;\n\nconst QueryTextInput = () => {\n const { activeQuery, updateActiveQuery, queryText, updateQueryText } =\n useGrantMatchContext();\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\" && !event.repeat) {\n event.preventDefault();\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n }\n };\n\n return (\n <BaseQueryTextInput\n value={queryText}\n onChange={(event) => updateQueryText(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder=\"Search grant or describe your project\"\n />\n );\n};\n\nconst BaseQueryTextInput = styled.input`\n width: 100%;\n margin-left: 16px;\n outline: none;\n border: none;\n\n background-color: ${Color.neutral.grey4};\n text-overflow: ellipsis;\n`;\n\nconst ResetTextButton = () => {\n const { activeQuery, updateActiveQuery, updateQueryText } =\n useGrantMatchContext();\n\n const onClick = () => {\n updateQueryText(\"\");\n updateActiveQuery({ files: activeQuery.files, text: \"\" });\n };\n\n return (\n <BaseResetTextButton type=\"button\" onClick={onClick}>\n <SystemIcon.XIcon size={14} color={Color.neutral.black} />\n </BaseResetTextButton>\n );\n};\n\nconst BaseResetTextButton = styled.button`\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 38px;\n min-width: 38px;\n height: 38px;\n\n background-color: ${Color.neutral.grey4};\n border-radius: 8px;\n`;\n\nconst ResetTextButtonPlaceholder = styled.div`\n width: 38px;\n height: 38px;\n\n border-radius: 8px;\n`;\n\ntype TextSearchButtonProps = {\n textSearchCallback?: () => void;\n};\n\nconst TextSearchButton = ({ textSearchCallback }: TextSearchButtonProps) => {\n const { activeQuery, updateActiveQuery, queryText } = useGrantMatchContext();\n\n const onClick = () => {\n if (textSearchCallback) {\n textSearchCallback();\n }\n\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n };\n\n return (\n <Button\n Icon={SystemIcon.MagnifyingGlassIcon}\n onClick={onClick}\n size=\"small\"\n />\n );\n};\n\ntype OpenModalButtonProps = {\n openModalCallback?: () => void;\n};\n\nconst OpenModalButton = ({ openModalCallback }: OpenModalButtonProps) => {\n const { openModal } = useGrantMatchContext();\n\n const onClickOpen = () => {\n if (openModalCallback) {\n openModalCallback();\n }\n\n openModal();\n };\n\n return (\n <BaseOpenModalButton onClick={onClickOpen}>\n <SystemIcon.FileArrowUpIcon size={20} />\n <OpenModalButtonText>File Drop</OpenModalButtonText>\n </BaseOpenModalButton>\n );\n};\n\nconst BaseOpenModalButton = styled.button`\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n\n height: 40px;\n\n border-radius: 8px;\n\n background-color: ${Color.neutral.grey3};\n color: ${Color.typography.blackHigh};\n\n ${applyTypography(Typography.bodySecondaryRegular)}\n\n &:hover {\n background-color: ${Color.accent.blue3};\n }\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 40px;\n min-width: 40px;\n padding: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: auto;\n min-width: 90px;\n padding: 2px 16px;\n }\n`;\n\nconst OpenModalButtonText = styled.p`\n font-weight: 500;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n display: none;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n display: inline;\n }\n`;\n"]}