triafly-ui-kit 1.0.79 → 1.0.80

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.
@@ -1 +1 @@
1
- .buttons .buttons-bar{display:flex}.buttons .buttons-label{margin:0 0 8px;display:flex}.buttons .button{height:44px;padding:0 12px;display:flex;justify-content:center;align-items:center;border:1px solid var(--color-border-primary-default);background-color:var(--color-bg-neutral-basic-default);cursor:pointer}.buttons .button:not(:last-of-type){border-right:0 solid}.buttons .button:first-of-type{border-radius:8px 0 0 8px}.buttons .button:last-of-type{border-radius:0 8px 8px 0}.buttons .button:not(:disabled):hover{background:#ddd}.buttons .button:disabled{cursor:not-allowed;opacity:.6}.buttons .button.active{background:var(--color-bg-neutral-light-default);font-weight:600}.buttons .button.status-error{color:var(--color-status-error-foreground)}.buttons .button.status-warning{color:var(--color-status-warning-foreground)}.buttons .button.status-success{color:var(--color-status-success-foreground)}
1
+ .buttons .buttons-bar{display:flex}.buttons .buttons-label{margin:0 0 8px;display:flex}.buttons .button{height:44px;padding:0 12px;display:flex;justify-content:center;align-items:center;border:1px solid var(--color-border-primary-default);background-color:var(--color-bg-neutral-basic-default);cursor:pointer}.buttons .button:not(:last-of-type){border-right:0 solid}.buttons .button:first-of-type{border-radius:8px 0 0 8px}.buttons .button:last-of-type{border-radius:0 8px 8px 0}.buttons .button.invalid{border:1px solid var(--color-border-error-default)}.buttons .button.invalid .helper-text{color:var(--color-border-error-default)}.buttons .button:not(:disabled):hover{background:#ddd}.buttons .button:disabled{cursor:not-allowed;opacity:.6}.buttons .helper-text{font-size:12px;color:var(--color-text-secondary-default);margin:8px 0 0}.buttons .button.active{background:var(--color-bg-neutral-light-default);font-weight:600}.buttons .button.status-error{color:var(--color-status-error-foreground)}.buttons .button.status-warning{color:var(--color-status-warning-foreground)}.buttons .button.status-success{color:var(--color-status-success-foreground)}
@@ -1,31 +1,32 @@
1
- import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as f, useState as p, useEffect as k } from "react";
1
+ import { jsxs as f, jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as h, useState as k, useEffect as N } from "react";
3
3
  import '../../../assets/src/components/Ui/ButtonsArray/ButtonsArray.css';/* empty css */
4
- const h = f(
5
- ({ tabs: e, label: o, onChange: a, activeKey: t, isDisabled: i }, u) => {
6
- const [c, l] = p(t ?? e[0].key);
7
- k(() => {
8
- t != null ? l(t) : l(e[0].key);
9
- }, [t]);
10
- const d = (s, r) => {
11
- s.stopPropagation(), s.preventDefault(), l(r), a && a(r);
4
+ const y = h(
5
+ ({ tabs: s, label: a, onChange: o, activeKey: e, isDisabled: i, errorMessage: u, hasError: c }, d) => {
6
+ const [m, r] = k(e ?? s[0].key);
7
+ N(() => {
8
+ e != null ? r(e) : r(s[0].key);
9
+ }, [e]);
10
+ const p = (t, l) => {
11
+ t.stopPropagation(), t.preventDefault(), r(l), o && o(l);
12
12
  };
13
- return e.length === 0 ? null : /* @__PURE__ */ m("div", { className: "buttons", ref: u, children: [
14
- o && /* @__PURE__ */ n("span", { className: "buttons-label", children: o }),
15
- /* @__PURE__ */ n("div", { className: "buttons-bar", children: e.map((s) => /* @__PURE__ */ n(
13
+ return s.length === 0 ? null : /* @__PURE__ */ f("div", { className: `buttons ${c && "invalid"}`, ref: d, children: [
14
+ a && /* @__PURE__ */ n("span", { className: "buttons-label", children: a }),
15
+ /* @__PURE__ */ n("div", { className: "buttons-bar", children: s.map((t) => /* @__PURE__ */ n(
16
16
  "button",
17
17
  {
18
- disabled: i || s.disabled,
19
- onClick: (r) => d(r, s.key),
20
- className: `button ${s.key === c ? "active" : ""} status-${s.status}`,
21
- children: s.label
18
+ disabled: i || t.disabled,
19
+ onClick: (l) => p(l, t.key),
20
+ className: `button ${t.key === m ? "active" : ""} status-${t.status}`,
21
+ children: t.label
22
22
  },
23
- s.key
24
- )) })
23
+ t.key
24
+ )) }),
25
+ u && /* @__PURE__ */ n("span", { className: "helper-text", children: u })
25
26
  ] });
26
27
  }
27
28
  );
28
- h.displayName = "ButtonsArray";
29
+ y.displayName = "ButtonsArray";
29
30
  export {
30
- h as ButtonsArray
31
+ y as ButtonsArray
31
32
  };
package/dist/main.d.ts CHANGED
@@ -82,6 +82,8 @@ export declare interface ButtonsArrayProps {
82
82
  onChange?: (key: string | number) => void;
83
83
  activeKey?: string | number | null | undefined;
84
84
  isDisabled?: boolean;
85
+ errorMessage?: string;
86
+ hasError?: boolean;
85
87
  }
86
88
 
87
89
  declare interface ButtonTab {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triafly-ui-kit",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "description": "UI Kit from Triafly",
5
5
  "main": "./dist/main.js",
6
6
  "module": "./dist/main.js",