@jfrader/ui 0.7.0 → 0.7.3

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.
Files changed (52) hide show
  1. package/README.md +14 -28
  2. package/dist/avatar-BuM1zB_f.js +164 -0
  3. package/dist/{avatar-group-BlMLNw4J.js → avatar-group-D1UEihvh.js} +1 -1
  4. package/dist/avatar-group.js +1 -1
  5. package/dist/avatar.js +1 -1
  6. package/dist/card-frame-CcLa6NQ4.js +13 -0
  7. package/dist/{chat-thread-DkB-WMWJ.js → chat-thread-CMhwxhoA.js} +1 -1
  8. package/dist/chat-thread.js +1 -1
  9. package/dist/{comment-thread-DXfqgRNI.js → comment-thread-DbOzYr0q.js} +1 -1
  10. package/dist/comment-thread.js +1 -1
  11. package/dist/editable-details-BndqEnYF.js +365 -0
  12. package/dist/editable-details.js +2 -0
  13. package/dist/flip-game-card-BOJIhBrh.js +104 -0
  14. package/dist/flip-game-card.js +2 -0
  15. package/dist/{game-card-Oeu74giK.js → game-card-Bnhpz78f.js} +42 -49
  16. package/dist/game-card.js +1 -1
  17. package/dist/{hover-card-Dgu2CwMD.js → hover-card--ijYr1cd.js} +1 -1
  18. package/dist/hover-card.js +1 -1
  19. package/dist/index.js +90 -90
  20. package/dist/{locale-switcher-DTkySKsM.js → locale-switcher-Ce_tN4Gb.js} +2 -2
  21. package/dist/locale-switcher.js +1 -1
  22. package/dist/{thread-parts-Cpktor6D.js → thread-parts-DbKhuwVU.js} +1 -1
  23. package/dist/{timeline-BcF46lG9.js → timeline-BPKY94mT.js} +1 -1
  24. package/dist/timeline.js +1 -1
  25. package/dist/{billing-toggle-CgC7yxxo.js → toggle-subscription-Ytz7ew1q.js} +19 -19
  26. package/dist/toggle-subscription.js +2 -0
  27. package/dist/types/components/avatar/avatar.d.ts +3 -1
  28. package/dist/types/components/editable-details/editable-details.d.ts +58 -0
  29. package/dist/types/components/editable-details/index.d.ts +2 -0
  30. package/dist/types/components/flip-game-card/flip-game-card.d.ts +22 -0
  31. package/dist/types/components/flip-game-card/index.d.ts +2 -0
  32. package/dist/types/components/locale-switcher/locale-switcher.d.ts +2 -2
  33. package/dist/types/components/toggle-subscription/index.d.ts +2 -0
  34. package/dist/types/components/toggle-subscription/toggle-subscription.d.ts +57 -0
  35. package/dist/types/index.d.ts +3 -3
  36. package/dist/types/styling/motion-timings.d.ts +8 -0
  37. package/dist/types/styling/theme.d.ts +5 -0
  38. package/dist/{user-menu-MctRu_Lh.js → user-menu-Czrrk93A.js} +1 -1
  39. package/dist/user-menu.js +1 -1
  40. package/package.json +14 -14
  41. package/dist/avatar-sPxDqFiZ.js +0 -133
  42. package/dist/billing-toggle.js +0 -2
  43. package/dist/in-view-title-BUZCMqge.js +0 -225
  44. package/dist/in-view-title.js +0 -2
  45. package/dist/shortcut-recorder-VgTQdjjn.js +0 -688
  46. package/dist/shortcut-recorder.js +0 -2
  47. package/dist/types/components/billing-toggle/billing-toggle.d.ts +0 -57
  48. package/dist/types/components/billing-toggle/index.d.ts +0 -2
  49. package/dist/types/components/in-view-title/in-view-title.d.ts +0 -23
  50. package/dist/types/components/in-view-title/index.d.ts +0 -1
  51. package/dist/types/components/shortcut-recorder/index.d.ts +0 -2
  52. package/dist/types/components/shortcut-recorder/shortcut-recorder.d.ts +0 -117
package/README.md CHANGED
@@ -2,7 +2,15 @@
2
2
 
3
3
  React components styled with Emotion and themed through the CSS custom properties from `@jfrader/tokens`.
4
4
 
