@grantbii/design-system 1.24.5 → 1.26.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.
- package/core/archive/RadioButtons.d.ts +1 -1
- package/core/archive/TallyModal.d.ts +1 -1
- package/core/archive/YesNoOptions.d.ts +1 -1
- package/core/atoms/BrandLogo.d.ts +1 -1
- package/core/atoms/Spacing.d.ts +2 -0
- package/core/atoms/Spacing.js +2 -0
- package/core/atoms/Spacing.js.map +1 -1
- package/core/integrations/registry.d.ts +1 -1
- package/core/molecules/Badge.d.ts +2 -2
- package/core/molecules/Button.d.ts +2 -2
- package/core/molecules/Checkbox.d.ts +1 -1
- package/core/molecules/Input.d.ts +1 -1
- package/core/molecules/PageLoader.d.ts +1 -1
- package/core/molecules/RadioButton.d.ts +1 -1
- package/core/organisms/Dropdown.d.ts +1 -1
- package/core/organisms/FileDrop.d.ts +1 -1
- package/core/organisms/SearchBar.d.ts +8 -7
- package/core/organisms/SearchBar.js +17 -28
- package/core/organisms/SearchBar.js.map +1 -1
- package/core/templates/ErrorFallback.d.ts +1 -1
- package/core/templates/GrantMatch/ActiveQueryFiles.d.ts +1 -1
- package/core/templates/GrantMatch/GrantMatchModal.d.ts +1 -1
- package/core/templates/GrantMatch/OpenModalButton.d.ts +1 -1
- package/core/templates/GrantMatch/index.d.ts +1 -1
- package/core/templates/GrantMatch/index.js +16 -8
- package/core/templates/GrantMatch/index.js.map +1 -1
- package/package.json +22 -22
- package/stories/archive/RadioButtons.stories.d.ts +1 -1
- package/stories/archive/TallyModal.stories.d.ts +1 -1
- package/stories/organisms/Dropdown.stories.d.ts +1 -1
- package/stories/organisms/FileDrop.stories.d.ts +1 -1
- package/stories/organisms/Modal.stories.d.ts +1 -1
- package/stories/organisms/SearchBar.stories.js +6 -8
- package/stories/organisms/SearchBar.stories.js.map +1 -1
- package/stories/templates/GrantMatch.stories.d.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -5,5 +5,5 @@ type RadioButtonProps = {
|
|
|
5
5
|
name?: string;
|
|
6
6
|
options: RadioOption[];
|
|
7
7
|
};
|
|
8
|
-
declare const RadioButtons: ({ name, options }: RadioButtonProps) => import("react
|
|
8
|
+
declare const RadioButtons: ({ name, options }: RadioButtonProps) => import("react").JSX.Element;
|
|
9
9
|
export default RadioButtons;
|
|
@@ -5,5 +5,5 @@ type TallyModalProps = {
|
|
|
5
5
|
prefilledFieldsQueryParams?: string;
|
|
6
6
|
onClickClose: MouseEventHandler<HTMLButtonElement>;
|
|
7
7
|
};
|
|
8
|
-
declare const TallyModal: ({ tallyId, prefilledFieldsQueryParams, ...modalProps }: TallyModalProps) => import("react
|
|
8
|
+
declare const TallyModal: ({ tallyId, prefilledFieldsQueryParams, ...modalProps }: TallyModalProps) => import("react").JSX.Element;
|
|
9
9
|
export default TallyModal;
|
|
@@ -5,5 +5,5 @@ type YesNoOptionsProps = {
|
|
|
5
5
|
noProps: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
6
6
|
unsureProps?: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
7
7
|
};
|
|
8
|
-
declare const YesNoOptions: ({ name, yesProps, noProps, unsureProps, }: YesNoOptionsProps) => import("react
|
|
8
|
+
declare const YesNoOptions: ({ name, yesProps, noProps, unsureProps, }: YesNoOptionsProps) => import("react").JSX.Element;
|
|
9
9
|
export default YesNoOptions;
|
|
@@ -9,5 +9,5 @@ type BrandLogoProps = {
|
|
|
9
9
|
borderRadius?: string;
|
|
10
10
|
alt?: string;
|
|
11
11
|
};
|
|
12
|
-
declare const BrandLogo: ({ colorVariant, isLogomark, smallScreenWidth, smallScreenHeight, bigScreenWidth, bigScreenHeight, borderRadius, alt, }: BrandLogoProps) => import("react
|
|
12
|
+
declare const BrandLogo: ({ colorVariant, isLogomark, smallScreenWidth, smallScreenHeight, bigScreenWidth, bigScreenHeight, borderRadius, alt, }: BrandLogoProps) => import("react").JSX.Element;
|
|
13
13
|
export default BrandLogo;
|
package/core/atoms/Spacing.d.ts
CHANGED
|
@@ -5,8 +5,10 @@ export declare const px16 = "16px";
|
|
|
5
5
|
export declare const px20 = "20px";
|
|
6
6
|
export declare const px24 = "24px";
|
|
7
7
|
export declare const px32 = "32px";
|
|
8
|
+
export declare const px36 = "36px";
|
|
8
9
|
export declare const px40 = "40px";
|
|
9
10
|
export declare const px48 = "48px";
|
|
11
|
+
export declare const px56 = "56px";
|
|
10
12
|
export declare const px64 = "64px";
|
|
11
13
|
export declare const px88 = "88px";
|
|
12
14
|
export declare const px100 = "100px";
|
package/core/atoms/Spacing.js
CHANGED
|
@@ -5,8 +5,10 @@ export const px16 = "16px";
|
|
|
5
5
|
export const px20 = "20px";
|
|
6
6
|
export const px24 = "24px";
|
|
7
7
|
export const px32 = "32px";
|
|
8
|
+
export const px36 = "36px";
|
|
8
9
|
export const px40 = "40px";
|
|
9
10
|
export const px48 = "48px";
|
|
11
|
+
export const px56 = "56px";
|
|
10
12
|
export const px64 = "64px";
|
|
11
13
|
export const px88 = "88px";
|
|
12
14
|
export const px100 = "100px";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spacing.js","sourceRoot":"","sources":["../../../core/atoms/Spacing.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC;AACzB,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC;AACzB,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC","sourcesContent":["export const px4 = \"4px\";\nexport const px8 = \"8px\";\nexport const px12 = \"12px\";\nexport const px16 = \"16px\";\nexport const px20 = \"20px\";\nexport const px24 = \"24px\";\nexport const px32 = \"32px\";\nexport const px40 = \"40px\";\nexport const px48 = \"48px\";\nexport const px64 = \"64px\";\nexport const px88 = \"88px\";\nexport const px100 = \"100px\";\n"]}
|
|
1
|
+
{"version":3,"file":"Spacing.js","sourceRoot":"","sources":["../../../core/atoms/Spacing.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC;AACzB,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC;AACzB,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAC3B,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC","sourcesContent":["export const px4 = \"4px\";\nexport const px8 = \"8px\";\nexport const px12 = \"12px\";\nexport const px16 = \"16px\";\nexport const px20 = \"20px\";\nexport const px24 = \"24px\";\nexport const px32 = \"32px\";\nexport const px36 = \"36px\";\nexport const px40 = \"40px\";\nexport const px48 = \"48px\";\nexport const px56 = \"56px\";\nexport const px64 = \"64px\";\nexport const px88 = \"88px\";\nexport const px100 = \"100px\";\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type PropsWithChildren } from "react";
|
|
2
|
-
declare const StyledComponentsRegistry: ({ children }: PropsWithChildren) => import("react
|
|
2
|
+
declare const StyledComponentsRegistry: ({ children }: PropsWithChildren) => import("react").JSX.Element;
|
|
3
3
|
export default StyledComponentsRegistry;
|
|
@@ -11,7 +11,7 @@ type CustomBadgeProps = {
|
|
|
11
11
|
type BadgeProps = {
|
|
12
12
|
variant?: BadgeVariant;
|
|
13
13
|
} & CustomBadgeProps;
|
|
14
|
-
declare const Badge: ({ variant, ...restOfProps }: BadgeProps) => import("react
|
|
14
|
+
declare const Badge: ({ variant, ...restOfProps }: BadgeProps) => import("react").JSX.Element;
|
|
15
15
|
export default Badge;
|
|
16
16
|
type VariantStyleProps = {
|
|
17
17
|
color: Color.DesignColor;
|
|
@@ -19,4 +19,4 @@ type VariantStyleProps = {
|
|
|
19
19
|
hoverBackgroundColor?: Color.DesignColor;
|
|
20
20
|
};
|
|
21
21
|
type RawBadgeProps = CustomBadgeProps & VariantStyleProps;
|
|
22
|
-
export declare const RawBadge: ({ label, Icon, onClick, onClickX, labelWidthPixels, defaultBackgroundColor, hoverBackgroundColor, color, }: RawBadgeProps) => import("react
|
|
22
|
+
export declare const RawBadge: ({ label, Icon, onClick, onClickX, labelWidthPixels, defaultBackgroundColor, hoverBackgroundColor, color, }: RawBadgeProps) => import("react").JSX.Element;
|
|
@@ -16,7 +16,7 @@ type ButtonProps = {
|
|
|
16
16
|
variant?: ButtonVariant;
|
|
17
17
|
size?: ButtonSize;
|
|
18
18
|
} & CustomButtonProps;
|
|
19
|
-
declare const Button: ({ variant, size, ...restOfProps }: ButtonProps) => import("react
|
|
19
|
+
declare const Button: ({ variant, size, ...restOfProps }: ButtonProps) => import("react").JSX.Element;
|
|
20
20
|
export default Button;
|
|
21
21
|
type VariantStyleProps = {
|
|
22
22
|
defaultColor: Color.DesignColor;
|
|
@@ -35,4 +35,4 @@ type SizeStyleProps = {
|
|
|
35
35
|
fontSize?: string;
|
|
36
36
|
};
|
|
37
37
|
type RawButtonProps = CustomButtonProps & VariantStyleProps & SizeStyleProps;
|
|
38
|
-
export declare const RawButton: ({ Icon, iconRight, label, href, target, disabled, type, width, height, padding, fontSize, textDecoration, defaultColor, hoverColor, disabledColor, defaultBackgroundColor, hoverBackgroundColor, disabledBackgroundColor, borderColor, ...restOfProps }: RawButtonProps) => import("react
|
|
38
|
+
export declare const RawButton: ({ Icon, iconRight, label, href, target, disabled, type, width, height, padding, fontSize, textDecoration, defaultColor, hoverColor, disabledColor, defaultBackgroundColor, hoverBackgroundColor, disabledBackgroundColor, borderColor, ...restOfProps }: RawButtonProps) => import("react").JSX.Element;
|
|
@@ -3,5 +3,5 @@ type CheckboxProps = {
|
|
|
3
3
|
label: ReactNode;
|
|
4
4
|
labelBefore?: boolean;
|
|
5
5
|
} & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
6
|
-
declare const Checkbox: ({ id, label, labelBefore, ...checkboxProps }: CheckboxProps) => import("react
|
|
6
|
+
declare const Checkbox: ({ id, label, labelBefore, ...checkboxProps }: CheckboxProps) => import("react").JSX.Element;
|
|
7
7
|
export default Checkbox;
|
|
@@ -5,5 +5,5 @@ type InputProps = {
|
|
|
5
5
|
datalistId?: string;
|
|
6
6
|
datalistOptions?: Option[];
|
|
7
7
|
} & InputValidationProps & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
8
|
-
declare const Input: ({ datalistOptions, datalistId, ...inputProps }: InputProps) => import("react
|
|
8
|
+
declare const Input: ({ datalistOptions, datalistId, ...inputProps }: InputProps) => import("react").JSX.Element;
|
|
9
9
|
export default Input;
|
|
@@ -7,5 +7,5 @@ type PageLoaderProps = {
|
|
|
7
7
|
/**
|
|
8
8
|
* The animation to show when loading the whole page
|
|
9
9
|
*/
|
|
10
|
-
declare const PageLoader: ({ loadingText, tip, pacman, color, size, ...restOfProps }: PageLoaderProps) => import("react
|
|
10
|
+
declare const PageLoader: ({ loadingText, tip, pacman, color, size, ...restOfProps }: PageLoaderProps) => import("react").JSX.Element;
|
|
11
11
|
export default PageLoader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
2
2
|
import type { Option } from "../types";
|
|
3
3
|
type RadioButtonProps = Option & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
4
|
-
declare const RadioButton: ({ label, value, id, ...radioButtonProps }: RadioButtonProps) => import("react
|
|
4
|
+
declare const RadioButton: ({ label, value, id, ...radioButtonProps }: RadioButtonProps) => import("react").JSX.Element;
|
|
5
5
|
export default RadioButton;
|
|
@@ -5,5 +5,5 @@ export type DropdownProps = {
|
|
|
5
5
|
options: DropdownOption[];
|
|
6
6
|
defaultLabel?: string;
|
|
7
7
|
} & DetailedHTMLProps<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
|
|
8
|
-
declare const Dropdown: ({ options, defaultLabel, ...selectProps }: DropdownProps) => import("react
|
|
8
|
+
declare const Dropdown: ({ options, defaultLabel, ...selectProps }: DropdownProps) => import("react").JSX.Element;
|
|
9
9
|
export default Dropdown;
|
|
@@ -6,7 +6,7 @@ type FileDropzoneProps = {
|
|
|
6
6
|
maxFiles?: number;
|
|
7
7
|
maxSizeMB?: number;
|
|
8
8
|
};
|
|
9
|
-
declare const FileDrop: ({ uploadedFiles, uploadFiles, removeFile, errorMessage, maxFiles, maxSizeMB, }: FileDropzoneProps) => import("react
|
|
9
|
+
declare const FileDrop: ({ uploadedFiles, uploadFiles, removeFile, errorMessage, maxFiles, maxSizeMB, }: FileDropzoneProps) => import("react").JSX.Element;
|
|
10
10
|
export default FileDrop;
|
|
11
11
|
export declare const useFileDrop: (initialFiles?: File[], maxFiles?: number, maxSizeMB?: number) => {
|
|
12
12
|
files: File[];
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChangeEventHandler, MouseEventHandler } from "react";
|
|
2
2
|
type SearchBarProps = {
|
|
3
|
-
activeQuery: GrantMatchQuery;
|
|
4
|
-
updateActiveQuery: (query: GrantMatchQuery) => void;
|
|
5
3
|
queryText: string;
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
onChangeQueryText: ChangeEventHandler<HTMLInputElement, HTMLInputElement>;
|
|
5
|
+
onClickReset: MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
onClickSearch: MouseEventHandler<HTMLButtonElement>;
|
|
7
|
+
handlePressEnter: () => void;
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
disableSearch?: boolean;
|
|
8
10
|
placeholder?: string;
|
|
9
|
-
runSearchOnReset?: boolean;
|
|
10
11
|
size?: SearchBarSize;
|
|
11
12
|
};
|
|
12
13
|
type SearchBarSize = "small" | "medium";
|
|
13
|
-
declare const SearchBar: ({
|
|
14
|
+
declare const SearchBar: ({ queryText, onChangeQueryText, onClickSearch, onClickReset, handlePressEnter, autoFocus, disableSearch, placeholder, size, }: SearchBarProps) => import("react").JSX.Element;
|
|
14
15
|
export default SearchBar;
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import { Color, Responsive, SystemIcon } from "../atoms";
|
|
3
|
+
import { Color, Responsive, Spacing, SystemIcon } from "../atoms";
|
|
4
4
|
import { Button } from "../molecules";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const resetSearch = () => {
|
|
9
|
-
updateQueryText("");
|
|
10
|
-
if (runSearchOnReset) {
|
|
11
|
-
updateActiveQuery({ files: activeQuery.files, text: "" });
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const executeSearch = () => {
|
|
15
|
-
onSearch?.();
|
|
16
|
-
updateActiveQuery({ files: activeQuery.files, text: queryText });
|
|
17
|
-
};
|
|
18
|
-
return (_jsxs(BaseSearchBar, { children: [_jsxs(SearchArea, { "$height": height, "$hasQueryText": queryText !== "", children: [_jsx(TextInput, { queryText: queryText, updateQueryText: updateQueryText, executeSearch: executeSearch, placeholder: placeholder, fontSize: fontSize }), queryText === "" ? (_jsx(ResetButtonPlaceholder, {})) : (_jsx(ResetButton, { resetSearch: resetSearch }))] }), _jsx(Button, { Icon: SystemIcon.MagnifyingGlassIcon, onClick: executeSearch, size: size })] }));
|
|
5
|
+
const SearchBar = ({ queryText, onChangeQueryText, onClickSearch, onClickReset, handlePressEnter, autoFocus = false, disableSearch = false, placeholder = "Search grant or describe your project", size = "medium", }) => {
|
|
6
|
+
const { height, fontSize } = sizePropsMap[size];
|
|
7
|
+
return (_jsxs(BaseSearchBar, { children: [_jsxs(SearchArea, { "$height": height, "$hasQueryText": queryText !== "", children: [_jsx(TextInput, { queryText: queryText, onChangeQueryText: onChangeQueryText, handlePressEnter: handlePressEnter, autoFocus: autoFocus, disableSearch: disableSearch, placeholder: placeholder, fontSize: fontSize }), queryText === "" ? (_jsx(ResetButtonPlaceholder, {})) : (_jsx(ResetButton, { onClickReset: onClickReset }))] }), _jsx(Button, { disabled: disableSearch, Icon: SystemIcon.MagnifyingGlassIcon, onClick: onClickSearch, size: size })] }));
|
|
19
8
|
};
|
|
20
9
|
export default SearchBar;
|
|
21
|
-
const
|
|
10
|
+
const sizePropsMap = {
|
|
22
11
|
small: {
|
|
23
|
-
height:
|
|
12
|
+
height: Spacing.px40,
|
|
24
13
|
fontSize: "12px",
|
|
25
14
|
},
|
|
26
15
|
medium: {
|
|
@@ -32,7 +21,7 @@ const BaseSearchBar = styled.div `
|
|
|
32
21
|
display: flex;
|
|
33
22
|
align-items: center;
|
|
34
23
|
justify-content: space-between;
|
|
35
|
-
gap:
|
|
24
|
+
gap: ${Spacing.px8};
|
|
36
25
|
|
|
37
26
|
width: 100%;
|
|
38
27
|
|
|
@@ -41,7 +30,7 @@ const BaseSearchBar = styled.div `
|
|
|
41
30
|
}
|
|
42
31
|
|
|
43
32
|
@media (width >= ${Responsive.widthBreakpoint.laptop}) {
|
|
44
|
-
border-radius:
|
|
33
|
+
border-radius: ${Spacing.px12};
|
|
45
34
|
}
|
|
46
35
|
`;
|
|
47
36
|
const SearchArea = styled.div `
|
|
@@ -55,25 +44,25 @@ const SearchArea = styled.div `
|
|
|
55
44
|
background-color: ${(props) => props.$hasQueryText ? Color.neutral.white : Color.neutral.grey4};
|
|
56
45
|
border: 0.5px solid
|
|
57
46
|
${(props) => props.$hasQueryText ? Color.accent.yellow1 : Color.neutral.grey2};
|
|
58
|
-
border-radius:
|
|
47
|
+
border-radius: ${Spacing.px8};
|
|
59
48
|
|
|
60
49
|
&:focus-within {
|
|
61
50
|
background-color: ${Color.neutral.white};
|
|
62
51
|
border: 0.5px solid ${Color.accent.yellow1};
|
|
63
52
|
}
|
|
64
53
|
`;
|
|
65
|
-
const TextInput = ({ queryText,
|
|
54
|
+
const TextInput = ({ queryText, onChangeQueryText, handlePressEnter, autoFocus, disableSearch, placeholder, fontSize, }) => {
|
|
66
55
|
const onKeyDown = (event) => {
|
|
67
|
-
if (event.key === "Enter" && !event.repeat) {
|
|
56
|
+
if (event.key === "Enter" && !event.repeat && !disableSearch) {
|
|
68
57
|
event.preventDefault();
|
|
69
|
-
|
|
58
|
+
handlePressEnter();
|
|
70
59
|
}
|
|
71
60
|
};
|
|
72
|
-
return (_jsx(BaseTextInput, { value: queryText, placeholder: placeholder, onChange:
|
|
61
|
+
return (_jsx(BaseTextInput, { value: queryText, placeholder: placeholder, onChange: onChangeQueryText, onKeyDown: onKeyDown, autoFocus: autoFocus, "$fontSize": fontSize }));
|
|
73
62
|
};
|
|
74
63
|
const BaseTextInput = styled.input `
|
|
75
64
|
width: 100%;
|
|
76
|
-
margin-left:
|
|
65
|
+
margin-left: ${Spacing.px16};
|
|
77
66
|
|
|
78
67
|
font-size: ${(props) => props.$fontSize};
|
|
79
68
|
text-overflow: ellipsis;
|
|
@@ -82,7 +71,7 @@ const BaseTextInput = styled.input `
|
|
|
82
71
|
outline: none;
|
|
83
72
|
border: none;
|
|
84
73
|
`;
|
|
85
|
-
const ResetButton = ({
|
|
74
|
+
const ResetButton = ({ onClickReset }) => (_jsx(BaseResetButton, { onClick: onClickReset, type: "button", children: _jsx(SystemIcon.XIcon, { size: 14, color: Color.neutral.black }) }));
|
|
86
75
|
const BaseResetButton = styled.button `
|
|
87
76
|
display: flex;
|
|
88
77
|
align-items: center;
|
|
@@ -92,12 +81,12 @@ const BaseResetButton = styled.button `
|
|
|
92
81
|
min-width: 38px;
|
|
93
82
|
height: 38px;
|
|
94
83
|
|
|
95
|
-
border-radius:
|
|
84
|
+
border-radius: ${Spacing.px8};
|
|
96
85
|
`;
|
|
97
86
|
const ResetButtonPlaceholder = styled.div `
|
|
98
87
|
width: 38px;
|
|
99
88
|
height: 38px;
|
|
100
89
|
|
|
101
|
-
border-radius:
|
|
90
|
+
border-radius: ${Spacing.px8};
|
|
102
91
|
`;
|
|
103
92
|
//# sourceMappingURL=SearchBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../core/organisms/SearchBar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../core/organisms/SearchBar.tsx"],"names":[],"mappings":";AAKA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAg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AAK,CAAuB;;iBAExC,OAAO,CAAC,IAAI;;eAEd,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS;;;;;;CAMxC,CAAC;AAMF,MAAM,WAAW,GAAG,CAAC,EAAE,YAAY,EAAoB,EAAE,EAAE,CAAC,CAC1D,KAAC,eAAe,IAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAC,QAAQ,YACnD,KAAC,UAAU,CAAC,KAAK,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,GAC1C,CACnB,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;mBASlB,OAAO,CAAC,GAAG;CAC7B,CAAC;AAEF,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;mBAItB,OAAO,CAAC,GAAG;CAC7B,CAAC","sourcesContent":["import type {\n ChangeEventHandler,\n KeyboardEvent,\n MouseEventHandler,\n} from \"react\";\nimport styled from \"styled-components\";\nimport { Color, Responsive, Spacing, SystemIcon } from \"../atoms\";\nimport { Button } from \"../molecules\";\n\ntype SearchBarProps = {\n queryText: string;\n onChangeQueryText: ChangeEventHandler<HTMLInputElement, HTMLInputElement>;\n onClickReset: MouseEventHandler<HTMLButtonElement>;\n onClickSearch: MouseEventHandler<HTMLButtonElement>;\n handlePressEnter: () => void;\n autoFocus?: boolean;\n disableSearch?: boolean;\n placeholder?: string;\n size?: SearchBarSize;\n};\n\ntype SearchBarSize = \"small\" | \"medium\";\n\nconst SearchBar = ({\n queryText,\n onChangeQueryText,\n onClickSearch,\n onClickReset,\n handlePressEnter,\n autoFocus = false,\n disableSearch = false,\n placeholder = \"Search grant or describe your project\",\n size = \"medium\",\n}: SearchBarProps) => {\n const { height, fontSize } = sizePropsMap[size];\n\n return (\n <BaseSearchBar>\n <SearchArea $height={height} $hasQueryText={queryText !== \"\"}>\n <TextInput\n queryText={queryText}\n onChangeQueryText={onChangeQueryText}\n handlePressEnter={handlePressEnter}\n autoFocus={autoFocus}\n disableSearch={disableSearch}\n placeholder={placeholder}\n fontSize={fontSize}\n />\n\n {queryText === \"\" ? (\n <ResetButtonPlaceholder />\n ) : (\n <ResetButton onClickReset={onClickReset} />\n )}\n </SearchArea>\n\n <Button\n disabled={disableSearch}\n Icon={SystemIcon.MagnifyingGlassIcon}\n onClick={onClickSearch}\n size={size}\n />\n </BaseSearchBar>\n );\n};\n\nexport default SearchBar;\n\ntype SizeStyleProps = {\n height: string;\n fontSize: string;\n};\n\nconst sizePropsMap: { [size in SearchBarSize]: SizeStyleProps } = {\n small: {\n height: Spacing.px40,\n fontSize: \"12px\",\n },\n medium: {\n height: \"44px\",\n fontSize: \"14px\",\n },\n};\n\nconst BaseSearchBar = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${Spacing.px8};\n\n width: 100%;\n\n @media (width < ${Responsive.widthBreakpoint.laptop}) {\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.widthBreakpoint.laptop}) {\n border-radius: ${Spacing.px12};\n }\n`;\n\ntype SearchAreaProps = {\n $height: string;\n $hasQueryText: boolean;\n};\n\nconst SearchArea = styled.div<SearchAreaProps>`\n display: flex;\n align-items: center;\n\n box-sizing: border-box;\n height: ${(props) => props.$height};\n width: 100%;\n\n background-color: ${(props) =>\n props.$hasQueryText ? Color.neutral.white : Color.neutral.grey4};\n border: 0.5px solid\n ${(props) =>\n props.$hasQueryText ? Color.accent.yellow1 : Color.neutral.grey2};\n border-radius: ${Spacing.px8};\n\n &:focus-within {\n background-color: ${Color.neutral.white};\n border: 0.5px solid ${Color.accent.yellow1};\n }\n`;\n\ntype TextInputProps = {\n queryText: string;\n onChangeQueryText?: ChangeEventHandler<HTMLInputElement, HTMLInputElement>;\n handlePressEnter: () => void;\n autoFocus: boolean;\n disableSearch: boolean;\n placeholder: string;\n fontSize: string;\n};\n\nconst TextInput = ({\n queryText,\n onChangeQueryText,\n handlePressEnter,\n autoFocus,\n disableSearch,\n placeholder,\n fontSize,\n}: TextInputProps) => {\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\" && !event.repeat && !disableSearch) {\n event.preventDefault();\n handlePressEnter();\n }\n };\n\n return (\n <BaseTextInput\n value={queryText}\n placeholder={placeholder}\n onChange={onChangeQueryText}\n onKeyDown={onKeyDown}\n autoFocus={autoFocus}\n $fontSize={fontSize}\n />\n );\n};\n\nconst BaseTextInput = styled.input<{ $fontSize: string }>`\n width: 100%;\n margin-left: ${Spacing.px16};\n\n font-size: ${(props) => props.$fontSize};\n text-overflow: ellipsis;\n\n background-color: transparent;\n outline: none;\n border: none;\n`;\n\ntype ResetButtonProps = {\n onClickReset: MouseEventHandler<HTMLButtonElement>;\n};\n\nconst ResetButton = ({ onClickReset }: ResetButtonProps) => (\n <BaseResetButton onClick={onClickReset} type=\"button\">\n <SystemIcon.XIcon size={14} color={Color.neutral.black} />\n </BaseResetButton>\n);\n\nconst BaseResetButton = 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: ${Spacing.px8};\n`;\n\nconst ResetButtonPlaceholder = styled.div`\n width: 38px;\n height: 38px;\n\n border-radius: ${Spacing.px8};\n`;\n"]}
|
|
@@ -4,5 +4,5 @@ type ErrorFallbackProps = {
|
|
|
4
4
|
errorDescription?: ReactNode;
|
|
5
5
|
onClickReload?: MouseEventHandler<HTMLButtonElement>;
|
|
6
6
|
};
|
|
7
|
-
declare const ErrorFallback: ({ errorMessage, errorDescription, onClickReload, }: ErrorFallbackProps) => import("react
|
|
7
|
+
declare const ErrorFallback: ({ errorMessage, errorDescription, onClickReload, }: ErrorFallbackProps) => import("react").JSX.Element;
|
|
8
8
|
export default ErrorFallback;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const ActiveQueryFiles: () => import("react
|
|
1
|
+
declare const ActiveQueryFiles: () => import("react").JSX.Element;
|
|
2
2
|
export default ActiveQueryFiles;
|
|
@@ -2,5 +2,5 @@ type GrantMatchModalProps = {
|
|
|
2
2
|
findGrantsCallback?: () => void;
|
|
3
3
|
closeModalCallback?: () => void;
|
|
4
4
|
};
|
|
5
|
-
declare const GrantMatchModal: ({ findGrantsCallback, closeModalCallback, }: GrantMatchModalProps) => import("react
|
|
5
|
+
declare const GrantMatchModal: ({ findGrantsCallback, closeModalCallback, }: GrantMatchModalProps) => import("react").JSX.Element;
|
|
6
6
|
export default GrantMatchModal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type OpenModalButtonProps = {
|
|
2
2
|
openModalCallback?: () => void;
|
|
3
3
|
};
|
|
4
|
-
declare const OpenModalButton: ({ openModalCallback }: OpenModalButtonProps) => import("react
|
|
4
|
+
declare const OpenModalButton: ({ openModalCallback }: OpenModalButtonProps) => import("react").JSX.Element;
|
|
5
5
|
export default OpenModalButton;
|
|
@@ -7,6 +7,6 @@ type GrantMatchProps = {
|
|
|
7
7
|
closeModalCallback?: () => void;
|
|
8
8
|
openModalCallback?: () => void;
|
|
9
9
|
};
|
|
10
|
-
declare const GrantMatch: ({ activeQuery, updateActiveQuery, textSearchCallback, findGrantsCallback, closeModalCallback, openModalCallback, }: GrantMatchProps) => import("react
|
|
10
|
+
declare const GrantMatch: ({ activeQuery, updateActiveQuery, textSearchCallback, findGrantsCallback, closeModalCallback, openModalCallback, }: GrantMatchProps) => import("react").JSX.Element;
|
|
11
11
|
export default GrantMatch;
|
|
12
12
|
export declare const useGrantMatchActiveQuery: (performGrantMatch: (newQuery: GrantMatchQuery) => void, resetGrantMatch: () => void) => GrantMatchProps;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { checkGrantMatchActive } from "@grantbii/ui-core/match/validations";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
import { Color, Responsive } from "../../atoms";
|
|
5
|
+
import { Color, Responsive, Spacing } from "../../atoms";
|
|
6
6
|
import { SearchBar, useModal } from "../../organisms";
|
|
7
7
|
import ActiveQueryFiles from "./ActiveQueryFiles";
|
|
8
8
|
import GrantMatchModal from "./GrantMatchModal";
|
|
@@ -27,13 +27,21 @@ const GrantMatch = ({ activeQuery, updateActiveQuery, textSearchCallback, findGr
|
|
|
27
27
|
openModal,
|
|
28
28
|
closeModal,
|
|
29
29
|
]);
|
|
30
|
-
|
|
30
|
+
const handleSearch = () => {
|
|
31
|
+
updateActiveQuery({ files: activeQuery.files, text: queryText });
|
|
32
|
+
textSearchCallback?.();
|
|
33
|
+
};
|
|
34
|
+
const handleReset = () => {
|
|
35
|
+
updateQueryText("");
|
|
36
|
+
updateActiveQuery({ files: activeQuery.files, text: "" });
|
|
37
|
+
};
|
|
38
|
+
return (_jsx(GrantMatchContext.Provider, { value: commonProps, children: _jsxs(BaseGrantMatch, { children: [_jsxs(SearchBarContainer, { children: [_jsx(SearchBar, { queryText: queryText, onChangeQueryText: (event) => setQueryText(event.target.value), handlePressEnter: () => handleSearch(), onClickSearch: () => handleSearch(), onClickReset: () => handleReset(), size: "small" }), _jsx(OpenModalButton, { openModalCallback: openModalCallback })] }), activeQuery.files.length > 0 ? _jsx(ActiveQueryFiles, {}) : _jsx(_Fragment, {}), showModal ? (_jsx(GrantMatchModal, { findGrantsCallback: findGrantsCallback, closeModalCallback: closeModalCallback })) : (_jsx(_Fragment, {}))] }) }));
|
|
31
39
|
};
|
|
32
40
|
export default GrantMatch;
|
|
33
41
|
const BaseGrantMatch = styled.div `
|
|
34
42
|
display: flex;
|
|
35
43
|
flex-direction: column;
|
|
36
|
-
gap:
|
|
44
|
+
gap: ${Spacing.px8};
|
|
37
45
|
|
|
38
46
|
width: 100%;
|
|
39
47
|
max-width: 100vw;
|
|
@@ -49,7 +57,7 @@ const SearchBarContainer = styled.div `
|
|
|
49
57
|
background-color: ${Color.neutral.white};
|
|
50
58
|
|
|
51
59
|
@media (width < ${Responsive.widthBreakpoint.laptop}) {
|
|
52
|
-
gap:
|
|
60
|
+
gap: ${Spacing.px8};
|
|
53
61
|
padding: 0px;
|
|
54
62
|
|
|
55
63
|
box-shadow: none;
|
|
@@ -57,11 +65,11 @@ const SearchBarContainer = styled.div `
|
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
@media (width >= ${Responsive.widthBreakpoint.laptop}) {
|
|
60
|
-
gap:
|
|
61
|
-
padding:
|
|
68
|
+
gap: ${Spacing.px16};
|
|
69
|
+
padding: ${Spacing.px12} ${Spacing.px16};
|
|
62
70
|
|
|
63
|
-
box-shadow: 0px 0px
|
|
64
|
-
border-radius:
|
|
71
|
+
box-shadow: 0px 0px ${Spacing.px40} 0px #00000008;
|
|
72
|
+
border-radius: ${Spacing.px12};
|
|
65
73
|
}
|
|
66
74
|
`;
|
|
67
75
|
export const useGrantMatchActiveQuery = (performGrantMatch, resetGrantMatch) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/templates/GrantMatch/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/templates/GrantMatch/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACzD,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ACjB,OAAO,CAAC,IAAI;;CAEhC,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/entities\";\nimport { checkGrantMatchActive } from \"@grantbii/ui-core/match/validations\";\nimport { useMemo, useState } from \"react\";\nimport styled from \"styled-components\";\nimport { Color, Responsive, Spacing } from \"../../atoms\";\nimport { SearchBar, useModal } from \"../../organisms\";\nimport ActiveQueryFiles from \"./ActiveQueryFiles\";\nimport GrantMatchModal from \"./GrantMatchModal\";\nimport OpenModalButton from \"./OpenModalButton\";\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 const commonProps = useMemo(\n () => ({\n activeQuery,\n updateActiveQuery,\n queryText,\n updateQueryText,\n openModal,\n closeModal,\n }),\n [\n activeQuery,\n updateActiveQuery,\n queryText,\n updateQueryText,\n openModal,\n closeModal,\n ],\n );\n\n const handleSearch = () => {\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n textSearchCallback?.();\n };\n\n const handleReset = () => {\n updateQueryText(\"\");\n updateActiveQuery({ files: activeQuery.files, text: \"\" });\n };\n\n return (\n <GrantMatchContext.Provider value={commonProps}>\n <BaseGrantMatch>\n <SearchBarContainer>\n <SearchBar\n queryText={queryText}\n onChangeQueryText={(event) => setQueryText(event.target.value)}\n handlePressEnter={() => handleSearch()}\n onClickSearch={() => handleSearch()}\n onClickReset={() => handleReset()}\n size=\"small\"\n />\n <OpenModalButton openModalCallback={openModalCallback} />\n </SearchBarContainer>\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: ${Spacing.px8};\n\n width: 100%;\n max-width: 100vw;\n`;\n\nconst SearchBarContainer = 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.widthBreakpoint.laptop}) {\n gap: ${Spacing.px8};\n padding: 0px;\n\n box-shadow: none;\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.widthBreakpoint.laptop}) {\n gap: ${Spacing.px16};\n padding: ${Spacing.px12} ${Spacing.px16};\n\n box-shadow: 0px 0px ${Spacing.px40} 0px #00000008;\n border-radius: ${Spacing.px12};\n }\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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@grantbii/design-system",
|
|
3
3
|
"author": "Grantbii",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.26.0",
|
|
6
6
|
"description": "Grantbii's Design System",
|
|
7
7
|
"homepage": "https://design.grantbii.com",
|
|
8
8
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-spinners": "0.17.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@grantbii/ui-core": "^1.
|
|
29
|
+
"@grantbii/ui-core": "^1.10",
|
|
30
30
|
"next": "^16.2",
|
|
31
31
|
"react": ">=18 <20",
|
|
32
32
|
"react-dom": ">=18 <20",
|
|
@@ -34,33 +34,33 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@chromatic-com/storybook": "5.2.1",
|
|
37
|
-
"@grantbii/ui-core": "1.
|
|
38
|
-
"@storybook/addon-a11y": "10.4.
|
|
39
|
-
"@storybook/addon-docs": "10.4.
|
|
40
|
-
"@storybook/addon-onboarding": "10.4.
|
|
41
|
-
"@storybook/addon-vitest": "10.4.
|
|
42
|
-
"@storybook/nextjs-vite": "10.4.
|
|
37
|
+
"@grantbii/ui-core": "1.10.0",
|
|
38
|
+
"@storybook/addon-a11y": "10.4.6",
|
|
39
|
+
"@storybook/addon-docs": "10.4.6",
|
|
40
|
+
"@storybook/addon-onboarding": "10.4.6",
|
|
41
|
+
"@storybook/addon-vitest": "10.4.6",
|
|
42
|
+
"@storybook/nextjs-vite": "10.4.6",
|
|
43
43
|
"@types/node": "22.19.17",
|
|
44
|
-
"@types/react": "19.2.
|
|
44
|
+
"@types/react": "19.2.17",
|
|
45
45
|
"@types/react-dom": "19.2.3",
|
|
46
|
-
"@vitest/browser": "4.1.
|
|
47
|
-
"@vitest/browser-playwright": "4.1.
|
|
48
|
-
"@vitest/coverage-v8": "4.1.
|
|
46
|
+
"@vitest/browser": "4.1.8",
|
|
47
|
+
"@vitest/browser-playwright": "4.1.8",
|
|
48
|
+
"@vitest/coverage-v8": "4.1.8",
|
|
49
49
|
"eslint": "9.39.4",
|
|
50
|
-
"eslint-config-next": "16.2.
|
|
50
|
+
"eslint-config-next": "16.2.9",
|
|
51
51
|
"eslint-config-prettier": "10.1.8",
|
|
52
|
-
"eslint-plugin-storybook": "10.4.
|
|
52
|
+
"eslint-plugin-storybook": "10.4.6",
|
|
53
53
|
"husky": "9.1.7",
|
|
54
|
-
"lint-staged": "17.0.
|
|
55
|
-
"next": "16.2.
|
|
56
|
-
"playwright": "1.
|
|
57
|
-
"prettier": "3.8.
|
|
58
|
-
"react": "19.2.
|
|
59
|
-
"react-dom": "19.2.
|
|
60
|
-
"storybook": "10.4.
|
|
54
|
+
"lint-staged": "17.0.8",
|
|
55
|
+
"next": "16.2.9",
|
|
56
|
+
"playwright": "1.61.0",
|
|
57
|
+
"prettier": "3.8.4",
|
|
58
|
+
"react": "19.2.7",
|
|
59
|
+
"react-dom": "19.2.7",
|
|
60
|
+
"storybook": "10.4.6",
|
|
61
61
|
"styled-components": "6.4.2",
|
|
62
62
|
"typescript": "6.0.3",
|
|
63
|
-
"vitest": "4.1.
|
|
63
|
+
"vitest": "4.1.8"
|
|
64
64
|
},
|
|
65
65
|
"lint-staged": {
|
|
66
66
|
"**/*.{html,css,json,md,yaml}": [
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
|
2
2
|
type ExampleProps = {
|
|
3
3
|
controlled: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare const RadioButtonsExample: ({ controlled }: ExampleProps) => import("react
|
|
5
|
+
declare const RadioButtonsExample: ({ controlled }: ExampleProps) => import("react").JSX.Element;
|
|
6
6
|
declare const meta: Meta<typeof RadioButtonsExample>;
|
|
7
7
|
export default meta;
|
|
8
8
|
type Story = StoryObj<typeof meta>;
|
|
@@ -5,7 +5,7 @@ type TallyModalExampleProps = {
|
|
|
5
5
|
tallyId: string;
|
|
6
6
|
prefilledFieldsQueryParams?: string;
|
|
7
7
|
};
|
|
8
|
-
declare const TallyModalExample: (props: TallyModalExampleProps) => import("react
|
|
8
|
+
declare const TallyModalExample: (props: TallyModalExampleProps) => import("react").JSX.Element;
|
|
9
9
|
declare const meta: Meta<typeof TallyModalExample>;
|
|
10
10
|
export default meta;
|
|
11
11
|
type Story = StoryObj<typeof meta>;
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
|
2
2
|
type ExampleProps = {
|
|
3
3
|
controlled: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare const DropdownExample: ({ controlled }: ExampleProps) => import("react
|
|
5
|
+
declare const DropdownExample: ({ controlled }: ExampleProps) => import("react").JSX.Element;
|
|
6
6
|
declare const meta: Meta<typeof DropdownExample>;
|
|
7
7
|
export default meta;
|
|
8
8
|
type Story = StoryObj<typeof meta>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
2
|
-
declare const FileDropExample: () => import("react
|
|
2
|
+
declare const FileDropExample: () => import("react").JSX.Element;
|
|
3
3
|
declare const meta: Meta<typeof FileDropExample>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
@@ -7,7 +7,7 @@ type ModalExampleProps = {
|
|
|
7
7
|
width?: string;
|
|
8
8
|
height?: string;
|
|
9
9
|
};
|
|
10
|
-
declare const ModalExample: (props: ModalExampleProps) =>
|
|
10
|
+
declare const ModalExample: (props: ModalExampleProps) => JSX.Element;
|
|
11
11
|
declare const meta: Meta<typeof ModalExample>;
|
|
12
12
|
export default meta;
|
|
13
13
|
type Story = StoryObj<typeof meta>;
|
|
@@ -2,15 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { SearchBar } from "@/.";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
const SearchBarExample = ({ size }) => {
|
|
5
|
-
const [activeQuery, setActiveQuery] = useState(emptyQuery);
|
|
6
|
-
const updateActiveQuery = (newQuery) => setActiveQuery(newQuery);
|
|
7
5
|
const [queryText, setQueryText] = useState("");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const performSearch = () => {
|
|
7
|
+
if (queryText.trim() !== "") {
|
|
8
|
+
alert(`Searching for ${queryText}`);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
return (_jsx(SearchBar, { queryText: queryText, onChangeQueryText: (event) => setQueryText(event.target.value), handlePressEnter: () => performSearch(), onClickSearch: () => performSearch(), onClickReset: () => setQueryText(""), size: size }));
|
|
14
12
|
};
|
|
15
13
|
const meta = {
|
|
16
14
|
title: "Organisms/SearchBar",
|