@grantbii/design-system 1.2.0 → 1.3.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/{molecules → atoms}/Dropdown.js +10 -2
- package/core/atoms/Dropdown.js.map +1 -0
- package/core/atoms/Input.d.ts +7 -1
- package/core/atoms/Input.js +6 -3
- package/core/atoms/Input.js.map +1 -1
- package/core/atoms/index.d.ts +1 -1
- package/core/atoms/index.js +1 -1
- package/core/atoms/index.js.map +1 -1
- package/core/molecules/Modal.d.ts +2 -1
- package/core/molecules/Modal.js +2 -2
- package/core/molecules/Modal.js.map +1 -1
- package/core/molecules/RadioButtons.js +1 -3
- package/core/molecules/RadioButtons.js.map +1 -1
- package/core/molecules/index.d.ts +0 -1
- package/core/molecules/index.js +0 -1
- package/core/molecules/index.js.map +1 -1
- package/package.json +32 -32
- package/stories/{molecules → atoms}/Dropdown.stories.js +1 -1
- package/stories/atoms/Dropdown.stories.js.map +1 -0
- package/stories/atoms/Input.stories.d.ts +1 -0
- package/stories/atoms/Input.stories.js +9 -1
- package/stories/atoms/Input.stories.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/core/atoms/Select.d.ts +0 -2
- package/core/atoms/Select.js +0 -12
- package/core/atoms/Select.js.map +0 -1
- package/core/molecules/Dropdown.js.map +0 -1
- package/stories/molecules/Dropdown.stories.js.map +0 -1
- /package/core/{molecules → atoms}/Dropdown.d.ts +0 -0
- /package/stories/{molecules → atoms}/Dropdown.stories.d.ts +0 -0
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {} from "../foundations";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { Colors } from "../foundations";
|
|
4
|
+
import { InputValidation } from "./shared";
|
|
4
5
|
const Dropdown = ({ options, defaultLabel, ...selectProps }) => (_jsxs(Select, { ...selectProps, children: [_jsx("option", { hidden: true, disabled: true, value: "", children: defaultLabel ? defaultLabel : "-" }), options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value)))] }));
|
|
5
6
|
export default Dropdown;
|
|
7
|
+
const Select = styled.select `
|
|
8
|
+
padding: 12px 16px;
|
|
9
|
+
background-color: ${Colors.base.white};
|
|
10
|
+
border-radius: 6px;
|
|
11
|
+
|
|
12
|
+
${InputValidation}
|
|
13
|
+
`;
|
|
6
14
|
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../core/atoms/Dropdown.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAe,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAU3C,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,WAAW,EAAiB,EAAE,EAAE,CAAC,CAC7E,MAAC,MAAM,OAAK,WAAW,aACrB,iBAAQ,MAAM,QAAC,QAAQ,QAAC,KAAK,EAAC,EAAE,YAC7B,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,GAC3B,EAER,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,iBAA2B,KAAK,EAAE,MAAM,CAAC,KAAK,YAC3C,MAAM,CAAC,KAAK,IADF,MAAM,CAAC,KAAK,CAEhB,CACV,CAAC,IACK,CACV,CAAC;AAEF,eAAe,QAAQ,CAAC;AAExB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;;sBAEN,MAAM,CAAC,IAAI,CAAC,KAAK;;;IAGnC,eAAe;CAClB,CAAC","sourcesContent":["import type { DetailedHTMLProps, SelectHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\nimport { Colors, type Option } from \"../foundations\";\nimport { InputValidation } from \"./shared\";\n\nexport type DropdownProps = {\n options: Option[];\n defaultLabel?: string;\n} & DetailedHTMLProps<\n SelectHTMLAttributes<HTMLSelectElement>,\n HTMLSelectElement\n>;\n\nconst Dropdown = ({ options, defaultLabel, ...selectProps }: DropdownProps) => (\n <Select {...selectProps}>\n <option hidden disabled value=\"\">\n {defaultLabel ? defaultLabel : \"-\"}\n </option>\n\n {options.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </Select>\n);\n\nexport default Dropdown;\n\nconst Select = styled.select`\n padding: 12px 16px;\n background-color: ${Colors.base.white};\n border-radius: 6px;\n\n ${InputValidation}\n`;\n"]}
|
package/core/atoms/Input.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
2
|
+
import { type Option } from "../foundations";
|
|
3
|
+
type InputProps = {
|
|
4
|
+
datalistId?: string;
|
|
5
|
+
datalistOptions?: Option[];
|
|
6
|
+
} & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
7
|
+
declare const Input: ({ datalistOptions, datalistId, ...inputProps }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
8
|
export default Input;
|
package/core/atoms/Input.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
import { InputValidation } from "./shared";
|
|
3
3
|
import { Colors } from "../foundations";
|
|
4
|
-
|
|
4
|
+
import { InputValidation } from "./shared";
|
|
5
|
+
const Input = ({ datalistOptions, datalistId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(BaseInput, { ...inputProps, list: datalistId }), datalistId && datalistOptions ? (_jsx(Datalist, { id: datalistId, options: datalistOptions })) : (_jsx(_Fragment, {}))] }));
|
|
6
|
+
export default Input;
|
|
7
|
+
const BaseInput = styled.input `
|
|
5
8
|
padding: 12px 16px;
|
|
6
9
|
background-color: ${Colors.base.white};
|
|
7
10
|
border-radius: 6px;
|
|
8
11
|
|
|
9
12
|
${InputValidation}
|
|
10
13
|
`;
|
|
11
|
-
|
|
14
|
+
const Datalist = ({ id, options }) => (_jsx("datalist", { id: id, children: options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value))) }));
|
|
12
15
|
//# sourceMappingURL=Input.js.map
|
package/core/atoms/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../core/atoms/Input.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../core/atoms/Input.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAe,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAO3C,MAAM,KAAK,GAAG,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,UAAU,EAAc,EAAE,EAAE,CAAC,CAC5E,8BACE,KAAC,SAAS,OAAK,UAAU,EAAE,IAAI,EAAE,UAAU,GAAI,EAE9C,UAAU,IAAI,eAAe,CAAC,CAAC,CAAC,CAC/B,KAAC,QAAQ,IAAC,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,GAAI,CACvD,CAAC,CAAC,CAAC,CACF,mBAAK,CACN,IACA,CACJ,CAAC;AAEF,eAAe,KAAK,CAAC;AAErB,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAA;;sBAER,MAAM,CAAC,IAAI,CAAC,KAAK;;;IAGnC,eAAe;CAClB,CAAC;AAOF,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAiB,EAAE,EAAE,CAAC,CACnD,mBAAU,EAAE,EAAE,EAAE,YACb,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,iBAA2B,KAAK,EAAE,MAAM,CAAC,KAAK,YAC3C,MAAM,CAAC,KAAK,IADF,MAAM,CAAC,KAAK,CAEhB,CACV,CAAC,GACO,CACZ,CAAC","sourcesContent":["import type { DetailedHTMLProps, InputHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\nimport { Colors, type Option } from \"../foundations\";\nimport { InputValidation } from \"./shared\";\n\ntype InputProps = {\n datalistId?: string;\n datalistOptions?: Option[];\n} & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;\n\nconst Input = ({ datalistOptions, datalistId, ...inputProps }: InputProps) => (\n <>\n <BaseInput {...inputProps} list={datalistId} />\n\n {datalistId && datalistOptions ? (\n <Datalist id={datalistId} options={datalistOptions} />\n ) : (\n <></>\n )}\n </>\n);\n\nexport default Input;\n\nconst BaseInput = styled.input`\n padding: 12px 16px;\n background-color: ${Colors.base.white};\n border-radius: 6px;\n\n ${InputValidation}\n`;\n\ntype DatalistProps = {\n id: string;\n options: Option[];\n};\n\nconst Datalist = ({ id, options }: DatalistProps) => (\n <datalist id={id}>\n {options.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </datalist>\n);\n"]}
|
package/core/atoms/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export { default as Badge, type BadgeProps } from "./Badge";
|
|
|
2
2
|
export { default as BrandLogo } from "./BrandLogo";
|
|
3
3
|
export { default as Button } from "./Button";
|
|
4
4
|
export { default as Checkbox } from "./Checkbox";
|
|
5
|
+
export { default as Dropdown, type DropdownProps } from "./Dropdown";
|
|
5
6
|
export { default as Input } from "./Input";
|
|
6
7
|
export { default as LinkButton } from "./LinkButton";
|
|
7
8
|
export { default as PageLoader } from "./PageLoader";
|
|
8
9
|
export { default as RadioButton } from "./RadioButton";
|
|
9
|
-
export { default as Select } from "./Select";
|
|
10
10
|
export { default as Textarea } from "./Textarea";
|
package/core/atoms/index.js
CHANGED
|
@@ -2,10 +2,10 @@ export { default as Badge } from "./Badge";
|
|
|
2
2
|
export { default as BrandLogo } from "./BrandLogo";
|
|
3
3
|
export { default as Button } from "./Button";
|
|
4
4
|
export { default as Checkbox } from "./Checkbox";
|
|
5
|
+
export { default as Dropdown } from "./Dropdown";
|
|
5
6
|
export { default as Input } from "./Input";
|
|
6
7
|
export { default as LinkButton } from "./LinkButton";
|
|
7
8
|
export { default as PageLoader } from "./PageLoader";
|
|
8
9
|
export { default as RadioButton } from "./RadioButton";
|
|
9
|
-
export { default as Select } from "./Select";
|
|
10
10
|
export { default as Textarea } from "./Textarea";
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/core/atoms/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/atoms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAmB,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/atoms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAmB,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAsB,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default as Badge, type BadgeProps } from \"./Badge\";\nexport { default as BrandLogo } from \"./BrandLogo\";\nexport { default as Button } from \"./Button\";\nexport { default as Checkbox } from \"./Checkbox\";\nexport { default as Dropdown, type DropdownProps } from \"./Dropdown\";\nexport { default as Input } from \"./Input\";\nexport { default as LinkButton } from \"./LinkButton\";\nexport { default as PageLoader } from \"./PageLoader\";\nexport { default as RadioButton } from \"./RadioButton\";\nexport { default as Textarea } from \"./Textarea\";\n"]}
|
|
@@ -6,8 +6,9 @@ type ModalProps = {
|
|
|
6
6
|
width?: string;
|
|
7
7
|
height?: string;
|
|
8
8
|
onClickCancel: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
cancelText?: string;
|
|
9
10
|
};
|
|
10
|
-
declare const Modal: ({ header, content, footer, width, height, onClickCancel, }: ModalProps) => import("react").ReactPortal;
|
|
11
|
+
declare const Modal: ({ header, content, footer, width, height, onClickCancel, cancelText, }: ModalProps) => import("react").ReactPortal;
|
|
11
12
|
export default Modal;
|
|
12
13
|
export declare const useModal: () => {
|
|
13
14
|
showModal: boolean;
|
package/core/molecules/Modal.js
CHANGED
|
@@ -4,7 +4,7 @@ import styled from "styled-components";
|
|
|
4
4
|
import { Button } from "../atoms";
|
|
5
5
|
import { Colors, Responsive } from "../foundations";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
|
-
const Modal = ({ header, content, footer, width, height, onClickCancel, }) => createPortal(_jsx(Overlay, { children: _jsxs(ModalWindow, { "$width": width, "$height": height, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: content }), _jsxs(ModalFooter, { children: [_jsx(CancelButton, { onClick: onClickCancel }), footer ? footer : _jsx(_Fragment, {})] })] }) }), document.body);
|
|
7
|
+
const Modal = ({ header, content, footer, width, height, onClickCancel, cancelText, }) => createPortal(_jsx(Overlay, { children: _jsxs(ModalWindow, { "$width": width, "$height": height, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: content }), _jsxs(ModalFooter, { children: [_jsx(CancelButton, { onClick: onClickCancel, cancelText: cancelText }), footer ? footer : _jsx(_Fragment, {})] })] }) }), document.body);
|
|
8
8
|
export default Modal;
|
|
9
9
|
export const useModal = () => {
|
|
10
10
|
const [showModal, setShowModal] = useState(false);
|
|
@@ -106,5 +106,5 @@ const ModalFooter = styled.div `
|
|
|
106
106
|
|
|
107
107
|
padding: 24px;
|
|
108
108
|
`;
|
|
109
|
-
const CancelButton = ({ onClick }) => (_jsx(Button, { text:
|
|
109
|
+
const CancelButton = ({ onClick, cancelText = "Cancel", }) => (_jsx(Button, { text: cancelText, onClick: onClick, backgroundColor: Colors.neutral.grey3, color: Colors.typography.blackHigh }));
|
|
110
110
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/molecules/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/molecules/Modal.tsx"],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CAAC,UAAU,CAAC,SAAS,GAClC,CACH,CAAC","sourcesContent":["import {\n type JSX,\n type MouseEventHandler,\n type ReactNode,\n useCallback,\n useState,\n} from \"react\";\nimport styled from \"styled-components\";\nimport { Button } from \"../atoms\";\nimport { Colors, Responsive } from \"../foundations\";\nimport { createPortal } from \"react-dom\";\n\ntype ModalProps = {\n header?: ReactNode;\n content: JSX.Element;\n footer?: ReactNode;\n width?: string;\n height?: string;\n onClickCancel: MouseEventHandler<HTMLButtonElement>;\n cancelText?: string;\n};\n\nconst Modal = ({\n header,\n content,\n footer,\n width,\n height,\n onClickCancel,\n cancelText,\n}: ModalProps) =>\n createPortal(\n <Overlay>\n <ModalWindow $width={width} $height={height}>\n {header ? <ModalHeader>{header}</ModalHeader> : <></>}\n\n <ModalBody>{content}</ModalBody>\n\n <ModalFooter>\n <CancelButton onClick={onClickCancel} cancelText={cancelText} />\n {footer ? footer : <></>}\n </ModalFooter>\n </ModalWindow>\n </Overlay>,\n document.body,\n );\n\nexport default Modal;\n\nexport const useModal = () => {\n const [showModal, setShowModal] = useState(false);\n\n const lockScroll = useCallback(() => {\n document.body.style.overflow = \"hidden\";\n }, []);\n\n const unlockScroll = useCallback(() => {\n document.body.style.overflow = \"initial\";\n }, []);\n\n const openModal = () => {\n setShowModal(true);\n lockScroll();\n };\n\n const closeModal = () => {\n setShowModal(false);\n unlockScroll();\n };\n\n return {\n showModal,\n openModal,\n closeModal,\n };\n};\n\nconst Overlay = styled.div`\n background-color: ${Colors.semantic.overlay};\n\n z-index: 9999;\n position: fixed;\n top: 0px;\n left: 0px;\n\n width: 100vw;\n height: 100vh;\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst ModalWindow = styled.div<{ $width?: string; $height?: string }>`\n display: flex;\n flex-direction: column;\n\n background-color: ${Colors.base.white};\n\n min-height: 100px;\n max-height: 100vh;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: fixed;\n bottom: 0px;\n left: 0px;\n\n width: 100%;\n height: 100%;\n\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: static;\n bottom: auto;\n left: auto;\n\n width: ${({ $width }) => $width};\n height: ${({ $height }) => $height};\n\n border-radius: 6px;\n }\n`;\n\nconst ModalHeader = styled.div`\n font-weight: 500;\n font-size: 18px;\n\n padding: 12px 24px;\n border-bottom: 1px solid ${Colors.neutral.grey3};\n`;\n\nconst ModalBody = styled.div`\n display: flex;\n flex-direction: column;\n\n height: 100%;\n padding-top: 24px;\n overflow-y: auto;\n\n > * {\n width: 100%;\n height: 100%;\n min-height: 100px;\n\n padding: 2px 24px;\n border: none;\n }\n`;\n\nconst ModalFooter = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 12px;\n\n padding: 24px;\n`;\n\ntype CancelButtonProps = {\n onClick: MouseEventHandler<HTMLButtonElement>;\n cancelText?: string;\n};\n\nconst CancelButton = ({\n onClick,\n cancelText = \"Cancel\",\n}: CancelButtonProps) => (\n <Button\n text={cancelText}\n onClick={onClick}\n backgroundColor={Colors.neutral.grey3}\n color={Colors.typography.blackHigh}\n />\n);\n"]}
|
|
@@ -2,9 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createElement as _createElement } from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { RadioButton } from "../atoms";
|
|
5
|
-
const RadioButtons = ({ name, options }) => {
|
|
6
|
-
return (_jsx(RadioGroup, { children: options.map(({ value, ...props }) => (_createElement(RadioButton, { ...props, key: `${name}-${value}`, value: value, name: name }))) }));
|
|
7
|
-
};
|
|
5
|
+
const RadioButtons = ({ name, options }) => (_jsx(RadioGroup, { children: options.map(({ value, ...props }) => (_createElement(RadioButton, { ...props, key: `${name}-${value}`, value: value, name: name }))) }));
|
|
8
6
|
export default RadioButtons;
|
|
9
7
|
const RadioGroup = styled.div `
|
|
10
8
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButtons.js","sourceRoot":"","sources":["../../../core/molecules/RadioButtons.tsx"],"names":[],"mappings":";;AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAWvC,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAoB,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"RadioButtons.js","sourceRoot":"","sources":["../../../core/molecules/RadioButtons.tsx"],"names":[],"mappings":";;AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAWvC,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAoB,EAAE,EAAE,CAAC,CAC5D,KAAC,UAAU,cACR,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CACpC,eAAC,WAAW,OACN,KAAK,EACT,GAAG,EAAE,GAAG,IAAI,IAAI,KAAK,EAAE,EACvB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,GACV,CACH,CAAC,GACS,CACd,CAAC;AAEF,eAAe,YAAY,CAAC;AAE5B,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAI5B,CAAC","sourcesContent":["import type { DetailedHTMLProps, InputHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\nimport { RadioButton } from \"../atoms\";\nimport type { Option } from \"../foundations\";\n\nexport type RadioOption = Option &\n DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;\n\ntype RadioButtonProps = {\n name?: string;\n options: RadioOption[];\n};\n\nconst RadioButtons = ({ name, options }: RadioButtonProps) => (\n <RadioGroup>\n {options.map(({ value, ...props }) => (\n <RadioButton\n {...props}\n key={`${name}-${value}`}\n value={value}\n name={name}\n />\n ))}\n </RadioGroup>\n);\n\nexport default RadioButtons;\n\nconst RadioGroup = styled.div`\n display: flex;\n align-items: center;\n gap: 12px;\n`;\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as Badges } from "./Badges";
|
|
2
|
-
export { default as Dropdown, type DropdownProps } from "./Dropdown";
|
|
3
2
|
export { default as FileDrop, useFileDrop } from "./FileDrop";
|
|
4
3
|
export { default as Modal, useModal } from "./Modal";
|
|
5
4
|
export { default as RadioButtons, type RadioOption } from "./RadioButtons";
|
package/core/molecules/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as Badges } from "./Badges";
|
|
2
|
-
export { default as Dropdown } from "./Dropdown";
|
|
3
2
|
export { default as FileDrop, useFileDrop } from "./FileDrop";
|
|
4
3
|
export { default as Modal, useModal } from "./Modal";
|
|
5
4
|
export { default as RadioButtons } from "./RadioButtons";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/molecules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/molecules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAoB,MAAM,gBAAgB,CAAC","sourcesContent":["export { default as Badges } from \"./Badges\";\nexport { default as FileDrop, useFileDrop } from \"./FileDrop\";\nexport { default as Modal, useModal } from \"./Modal\";\nexport { default as RadioButtons, type RadioOption } from \"./RadioButtons\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grantbii/design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Grantbii's Design System",
|
|
5
5
|
"homepage": "https://design.grantbii.com",
|
|
6
6
|
"repository": {
|
|
@@ -20,39 +20,39 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@grantbii/ui-core": "1.0.0",
|
|
23
|
-
"@phosphor-icons/react": "
|
|
24
|
-
"country-flag-icons": "
|
|
25
|
-
"next": "
|
|
26
|
-
"react": "
|
|
27
|
-
"react-dom": "
|
|
28
|
-
"react-dropzone": "
|
|
29
|
-
"react-spinners": "
|
|
30
|
-
"styled-components": "
|
|
23
|
+
"@phosphor-icons/react": "2.1.10",
|
|
24
|
+
"country-flag-icons": "1.5.20",
|
|
25
|
+
"next": "15.5.3",
|
|
26
|
+
"react": "19.1.1",
|
|
27
|
+
"react-dom": "19.1.1",
|
|
28
|
+
"react-dropzone": "14.3.8",
|
|
29
|
+
"react-spinners": "0.17.0",
|
|
30
|
+
"styled-components": "6.1.19"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@chromatic-com/storybook": "
|
|
34
|
-
"@eslint/js": "
|
|
35
|
-
"@next/eslint-plugin-next": "
|
|
36
|
-
"@storybook/addon-a11y": "
|
|
37
|
-
"@storybook/addon-docs": "
|
|
38
|
-
"@storybook/addon-onboarding": "
|
|
39
|
-
"@storybook/addon-vitest": "
|
|
40
|
-
"@storybook/nextjs-vite": "
|
|
41
|
-
"@types/node": "
|
|
42
|
-
"@types/react": "
|
|
43
|
-
"@types/react-dom": "
|
|
44
|
-
"@vitest/browser": "
|
|
45
|
-
"@vitest/coverage-v8": "
|
|
46
|
-
"eslint": "
|
|
47
|
-
"eslint-config-next": "15.5.
|
|
48
|
-
"eslint-plugin-storybook": "
|
|
49
|
-
"husky": "
|
|
50
|
-
"lint-staged": "
|
|
51
|
-
"playwright": "
|
|
52
|
-
"prettier": "
|
|
53
|
-
"storybook": "
|
|
54
|
-
"typescript": "
|
|
55
|
-
"vitest": "
|
|
33
|
+
"@chromatic-com/storybook": "4.1.1",
|
|
34
|
+
"@eslint/js": "9.35.0",
|
|
35
|
+
"@next/eslint-plugin-next": "15.5.3",
|
|
36
|
+
"@storybook/addon-a11y": "9.1.5",
|
|
37
|
+
"@storybook/addon-docs": "9.1.5",
|
|
38
|
+
"@storybook/addon-onboarding": "9.1.5",
|
|
39
|
+
"@storybook/addon-vitest": "9.1.5",
|
|
40
|
+
"@storybook/nextjs-vite": "9.1.5",
|
|
41
|
+
"@types/node": "22.18.0",
|
|
42
|
+
"@types/react": "19.1.12",
|
|
43
|
+
"@types/react-dom": "19.1.9",
|
|
44
|
+
"@vitest/browser": "3.2.4",
|
|
45
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
46
|
+
"eslint": "9.35.0",
|
|
47
|
+
"eslint-config-next": "15.5.3",
|
|
48
|
+
"eslint-plugin-storybook": "9.1.5",
|
|
49
|
+
"husky": "9.1.7",
|
|
50
|
+
"lint-staged": "16.1.6",
|
|
51
|
+
"playwright": "1.55.0",
|
|
52
|
+
"prettier": "3.6.2",
|
|
53
|
+
"storybook": "9.1.5",
|
|
54
|
+
"typescript": "5.9.2",
|
|
55
|
+
"vitest": "3.2.4"
|
|
56
56
|
},
|
|
57
57
|
"lint-staged": {
|
|
58
58
|
"**/*.{html,css,json,md,yaml}": [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.stories.js","sourceRoot":"","sources":["../../../stories/atoms/Dropdown.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAsB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC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ropdownProps } from \"@/.\";\nimport { Need } from \"@grantbii/ui-core/filter/enums\";\nimport { parseEnum } from \"@grantbii/ui-core/shared/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport { useState } from \"react\";\n\ntype ExampleProps = {\n controlled: boolean;\n};\n\nconst DropdownExample = ({ controlled }: ExampleProps) => {\n const [selectedNeed, setSelectedNeed] = useState(Need.UNKNOWN);\n\n const controlledProps: DropdownProps = {\n ...baseProps,\n value: selectedNeed === Need.UNKNOWN ? \"\" : selectedNeed,\n onChange: (event) => setSelectedNeed(parseEnum(event.target.value, Need)),\n };\n\n return <Dropdown {...(controlled ? controlledProps : uncontrolledProps)} />;\n};\n\nconst baseProps: DropdownProps = {\n options: mapEnumToOptions(Need),\n defaultLabel: \"Select your grant need\",\n};\n\nconst uncontrolledProps: DropdownProps = {\n ...baseProps,\n defaultValue: \"\",\n};\n\nconst meta: Meta<typeof DropdownExample> = {\n title: \"Atoms/Dropdown\",\n component: DropdownExample,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Controlled: Story = {\n args: {\n controlled: true,\n },\n};\n\nexport const Uncontrolled: Story = {\n args: {\n controlled: false,\n },\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Input } from "@/.";
|
|
1
|
+
import { Input, mapEnumToOptions } from "@/.";
|
|
2
|
+
import { SupportableCost } from "@grantbii/ui-core/grant/enums";
|
|
2
3
|
const meta = {
|
|
3
4
|
title: "Atoms/Input",
|
|
4
5
|
component: Input,
|
|
@@ -20,4 +21,11 @@ export const EmailField = {
|
|
|
20
21
|
export const MinimumLength = {
|
|
21
22
|
args: { placeholder: "At least 10 characters", minLength: 10 },
|
|
22
23
|
};
|
|
24
|
+
export const WithDatalist = {
|
|
25
|
+
args: {
|
|
26
|
+
placeholder: "Enter a cost item",
|
|
27
|
+
datalistId: "supportable-cost-items",
|
|
28
|
+
datalistOptions: mapEnumToOptions(SupportableCost),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
23
31
|
//# sourceMappingURL=Input.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.stories.js","sourceRoot":"","sources":["../../../stories/atoms/Input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.stories.js","sourceRoot":"","sources":["../../../stories/atoms/Input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,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,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,IAAI,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;CACtD,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,EAAE;CACzD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,IAAI,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,SAAS,EAAE,EAAE,EAAE;CAC/D,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE;QACJ,WAAW,EAAE,mBAAmB;QAChC,UAAU,EAAE,wBAAwB;QACpC,eAAe,EAAE,gBAAgB,CAAC,eAAe,CAAC;KACnD;CACF,CAAC","sourcesContent":["import { Input, mapEnumToOptions } from \"@/.\";\nimport { SupportableCost } from \"@grantbii/ui-core/grant/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\n\nconst meta: Meta<typeof Input> = {\n title: \"Atoms/Input\",\n component: Input,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const BasicInput: Story = {\n args: { placeholder: \"Type here\" },\n};\n\nexport const NumericalField: Story = {\n args: { placeholder: \"Numbers only\", type: \"number\" },\n};\n\nexport const EmailField: Story = {\n args: { placeholder: \"Enter your email\", type: \"email\" },\n};\n\nexport const MinimumLength: Story = {\n args: { placeholder: \"At least 10 characters\", minLength: 10 },\n};\n\nexport const WithDatalist: Story = {\n args: {\n placeholder: \"Enter a cost item\",\n datalistId: \"supportable-cost-items\",\n datalistOptions: mapEnumToOptions(SupportableCost),\n },\n};\n"]}
|