5
- ## Components
5
+ ## Start here
6
+
7
+ - [Getting started](https://github.com/jfrader/jfrader-ui/blob/master/docs/consuming-jfrader-ui.md): installation and complete React / Vite and Next.js examples.
8
+ - [Theming](https://github.com/jfrader/jfrader-ui/blob/master/docs/theming.md): light/dark palettes, brand accents and token overrides.
9
+ - [Styling](https://github.com/jfrader/jfrader-ui/blob/master/docs/styling.md): customize instances, public parts and reusable wrappers.
10
+
11
+ Requires React 19 and the `@jfrader/tokens/tokens.css` stylesheet. The same guides appear under **Foundations** in Storybook.
12
+
13
+ ## Component subpath examples
6
14
 
7
15
  | Subpath | Exports |
8
16
  | --- | --- |
@@ -22,8 +30,10 @@ React components styled with Emotion and themed through the CSS custom propertie
22
30
  | `@jfrader/ui/date-picker` | `DatePicker` |
23
31
  | `@jfrader/ui/dialog` | `Dialog` |
24
32
  | `@jfrader/ui/divider` | `Divider` |
33
+ | `@jfrader/ui/editable-details` | `EditableDetails` |
25
34
  | `@jfrader/ui/emblem` | `Emblem` |
26
35
  | `@jfrader/ui/flex` | `Flex` |
36
+ | `@jfrader/ui/flip-game-card` | `FlipGameCard` |
27
37
  | `@jfrader/ui/game-card` | `GameCard` |
28
38
  | `@jfrader/ui/kbd` | `Kbd` |
29
39
  | `@jfrader/ui/menu` | `Menu` |
@@ -46,7 +56,7 @@ React components styled with Emotion and themed through the CSS custom propertie
46
56
  | `@jfrader/ui/toggle-group` | `ToggleGroup` |
47
57
  | `@jfrader/ui/tooltip` | `Tooltip` |
48
58
 
49
- Each subpath also exports its prop types. The package root re-exports everything.
59
+ Each component subpath also exports its prop types. The package root re-exports component APIs; optional integrations such as `@jfrader/ui/next` and `@jfrader/ui/code-block/shiki` remain separate imports.
50
60
 
51
61
  ## Usage
52
62
 
@@ -66,35 +76,11 @@ import { ThemeRoot } from '@jfrader/ui/theme-root';
66
76
 
67
77
  ## Next.js App Router
68
78
 
69
- `@jfrader/ui/next` exports `EmotionRegistry`, the required Emotion registry. It needs the optional `next` and `@emotion/cache` peers:
70
-
71
- ```sh
72
- pnpm add @emotion/cache
73
- ```
74
-
75
- ```tsx
76
- // app/layout.tsx
77
- import { EmotionRegistry } from '@jfrader/ui/next';
78
-
79
- <body>
80
- <EmotionRegistry>{children}</EmotionRegistry>
81
- </body>;
82
- ```
83
-
84
- See [Next.js App Router](https://github.com/jfrader/jfrader-ui/blob/master/docs/consuming-jfrader-ui.md#nextjs-app-router) for Server Component boundaries.
79
+ Use the `EmotionRegistry` adapter from `@jfrader/ui/next`. See the complete [App Router layout](https://github.com/jfrader/jfrader-ui/blob/master/docs/consuming-jfrader-ui.md#nextjs-app-router), including dependencies and Server Component boundaries.
85
80
 
86
81
  ## Theming
87
82
 
88
- Components read CSS custom properties defined by `@jfrader/tokens`. Load the stylesheet once and wrap the app in `ThemeRoot`:
89
-
90
- ```tsx
91
- import '@jfrader/tokens/tokens.css';
92
- import { ThemeRoot } from '@jfrader/ui/theme-root';
93
-
94
- <ThemeRoot theme="light">{app}</ThemeRoot>;
95
- ```
96
-
97
- Token names and values live in `packages/tokens/src/tokens.ts`.
83
+ Set `data-theme` on `<html>` for the page, or use `ThemeRoot` for a subtree. `ThemeProvider` supplies styling callbacks with token references; it does not choose light or dark. See [Theming](https://github.com/jfrader/jfrader-ui/blob/master/docs/theming.md) for complete recipes and portal behavior.
98
84
 
99
85
  ## Build
100
86
 
@@ -0,0 +1,164 @@
1
+ 'use client';
2
+ import { a as e, i as t } from "./css-BYJhdGh-.js";
3
+ import { n, r } from "./media-8yrN85VT.js";
4
+ import { t as i } from "./sx-BJXJ2xJK.js";
5
+ import { t as a } from "./initials-DEdwNe9_.js";
6
+ import { useState as o } from "react";
7
+ import { vars as s } from "@jfrader/tokens/vars";
8
+ import { jsx as c, jsxs as l } from "@emotion/react/jsx-runtime";
9
+ //#region src/components/avatar/avatar.tsx
10
+ var u = 2, d = t({
11
+ position: "relative",
12
+ display: "inline-flex",
13
+ alignItems: "center",
14
+ justifyContent: "center",
15
+ flexShrink: 0,
16
+ boxSizing: "border-box",
17
+ borderRadius: s.radius.full,
18
+ backgroundColor: s.color.surfaceHover,
19
+ color: s.color.text,
20
+ fontWeight: s.fontWeight.medium,
21
+ lineHeight: 1,
22
+ userSelect: "none",
23
+ verticalAlign: "middle",
24
+ [n]: { outline: "1px solid CanvasText" }
25
+ }), f = {
26
+ sm: t({
27
+ inlineSize: s.space[6],
28
+ blockSize: s.space[6],
29
+ fontSize: s.textSize.xs
30
+ }),
31
+ md: t({
32
+ inlineSize: s.space[8],
33
+ blockSize: s.space[8],
34
+ fontSize: s.textSize.sm
35
+ }),
36
+ lg: t({
37
+ inlineSize: s.space[10],
38
+ blockSize: s.space[10],
39
+ fontSize: s.textSize.md
40
+ })
41
+ }, p = t({
42
+ display: "block",
43
+ inlineSize: "100%",
44
+ blockSize: "100%",
45
+ borderRadius: s.radius.full,
46
+ objectFit: "cover"
47
+ }), m = t({
48
+ position: "absolute",
49
+ insetBlockEnd: 0,
50
+ insetInlineEnd: 0,
51
+ inlineSize: "25%",
52
+ blockSize: "25%",
53
+ pointerEvents: "none",
54
+ "&::before": {
55
+ content: "\"\"",
56
+ position: "absolute",
57
+ insetBlockStart: 0,
58
+ insetInlineStart: 0,
59
+ inlineSize: "100%",
60
+ blockSize: "100%",
61
+ boxSizing: "border-box",
62
+ borderRadius: s.radius.full,
63
+ boxShadow: `0 0 0 2px ${s.color.bg}`
64
+ }
65
+ }), h = {
66
+ online: t({ "&::before": { backgroundColor: s.color.success } }),
67
+ away: t({ "&::before": {
68
+ border: `2px solid ${s.color.warning}`,
69
+ backgroundColor: "transparent"
70
+ } }),
71
+ busy: t({ "&::before": {
72
+ backgroundColor: s.color.danger,
73
+ blockSize: "30%",
74
+ insetBlockStart: "35%"
75
+ } }),
76
+ offline: t({ "&::before": {
77
+ backgroundColor: s.color.textSubtle,
78
+ inlineSize: "60%",
79
+ blockSize: "60%",
80
+ insetBlockStart: "20%",
81
+ insetInlineStart: "20%"
82
+ } })
83
+ }, g = t({ [n]: {
84
+ "&::before": {
85
+ forcedColorAdjust: "none",
86
+ backgroundColor: "CanvasText",
87
+ outline: "2px solid Canvas"
88
+ },
89
+ "&[data-status=\"away\"]::before": {
90
+ borderColor: "CanvasText",
91
+ backgroundColor: "Canvas"
92
+ }
93
+ } }), _ = e({
94
+ from: {
95
+ transform: "scale(.8)",
96
+ opacity: 1
97
+ },
98
+ to: {
99
+ transform: "scale(2.4)",
100
+ opacity: 0
101
+ }
102
+ }), v = { "&[data-status=\"online\"][data-pulse]::after": {
103
+ content: "none",
104
+ display: "none",
105
+ animation: "none"
106
+ } }, y = t({
107
+ "&[data-status=\"online\"][data-pulse]::after": {
108
+ content: "\"\"",
109
+ position: "absolute",
110
+ insetBlockStart: 0,
111
+ insetInlineStart: 0,
112
+ inlineSize: "100%",
113
+ blockSize: "100%",
114
+ borderRadius: s.radius.full,
115
+ color: s.color.success,
116
+ border: "1px solid currentColor",
117
+ animation: `${_} ${s.motion.duration.presence} infinite ${s.motion.easePresence}`
118
+ },
119
+ [r]: v,
120
+ [n]: v
121
+ });
122
+ function b({ ref: e, name: t, src: n, size: r = "md", status: s, pulse: _ = !1, statusLabel: v, slotProps: b, className: x, sx: S, ...C }) {
123
+ let [w, T] = o(), E = n !== void 0 && n !== "" && n !== w, D = s === void 0 ? t : `${t}, ${v ?? s}`;
124
+ return /* @__PURE__ */ c(i, {
125
+ className: x,
126
+ styles: [d, f[r]],
127
+ sx: S,
128
+ children: (r) => /* @__PURE__ */ l("span", {
129
+ ...C,
130
+ ref: e,
131
+ "data-ui": "avatar",
132
+ role: "img",
133
+ "aria-label": D,
134
+ className: r,
135
+ children: [E ? /* @__PURE__ */ c("img", {
136
+ src: n,
137
+ alt: "",
138
+ onError: () => T(n),
139
+ className: b?.image?.className,
140
+ css: [p, b?.image?.css]
141
+ }) : /* @__PURE__ */ c("span", {
142
+ "aria-hidden": "true",
143
+ className: b?.fallback?.className,
144
+ css: b?.fallback?.css,
145
+ children: a(t, u)
146
+ }), s !== void 0 && /* @__PURE__ */ c("span", {
147
+ "aria-hidden": "true",
148
+ "data-status": s,
149
+ "data-pulse": _ && s === "online" ? "" : void 0,
150
+ className: b?.status?.className,
151
+ css: [
152
+ m,
153
+ h[s],
154
+ g,
155
+ y,
156
+ b?.status?.css
157
+ ]
158
+ })]
159
+ })
160
+ });
161
+ }
162
+ b.displayName = "Avatar";
163
+ //#endregion
164
+ export { b as t };
@@ -3,7 +3,7 @@ import { i as e } from "./css-BYJhdGh-.js";
3
3
  import { n as t } from "./media-8yrN85VT.js";
4
4
  import { t as n } from "./sx-BJXJ2xJK.js";
5
5
  import { t as r } from "./visually-hidden-DgVO3NaB.js";
6
- import { t as i } from "./avatar-sPxDqFiZ.js";
6
+ import { t as i } from "./avatar-BuM1zB_f.js";
7
7
  import { useId as a } from "react";
8
8
  import { vars as o } from "@jfrader/tokens/vars";
9
9
  import { jsx as s, jsxs as c } from "@emotion/react/jsx-runtime";
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as AvatarGroup } from "./avatar-group-BlMLNw4J.js";
2
+ export { t as AvatarGroup } from "./avatar-group-D1UEihvh.js";
package/dist/avatar.js CHANGED
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as Avatar } from "./avatar-sPxDqFiZ.js";
2
+ export { t as Avatar } from "./avatar-BuM1zB_f.js";
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ //#region src/components/game-card/card-frame.ts
3
+ var e = {
4
+ ratio: 1.48,
5
+ cornerDivisor: 13
6
+ }, t = {
7
+ markWidthRatio: .35,
8
+ watermarkInsetPercent: 3,
9
+ watermarkOpacity: .15,
10
+ contentPaddingPercent: 4
11
+ };
12
+ //#endregion
13
+ export { e as n, t };
@@ -8,7 +8,7 @@ import { t as s } from "./visually-hidden-DgVO3NaB.js";
8
8
  import { t as c } from "./button-C6OV0C7J.js";
9
9
  import { t as ee } from "./part-id-D0zksy32.js";
10
10
  import { t as te } from "./card-C008OQCp.js";
11
- import { c as l, d as ne, g as re, h as u, i as ie, m as ae, n as d, p as oe, r as se, t as f } from "./thread-parts-Cpktor6D.js";
11
+ import { c as l, d as ne, g as re, h as u, i as ie, m as ae, n as d, p as oe, r as se, t as f } from "./thread-parts-DbKhuwVU.js";
12
12
  import { useEffect as ce, useId as le, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
13
13
  import { vars as _ } from "@jfrader/tokens/vars";
14
14
  import { Fragment as v, jsx as y, jsxs as b } from "@emotion/react/jsx-runtime";
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as ChatThread } from "./chat-thread-DkB-WMWJ.js";
2
+ export { t as ChatThread } from "./chat-thread-CMhwxhoA.js";
@@ -8,7 +8,7 @@ import { t as ee } from "./renderable-DzcIj1Lo.js";
8
8
  import { t as s } from "./button-C6OV0C7J.js";
9
9
  import { t as c } from "./part-id-D0zksy32.js";
10
10
  import { t as l } from "./card-C008OQCp.js";
11
- import { a as u, c as d, d as f, f as te, g as p, h as m, i as ne, l as re, n as ie, o as ae, p as oe, r as se, s as ce, t as le, u as ue } from "./thread-parts-Cpktor6D.js";
11
+ import { a as u, c as d, d as f, f as te, g as p, h as m, i as ne, l as re, n as ie, o as ae, p as oe, r as se, s as ce, t as le, u as ue } from "./thread-parts-DbKhuwVU.js";
12
12
  import { useEffect as de, useId as fe, useLayoutEffect as h, useMemo as g, useRef as _, useState as v } from "react";
13
13
  import { vars as y } from "@jfrader/tokens/vars";
14
14
  import { Fragment as pe, jsx as b, jsxs as x } from "@emotion/react/jsx-runtime";
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- export { t as CommentThread } from "./comment-thread-DXfqgRNI.js";
2
+ export { t as CommentThread } from "./comment-thread-DbOzYr0q.js";
@@ -0,0 +1,365 @@
1
+ 'use client';
2
+ import { i as e } from "./css-BYJhdGh-.js";
3
+ import { t } from "./disclosure-caret-C5T3fcl6.js";
4
+ import { n, t as r } from "./focus-ring-BK5W5_NY.js";
5
+ import { n as i, r as a } from "./media-8yrN85VT.js";
6
+ import { t as o } from "./sx-BJXJ2xJK.js";
7
+ import { t as s } from "./use-controlled-state-DpeVQZNR.js";
8
+ import { createContext as c, useCallback as l, useContext as u, useId as d, useLayoutEffect as f, useMemo as p, useRef as m } from "react";
9
+ import { vars as h } from "@jfrader/tokens/vars";
10
+ import { jsx as g, jsxs as _ } from "@emotion/react/jsx-runtime";
11
+ import { useMergeRefs as v } from "@floating-ui/react";
12
+ //#region src/components/editable-details/editable-details.tsx
13
+ var y = { edit: "Edit" }, b = {
14
+ 1: "h1",
15
+ 2: "h2",
16
+ 3: "h3",
17
+ 4: "h4",
18
+ 5: "h5",
19
+ 6: "h6"
20
+ }, x = c(y), S = c({
21
+ visible: !0,
22
+ triggers: []
23
+ }), C = e({
24
+ label: "editable-details",
25
+ display: "grid",
26
+ gap: h.space[6],
27
+ minInlineSize: 0,
28
+ maxInlineSize: "100%",
29
+ fontFamily: h.font.sans,
30
+ color: h.color.text,
31
+ lineHeight: h.lineHeight.base,
32
+ textAlign: "start",
33
+ overflowWrap: "anywhere"
34
+ }), w = e({ minInlineSize: 0 }), T = e({
35
+ margin: 0,
36
+ font: "inherit"
37
+ }), E = e({
38
+ display: "flex",
39
+ alignItems: "center",
40
+ justifyContent: "space-between",
41
+ gap: h.space[3],
42
+ inlineSize: "100%",
43
+ minInlineSize: 0,
44
+ minBlockSize: h.space[10],
45
+ paddingBlock: h.space[2],
46
+ paddingInlineStart: 0,
47
+ paddingInlineEnd: h.space[2],
48
+ border: 0,
49
+ background: "transparent",
50
+ color: "inherit",
51
+ font: "inherit",
52
+ fontWeight: h.fontWeight.semibold,
53
+ textAlign: "start",
54
+ overflowWrap: "anywhere",
55
+ cursor: "pointer",
56
+ "&::after": t,
57
+ "&[aria-expanded=\"true\"]::after": { transform: "rotate(90deg)" },
58
+ "&[aria-expanded=\"true\"]:dir(rtl)::after": { transform: "rotate(-90deg)" },
59
+ "&:hover": { backgroundColor: h.color.surfaceHover },
60
+ "&:focus-visible": r,
61
+ [a]: { "&::after": { transitionDuration: "0s" } },
62
+ [i]: { "&::after": {
63
+ forcedColorAdjust: "none",
64
+ borderInlineStartColor: "ButtonText"
65
+ } }
66
+ }), D = e({
67
+ display: "grid",
68
+ gap: h.space[4],
69
+ minInlineSize: 0,
70
+ paddingBlockStart: h.space[2],
71
+ "&[hidden]": { display: "none" }
72
+ }), O = e({
73
+ margin: 0,
74
+ minInlineSize: 0
75
+ }), k = e({
76
+ display: "flex",
77
+ flexWrap: "wrap",
78
+ gap: h.space[2],
79
+ minInlineSize: 0,
80
+ paddingBlock: h.space[3],
81
+ "&:where(:not(:last-child))": { borderBlockEnd: `1px solid ${h.color.border}` }
82
+ }), A = e({
83
+ flex: "1 1 10rem",
84
+ minInlineSize: 0,
85
+ color: h.color.textMuted,
86
+ fontWeight: h.fontWeight.regular
87
+ }), j = e({
88
+ flex: "2 1 16rem",
89
+ minInlineSize: 0,
90
+ margin: 0
91
+ }), M = e({
92
+ display: "flex",
93
+ flexWrap: "wrap",
94
+ alignItems: "start",
95
+ gap: h.space[2],
96
+ minInlineSize: 0
97
+ }), N = e({
98
+ flex: "1 1 8rem",
99
+ minInlineSize: 0
100
+ }), P = e({
101
+ minBlockSize: h.space[8],
102
+ paddingInline: h.space[2],
103
+ paddingBlock: h.space[1],
104
+ border: `1px solid ${h.color.borderControl}`,
105
+ borderRadius: h.radius.sm,
106
+ background: "transparent",
107
+ color: h.color.text,
108
+ font: "inherit",
109
+ cursor: "pointer",
110
+ "&:hover": { backgroundColor: h.color.surfaceHover },
111
+ "&:focus-visible": n,
112
+ [i]: {
113
+ borderColor: "ButtonText",
114
+ color: "ButtonText"
115
+ }
116
+ }), F = e({
117
+ minInlineSize: 0,
118
+ maxInlineSize: "100%",
119
+ "&:focus": r
120
+ });
121
+ function I(e) {
122
+ return e !== null && e.isConnected && e.getClientRects().length > 0 && !e.closest("[hidden], [inert]") && e.ownerDocument.defaultView?.getComputedStyle(e).visibility !== "hidden";
123
+ }
124
+ function L(e) {
125
+ for (let t of e) if (I(t.current)) {
126
+ t.current.focus();
127
+ return;
128
+ }
129
+ }
130
+ function R(e, t = !1) {
131
+ let n = m(null), r = m(!1);
132
+ return f(() => {
133
+ let i = e.current;
134
+ if (!i) return;
135
+ let a = i.ownerDocument;
136
+ n.current = a.activeElement;
137
+ let o = () => {
138
+ n.current = a.activeElement, (t || !i.contains(a.activeElement)) && (r.current = !1);
139
+ }, s = (e) => {
140
+ !e.defaultPrevented && (t || !e.composedPath().includes(i)) && (r.current = !1), !e.defaultPrevented && !e.composedPath().includes(i) && (n.current = null);
141
+ };
142
+ return a.addEventListener("focusin", o), a.addEventListener("mousedown", s), () => {
143
+ a.removeEventListener("focusin", o), a.removeEventListener("mousedown", s);
144
+ };
145
+ }, [e, t]), {
146
+ last: n,
147
+ intent: r
148
+ };
149
+ }
150
+ function z(e, t) {
151
+ let n = e.ownerDocument.activeElement;
152
+ return e.contains(n) || n === e.ownerDocument.body && t !== null && e.contains(t);
153
+ }
154
+ function B({ messages: e, className: t, sx: n, ...r }) {
155
+ let i = u(x), a = p(() => ({
156
+ ...i,
157
+ ...e
158
+ }), [i, e]);
159
+ return /* @__PURE__ */ g(x.Provider, {
160
+ value: a,
161
+ children: /* @__PURE__ */ g(o, {
162
+ className: t,
163
+ styles: C,
164
+ sx: n,
165
+ children: (e) => /* @__PURE__ */ g("div", {
166
+ ...r,
167
+ className: e,
168
+ "data-ui": "editable-details"
169
+ })
170
+ })
171
+ });
172
+ }
173
+ B.displayName = "EditableDetails";
174
+ function V({ ref: e, title: t, headingLevel: n = 3, open: r, defaultOpen: i = !1, onOpenChange: a, triggerRef: c, slotProps: l, children: h, className: y, sx: x, ...C }) {
175
+ let [O, k] = s(r, i, a), A = u(S), j = m(null), M = v([j, c]), N = m(null), P = R(N), F = d(), I = b[n], B = A.visible && !!O, V = p(() => [j, ...A.triggers], [A.triggers]), H = p(() => ({
176
+ visible: B,
177
+ triggers: V
178
+ }), [B, V]);
179
+ return f(() => {
180
+ let e = N.current;
181
+ !B && e && z(e, P.last.current) && L(H.triggers);
182
+ }, [
183
+ B,
184
+ H,
185
+ P.last
186
+ ]), /* @__PURE__ */ g(o, {
187
+ className: y,
188
+ styles: w,
189
+ sx: x,
190
+ children: (n) => /* @__PURE__ */ _("section", {
191
+ ...C,
192
+ ref: e,
193
+ className: n,
194
+ "data-ui": "editable-details-section",
195
+ "data-state": O ? "open" : "closed",
196
+ children: [/* @__PURE__ */ g(I, {
197
+ css: [T, l?.heading?.css],
198
+ className: l?.heading?.className,
199
+ children: /* @__PURE__ */ g("button", {
200
+ ref: M,
201
+ type: "button",
202
+ id: `${F}-trigger`,
203
+ "aria-expanded": !!O,
204
+ "aria-controls": `${F}-panel`,
205
+ onClick: () => k(!O),
206
+ css: [E, l?.trigger?.css],
207
+ className: l?.trigger?.className,
208
+ "data-ui": "editable-details-section-trigger",
209
+ children: t
210
+ })
211
+ }), /* @__PURE__ */ g(S.Provider, {
212
+ value: H,
213
+ children: /* @__PURE__ */ g("div", {
214
+ ref: N,
215
+ id: `${F}-panel`,
216
+ hidden: !O,
217
+ css: [D, l?.panel?.css],
218
+ className: l?.panel?.className,
219
+ "data-ui": "editable-details-section-panel",
220
+ children: h
221
+ })
222
+ })]
223
+ })
224
+ });
225
+ }
226
+ V.displayName = "EditableDetails.Section";
227
+ function H({ className: e, sx: t, ...n }) {
228
+ return /* @__PURE__ */ g(o, {
229
+ className: e,
230
+ styles: O,
231
+ sx: t,
232
+ children: (e) => /* @__PURE__ */ g("dl", {
233
+ ...n,
234
+ className: e,
235
+ "data-ui": "editable-details-list"
236
+ })
237
+ });
238
+ }
239
+ H.displayName = "EditableDetails.List";
240
+ function U({ renderEditor: e, labelId: t, hostId: n, part: r, edit: i, requestClose: a, focusIntent: o, acceptedClose: s }) {
241
+ let c = u(S), d = m(null), p = m(null), h = R(d), _ = m(!1), v = m(!1), y = h.intent, b = l((e) => (p.current = e, () => {
242
+ p.current === e && (p.current = null);
243
+ }), []), x = l(() => {
244
+ if (!_.current) return;
245
+ v.current = !0;
246
+ let e = d.current;
247
+ y.current = !!e && z(e, h.last.current), a();
248
+ }, [
249
+ a,
250
+ h.last,
251
+ y
252
+ ]);
253
+ return f(() => {
254
+ _.current = !0;
255
+ let e = d.current;
256
+ return () => {
257
+ if (_.current = !1, !e) return;
258
+ let t = z(e, h.last.current);
259
+ queueMicrotask(() => {
260
+ !e.isConnected && t && e.ownerDocument.activeElement === e.ownerDocument.body && (s.current && v.current && !y.current || (y.current && I(i.current) ? i.current.focus() : L(c.triggers)));
261
+ });
262
+ };
263
+ }, [
264
+ s,
265
+ i,
266
+ h.last,
267
+ y,
268
+ c.triggers
269
+ ]), f(() => {
270
+ if (!o.current) return;
271
+ o.current = !1;
272
+ let e = d.current;
273
+ e && c.visible && (I(p.current) && (p.current.focus(), e.ownerDocument.activeElement === p.current) || e.focus());
274
+ }, [o, c.visible]), /* @__PURE__ */ g("div", {
275
+ ref: d,
276
+ id: n,
277
+ role: "group",
278
+ "aria-labelledby": t,
279
+ tabIndex: -1,
280
+ className: r?.className,
281
+ css: [F, r?.css],
282
+ "data-ui": "editable-details-editor",
283
+ children: e({
284
+ initialFocusRef: b,
285
+ complete: x,
286
+ cancel: x,
287
+ visible: c.visible
288
+ })
289
+ });
290
+ }
291
+ function W({ ref: e, label: t, renderEditor: n, open: r, defaultOpen: i = !1, onOpenChange: a, children: c, slotProps: p, className: h, sx: y, ...b }) {
292
+ let [C, w, T] = s(r, n ? i : !1, a), E = u(S), D = u(x), O = m(null), F = m(null), I = R(O, !0), B = m(!!n), V = m(!1);
293
+ V.current = !C && !!n;
294
+ let H = d();
295
+ f(() => {
296
+ B.current && !n && (I.intent.current = !1, T()), B.current = !!n;
297
+ }, [
298
+ n,
299
+ T,
300
+ I.intent
301
+ ]);
302
+ let W = l((e) => (O.current = e, () => {
303
+ e && z(e, I.last.current) && queueMicrotask(() => {
304
+ !e.isConnected && e.ownerDocument.activeElement === e.ownerDocument.body && L(E.triggers);
305
+ }), O.current = null;
306
+ }), [I.last, E.triggers]), G = v([W, e]), K = l(() => w(!1), [w]), q = !!C && !!n;
307
+ return /* @__PURE__ */ g(o, {
308
+ className: h,
309
+ styles: k,
310
+ sx: y,
311
+ children: (e) => /* @__PURE__ */ _("div", {
312
+ ...b,
313
+ ref: G,
314
+ className: e,
315
+ "data-ui": "editable-details-item",
316
+ "data-state": q ? "open" : "closed",
317
+ children: [/* @__PURE__ */ g("dt", {
318
+ id: `${H}-label`,
319
+ css: [A, p?.label?.css],
320
+ className: p?.label?.className,
321
+ children: t
322
+ }), /* @__PURE__ */ g("dd", {
323
+ css: [j, p?.description?.css],
324
+ className: p?.description?.className,
325
+ children: q ? /* @__PURE__ */ g(U, {
326
+ renderEditor: n,
327
+ labelId: `${H}-label`,
328
+ hostId: `${H}-editor`,
329
+ part: p?.editor,
330
+ edit: F,
331
+ requestClose: K,
332
+ focusIntent: I.intent,
333
+ acceptedClose: V
334
+ }) : /* @__PURE__ */ _("div", {
335
+ css: [M, p?.summary?.css],
336
+ className: p?.summary?.className,
337
+ children: [/* @__PURE__ */ g("div", {
338
+ css: N,
339
+ children: c
340
+ }), n && /* @__PURE__ */ g("button", {
341
+ ref: F,
342
+ type: "button",
343
+ id: `${H}-edit`,
344
+ "aria-labelledby": `${H}-edit ${H}-label`,
345
+ onClick: () => {
346
+ I.intent.current = !0, w(!0);
347
+ },
348
+ css: [P, p?.edit?.css],
349
+ className: p?.edit?.className,
350
+ "data-ui": "editable-details-edit",
351
+ children: D.edit
352
+ })]
353
+ })
354
+ })]
355
+ })
356
+ });
357
+ }
358
+ W.displayName = "EditableDetails.Item";
359
+ var G = Object.assign(B, {
360
+ Section: V,
361
+ List: H,
362
+ Item: W
363
+ });
364
+ //#endregion
365
+ export { G as t };
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ export { t as EditableDetails } from "./editable-details-BndqEnYF.js";