@divayth/brick-ui 0.5.0 → 0.5.1

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.
@@ -2,9 +2,13 @@ import { Accordion as Primitive } from 'radix-ui';
2
2
  import type { ComponentProps, ReactElement } from 'react';
3
3
  export interface AccordionProps extends Omit<Extract<ComponentProps<typeof Primitive.Root>, {
4
4
  type: 'single';
5
- }>, 'type' | 'title' | 'orientation'> {
5
+ }>, 'type' | 'title' | 'orientation' | 'defaultValue' | 'value' | 'onValueChange'> {
6
+ defaultOpen?: boolean;
7
+ open?: boolean;
8
+ onOpenChange?: (open: boolean) => void;
6
9
  title?: string | ReactElement;
10
+ headerActions?: ReactElement;
7
11
  summary?: string | ReactElement;
8
12
  }
9
- export declare const Accordion: ({ title, summary, children, className, ...props }: AccordionProps) => import("react").JSX.Element;
13
+ export declare const Accordion: ({ defaultOpen, open, onOpenChange, title, headerActions, summary, children, className, ...props }: AccordionProps) => import("react").JSX.Element;
10
14
  //# sourceMappingURL=Accordion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/ui/Accordion/Accordion.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAQ1D,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,OAAO,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EAClE,MAAM,GAAG,OAAO,GAAG,aAAa,CACjC;IACC,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;CACjC;AAED,eAAO,MAAM,SAAS,GAAI,mDAMvB,cAAc,gCA6BhB,CAAC"}
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/ui/Accordion/Accordion.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAU1D,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,OAAO,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EAClE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,cAAc,GAAG,OAAO,GAAG,eAAe,CAC9E;IACC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;CACjC;AAED,eAAO,MAAM,SAAS,GAAI,mGAUvB,cAAc,gCAqChB,CAAC"}
@@ -1,35 +1,48 @@
1
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { ChevronDown as d } from "lucide-react";
3
- import { Accordion as r } from "radix-ui";
1
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import { ChevronDown as N } from "lucide-react";
3
+ import { Accordion as o } from "radix-ui";
4
4
  import { Flex as t } from "../Flex/Flex.js";
5
- import { Text as l } from "../Text/Text.js";
6
- import { cn as p } from "../../lib/cn.js";
7
- import o from "./Accordion.module.css.js";
8
- const w = ({
9
- title: c,
10
- summary: i,
11
- children: s,
12
- className: a,
13
- ...m
14
- }) => /* @__PURE__ */ e(
15
- r.Root,
16
- {
17
- type: "single",
18
- collapsible: !0,
19
- className: p("w-full", a),
20
- ...m,
21
- children: /* @__PURE__ */ n(r.Item, { value: "content", children: [
22
- /* @__PURE__ */ e(r.Header, { className: "m-0", children: /* @__PURE__ */ n(t, { direction: "col", gap: "sm", children: [
23
- /* @__PURE__ */ n(r.Trigger, { className: o.trigger, children: [
24
- typeof c == "string" ? /* @__PURE__ */ e(l, { children: c }) : c,
25
- /* @__PURE__ */ e(d, { className: o.icon, size: 20, "aria-hidden": "true" })
5
+ import { Text as a } from "../Text/Text.js";
6
+ import { cn as x } from "../../lib/cn.js";
7
+ import i from "./Accordion.module.css.js";
8
+ const c = "content", y = ({
9
+ defaultOpen: d = !1,
10
+ open: s,
11
+ onOpenChange: m,
12
+ title: n,
13
+ headerActions: f,
14
+ summary: l,
15
+ children: h,
16
+ className: p,
17
+ ...g
18
+ }) => {
19
+ const u = s === void 0 ? void 0 : s ? c : "";
20
+ return /* @__PURE__ */ e(
21
+ o.Root,
22
+ {
23
+ type: "single",
24
+ collapsible: !0,
25
+ defaultValue: d ? c : void 0,
26
+ value: u,
27
+ onValueChange: (v) => m?.(v === c),
28
+ className: x("w-full", p),
29
+ ...g,
30
+ children: /* @__PURE__ */ r(o.Item, { value: c, children: [
31
+ /* @__PURE__ */ r(t, { direction: "col", gap: "sm", children: [
32
+ /* @__PURE__ */ r(t, { alignItems: "center", gap: "sm", children: [
33
+ /* @__PURE__ */ e(o.Header, { className: "m-0 flex-1", children: /* @__PURE__ */ r(o.Trigger, { className: i.trigger, children: [
34
+ typeof n == "string" ? /* @__PURE__ */ e(a, { children: n }) : n,
35
+ /* @__PURE__ */ e(N, { className: i.icon, size: 20, "aria-hidden": "true" })
36
+ ] }) }),
37
+ f
38
+ ] }),
39
+ typeof l == "string" ? /* @__PURE__ */ e(a, { className: "text-gray-1", children: l }) : l
26
40
  ] }),
27
- typeof i == "string" ? /* @__PURE__ */ e(l, { className: "text-gray-1", children: i }) : i
28
- ] }) }),
29
- /* @__PURE__ */ e(r.Content, { forceMount: !0, className: o.content, children: /* @__PURE__ */ e("div", { className: o.viewport, children: /* @__PURE__ */ e(t, { direction: "col", className: "min-h-0 overflow-hidden", children: s }) }) })
30
- ] })
31
- }
32
- );
41
+ /* @__PURE__ */ e(o.Content, { forceMount: !0, className: i.content, children: /* @__PURE__ */ e("div", { className: i.viewport, children: /* @__PURE__ */ e(t, { direction: "col", className: "min-h-0 overflow-hidden", children: h }) }) })
42
+ ] })
43
+ }
44
+ );
45
+ };
33
46
  export {
34
- w as Accordion
47
+ y as Accordion
35
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divayth/brick-ui",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "React components for Brick UI",
5
5
  "type": "module",
6
6
  "files": [