@grantbii/design-system 1.4.6 → 1.4.8
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.
- package/core/assets/logos/grant_match_logo.webp +0 -0
- package/core/atoms/Badge.d.ts +4 -4
- package/core/atoms/Badge.js +1 -1
- package/core/atoms/Badge.js.map +1 -1
- package/core/atoms/RadioButton.d.ts +2 -3
- package/core/atoms/RadioButton.js.map +1 -1
- package/core/foundations/types.d.ts +2 -1
- package/core/foundations/types.js.map +1 -1
- package/core/integrations/mappings.d.ts +5 -1
- package/core/integrations/mappings.js +8 -0
- package/core/integrations/mappings.js.map +1 -1
- package/core/molecules/FileDrop.js +2 -2
- package/core/molecules/FileDrop.js.map +1 -1
- package/core/molecules/Modal.js +2 -2
- package/core/molecules/Modal.js.map +1 -1
- package/core/molecules/RadioButtons.js +3 -0
- package/core/molecules/RadioButtons.js.map +1 -1
- package/core/organisms/GrantMatch/ActiveQueryFiles.js +1 -1
- package/core/organisms/GrantMatch/ActiveQueryFiles.js.map +1 -1
- package/core/organisms/GrantMatch/GrantMatchModal.js +23 -3
- package/core/organisms/GrantMatch/GrantMatchModal.js.map +1 -1
- package/core/organisms/GrantMatch/SearchBar.js +68 -42
- package/core/organisms/GrantMatch/SearchBar.js.map +1 -1
- package/core/organisms/GrantMatch/index.js.map +1 -1
- package/package.json +1 -1
- package/stories/atoms/Badge.stories.js +7 -7
- package/stories/atoms/Badge.stories.js.map +1 -1
- package/stories/molecules/Badges.stories.js +1 -1
- package/stories/molecules/Badges.stories.js.map +1 -1
- package/stories/molecules/RadioButtons.stories.js +14 -4
- package/stories/molecules/RadioButtons.stories.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/SearchBar.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM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AC;QAED,SAAS,EAAE,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,mBAAmB,IAClB,OAAO,EAAE,WAAW,0BACE,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,aAElD,KAAC,KAAK,CAAC,eAAe,IAAC,IAAI,EAAE,EAAE,GAAI,EACnC,KAAC,mBAAmB,4BAAgC,IAChC,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAmC;;;;;;;;;sBAStD,MAAM,CAAC,IAAI,CAAC,cAAc;;;IAG5C,CAAC,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAC7B,oBAAoB;IAClB,CAAC,CAAC,GAAG,CAAA;8BACmB,MAAM,CAAC,IAAI,CAAC,cAAc;mBACrC,MAAM,CAAC,UAAU,CAAC,SAAS;SACrC;IACH,CAAC,CAAC,GAAG,CAAA;8BACmB,MAAM,CAAC,IAAI,CAAC,KAAK;mBAC5B,MAAM,CAAC,IAAI,CAAC,cAAc;SACpC;;oBAEW,UAAU,CAAC,iBAAiB,CAAC,MAAM;;iBAEtC,UAAU,CAAC,iBAAiB,CAAC,KAAK;;;qBAG9B,UAAU,CAAC,iBAAiB,CAAC,MAAM;;iBAEvC,UAAU,CAAC,iBAAiB,CAAC,GAAG;;CAEhD,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;oBAKhB,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;qBAIlC,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;CAGvD,CAAC","sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { Colors, Icons, Responsive, Typography } from \"../../foundations\";\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 $hasActiveQueryText={activeQuery.text !== \"\"}>\n <QueryTextInput />\n\n <Buttons>\n {queryText !== \"\" ? <ResetTextButton /> : <></>}\n <TextSearchButton textSearchCallback={textSearchCallback} />\n <OpenModalButton openModalCallback={openModalCallback} />\n </Buttons>\n </BaseSearchBar>\n );\n};\n\nexport default SearchBar;\n\nconst BaseSearchBar = styled.div<{ $hasActiveQueryText: boolean }>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n background-color: ${Colors.base.white};\n color: ${Colors.typography.blackHigh};\n\n border: 1px solid\n ${({ $hasActiveQueryText }) =>\n $hasActiveQueryText ? Colors.main.grantbiiOrange : Colors.neutral.grey3};\n border-radius: 12px;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 6px;\n padding: 6px;\n width: 100%;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 10px;\n padding: 10px;\n width: 480px;\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=\"Find grants that match your needs\"\n />\n );\n};\n\nconst BaseQueryTextInput = styled.input`\n border: none;\n outline: none;\n\n width: 100%;\n`;\n\nconst Buttons = styled.div`\n display: flex;\n align-items: center;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 6px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 10px;\n }\n`;\n\nconst BaseIconButton = styled.button`\n display: flex;\n align-items: center;\n justify-content: center;\n\n height: 31px;\n width: 31px;\n min-width: 31px;\n\n border-radius: 8px;\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 <Icons.XIcon size={16} color={Colors.neutral.grey1} />\n </BaseResetTextButton>\n );\n};\n\nconst BaseResetTextButton = styled(BaseIconButton)`\n background-color: ${Colors.base.white};\n border: 1px solid ${Colors.base.white};\n`;\n\ntype TextSearchButtonProps = {\n textSearchCallback?: () => void;\n};\n\nconst TextSearchButton = ({ textSearchCallback }: TextSearchButtonProps) => {\n const { activeQuery, updateActiveQuery, queryText } = useGrantMatchContext();\n\n const onClickSearch = () => {\n if (textSearchCallback) {\n textSearchCallback();\n }\n\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n };\n\n return (\n <BaseSearchButton type=\"button\" onClick={onClickSearch}>\n <Icons.MagnifyingGlassIcon size={16} color={Colors.neutral.grey1} />\n </BaseSearchButton>\n );\n};\n\nconst BaseSearchButton = styled(BaseIconButton)`\n background-color: ${Colors.neutral.grey4};\n border: 1px solid ${Colors.neutral.grey3};\n`;\n\ntype OpenModalButtonProps = {\n openModalCallback?: () => void;\n};\n\nconst OpenModalButton = ({ openModalCallback }: OpenModalButtonProps) => {\n const { activeQuery, openModal } = useGrantMatchContext();\n\n const onClickOpen = () => {\n if (openModalCallback) {\n openModalCallback();\n }\n\n openModal();\n };\n\n return (\n <BaseOpenModalButton\n onClick={onClickOpen}\n $hasActiveQueryFiles={activeQuery.files.length > 0}\n >\n <Icons.FileArrowUpIcon size={16} />\n <OpenModalButtonText>File Drop</OpenModalButtonText>\n </BaseOpenModalButton>\n );\n};\n\nconst BaseOpenModalButton = styled.button<{ $hasActiveQueryFiles: boolean }>`\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n\n height: 31px;\n min-width: 31px;\n\n border: 1px solid ${Colors.main.grantbiiOrange};\n border-radius: 8px;\n\n ${({ $hasActiveQueryFiles }) =>\n $hasActiveQueryFiles\n ? css`\n background-color: ${Colors.main.grantbiiOrange};\n color: ${Colors.typography.whiteHigh};\n `\n : css`\n background-color: ${Colors.base.white};\n color: ${Colors.main.grantbiiOrange};\n `}\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n padding: 0px;\n font-size: ${Typography.HELPER_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n padding: 0px 8px;\n font-size: ${Typography.HELPER_FONT_SIZES.big};\n }\n`;\n\nconst OpenModalButtonText = styled.p`\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"]}
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/SearchBar.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,cAAc,MAAM,0CAA0C,CAAC;AACtE,OAAO,KAAK,MAAM,YAAY,CAAC;AAO/B,MAAM,SAAS,GAAG,CAAC,EACjB,kBAAkB,EAClB,iBAAiB,GACF,EAAE,EAAE;IACnB,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAE1D,OAAO,CACL,MAAC,aAAa,eACZ,MAAC,cAAc,mBAAc,WAAW,CAAC,IAAI,KAAK,EAAE,aAClD,KAAC,cAAc,KAAG,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AElD,KAAC,cAAc,IACb,GAAG,EAAE,cAAc,EACnB,GAAG,EAAC,aAAa,EACjB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,GACV,EACF,KAAC,mBAAmB,iDAAqD,IACrD,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAmC;;;;;;;;sBAQtD,MAAM,CAAC,IAAI,CAAC,cAAc;;;IAG5C,CAAC,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAC7B,oBAAoB;IAClB,CAAC,CAAC,GAAG,CAAA;8BACmB,MAAM,CAAC,IAAI,CAAC,cAAc;mBACrC,MAAM,CAAC,UAAU,CAAC,SAAS;SACrC;IACH,CAAC,CAAC,GAAG,CAAA;8BACmB,MAAM,CAAC,IAAI,CAAC,KAAK;mBAC5B,MAAM,CAAC,IAAI,CAAC,cAAc;SACpC;;oBAEW,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;iBAItC,UAAU,CAAC,iBAAiB,CAAC,KAAK;;;qBAG9B,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;iBAIvC,UAAU,CAAC,iBAAiB,CAAC,GAAG;;CAEhD,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;;;;;;CAMnC,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, { css } from \"styled-components\";\nimport { Colors, Icons, Responsive, Typography } from \"../../foundations\";\nimport { useGrantMatchContext } from \"./context\";\nimport grantMatchLogo from \"../../assets/logos/grant_match_logo.webp\";\nimport Image from \"next/image\";\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 <ResetTextButton />\n ) : (\n <ResetTextButtonPlaceholder />\n )}\n </TextSearchArea>\n\n <TextSearchButton textSearchCallback={textSearchCallback} />\n <VerticalDivider />\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 padding: 12px 16px;\n\n color: ${Colors.typography.blackHigh};\n background-color: ${Colors.base.white};\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 8px;\n box-shadow: none;\n border-radius: 0 px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 16px;\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 width: 100%;\n\n background-color: ${Colors.neutral.grey4};\n border-radius: 8px;\n\n border: 1px solid\n ${({ $showBorder }) =>\n $showBorder ? Colors.main.grantbiiOrange : Colors.neutral.grey4};\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: ${Colors.neutral.grey4};\n text-overflow: ellipsis;\n`;\n\nconst BaseIconButton = 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 border-radius: 8px;\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 <Icons.XIcon size={20} color={Colors.neutral.grey1} />\n </BaseResetTextButton>\n );\n};\n\nconst BaseResetTextButton = styled(BaseIconButton)`\n background-color: ${Colors.neutral.grey4};\n border: 1px solid ${Colors.neutral.grey4};\n`;\n\nconst ResetTextButtonPlaceholder = styled.div`\n width: 40px;\n height: 40px;\n\n background-color: ${Colors.neutral.grey4};\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 onClickSearch = () => {\n if (textSearchCallback) {\n textSearchCallback();\n }\n\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n };\n\n return (\n <BaseSearchButton type=\"button\" onClick={onClickSearch}>\n <Icons.MagnifyingGlassIcon size={20} color={Colors.base.white} />\n </BaseSearchButton>\n );\n};\n\nconst BaseSearchButton = styled(BaseIconButton)`\n background-color: ${Colors.main.grantbiiBlue};\n border: 1px solid ${Colors.main.grantbiiBlue};\n`;\n\nconst VerticalDivider = styled.div`\n height: 40px;\n border-left: 1px solid ${Colors.neutral.grey2};\n`;\n\ntype OpenModalButtonProps = {\n openModalCallback?: () => void;\n};\n\nconst OpenModalButton = ({ openModalCallback }: OpenModalButtonProps) => {\n const { activeQuery, openModal } = useGrantMatchContext();\n\n const onClickOpen = () => {\n if (openModalCallback) {\n openModalCallback();\n }\n\n openModal();\n };\n\n return (\n <BaseOpenModalButton\n onClick={onClickOpen}\n $hasActiveQueryFiles={activeQuery.files.length > 0}\n >\n <GrantMatchLogo\n src={grantMatchLogo}\n alt=\"Grant Match\"\n width={64}\n height={64}\n />\n <OpenModalButtonText>Get Personalized Grant Matches</OpenModalButtonText>\n </BaseOpenModalButton>\n );\n};\n\nconst BaseOpenModalButton = styled.button<{ $hasActiveQueryFiles: boolean }>`\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n\n height: 38px;\n\n border: 1px solid ${Colors.main.grantbiiOrange};\n border-radius: 8px;\n\n ${({ $hasActiveQueryFiles }) =>\n $hasActiveQueryFiles\n ? css`\n background-color: ${Colors.main.grantbiiOrange};\n color: ${Colors.typography.whiteHigh};\n `\n : css`\n background-color: ${Colors.base.white};\n color: ${Colors.main.grantbiiOrange};\n `}\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 38px;\n min-width: 38px;\n padding: 0px;\n font-size: ${Typography.HELPER_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 238px;\n min-width: 238px;\n padding: 2px 12px;\n font-size: ${Typography.HELPER_FONT_SIZES.big};\n }\n`;\n\nconst GrantMatchLogo = styled(Image)`\n width: 18px;\n height: 18px;\n\n box-shadow: 0px 0px 3px 3px #ffe2b680;\n border-radius: 120px;\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,C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AM,CAAC,GAAG,CAAA;;;;;;;CAOhC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,iBAAsD,EACtD,eAA2B,EACV,EAAE;IACnB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAkB;QAC9D,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,CAAC,QAAyB,EAAE,EAAE;QACtD,cAAc,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;QAEhC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,eAAe,EAAE,CAAC;QACpB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type { GrantMatchQuery } from \"@grantbii/ui-core/match/models\";\nimport { checkGrantMatchActive } from \"@grantbii/ui-core/match/validations\";\nimport { useState } from \"react\";\nimport styled from \"styled-components\";\nimport { useModal } from \"../../molecules\";\nimport ActiveQueryFiles from \"./ActiveQueryFiles\";\nimport GrantMatchModal from \"./GrantMatchModal\";\nimport SearchBar from \"./SearchBar\";\nimport { GrantMatchContext } from \"./context\";\n\ntype GrantMatchProps = {\n activeQuery: GrantMatchQuery;\n updateActiveQuery: (newQuery: GrantMatchQuery) => void;\n textSearchCallback?: () => void;\n findGrantsCallback?: () => void;\n closeModalCallback?: () => void;\n openModalCallback?: () => void;\n};\n\nconst GrantMatch = ({\n activeQuery,\n updateActiveQuery,\n textSearchCallback,\n findGrantsCallback,\n closeModalCallback,\n openModalCallback,\n}: GrantMatchProps) => {\n const { showModal, openModal, closeModal } = useModal();\n const [queryText, setQueryText] = useState(activeQuery.text);\n const updateQueryText = (newText: string) => setQueryText(newText);\n\n // TODO: refactor away?\n const commonProps = {\n activeQuery,\n updateActiveQuery,\n queryText,\n updateQueryText,\n openModal,\n closeModal,\n };\n\n return (\n <GrantMatchContext.Provider value={commonProps}>\n <BaseGrantMatch>\n <SearchBar\n textSearchCallback={textSearchCallback}\n openModalCallback={openModalCallback}\n />\n\n {activeQuery.files.length > 0 ? <ActiveQueryFiles /> : <></>}\n\n {showModal ? (\n <GrantMatchModal\n findGrantsCallback={findGrantsCallback}\n closeModalCallback={closeModalCallback}\n />\n ) : (\n <></>\n )}\n </BaseGrantMatch>\n </GrantMatchContext.Provider>\n );\n};\n\nexport default GrantMatch;\n\nconst BaseGrantMatch = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n width: 100%;\n max-width: 100vw;\n`;\n\nexport const useGrantMatchActiveQuery = (\n performGrantMatch: (newQuery: GrantMatchQuery) => void,\n resetGrantMatch: () => void,\n): GrantMatchProps => {\n const [activeQuery, setActiveQuery] = useState<GrantMatchQuery>({\n files: [],\n text: \"\",\n });\n\n const updateActiveQuery = (newQuery: GrantMatchQuery) => {\n setActiveQuery({ ...newQuery });\n\n if (checkGrantMatchActive(newQuery)) {\n performGrantMatch(newQuery);\n } else {\n resetGrantMatch();\n }\n };\n\n return { activeQuery, updateActiveQuery };\n};\n"]}
|
package/package.json
CHANGED
|
@@ -13,32 +13,32 @@ const longText = "the quick brown fox jumps over the lazy dog";
|
|
|
13
13
|
const onClickClose = () => alert("You have closed the badge.");
|
|
14
14
|
export const TextOnly = {
|
|
15
15
|
args: {
|
|
16
|
-
|
|
16
|
+
label: defaultText,
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
export const Icon = {
|
|
20
20
|
args: {
|
|
21
21
|
Icon: Icons.SmileyXEyesIcon,
|
|
22
|
-
|
|
22
|
+
label: defaultText,
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
export const Closeable = {
|
|
26
26
|
args: {
|
|
27
|
-
|
|
27
|
+
label: defaultText,
|
|
28
28
|
onClickClose,
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
export const LongText = {
|
|
32
32
|
args: {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
label: longText,
|
|
34
|
+
labelWidthPixels: 160,
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
export const Everything = {
|
|
38
38
|
args: {
|
|
39
39
|
Icon: Icons.SmileyXEyesIcon,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
label: longText,
|
|
41
|
+
labelWidthPixels: 160,
|
|
42
42
|
onClickClose,
|
|
43
43
|
},
|
|
44
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.stories.js","sourceRoot":"","sources":["../../../stories/atoms/Badge.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAGnC,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,QAAQ,GAAG,6CAA6C,CAAC;AAC/D,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE;QACJ,
|
|
1
|
+
{"version":3,"file":"Badge.stories.js","sourceRoot":"","sources":["../../../stories/atoms/Badge.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAGnC,MAAM,IAAI,GAAuB;IAC/B,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,QAAQ,GAAG,6CAA6C,CAAC;AAC/D,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE;QACJ,KAAK,EAAE,WAAW;KACnB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK,CAAC,eAAe;QAC3B,KAAK,EAAE,WAAW;KACnB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,IAAI,EAAE;QACJ,KAAK,EAAE,WAAW;QAClB,YAAY;KACb;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE;QACJ,KAAK,EAAE,QAAQ;QACf,gBAAgB,EAAE,GAAG;KACtB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK,CAAC,eAAe;QAC3B,KAAK,EAAE,QAAQ;QACf,gBAAgB,EAAE,GAAG;QACrB,YAAY;KACb;CACF,CAAC","sourcesContent":["import { Badge, Icons } from \"@/.\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\n\nconst meta: Meta<typeof Badge> = {\n title: \"Atoms/Badge\",\n component: Badge,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nconst defaultText = \"Badge\";\nconst longText = \"the quick brown fox jumps over the lazy dog\";\nconst onClickClose = () => alert(\"You have closed the badge.\");\n\nexport const TextOnly: Story = {\n args: {\n label: defaultText,\n },\n};\n\nexport const Icon: Story = {\n args: {\n Icon: Icons.SmileyXEyesIcon,\n label: defaultText,\n },\n};\n\nexport const Closeable: Story = {\n args: {\n label: defaultText,\n onClickClose,\n },\n};\n\nexport const LongText: Story = {\n args: {\n label: longText,\n labelWidthPixels: 160,\n },\n};\n\nexport const Everything: Story = {\n args: {\n Icon: Icons.SmileyXEyesIcon,\n label: longText,\n labelWidthPixels: 160,\n onClickClose,\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badges.stories.js","sourceRoot":"","sources":["../../../stories/molecules/Badges.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAmB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,MAAM,IAAI,GAAwB;IAChC,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,aAAa,GAAiB,gBAAgB,CAAC,SAAS,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"Badges.stories.js","sourceRoot":"","sources":["../../../stories/molecules/Badges.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAmB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,MAAM,IAAI,GAAwB;IAChC,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,aAAa,GAAiB,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE;QACJ,aAAa;QACb,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE;QACJ,aAAa;QACb,YAAY,EAAE,KAAK;KACpB;CACF,CAAC","sourcesContent":["import { Badges, mapEnumToOptions, type BadgeProps } from \"@/.\";\nimport { Objective } from \"@grantbii/ui-core/grant/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\n\nconst meta: Meta<typeof Badges> = {\n title: \"Molecules/Badges\",\n component: Badges,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nconst allBadgeProps: BadgeProps[] = mapEnumToOptions(Objective);\n\nexport const Scrollable: Story = {\n args: {\n allBadgeProps,\n isScrollable: true,\n },\n};\n\nexport const WrapAround: Story = {\n args: {\n allBadgeProps,\n isScrollable: false,\n },\n};\n"]}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { RadioButtons } from "@/.";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LOCATION_FLAG_MAP, RadioButtons } from "@/.";
|
|
3
3
|
import { Location } from "@grantbii/ui-core/grant/enums";
|
|
4
4
|
import { useState } from "react";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
const Label = ({ location }) => {
|
|
7
|
+
const Flag = LOCATION_FLAG_MAP[location];
|
|
8
|
+
return (_jsxs(BaseLabel, { children: [_jsx(Flag, { width: 20 }), _jsx("p", { children: location })] }));
|
|
9
|
+
};
|
|
10
|
+
const BaseLabel = styled.div `
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 4px;
|
|
14
|
+
`;
|
|
5
15
|
const RadioButtonsExample = ({ controlled }) => {
|
|
6
16
|
const [selectedLocation, setSelectedLocation] = useState("");
|
|
7
17
|
const controlledProps = {
|
|
8
18
|
options: Object.values(Location)
|
|
9
19
|
.filter((location) => location !== Location.UNKNOWN)
|
|
10
20
|
.map((location) => ({
|
|
11
|
-
label: location,
|
|
12
21
|
value: location,
|
|
22
|
+
label: _jsx(Label, { location: location }),
|
|
13
23
|
checked: selectedLocation === location,
|
|
14
24
|
onClick: () => setSelectedLocation(location),
|
|
15
25
|
})),
|
|
@@ -21,8 +31,8 @@ const uncontrolledProps = {
|
|
|
21
31
|
options: Object.values(Location)
|
|
22
32
|
.filter((location) => location !== Location.UNKNOWN)
|
|
23
33
|
.map((location) => ({
|
|
24
|
-
label: location,
|
|
25
34
|
value: location,
|
|
35
|
+
label: _jsx(Label, { location: location }),
|
|
26
36
|
onChange: () => alert(`Selected ${location}!`),
|
|
27
37
|
})),
|
|
28
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButtons.stories.js","sourceRoot":"","sources":["../../../stories/molecules/RadioButtons.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioButtons.stories.js","sourceRoot":"","sources":["../../../stories/molecules/RadioButtons.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAMvC,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAc,EAAE,EAAE;IACzC,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAEzC,OAAO,CACL,MAAC,SAAS,eACR,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,GAAI,EACnB,sBAAI,QAAQ,GAAK,IACP,CACb,CAAC;AACJ,CAAC,CAAC;AA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CAAC;AAEF,MAAM,IAAI,GAAqC;IAC7C,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,mBAAmB;IAC9B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE;QACJ,UAAU,EAAE,KAAK;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE;QACJ,UAAU,EAAE,IAAI;KACjB;CACF,CAAC","sourcesContent":["import { LOCATION_FLAG_MAP, RadioButtons } from \"@/.\";\nimport { Location } from \"@grantbii/ui-core/grant/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport { useState } from \"react\";\nimport styled from \"styled-components\";\n\ntype LabelProps = {\n location: Location;\n};\n\nconst Label = ({ location }: LabelProps) => {\n const Flag = LOCATION_FLAG_MAP[location];\n\n return (\n <BaseLabel>\n <Flag width={20} />\n <p>{location}</p>\n </BaseLabel>\n );\n};\n\nconst BaseLabel = styled.div`\n display: flex;\n align-items: center;\n gap: 4px;\n`;\n\ntype ExampleProps = {\n controlled: boolean;\n};\n\nconst RadioButtonsExample = ({ controlled }: ExampleProps) => {\n const [selectedLocation, setSelectedLocation] = useState(\"\");\n\n const controlledProps = {\n options: Object.values(Location)\n .filter((location) => location !== Location.UNKNOWN)\n .map((location) => ({\n value: location,\n label: <Label location={location} />,\n checked: selectedLocation === location,\n onClick: () => setSelectedLocation(location),\n })),\n };\n\n return (\n <RadioButtons {...(controlled ? controlledProps : uncontrolledProps)} />\n );\n};\n\nconst uncontrolledProps = {\n name: \"location\",\n options: Object.values(Location)\n .filter((location) => location !== Location.UNKNOWN)\n .map((location) => ({\n value: location,\n label: <Label location={location} />,\n onChange: () => alert(`Selected ${location}!`),\n })),\n};\n\nconst meta: Meta<typeof RadioButtonsExample> = {\n title: \"Molecules/Radio Buttons\",\n component: RadioButtonsExample,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Uncontrolled: Story = {\n args: {\n controlled: false,\n },\n};\n\nexport const Controlled: Story = {\n args: {\n controlled: true,\n },\n};\n"]}
|