@companix/uikit 0.1.4 → 0.1.6

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.
@@ -8,6 +8,7 @@ export interface RadioGroupProps<T> {
8
8
  value: T | null;
9
9
  disabled?: boolean;
10
10
  required?: boolean;
11
+ className?: string;
11
12
  size?: 'sm' | 'md';
12
13
  }
13
14
  export declare const RadioGroup: <T extends string>(props: RadioGroupProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,7 @@ export interface TableProps<T> {
4
4
  style?: React.CSSProperties;
5
5
  }[];
6
6
  items: T[];
7
- getItemLayout: (item: T) => React.ReactNode[];
7
+ getItemLayout: (item: T, index: number) => React.ReactNode[];
8
8
  onRowClick?: (item: T) => void;
9
9
  className?: string;
10
10
  }
@@ -1,39 +1,40 @@
1
- import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
- import { useId as p } from "react";
1
+ import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
+ import h from "classnames";
3
+ import { useId as N } from "react";
3
4
  import * as l from "@radix-ui/react-radio-group";
4
5
  import { attr as s } from "@companix/utils-browser";
5
- const q = (t) => {
6
- const { options: m, value: a, onChange: r, disabled: d, required: e, size: n } = t;
6
+ const R = (t) => {
7
+ const { options: m, value: a, onChange: r, disabled: i, required: e, size: n, className: c } = t;
7
8
  return /* @__PURE__ */ o(
8
9
  l.Root,
9
10
  {
10
- className: "radio-group",
11
- disabled: d,
11
+ className: h("radio-group", c),
12
+ disabled: i,
12
13
  "data-required": s(e && !a),
13
14
  "data-v": a,
14
15
  value: a,
15
- onValueChange: (i) => r(i),
16
- children: m.map((i, c) => /* @__PURE__ */ o(
17
- h,
16
+ onValueChange: (d) => r(d),
17
+ children: m.map((d, u) => /* @__PURE__ */ o(
18
+ f,
18
19
  {
19
- ...i,
20
+ ...d,
20
21
  size: n,
21
- disabled: d,
22
+ disabled: i,
22
23
  required: e && !a
23
24
  },
24
- `radio-${i.value}-${c}`
25
+ `radio-${d.value}-${u}`
25
26
  ))
26
27
  }
27
28
  );
28
- }, h = ({ value: t, label: m, size: a = "md", disabled: r, required: d }) => {
29
- const e = p();
30
- return /* @__PURE__ */ u(
29
+ }, f = ({ value: t, label: m, size: a = "md", disabled: r, required: i }) => {
30
+ const e = N();
31
+ return /* @__PURE__ */ p(
31
32
  "span",
32
33
  {
33
34
  className: "radio",
34
35
  "data-disabled": s(r),
35
36
  "data-size": a,
36
- "data-required": s(d),
37
+ "data-required": s(i),
37
38
  children: [
38
39
  /* @__PURE__ */ o(l.Item, { className: "radio-box", value: t, disabled: r, id: e, children: /* @__PURE__ */ o(l.Indicator, { className: "radio-mark" }) }),
39
40
  /* @__PURE__ */ o("label", { className: "radio-label", htmlFor: e, "data-disabled": s(r), children: m })
@@ -42,6 +43,6 @@ const q = (t) => {
42
43
  );
43
44
  };
44
45
  export {
45
- h as Radio,
46
- q as RadioGroup
46
+ f as Radio,
47
+ R as RadioGroup
47
48
  };
@@ -1,8 +1,8 @@
1
- import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- const b = ({ header: c, items: e, getItemLayout: d, className: o, onRowClick: h }) => /* @__PURE__ */ i("table", { className: o, children: [
3
- /* @__PURE__ */ r("colgroup", { children: c.map(({ style: l }, t) => /* @__PURE__ */ r("col", { style: l }, `colgroup-col-${t}`)) }),
4
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: c.map(({ content: l }, t) => /* @__PURE__ */ r("th", { children: l }, `header-th-${t}`)) }) }),
5
- /* @__PURE__ */ r("tbody", { children: e.map((l, t) => /* @__PURE__ */ r("tr", { onClick: () => h?.(l), children: d(l).map((n, a) => /* @__PURE__ */ r("td", { children: n }, `table-td-${t}-${a}`)) }, `table-tr-${t}`)) })
1
+ import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
+ const b = ({ header: c, items: e, getItemLayout: d, className: o, onRowClick: h }) => /* @__PURE__ */ p("table", { className: o, children: [
3
+ /* @__PURE__ */ r("colgroup", { children: c.map(({ style: t }, l) => /* @__PURE__ */ r("col", { style: t }, `colgroup-col-${l}`)) }),
4
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: c.map(({ content: t }, l) => /* @__PURE__ */ r("th", { children: t }, `header-th-${l}`)) }) }),
5
+ /* @__PURE__ */ r("tbody", { children: e.map((t, l) => /* @__PURE__ */ r("tr", { onClick: () => h?.(t), children: d(t, l).map((n, a) => /* @__PURE__ */ r("td", { children: n }, `table-td-${l}-${a}`)) }, `table-tr-${l}`)) })
6
6
  ] });
7
7
  export {
8
8
  b as Table
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.1.04",
3
+ "version": "0.1.06",
4
4
  "main": "./dist/bundle.es.js",
5
5
  "module": "./dist/bundle.es.js",
6
6
  "types": "./dist/index.d.ts",