@cfx-dev/ui-components 4.5.4 → 4.5.5

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.
@@ -12,11 +12,23 @@ export interface TabularItem {
12
12
  ariaControls?: string;
13
13
  hasNotification?: boolean;
14
14
  }
15
+ export interface TabularItemComponentProps {
16
+ disabled?: boolean;
17
+ type: HTMLButtonElement['type'];
18
+ role: HTMLButtonElement['role'];
19
+ className?: string;
20
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
21
+ 'aria-label'?: string;
22
+ 'aria-controls'?: string;
23
+ 'data-text'?: React.ReactNode;
24
+ 'aria-selected'?: boolean;
25
+ }
15
26
  export interface TabularProps {
16
27
  items: TabularItem[];
17
28
  activeItem?: string;
18
29
  onActivate?: (id: string) => void;
19
30
  itemClassName?: string;
31
+ ItemComponent?: React.ElementType<TabularItemComponentProps>;
20
32
  className?: string;
21
33
  ariaLabel?: string;
22
34
  tabIndex?: number;
@@ -32,17 +44,6 @@ export declare namespace Tabular {
32
44
  export interface TabularRootProps extends React.PropsWithChildren, Pick<TabularProps, 'className' | 'ariaLabel' | 'tabIndex' | 'theme' | 'role' | 'size'> {
33
45
  style?: React.CSSProperties;
34
46
  }
35
- export interface TabularItemComponentProps {
36
- disabled?: boolean;
37
- type: HTMLButtonElement['type'];
38
- role: HTMLButtonElement['role'];
39
- className?: string;
40
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
41
- 'aria-label'?: string;
42
- 'aria-controls'?: string;
43
- 'data-text'?: React.ReactNode;
44
- 'aria-selected'?: boolean;
45
- }
46
47
  export interface TabularItemProps extends TabularItem {
47
48
  active: boolean;
48
49
  onClick: (id: string) => void;
@@ -1,9 +1,9 @@
1
- import { jsx as m, jsxs as N } from "react/jsx-runtime";
2
- import d, { createElement as p } from "react";
1
+ import { jsx as b, jsxs as N } from "react/jsx-runtime";
2
+ import x, { createElement as p } from "react";
3
3
  import { Dot as C } from "../Dot/Dot.js";
4
- import { clsx as n } from "../../utils/clsx.js";
4
+ import { clsx as d } from "../../utils/clsx.js";
5
5
  import { ui as v } from "../../utils/ui/ui.js";
6
- const k = "cfxui__Tabular__reset__b1dbc", R = "cfxui__Tabular__item__98cc3", I = "cfxui__Tabular__root__0ff05", y = "cfxui__Tabular__active__1ae95", j = "cfxui__Tabular__hasNotification__c372f", A = "cfxui__Tabular__content__3a95a", e = {
6
+ const k = "cfxui__Tabular__reset__b1dbc", R = "cfxui__Tabular__item__98cc3", I = "cfxui__Tabular__root__0ff05", y = "cfxui__Tabular__active__1ae95", j = "cfxui__Tabular__hasNotification__c372f", A = "cfxui__Tabular__content__3a95a", a = {
7
7
  reset: k,
8
8
  "tabular-size-initial-large": "cfxui__Tabular__tabular-size-initial-large__9451f",
9
9
  item: R,
@@ -27,98 +27,101 @@ const k = "cfxui__Tabular__reset__b1dbc", R = "cfxui__Tabular__item__98cc3", I =
27
27
  hasNotification: j,
28
28
  content: A
29
29
  };
30
- function o(b) {
30
+ function n(f) {
31
31
  const {
32
32
  items: s,
33
- activeItem: t,
34
- onActivate: l,
35
- itemClassName: i,
33
+ activeItem: i,
34
+ onActivate: e,
35
+ itemClassName: _,
36
36
  size: u = "medium",
37
- ..._
38
- } = b, c = d.useCallback((a) => {
39
- l && l(a);
40
- }, [l]), r = n(
41
- e.root,
42
- _.className
37
+ className: c,
38
+ ItemComponent: m,
39
+ ...r
40
+ } = f, l = x.useCallback((t) => {
41
+ e && e(t);
42
+ }, [e]), o = d(
43
+ a.root,
44
+ c
43
45
  );
44
- return /* @__PURE__ */ m(o.Root, { ..._, className: r, children: s.map((a) => /* @__PURE__ */ p(
45
- o.Item,
46
+ return /* @__PURE__ */ b(n.Root, { ...r, className: o, children: s.map((t) => /* @__PURE__ */ p(
47
+ n.Item,
46
48
  {
47
- ...a,
48
- className: i,
49
- key: a.id,
50
- active: a.id === t,
51
- onClick: c,
49
+ ...t,
50
+ Component: m,
51
+ className: _,
52
+ key: t.id,
53
+ active: t.id === i,
54
+ onClick: l,
52
55
  size: u
53
56
  }
54
57
  )) });
55
58
  }
56
- o.Root = function(s) {
59
+ n.Root = function(s) {
57
60
  const {
58
- children: t,
59
- className: l,
60
- ariaLabel: i,
61
+ children: i,
62
+ className: e,
63
+ ariaLabel: _,
61
64
  tabIndex: u,
62
- theme: _ = "dark",
63
- role: c = "tablist",
65
+ theme: c = "dark",
66
+ role: m = "tablist",
64
67
  style: r
65
- } = s, a = n(e.root, e[`theme-${_}`], l);
66
- return /* @__PURE__ */ m(
68
+ } = s, l = d(a.root, a[`theme-${c}`], e);
69
+ return /* @__PURE__ */ b(
67
70
  "div",
68
71
  {
69
- role: c,
70
- "aria-label": i,
72
+ role: m,
73
+ "aria-label": _,
71
74
  tabIndex: u,
72
- className: a,
75
+ className: l,
73
76
  style: r,
74
- children: t
77
+ children: i
75
78
  }
76
79
  );
77
80
  };
78
- o.Item = function(s) {
81
+ n.Item = function(s) {
79
82
  const {
80
- id: t,
81
- label: l,
82
- onClick: i,
83
+ id: i,
84
+ label: e,
85
+ onClick: _,
83
86
  ariaLabel: u,
84
- ariaControls: _,
85
- className: c,
87
+ ariaControls: c,
88
+ className: m,
86
89
  active: r = !1,
87
- disabled: a = !1,
88
- hasNotification: f = !1,
89
- size: x,
90
+ disabled: l = !1,
91
+ hasNotification: o = !1,
92
+ size: t,
90
93
  Component: z
91
- } = s, g = d.useCallback(() => {
92
- a || i(t);
93
- }, [a, i, t]), T = n(
94
- e.reset,
95
- e.item,
96
- c,
97
- v.getResponsiveFlatClassnames("tabular-size", x).map((h) => e[h]),
94
+ } = s, g = x.useCallback(() => {
95
+ l || _(i);
96
+ }, [l, _, i]), T = d(
97
+ a.reset,
98
+ a.item,
99
+ m,
100
+ v.getResponsiveFlatClassnames("tabular-size", t).map((h) => a[h]),
98
101
  {
99
- [e.active]: r,
100
- [e.hasNotification]: f
102
+ [a.active]: r,
103
+ [a.hasNotification]: o
101
104
  }
102
105
  );
103
- return /* @__PURE__ */ m(
106
+ return /* @__PURE__ */ b(
104
107
  z || "button",
105
108
  {
106
- disabled: a,
109
+ disabled: l,
107
110
  type: "button",
108
111
  role: "tab",
109
112
  className: T,
110
113
  onClick: g,
111
114
  "aria-label": u,
112
- "aria-controls": _,
113
- "data-text": l,
115
+ "aria-controls": c,
116
+ "data-text": e,
114
117
  "aria-selected": r,
115
- children: /* @__PURE__ */ N("span", { className: e.content, children: [
116
- l,
117
- f && /* @__PURE__ */ m(C, { color: "green", className: e.notification })
118
+ children: /* @__PURE__ */ N("span", { className: a.content, children: [
119
+ e,
120
+ o && /* @__PURE__ */ b(C, { color: "green", className: a.notification })
118
121
  ] })
119
122
  }
120
123
  );
121
124
  };
122
125
  export {
123
- o as Tabular
126
+ n as Tabular
124
127
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfx-dev/ui-components",
3
3
  "private": false,
4
- "version": "4.5.4",
4
+ "version": "4.5.5",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "dist/main.js",