gasp-components 1.0.32 → 1.0.33

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.
@@ -3,6 +3,7 @@ interface RadioButtonProps {
3
3
  value: string | number | null;
4
4
  onChange?: (value: string | number | null) => void;
5
5
  children: React.ReactNode | string | number | null;
6
+ className?: string;
6
7
  }
7
8
  export declare const RadioButton: React.FC<RadioButtonProps>;
8
9
  export {};
@@ -1,31 +1,33 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { Typography as n } from "antd";
3
- import i from "classnames";
4
- import { useContext as p } from "react";
5
- import { radioButtonGroupContext as a } from "../radio-button-group/context.js";
6
- const u = ({
2
+ import { Typography as i } from "antd";
3
+ import p from "classnames";
4
+ import { useContext as a } from "react";
5
+ import { radioButtonGroupContext as c } from "../radio-button-group/context.js";
6
+ const f = ({
7
7
  value: t,
8
8
  onChange: o,
9
- children: m
9
+ children: m,
10
+ className: s
10
11
  }) => {
11
- const r = p(a), s = () => {
12
+ const r = a(c), n = () => {
12
13
  o && o(t);
13
14
  };
14
15
  return /* @__PURE__ */ e(
15
16
  "div",
16
17
  {
17
- className: i(
18
+ className: p([
19
+ s,
18
20
  "min-w-[94px] text-center rounded-lg px-4 py-2 hover:cursor-pointer",
19
21
  {
20
22
  "bg-ghostWhite": r !== t,
21
23
  "bg-lightBlue": r === t
22
24
  }
23
- ),
24
- onClick: s,
25
- children: /* @__PURE__ */ e(n.Text, { className: "text-sm text-slateGray font-medium", children: m })
25
+ ]),
26
+ onClick: n,
27
+ children: /* @__PURE__ */ e(i.Text, { className: "text-sm text-slateGray font-medium", children: m })
26
28
  }
27
29
  );
28
30
  };
29
31
  export {
30
- u as RadioButton
32
+ f as RadioButton
31
33
  };
@@ -2,12 +2,14 @@ import React from "react";
2
2
  type Option = {
3
3
  label: React.ReactNode | string;
4
4
  value: string | number | null;
5
+ className?: string;
5
6
  };
6
7
  interface RadioButtonGroupProps {
7
8
  value?: string | number | null;
8
9
  onChange?: (value: string | number | null) => void;
9
10
  defaultValue?: string | number | null;
10
11
  options: Option[];
12
+ containerClassName?: string;
11
13
  renderOption?: (params: {
12
14
  state: string | number | null;
13
15
  option: Option;
@@ -1,36 +1,48 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useState as f, useEffect as v } from "react";
3
- import { RadioButton as d } from "../radio-button/index.js";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { useState as v, useEffect as d } from "react";
3
+ import { RadioButton as x } from "../radio-button/index.js";
4
4
  import { radioButtonGroupContext as n } from "./context.js";
5
- const B = ({
6
- options: i,
7
- defaultValue: e,
8
- value: l,
9
- onChange: r,
10
- renderOption: s
5
+ import p from "classnames";
6
+ const y = ({
7
+ options: o,
8
+ defaultValue: t,
9
+ value: i,
10
+ onChange: e,
11
+ containerClassName: u,
12
+ renderOption: a
11
13
  }) => {
12
- const [m, u] = f(l || e || null), a = (t) => {
13
- u(t), r && r(t);
14
+ const [m, f] = v(i || t || null), c = (r) => {
15
+ f(r), e && e(r);
14
16
  };
15
- return v(() => {
16
- e && r && r(e);
17
- }, [e, r]), /* @__PURE__ */ o("div", { className: "flex justify-center gap-x-8", children: /* @__PURE__ */ o(n.Provider, { value: m, children: i.map(
18
- (t, c) => s ? s({
19
- state: m,
20
- option: t,
21
- key: `${t.value}_${c}`,
22
- onChange: a
23
- }) : /* @__PURE__ */ o(
24
- d,
25
- {
26
- value: t.value,
27
- onChange: a,
28
- children: t.label
29
- },
30
- `${t.value}_${c}`
31
- )
32
- ) }) });
17
+ return d(() => {
18
+ t && e && e(t);
19
+ }, [t, e]), /* @__PURE__ */ s(
20
+ "div",
21
+ {
22
+ className: p([
23
+ u,
24
+ "flex justify-center gap-x-8"
25
+ ]),
26
+ children: /* @__PURE__ */ s(n.Provider, { value: m, children: o.map(
27
+ (r, l) => a ? a({
28
+ state: m,
29
+ option: r,
30
+ key: `${r.value}_${l}`,
31
+ onChange: c
32
+ }) : /* @__PURE__ */ s(
33
+ x,
34
+ {
35
+ value: r.value,
36
+ onChange: c,
37
+ className: r.className,
38
+ children: r.label
39
+ },
40
+ `${r.value}_${l}`
41
+ )
42
+ ) })
43
+ }
44
+ );
33
45
  };
34
46
  export {
35
- B as RadioButtonGroup
47
+ y as RadioButtonGroup
36
48
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gasp-components",
3
3
  "private": false,
4
- "version": "1.0.32",
4
+ "version": "1.0.33",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "npm run storybook",