@konstructio/ui 0.1.2-alpha.73 → 0.1.2-alpha.74

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,4 +1,4 @@
1
- import { jsxs as l, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
2
  import { useRef as h, useState as C, useCallback as I, useEffect as b } from "react";
3
3
  import { V as g } from "../../index-BKjcReYh.js";
4
4
  import { cn as t } from "../../utils/index.js";
@@ -14,10 +14,10 @@ const R = {
14
14
  warning: A,
15
15
  danger: w
16
16
  }, X = ({
17
- theme: c,
17
+ theme: m,
18
18
  type: r,
19
- title: m,
20
- description: s,
19
+ title: l,
20
+ description: i,
21
21
  isVisible: a = !0,
22
22
  showCloseButton: d = !1
23
23
  }) => {
@@ -36,23 +36,23 @@ const R = {
36
36
  ), () => e.abort();
37
37
  }, []), !f)
38
38
  return null;
39
- const i = r ? R[r] : null;
40
- return /* @__PURE__ */ l(
39
+ const c = r ? R[r] : null;
40
+ return /* @__PURE__ */ s(
41
41
  "div",
42
42
  {
43
43
  ref: o,
44
44
  className: t(k({ type: r, isVisible: a })),
45
45
  "data-state": a ? "visible" : "hidden",
46
- "data-theme": c,
46
+ "data-theme": m,
47
47
  role: "alert",
48
48
  "aria-live": "polite",
49
49
  children: [
50
- i && /* @__PURE__ */ n(i, { className: t(N({ type: r })) }),
51
- /* @__PURE__ */ l("div", { className: "flex flex-col gap-1 flex-1", children: [
52
- /* @__PURE__ */ n("p", { className: t(V({ type: r })), children: m }),
53
- s && /* @__PURE__ */ n("div", { className: t(v({ type: r })), children: s })
50
+ c && /* @__PURE__ */ n(c, { className: t(N({ type: r })) }),
51
+ /* @__PURE__ */ s("div", { className: "flex flex-col gap-1 flex-1", children: [
52
+ l && /* @__PURE__ */ n("p", { className: t(V({ type: r })), children: l }),
53
+ i && /* @__PURE__ */ n("div", { className: t(v({ type: r })), children: i })
54
54
  ] }),
55
- d && /* @__PURE__ */ l("button", { type: "button", onClick: p, children: [
55
+ d && /* @__PURE__ */ s("button", { type: "button", onClick: p, children: [
56
56
  /* @__PURE__ */ n(P, { className: t(x({ type: r })) }),
57
57
  /* @__PURE__ */ n(g, { children: "Dismiss alert" })
58
58
  ] })
@@ -12,15 +12,30 @@ import { alertVariants } from './Alert.variants';
12
12
  * <Alert type="warning" title="Warning" description={<span>Action <strong>required</strong></span>} />
13
13
  * ```
14
14
  */
15
- export interface AlertProps extends VariantProps<typeof alertVariants> {
16
- /** Alert title (bold text) */
17
- title: string;
18
- /** Alert description */
19
- description?: string | ReactNode;
15
+ type AlertBaseProps = VariantProps<typeof alertVariants> & {
20
16
  /** Whether the alert is visible */
21
17
  isVisible?: boolean;
22
18
  /** Show close button to dismiss alert */
23
19
  showCloseButton?: boolean;
24
20
  /** Theme override for this component */
25
21
  theme?: Theme;
26
- }
22
+ };
23
+ /**
24
+ * Props for the Alert component.
25
+ * At least one of `title` or `description` must be provided.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <Alert type="success" title="Operation completed!" />
30
+ * <Alert type="danger" description="Something went wrong" />
31
+ * <Alert type="warning" title="Warning" description={<span>Action <strong>required</strong></span>} />
32
+ * ```
33
+ */
34
+ export type AlertProps = AlertBaseProps & ({
35
+ title: string | ReactNode;
36
+ description?: string | ReactNode;
37
+ } | {
38
+ title?: string | ReactNode;
39
+ description: string | ReactNode;
40
+ });
41
+ export {};
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.72",
5
+ "version": "0.1.2-alpha.73",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.73",
5
+ "version": "0.1.2-alpha.74",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",