@pie-lib/render-ui 8.0.1-next.20261003161149 → 8.0.1-next.20261004162038

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.
@@ -15,6 +15,7 @@ export declare class Collapsible extends React.Component {
15
15
  state: {
16
16
  expanded: boolean;
17
17
  };
18
+ panelId: string;
18
19
  toggleExpanded: any;
19
20
  componentDidMount(): void;
20
21
  componentDidUpdate(): void;
@@ -1,53 +1,68 @@
1
- import e from "react";
2
- import t from "prop-types";
3
- import { styled as n } from "@mui/material/styles";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import a from "@mui/material/Collapse";
6
- import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
1
+ import { tertiary as e } from "../color.js";
2
+ import { createUniqueId as t } from "../unique-id.js";
3
+ import n from "react";
4
+ import r from "prop-types";
5
+ import { styled as i } from "@mui/material/styles";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import s from "@mui/material/Collapse";
8
+ import { renderMath as c } from "@pie-element/shared-math-rendering-mathjax";
7
9
  //#region src/collapsible/index.tsx
8
- var s = n("span")(({ theme: e }) => ({
9
- color: e.palette.primary.light,
10
- borderBottom: `1px dotted ${e.palette.primary.light}`,
10
+ var l = i("button")({
11
+ display: "inline-block",
12
+ minHeight: "24px",
13
+ padding: 0,
14
+ border: 0,
15
+ background: "transparent",
16
+ font: "inherit",
17
+ textAlign: "inherit",
18
+ color: e(),
11
19
  cursor: "pointer"
12
- })), c = n(a)(({ theme: e }) => ({ paddingTop: e.spacing(2) })), l = class extends e.Component {
20
+ }), u = i("span")({ borderBottom: "1px dotted currentColor" }), d = i(s)(({ theme: e }) => ({ paddingTop: e.spacing(2) })), f = class extends n.Component {
13
21
  static propTypes = {
14
- className: t.string,
15
- children: t.object,
16
- labels: t.shape({
17
- visible: t.string,
18
- hidden: t.string
22
+ className: r.string,
23
+ children: r.object,
24
+ labels: r.shape({
25
+ visible: r.string,
26
+ hidden: r.string
19
27
  })
20
28
  };
21
29
  static defaultProps = { labels: {} };
22
30
  state = { expanded: !1 };
31
+ panelId = t("pie-collapsible");
23
32
  toggleExpanded = () => {
24
33
  this.setState((e) => ({ expanded: !e.expanded }));
25
34
  };
26
35
  componentDidMount() {
27
- o(this.root);
36
+ c(this.root);
28
37
  }
29
38
  componentDidUpdate() {
30
- o(this.root);
39
+ c(this.root);
31
40
  }
32
41
  render() {
33
- let { labels: e, children: t, className: n } = this.props, a = this.state.expanded ? e.visible || "Hide" : e.hidden || "Show";
34
- return /* @__PURE__ */ i("div", {
42
+ let { labels: e, children: t, className: n } = this.props, { expanded: r } = this.state, i = r ? e.visible || "Hide" : e.hidden || "Show";
43
+ return /* @__PURE__ */ o("div", {
35
44
  className: n,
36
45
  ref: (e) => this.root = e,
37
- children: [/* @__PURE__ */ r("div", {
46
+ children: [/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(l, {
47
+ type: "button",
48
+ "aria-expanded": r,
49
+ "aria-controls": this.panelId,
38
50
  onClick: this.toggleExpanded,
39
- children: /* @__PURE__ */ r(s, { children: a })
40
- }), /* @__PURE__ */ r(c, {
41
- in: this.state.expanded,
42
- timeout: {
43
- enter: 225,
44
- exit: 195
45
- },
46
- unmountOnExit: !0,
47
- children: t
51
+ children: /* @__PURE__ */ a(u, { children: i })
52
+ }) }), /* @__PURE__ */ a("div", {
53
+ id: this.panelId,
54
+ children: /* @__PURE__ */ a(d, {
55
+ in: r,
56
+ timeout: {
57
+ enter: 225,
58
+ exit: 195
59
+ },
60
+ unmountOnExit: !0,
61
+ children: t
62
+ })
48
63
  })]
49
64
  });
50
65
  }
51
66
  };
52
67
  //#endregion
53
- export { l as Collapsible, l as default };
68
+ export { f as Collapsible, f as default };
package/dist/index.d.ts CHANGED
@@ -16,3 +16,4 @@ import EnableAudioAutoplayImage from './assets/enableAudioAutoplayImage.js';
16
16
  import { transformDataHeadings } from './transform-headings.js';
17
17
  export { HtmlAndMath, indicators, withUndoReset, Feedback, UiLayout, PreviewLayout, Collapsible, InputContainer, PreviewPrompt, color, Readable, Purpose, hasText, hasMedia, EnableAudioAutoplayImage, transformDataHeadings, };
18
18
  export { InlineMenu } from './inline-menu.js';
19
+ export { createUniqueId, useUniqueId } from './unique-id.js';
package/dist/index.js CHANGED
@@ -1,18 +1,19 @@
1
1
  import { color_exports as e } from "./color.js";
2
2
  import { Feedback as t } from "./feedback.js";
3
3
  import { response_indicators_exports as n } from "./response-indicators.js";
4
- import { Collapsible as r } from "./collapsible/index.js";
5
- import i from "./withUndoReset.js";
6
- import a from "./ui-layout.js";
7
- import o from "./preview-layout.js";
8
- import s from "./html-and-math.js";
9
- import c from "./input-container.js";
10
- import { PreviewPrompt as l } from "./preview-prompt.js";
11
- import u from "./readable.js";
12
- import d from "./purpose.js";
13
- import { hasText as f } from "./has-text.js";
14
- import { hasMedia as p } from "./has-media.js";
15
- import m from "./assets/enableAudioAutoplayImage.js";
16
- import { transformDataHeadings as h } from "./transform-headings.js";
17
- import { InlineMenu as g } from "./inline-menu.js";
18
- export { r as Collapsible, m as EnableAudioAutoplayImage, t as Feedback, s as HtmlAndMath, g as InlineMenu, c as InputContainer, o as PreviewLayout, l as PreviewPrompt, d as Purpose, u as Readable, a as UiLayout, e as color, p as hasMedia, f as hasText, n as indicators, h as transformDataHeadings, i as withUndoReset };
4
+ import { createUniqueId as r, useUniqueId as i } from "./unique-id.js";
5
+ import { Collapsible as a } from "./collapsible/index.js";
6
+ import o from "./withUndoReset.js";
7
+ import s from "./ui-layout.js";
8
+ import c from "./preview-layout.js";
9
+ import l from "./html-and-math.js";
10
+ import u from "./input-container.js";
11
+ import { PreviewPrompt as d } from "./preview-prompt.js";
12
+ import f from "./readable.js";
13
+ import p from "./purpose.js";
14
+ import { hasText as m } from "./has-text.js";
15
+ import { hasMedia as h } from "./has-media.js";
16
+ import g from "./assets/enableAudioAutoplayImage.js";
17
+ import { transformDataHeadings as _ } from "./transform-headings.js";
18
+ import { InlineMenu as v } from "./inline-menu.js";
19
+ export { a as Collapsible, g as EnableAudioAutoplayImage, t as Feedback, l as HtmlAndMath, v as InlineMenu, u as InputContainer, c as PreviewLayout, d as PreviewPrompt, p as Purpose, f as Readable, s as UiLayout, e as color, r as createUniqueId, h as hasMedia, m as hasText, n as indicators, _ as transformDataHeadings, i as useUniqueId, o as withUndoReset };
@@ -0,0 +1,2 @@
1
+ export declare const createUniqueId: (prefix: string) => string;
2
+ export declare const useUniqueId: (prefix: string) => string;
@@ -0,0 +1,5 @@
1
+ import e from "react";
2
+ //#region src/unique-id.ts
3
+ var t = (e) => `${e}-${Math.random().toString(36).slice(2, 10)}`, n = (n) => e.useState(() => t(n))[0];
4
+ //#endregion
5
+ export { t as createUniqueId, n as useUniqueId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/render-ui",
3
- "version": "8.0.1-next.20261003161149",
3
+ "version": "8.0.1-next.20261004162038",
4
4
  "description": "Some shared ui elements when rendering - but not worthy of their own package yet.",
5
5
  "repository": {
6
6
  "type": "git",