@grantbii/design-system 1.0.47 → 1.0.48

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.
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import styled from "styled-components";
14
14
  const RadioButton = (_a) => {
15
15
  var { label, id } = _a, radioButtonProps = __rest(_a, ["label", "id"]);
16
- return (_jsxs(BaseRadioButton, { children: [_jsx("input", Object.assign({}, radioButtonProps, { id: id, type: "radio" })), _jsx("label", { htmlFor: id, children: label })] }));
16
+ return (_jsxs(BaseRadioButton, { children: [_jsx("input", Object.assign({}, radioButtonProps, { id: `${id}-radio-button`, type: "radio" })), _jsx("label", { htmlFor: `${id}-radio-button`, children: label })] }));
17
17
  };
18
18
  export default RadioButton;
19
19
  const BaseRadioButton = styled.div `
@@ -16,7 +16,7 @@ import { RadioButton } from "../atoms";
16
16
  const RadioButtons = ({ name, options }) => {
17
17
  return (_jsx(RadioGroup, { children: options.map((_a) => {
18
18
  var { value } = _a, props = __rest(_a, ["value"]);
19
- return (_createElement(RadioButton, Object.assign({}, props, { key: `${value}-radio-button`, id: `${value}-radio-button`, value: value, name: name })));
19
+ return (_createElement(RadioButton, Object.assign({}, props, { key: `${name}-${value}`, id: `${name}-${value}`, value: value, name: name })));
20
20
  }) }));
21
21
  };
22
22
  export default RadioButtons;
@@ -0,0 +1,9 @@
1
+ import { DetailedHTMLProps, InputHTMLAttributes } from "react";
2
+ type YesNoOptionsProps = {
3
+ name: string;
4
+ yesProps: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
5
+ noProps: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
6
+ unsureProps?: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
7
+ };
8
+ declare const YesNoOptions: ({ name, yesProps, noProps, unsureProps, }: YesNoOptionsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default YesNoOptions;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { RadioButton } from "../atoms";
4
+ import { LogicOption } from "@grantbii/ui-base/enums";
5
+ const YesNoOptions = ({ name, yesProps, noProps, unsureProps, }) => (_jsxs(RadioGroup, { children: [_jsx(RadioButton, Object.assign({}, yesProps, { id: `${name}-yes`, label: LogicOption.YES, value: LogicOption.YES, name: name })), _jsx(RadioButton, Object.assign({}, noProps, { id: `${name}-no`, label: LogicOption.NO, value: LogicOption.NO, name: name })), unsureProps ? (_jsx(RadioButton, Object.assign({}, unsureProps, { id: `${name}-unsure`, label: LogicOption.UNSURE, value: LogicOption.UNSURE, name: name }))) : (_jsx(_Fragment, {}))] }));
6
+ export default YesNoOptions;
7
+ const RadioGroup = styled.div `
8
+ display: flex;
9
+ gap: 12px;
10
+ `;
@@ -0,0 +1 @@
1
+ export { default as YesNoOptions } from "./YesNoOptions";
@@ -0,0 +1 @@
1
+ export { default as YesNoOptions } from "./YesNoOptions";
package/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from "./core/foundations";
3
3
  export { default as GlobalStyle } from "./core/global/GlobalStyle";
4
4
  export * from "./core/integrations";
5
5
  export * from "./core/molecules";
6
+ export * from "./core/organisms";
package/index.js CHANGED
@@ -3,3 +3,4 @@ export * from "./core/foundations";
3
3
  export { default as GlobalStyle } from "./core/global/GlobalStyle";
4
4
  export * from "./core/integrations";
5
5
  export * from "./core/molecules";
6
+ export * from "./core/organisms";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -18,6 +18,7 @@
18
18
  "build-storybook": "storybook build"
19
19
  },
20
20
  "dependencies": {
21
+ "@grantbii/ui-base": "1.0.13",
21
22
  "@phosphor-icons/react": "^2.1.10",
22
23
  "country-flag-icons": "^1.5.19",
23
24
  "next": "^15.3.5",
@@ -1,23 +1,22 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { RadioButtons } from "@/.";
3
+ import { Location } from "@grantbii/ui-base/enums";
3
4
  import { useState } from "react";
4
- const SINGAPORE = "Singapore";
5
- const HONG_KONG = "Hong Kong";
6
5
  const RadioButtonsExample = ({ controlled }) => {
7
6
  const [location, setLocation] = useState("");
8
7
  const controlledProps = {
9
8
  options: [
10
9
  {
11
- label: SINGAPORE,
12
- value: SINGAPORE,
13
- checked: location === SINGAPORE,
14
- onClick: () => setLocation(SINGAPORE),
10
+ label: Location.SINGAPORE,
11
+ value: Location.SINGAPORE,
12
+ checked: location === Location.SINGAPORE,
13
+ onClick: () => setLocation(Location.SINGAPORE),
15
14
  },
16
15
  {
17
- label: HONG_KONG,
18
- value: HONG_KONG,
19
- checked: location === HONG_KONG,
20
- onClick: () => setLocation(HONG_KONG),
16
+ label: Location.HONG_KONG,
17
+ value: Location.HONG_KONG,
18
+ checked: location === Location.HONG_KONG,
19
+ onClick: () => setLocation(Location.HONG_KONG),
21
20
  },
22
21
  ],
23
22
  };
@@ -27,14 +26,14 @@ const uncontrolledProps = {
27
26
  name: "location",
28
27
  options: [
29
28
  {
30
- label: SINGAPORE,
31
- value: SINGAPORE,
32
- onChange: () => alert(`Selected ${SINGAPORE}!`),
29
+ label: Location.SINGAPORE,
30
+ value: Location.SINGAPORE,
31
+ onChange: () => alert(`Selected ${Location.SINGAPORE}!`),
33
32
  },
34
33
  {
35
- label: HONG_KONG,
36
- value: HONG_KONG,
37
- onChange: () => alert(`Selected ${HONG_KONG}!`),
34
+ label: Location.HONG_KONG,
35
+ value: Location.HONG_KONG,
36
+ onChange: () => alert(`Selected ${Location.HONG_KONG}!`),
38
37
  },
39
38
  ],
40
39
  };
@@ -0,0 +1,7 @@
1
+ import { YesNoOptions } from "@/.";
2
+ import { Meta, StoryObj } from "@storybook/nextjs-vite";
3
+ declare const meta: Meta<typeof YesNoOptions>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const YesOrNo: Story;
7
+ export declare const YesOrNoOrUnsure: Story;
@@ -0,0 +1,21 @@
1
+ import { YesNoOptions } from "@/.";
2
+ const meta = {
3
+ title: "Organisms/Yes-No Options",
4
+ component: YesNoOptions,
5
+ tags: ["autodocs"],
6
+ parameters: {
7
+ layout: "centered",
8
+ },
9
+ };
10
+ export default meta;
11
+ const baseArgs = {
12
+ name: "question",
13
+ yesProps: {},
14
+ noProps: {},
15
+ };
16
+ export const YesOrNo = {
17
+ args: baseArgs,
18
+ };
19
+ export const YesOrNoOrUnsure = {
20
+ args: Object.assign(Object.assign({}, baseArgs), { unsureProps: {} }),
21
+ };