@editora/ui-react 0.1.13 → 0.1.14
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.
- package/README.md +138 -3
- package/dist/AlertDialogProvider.cjs.js +1 -1
- package/dist/AlertDialogProvider.esm.js +10 -10
- package/dist/DialogProvider.cjs.js +1 -1
- package/dist/DialogProvider.esm.js +13 -13
- package/dist/Gantt.cjs.js +1 -1
- package/dist/Gantt.esm.js +72 -25
- package/dist/ThemeProvider.cjs.js +1 -1
- package/dist/ThemeProvider.esm.js +11 -11
- package/dist/components/AlertDialogProvider.cjs.js +1 -1
- package/dist/components/AlertDialogProvider.esm.js +1 -1
- package/dist/components/DialogProvider.cjs.js +1 -1
- package/dist/components/DialogProvider.esm.js +1 -1
- package/dist/components/Gantt.d.ts +112 -4
- package/dist/components/Gantt.d.ts.map +1 -1
- package/dist/components/ThemeProvider.cjs.js +1 -1
- package/dist/components/ThemeProvider.esm.js +1 -1
- package/dist/hooks/useFloating.d.ts +135 -7
- package/dist/hooks/useFloating.d.ts.map +1 -1
- package/dist/hooks/useFloatingInteractions.d.ts +192 -0
- package/dist/hooks/useFloatingInteractions.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1438 -460
- package/package.json +2 -2
- package/dist/runtime-864efe2f-3a3f8a32.mjs +0 -1884
- package/dist/runtime-864efe2f-b526ae0d.js +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# @editora/ui-react
|
|
2
2
|
|
|
3
|
-
> [!IMPORTANT]
|
|
4
|
-
> **Live Website:** https://editora-ecosystem.netlify.app/
|
|
5
|
-
> **Storybook:** https://editora-ecosystem-storybook.netlify.app/
|
|
6
3
|
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## Demos
|
|
7
|
+
|
|
8
|
+
- **CodeSandbox:** https://qjr47y-5173.csb.app/button
|
|
9
|
+
- **UI Component Catalog:** https://editora-ecosystem.netlify.app/
|
|
10
|
+
- **Web Demo:** https://editora-free.netlify.app/
|
|
11
|
+
- **Storybook:** https://editora-ecosystem-storybook.netlify.app/
|
|
7
12
|
|
|
8
13
|
React wrappers for `@editora/ui-core` Web Components.
|
|
9
14
|
|
|
@@ -232,6 +237,66 @@ import { ThemeProvider } from '@editora/ui-react';
|
|
|
232
237
|
</ThemeProvider>
|
|
233
238
|
```
|
|
234
239
|
|
|
240
|
+
## Gantt Planning Workspace
|
|
241
|
+
|
|
242
|
+
`Gantt` is the React wrapper for the production planning timeline in `@editora/ui-core`. It supports task, summary, and milestone rows; dependency routing; drag/resize editing; keyboard selection; baselines; critical path highlighting; split task segments; and virtualized rendering for large schedules.
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import { Gantt, type GanttLink, type GanttTask } from '@editora/ui-react';
|
|
246
|
+
import { useState } from 'react';
|
|
247
|
+
|
|
248
|
+
const initialTasks: GanttTask[] = [
|
|
249
|
+
{
|
|
250
|
+
id: 'foundation',
|
|
251
|
+
label: 'Foundation',
|
|
252
|
+
start: '2026-02-01',
|
|
253
|
+
end: '2026-02-18',
|
|
254
|
+
progress: 68,
|
|
255
|
+
baselineStart: '2026-01-29',
|
|
256
|
+
baselineEnd: '2026-02-14',
|
|
257
|
+
critical: true
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: 'handoff',
|
|
261
|
+
label: 'Handoff milestone',
|
|
262
|
+
start: '2026-02-20',
|
|
263
|
+
type: 'milestone',
|
|
264
|
+
tone: 'success'
|
|
265
|
+
}
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
const links: GanttLink[] = [
|
|
269
|
+
{ id: 'foundation-handoff', source: 'foundation', target: 'handoff', type: 'e2s' }
|
|
270
|
+
];
|
|
271
|
+
|
|
272
|
+
export function PlanningDemo() {
|
|
273
|
+
const [tasks, setTasks] = useState(initialTasks);
|
|
274
|
+
|
|
275
|
+
return (
|
|
276
|
+
<Gantt
|
|
277
|
+
tasks={tasks}
|
|
278
|
+
links={links}
|
|
279
|
+
zoom="week"
|
|
280
|
+
sort="start"
|
|
281
|
+
barVariant="soft"
|
|
282
|
+
onTaskChange={({ id, start, end }) => {
|
|
283
|
+
setTasks((items) => items.map((task) => task.id === id ? { ...task, start: start ?? task.start, end: end ?? task.end } : task));
|
|
284
|
+
}}
|
|
285
|
+
onTaskDelete={({ id }) => setTasks((items) => items.filter((task) => task.id !== id))}
|
|
286
|
+
onLinkSelect={(detail) => console.log('dependency selected', detail)}
|
|
287
|
+
/>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Highlights:
|
|
293
|
+
|
|
294
|
+
- Dependency types: `e2s`, `s2s`, `e2e`, and `s2e`, with selectable SVG links and arrowheads.
|
|
295
|
+
- Bar designs: `solid`, `soft`, `striped`, `outline`, and `glass`.
|
|
296
|
+
- Planning data: baselines, critical tasks, milestones, parent/child summaries, assignees, progress, and split segments.
|
|
297
|
+
- Interaction: drag, resize, keyboard task selection, delete events, toolbar zoom/filter/sort, and readonly mode.
|
|
298
|
+
- Scale: row virtualization turns on automatically for large task sets; pass `virtualized={false}` only for small custom layouts.
|
|
299
|
+
|
|
235
300
|
## Component Catalog
|
|
236
301
|
|
|
237
302
|
### Form and inputs
|
|
@@ -261,6 +326,76 @@ import { ThemeProvider } from '@editora/ui-react';
|
|
|
261
326
|
- `ThemeProvider`, `useTheme`
|
|
262
327
|
- `useForm`, `useFloating`
|
|
263
328
|
|
|
329
|
+
## Floating Positioning
|
|
330
|
+
|
|
331
|
+
`@editora/ui-react` exposes a first-party floating layer built on `@editora/ui-core`.
|
|
332
|
+
|
|
333
|
+
Use `useFloating()` for shared positioning, then compose interaction hooks as needed:
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
import {
|
|
337
|
+
FloatingArrow,
|
|
338
|
+
FloatingFocusManager,
|
|
339
|
+
FloatingPortal,
|
|
340
|
+
useClick,
|
|
341
|
+
useDismiss,
|
|
342
|
+
useFloating,
|
|
343
|
+
useInteractions
|
|
344
|
+
} from '@editora/ui-react';
|
|
345
|
+
|
|
346
|
+
function Example() {
|
|
347
|
+
const floating = useFloating({
|
|
348
|
+
placement: 'bottom-start',
|
|
349
|
+
offset: 10,
|
|
350
|
+
flip: true,
|
|
351
|
+
shift: true,
|
|
352
|
+
fitViewport: true
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
const interactions = useInteractions([
|
|
356
|
+
useClick(floating.context),
|
|
357
|
+
useDismiss(floating.context)
|
|
358
|
+
]);
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<>
|
|
362
|
+
<button ref={floating.referenceRef} {...interactions.getReferenceProps()}>
|
|
363
|
+
Open
|
|
364
|
+
</button>
|
|
365
|
+
|
|
366
|
+
{floating.open ? (
|
|
367
|
+
<FloatingPortal>
|
|
368
|
+
<FloatingFocusManager context={floating.context}>
|
|
369
|
+
<div
|
|
370
|
+
ref={floating.floatingRef}
|
|
371
|
+
{...interactions.getFloatingProps({
|
|
372
|
+
style: {
|
|
373
|
+
position: floating.strategy,
|
|
374
|
+
top: floating.coords.top,
|
|
375
|
+
left: floating.coords.left
|
|
376
|
+
}
|
|
377
|
+
})}
|
|
378
|
+
>
|
|
379
|
+
<FloatingArrow context={floating.context} fill="#fff" stroke="#111827" />
|
|
380
|
+
Floating content
|
|
381
|
+
</div>
|
|
382
|
+
</FloatingFocusManager>
|
|
383
|
+
</FloatingPortal>
|
|
384
|
+
) : null}
|
|
385
|
+
</>
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Common React floating exports:
|
|
391
|
+
|
|
392
|
+
- hooks: `useFloating`, `useInteractions`, `useClick`, `useHover`, `useFocus`, `useDismiss`, `useRole`, `useListNavigation`, `useTypeahead`, `useClientPoint`, `useTransition`
|
|
393
|
+
- helpers: `FloatingArrow`, `FloatingPortal`, `FloatingOverlay`, `FloatingFocusManager`, `FloatingTree`, `FloatingList`, `FloatingDelayGroup`, `Composite`
|
|
394
|
+
|
|
395
|
+
For the full core + React guide and the Floating UI concept map, see:
|
|
396
|
+
|
|
397
|
+
- `../ui-core/docs/FLOATING_USAGE.md`
|
|
398
|
+
|
|
264
399
|
## SSR and StrictMode Notes
|
|
265
400
|
|
|
266
401
|
- Providers are SSR-safe (they create hosts in `useEffect` on client).
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),b=require("
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),b=require("@editora/ui-core/runtime"),p=r=>r&&r.__esModule?r:{default:r},C=p(o),m=o.createContext(null),i="data-ui-alert-dialog-react-host-refcount";function f({children:r,hostId:u="ui-alert-dialog-react-host",defaults:l}){const n=o.useRef(null);n.current||(n.current=b.createAlertDialogManager()),o.useEffect(()=>{var e;(e=n.current)==null||e.setDefaults(l||null)},[l]),o.useEffect(()=>{var a;if(typeof document>"u")return;let e=document.getElementById(u);const t=!e;e||(e=document.createElement("div"),e.id=u,e.setAttribute("data-ui-alert-dialog-react-host","true"),document.body.appendChild(e));const v=Number(e.getAttribute(i)||"0");return e.setAttribute(i,String(Math.max(0,v)+1)),(a=n.current)==null||a.setContainer(e),()=>{var c,d;if((c=n.current)==null||c.destroy("unmount"),n.current=null,!e||!e.isConnected)return;const A=Number(e.getAttribute(i)||"1"),s=Math.max(0,A-1);s===0?(e.removeAttribute(i),t&&((d=e.parentElement)==null||d.removeChild(e))):e.setAttribute(i,String(s))}},[u]);const g=o.useMemo(()=>({alert:(e={})=>{var t;return((t=n.current)==null?void 0:t.alert(e))??Promise.resolve({id:"",action:"dismiss"})},confirm:(e={})=>{var t;return((t=n.current)==null?void 0:t.confirm(e))??Promise.resolve({id:"",action:"dismiss"})},prompt:(e={})=>{var t;return((t=n.current)==null?void 0:t.prompt(e))??Promise.resolve({id:"",action:"dismiss",value:""})}}),[]);return C.default.createElement(m.Provider,{value:g},r)}function D(){const r=o.useContext(m);if(!r)throw new Error("useAlertDialog must be used within <AlertDialogProvider>.");return r}exports.AlertDialogProvider=f;exports.default=f;exports.useAlertDialog=D;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
const d =
|
|
2
|
+
import A, { createContext as v, useRef as b, useEffect as m, useMemo as C, useContext as h } from "react";
|
|
3
|
+
import { createAlertDialogManager as x } from "@editora/ui-core/runtime";
|
|
4
|
+
const d = v(null), n = "data-ui-alert-dialog-react-host-refcount";
|
|
5
5
|
function P({
|
|
6
6
|
children: o,
|
|
7
7
|
hostId: i = "ui-alert-dialog-react-host",
|
|
@@ -12,19 +12,19 @@ function P({
|
|
|
12
12
|
var e;
|
|
13
13
|
(e = r.current) == null || e.setDefaults(u || null);
|
|
14
14
|
}, [u]), m(() => {
|
|
15
|
-
var
|
|
15
|
+
var a;
|
|
16
16
|
if (typeof document > "u")
|
|
17
17
|
return;
|
|
18
18
|
let e = document.getElementById(i);
|
|
19
19
|
const t = !e;
|
|
20
20
|
e || (e = document.createElement("div"), e.id = i, e.setAttribute("data-ui-alert-dialog-react-host", "true"), document.body.appendChild(e));
|
|
21
21
|
const g = Number(e.getAttribute(n) || "0");
|
|
22
|
-
return e.setAttribute(n, String(Math.max(0, g) + 1)), (
|
|
23
|
-
var
|
|
24
|
-
if ((
|
|
22
|
+
return e.setAttribute(n, String(Math.max(0, g) + 1)), (a = r.current) == null || a.setContainer(e), () => {
|
|
23
|
+
var l, c;
|
|
24
|
+
if ((l = r.current) == null || l.destroy("unmount"), r.current = null, !e || !e.isConnected)
|
|
25
25
|
return;
|
|
26
|
-
const p = Number(e.getAttribute(n) || "1"),
|
|
27
|
-
|
|
26
|
+
const p = Number(e.getAttribute(n) || "1"), s = Math.max(0, p - 1);
|
|
27
|
+
s === 0 ? (e.removeAttribute(n), t && ((c = e.parentElement) == null || c.removeChild(e))) : e.setAttribute(n, String(s));
|
|
28
28
|
};
|
|
29
29
|
}, [i]);
|
|
30
30
|
const f = C(
|
|
@@ -44,7 +44,7 @@ function P({
|
|
|
44
44
|
}),
|
|
45
45
|
[]
|
|
46
46
|
);
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ A.createElement(d.Provider, { value: f }, o);
|
|
48
48
|
}
|
|
49
49
|
function R() {
|
|
50
50
|
const o = h(d);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),b=require("
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),b=require("@editora/ui-core/runtime"),p=t=>t&&t.__esModule?t:{default:t},C=p(o),d=o.createContext(null),i="data-ui-dialog-react-host-refcount";function m({children:t,hostId:u="ui-dialog-react-host"}){const r=o.useRef(null);r.current||(r.current=b.createDialogManager()),o.useEffect(()=>{var a;if(typeof document>"u")return;let e=document.getElementById(u);const n=!e;e||(e=document.createElement("div"),e.id=u,e.setAttribute("data-ui-dialog-react-host","true"),document.body.appendChild(e));const g=Number(e.getAttribute(i)||"0");return e.setAttribute(i,String(Math.max(0,g)+1)),(a=r.current)==null||a.setContainer(e),()=>{var c,l;if((c=r.current)==null||c.destroy("unmount"),r.current=null,!e||!e.isConnected)return;const v=Number(e.getAttribute(i)||"1"),s=Math.max(0,v-1);s===0?(e.removeAttribute(i),n&&((l=e.parentElement)==null||l.removeChild(e))):e.setAttribute(i,String(s))}},[u]);const f=o.useMemo(()=>({open:(e={})=>{var n;return((n=r.current)==null?void 0:n.open(e))??Promise.resolve({id:"",action:"dismiss"})},confirm:(e={})=>{var n;return((n=r.current)==null?void 0:n.confirm(e))??Promise.resolve({id:"",action:"dismiss"})}}),[]);return C.default.createElement(d.Provider,{value:f},t)}function D(){const t=o.useContext(d);if(!t)throw new Error("useDialog must be used within <DialogProvider>.");return t}exports.DialogProvider=m;exports.default=m;exports.useDialog=D;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import g, { createContext as p, useRef as b, useEffect as v, useMemo as C, useContext as h } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { createDialogManager as x } from "@editora/ui-core/runtime";
|
|
4
4
|
const d = p(null), n = "data-ui-dialog-react-host-refcount";
|
|
5
|
-
function
|
|
5
|
+
function D({ children: o, hostId: i = "ui-dialog-react-host" }) {
|
|
6
6
|
const t = b(null);
|
|
7
7
|
t.current || (t.current = x()), v(() => {
|
|
8
8
|
var u;
|
|
@@ -11,16 +11,16 @@ function R({ children: o, hostId: i = "ui-dialog-react-host" }) {
|
|
|
11
11
|
let e = document.getElementById(i);
|
|
12
12
|
const r = !e;
|
|
13
13
|
e || (e = document.createElement("div"), e.id = i, e.setAttribute("data-ui-dialog-react-host", "true"), document.body.appendChild(e));
|
|
14
|
-
const
|
|
15
|
-
return e.setAttribute(n, String(Math.max(0,
|
|
16
|
-
var c,
|
|
14
|
+
const m = Number(e.getAttribute(n) || "0");
|
|
15
|
+
return e.setAttribute(n, String(Math.max(0, m) + 1)), (u = t.current) == null || u.setContainer(e), () => {
|
|
16
|
+
var c, s;
|
|
17
17
|
if ((c = t.current) == null || c.destroy("unmount"), t.current = null, !e || !e.isConnected)
|
|
18
18
|
return;
|
|
19
|
-
const f = Number(e.getAttribute(n) || "1"),
|
|
20
|
-
|
|
19
|
+
const f = Number(e.getAttribute(n) || "1"), a = Math.max(0, f - 1);
|
|
20
|
+
a === 0 ? (e.removeAttribute(n), r && ((s = e.parentElement) == null || s.removeChild(e))) : e.setAttribute(n, String(a));
|
|
21
21
|
};
|
|
22
22
|
}, [i]);
|
|
23
|
-
const
|
|
23
|
+
const l = C(
|
|
24
24
|
() => ({
|
|
25
25
|
open: (e = {}) => {
|
|
26
26
|
var r;
|
|
@@ -33,16 +33,16 @@ function R({ children: o, hostId: i = "ui-dialog-react-host" }) {
|
|
|
33
33
|
}),
|
|
34
34
|
[]
|
|
35
35
|
);
|
|
36
|
-
return /* @__PURE__ */ g.createElement(d.Provider, { value:
|
|
36
|
+
return /* @__PURE__ */ g.createElement(d.Provider, { value: l }, o);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function R() {
|
|
39
39
|
const o = h(d);
|
|
40
40
|
if (!o)
|
|
41
41
|
throw new Error("useDialog must be used within <DialogProvider>.");
|
|
42
42
|
return o;
|
|
43
43
|
}
|
|
44
44
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
D as DialogProvider,
|
|
46
|
+
D as default,
|
|
47
|
+
R as useDialog
|
|
48
48
|
};
|
package/dist/Gantt.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react"),H=r=>r&&r.__esModule?r:{default:r},J=H(a),P=typeof window<"u"?a.useLayoutEffect:a.useEffect;function f(r){if(r instanceof Date){const n=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),i=String(r.getDate()).padStart(2,"0");return`${n}-${d}-${i}`}return r}function Y(r){return r!=null&&r.length?JSON.stringify(r.map(n=>{var d;return{...n,start:f(n.start),end:f(n.end),baselineStart:f(n.baselineStart),baselineEnd:f(n.baselineEnd),segments:(d=n.segments)==null?void 0:d.map(i=>({...i,start:f(i.start),end:f(i.end)}))}})):null}const A=J.default.forwardRef(function({tasks:n,links:d,zoom:i,sort:v,barVariant:L,variant:m,readonly:G,showToolbar:M,showToday:R,filterText:w,virtualized:N,headless:O,children:j,onTaskChange:y,onTaskSelect:o,onTaskDelete:p,onLinkSelect:b,onZoomChange:_,onFilterChange:g,onSortChange:z,...q},B){const h=a.useRef(null);return a.useImperativeHandle(B,()=>h.current),P(()=>{const e=h.current;if(!e)return;const l=(u,s)=>{const E=e.getAttribute(u);if(s==null){E!=null&&e.removeAttribute(u);return}E!==s&&e.setAttribute(u,s)},c=(u,s)=>{s?l(u,""):l(u,null)};l("tasks",Y(n)),l("links",d!=null&&d.length?JSON.stringify(d):null),l("zoom",i||null),l("sort",v&&v!=="none"?v:null),l("bar-variant",L&&L!=="solid"?L:null),l("variant",m&&m!=="default"?m:null),l("filter",w||null),c("readonly",G),c("show-toolbar",M),c("show-today",R),N===!1?l("virtualized","false"):l("virtualized",null),c("headless",O)},[n,d,i,v,L,m,G,M,R,w,N,O]),a.useEffect(()=>{const e=h.current;if(!e)return;const l=t=>y==null?void 0:y(t.detail,t),c=t=>o==null?void 0:o(t.detail,t),u=t=>p==null?void 0:p(t.detail,t),s=t=>b==null?void 0:b(t.detail,t),E=t=>_==null?void 0:_(t.detail,t),$=t=>g==null?void 0:g(t.detail,t),I=t=>z==null?void 0:z(t.detail,t);return e.addEventListener("taskchange",l),e.addEventListener("taskselect",c),e.addEventListener("taskdelete",u),e.addEventListener("linkselect",s),e.addEventListener("zoomchange",E),e.addEventListener("filterchange",$),e.addEventListener("sortchange",I),()=>{e.removeEventListener("taskchange",l),e.removeEventListener("taskselect",c),e.removeEventListener("taskdelete",u),e.removeEventListener("linkselect",s),e.removeEventListener("zoomchange",E),e.removeEventListener("filterchange",$),e.removeEventListener("sortchange",I)}},[y,o,p,b,_,g,z]),J.default.createElement("ui-gantt",{ref:h,...q},j)});A.displayName="Gantt";exports.Gantt=A;exports.default=A;
|
package/dist/Gantt.esm.js
CHANGED
|
@@ -1,34 +1,81 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
2
|
+
import O, { useRef as Y, useImperativeHandle as j, useEffect as _, useLayoutEffect as q } from "react";
|
|
3
|
+
const K = typeof window < "u" ? q : _;
|
|
4
|
+
function f(n) {
|
|
5
|
+
if (n instanceof Date) {
|
|
6
|
+
const d = n.getFullYear(), i = String(n.getMonth() + 1).padStart(2, "0"), s = String(n.getDate()).padStart(2, "0");
|
|
7
|
+
return `${d}-${i}-${s}`;
|
|
8
|
+
}
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function P(n) {
|
|
12
|
+
return n != null && n.length ? JSON.stringify(n.map((d) => {
|
|
13
|
+
var i;
|
|
14
|
+
return {
|
|
15
|
+
...d,
|
|
16
|
+
start: f(d.start),
|
|
17
|
+
end: f(d.end),
|
|
18
|
+
baselineStart: f(d.baselineStart),
|
|
19
|
+
baselineEnd: f(d.baselineEnd),
|
|
20
|
+
segments: (i = d.segments) == null ? void 0 : i.map((s) => ({
|
|
21
|
+
...s,
|
|
22
|
+
start: f(s.start),
|
|
23
|
+
end: f(s.end)
|
|
24
|
+
}))
|
|
25
|
+
};
|
|
26
|
+
})) : null;
|
|
27
|
+
}
|
|
28
|
+
const Q = O.forwardRef(function({
|
|
29
|
+
tasks: d,
|
|
30
|
+
links: i,
|
|
31
|
+
zoom: s,
|
|
32
|
+
sort: E,
|
|
33
|
+
barVariant: m,
|
|
34
|
+
variant: v,
|
|
35
|
+
readonly: o,
|
|
36
|
+
showToolbar: w,
|
|
37
|
+
showToday: G,
|
|
38
|
+
filterText: N,
|
|
39
|
+
virtualized: R,
|
|
40
|
+
headless: $,
|
|
41
|
+
children: B,
|
|
42
|
+
onTaskChange: L,
|
|
43
|
+
onTaskSelect: p,
|
|
44
|
+
onTaskDelete: y,
|
|
45
|
+
onLinkSelect: b,
|
|
46
|
+
onZoomChange: z,
|
|
47
|
+
onFilterChange: h,
|
|
48
|
+
onSortChange: A,
|
|
49
|
+
...H
|
|
50
|
+
}, M) {
|
|
51
|
+
const g = Y(null);
|
|
52
|
+
return j(M, () => g.current), K(() => {
|
|
53
|
+
const t = g.current;
|
|
54
|
+
if (!t)
|
|
8
55
|
return;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
56
|
+
const r = (l, u) => {
|
|
57
|
+
const a = t.getAttribute(l);
|
|
11
58
|
if (u == null) {
|
|
12
|
-
|
|
59
|
+
a != null && t.removeAttribute(l);
|
|
13
60
|
return;
|
|
14
61
|
}
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
u ?
|
|
62
|
+
a !== u && t.setAttribute(l, u);
|
|
63
|
+
}, c = (l, u) => {
|
|
64
|
+
u ? r(l, "") : r(l, null);
|
|
18
65
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
t("
|
|
27
|
-
|
|
28
|
-
}, [
|
|
66
|
+
r("tasks", P(d)), r("links", i != null && i.length ? JSON.stringify(i) : null), r("zoom", s || null), r("sort", E && E !== "none" ? E : null), r("bar-variant", m && m !== "solid" ? m : null), r("variant", v && v !== "default" ? v : null), r("filter", N || null), c("readonly", o), c("show-toolbar", w), c("show-today", G), R === !1 ? r("virtualized", "false") : r("virtualized", null), c("headless", $);
|
|
67
|
+
}, [d, i, s, E, m, v, o, w, G, N, R, $]), _(() => {
|
|
68
|
+
const t = g.current;
|
|
69
|
+
if (!t)
|
|
70
|
+
return;
|
|
71
|
+
const r = (e) => L == null ? void 0 : L(e.detail, e), c = (e) => p == null ? void 0 : p(e.detail, e), l = (e) => y == null ? void 0 : y(e.detail, e), u = (e) => b == null ? void 0 : b(e.detail, e), a = (e) => z == null ? void 0 : z(e.detail, e), I = (e) => h == null ? void 0 : h(e.detail, e), J = (e) => A == null ? void 0 : A(e.detail, e);
|
|
72
|
+
return t.addEventListener("taskchange", r), t.addEventListener("taskselect", c), t.addEventListener("taskdelete", l), t.addEventListener("linkselect", u), t.addEventListener("zoomchange", a), t.addEventListener("filterchange", I), t.addEventListener("sortchange", J), () => {
|
|
73
|
+
t.removeEventListener("taskchange", r), t.removeEventListener("taskselect", c), t.removeEventListener("taskdelete", l), t.removeEventListener("linkselect", u), t.removeEventListener("zoomchange", a), t.removeEventListener("filterchange", I), t.removeEventListener("sortchange", J);
|
|
74
|
+
};
|
|
75
|
+
}, [L, p, y, b, z, h, A]), O.createElement("ui-gantt", { ref: g, ...H }, B);
|
|
29
76
|
});
|
|
30
|
-
|
|
77
|
+
Q.displayName = "Gantt";
|
|
31
78
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
79
|
+
Q as Gantt,
|
|
80
|
+
Q as default
|
|
34
81
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),u=require("
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),u=require("@editora/ui-core/runtime"),ue=e=>e&&e.__esModule?e:{default:e},ce=ue(c),le=c.createContext(null),se=typeof window<"u"?c.useLayoutEffect:c.useEffect;function s(e,t){var n,p,l,m,r,a,d,o,i,f,y,g,S,k,T,w,x,v,h,A,E,C,M,P,I,O,R,_,z,H,D,J,N,V,j,q,L,F,U,B,G,Q,W,X,Y,Z,$,K,b,ee,te,oe,ne,re;return t?{...e,...t,colors:{...e.colors,...t.colors||{}},palette:{...e.palette||{},...t.palette||{},gray:{...((n=e.palette)==null?void 0:n.gray)||{},...((p=t.palette)==null?void 0:p.gray)||{}},grayAlpha:{...((l=e.palette)==null?void 0:l.grayAlpha)||{},...((m=t.palette)==null?void 0:m.grayAlpha)||{}},blackAlpha:{...((r=e.palette)==null?void 0:r.blackAlpha)||{},...((a=t.palette)==null?void 0:a.blackAlpha)||{}},whiteAlpha:{...((d=e.palette)==null?void 0:d.whiteAlpha)||{},...((o=t.palette)==null?void 0:o.whiteAlpha)||{}},accent:{...((i=e.palette)==null?void 0:i.accent)||{},...((f=t.palette)==null?void 0:f.accent)||{}},accentAlpha:{...((y=e.palette)==null?void 0:y.accentAlpha)||{},...((g=t.palette)==null?void 0:g.accentAlpha)||{}}},surfaces:{...e.surfaces||{},...t.surfaces||{}},shadows:{...e.shadows||{},...t.shadows||{}},spacing:{...e.spacing||{},...t.spacing||{}},spaceScale:{...e.spaceScale||{},...t.spaceScale||{}},radiusScale:{...e.radiusScale||{},...t.radiusScale||{}},typography:{...e.typography||{},...t.typography||{},size:{...((S=e.typography)==null?void 0:S.size)||{},...((k=t.typography)==null?void 0:k.size)||{}},fontScale:{...((T=e.typography)==null?void 0:T.fontScale)||{},...((w=t.typography)==null?void 0:w.fontScale)||{}},lineHeight:{...((x=e.typography)==null?void 0:x.lineHeight)||{},...((v=t.typography)==null?void 0:v.lineHeight)||{}},letterSpacing:{...((h=e.typography)==null?void 0:h.letterSpacing)||{},...((A=t.typography)==null?void 0:A.letterSpacing)||{}}},motion:{...e.motion||{},...t.motion||{}},effects:{...e.effects||{},...t.effects||{}},components:{...e.components||{},...t.components||{},button:{...((E=e.components)==null?void 0:E.button)||{},...((C=t.components)==null?void 0:C.button)||{}},badge:{...((M=e.components)==null?void 0:M.badge)||{},...((P=t.components)==null?void 0:P.badge)||{}},sidebar:{...((I=e.components)==null?void 0:I.sidebar)||{},...((O=t.components)==null?void 0:O.sidebar)||{}},blockControls:{...((R=e.components)==null?void 0:R.blockControls)||{},...((_=t.components)==null?void 0:_.blockControls)||{}},box:{...((z=e.components)==null?void 0:z.box)||{},...((H=t.components)==null?void 0:H.box)||{}},breadcrumb:{...((D=e.components)==null?void 0:D.breadcrumb)||{},...((J=t.components)==null?void 0:J.breadcrumb)||{}},card:{...((N=e.components)==null?void 0:N.card)||{},...((V=t.components)==null?void 0:V.card)||{}},contextMenu:{...((j=e.components)==null?void 0:j.contextMenu)||{},...((q=t.components)==null?void 0:q.contextMenu)||{}},alert:{...((L=e.components)==null?void 0:L.alert)||{},...((F=t.components)==null?void 0:F.alert)||{}},alertDialog:{...((U=e.components)==null?void 0:U.alertDialog)||{},...((B=t.components)==null?void 0:B.alertDialog)||{}},appHeader:{...((G=e.components)==null?void 0:G.appHeader)||{},...((Q=t.components)==null?void 0:Q.appHeader)||{}},aspectRatio:{...((W=e.components)==null?void 0:W.aspectRatio)||{},...((X=t.components)==null?void 0:X.aspectRatio)||{}},avatar:{...((Y=e.components)==null?void 0:Y.avatar)||{},...((Z=t.components)==null?void 0:Z.avatar)||{}},menu:{...(($=e.components)==null?void 0:$.menu)||{},...((K=t.components)==null?void 0:K.menu)||{}},multiSelect:{...((b=e.components)==null?void 0:b.multiSelect)||{},...((ee=t.components)==null?void 0:ee.multiSelect)||{}},panel:{...((te=e.components)==null?void 0:te.panel)||{},...((oe=t.components)==null?void 0:oe.panel)||{}},input:{...((ne=e.components)==null?void 0:ne.input)||{},...((re=t.components)==null?void 0:re.input)||{}}},zIndex:{...e.zIndex||{},...t.zIndex||{}},breakpoints:{...e.breakpoints||{},...t.breakpoints||{}}}:e}function pe(){try{const e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--ui-color-primary").trim();return t?{colors:{primary:t||void 0,text:e.getPropertyValue("--ui-color-text").trim()||void 0,background:e.getPropertyValue("--ui-color-background").trim()||void 0}}:{}}catch{return{}}}function ae(e,t){const n=typeof t=="function"?t(e):t;return s(e,n)}function ie({tokens:e,children:t,storageKey:n="editora.theme.tokens"}){const p=c.useRef(null),l=e&&Object.keys(e).length?e:null,m=()=>{if(typeof window<"u"&&n)try{const o=localStorage.getItem(n);if(o){const i=JSON.parse(o);return s(u.defaultTokens,i)}}catch{}if(l)return s(u.defaultTokens,l);if(typeof window<"u"){const o=pe();if(o.colors&&o.colors.primary)return s(u.defaultTokens,o)}return s(u.defaultTokens,l||{})},[r,a]=c.useState(()=>m());c.useEffect(()=>{l&&a(o=>{const i=s(u.defaultTokens,l);return JSON.stringify(o)===JSON.stringify(i)?o:i})},[l]),se(()=>{typeof document<"u"&&u.applyTheme(r,document);const o=p.current;o&&u.applyTheme(r,o)},[r]),c.useEffect(()=>{if(!(typeof window>"u"||!n))try{localStorage.setItem(n,JSON.stringify(r))}catch{}},[r,n]);const d=c.useMemo(()=>({tokens:r,setTokens:o=>{a(i=>ae(i,o))}}),[r]);return ce.default.createElement(le.Provider,{value:d},ce.default.createElement("div",{ref:p,style:{display:"contents"}},t))}function me(){const e=c.useContext(le);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}exports.ThemeProvider=ie;exports.default=ie;exports.useTheme=me;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import ce, { createContext as pe, useRef as se, useState as ue, useEffect as d, useMemo as me, useContext as ae, useLayoutEffect as de } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { applyTheme as le, defaultTokens as u } from "@editora/ui-core/runtime";
|
|
4
4
|
const ie = pe(null), fe = typeof window < "u" ? de : d;
|
|
5
5
|
function i(e, t) {
|
|
6
|
-
var n, p, c, m, r, s, a, o, l, f, y, g, S,
|
|
6
|
+
var n, p, c, m, r, s, a, o, l, f, y, g, S, k, w, x, T, A, v, h, C, E, I, z, H, O, P, R, M, D, J, N, V, L, _, j, F, U, q, B, G, Q, W, X, Y, Z, $, K, b, ee, te, oe, ne, re;
|
|
7
7
|
return t ? {
|
|
8
8
|
...e,
|
|
9
9
|
...t,
|
|
@@ -28,15 +28,15 @@ function i(e, t) {
|
|
|
28
28
|
...t.typography || {},
|
|
29
29
|
size: {
|
|
30
30
|
...((S = e.typography) == null ? void 0 : S.size) || {},
|
|
31
|
-
...((
|
|
31
|
+
...((k = t.typography) == null ? void 0 : k.size) || {}
|
|
32
32
|
},
|
|
33
33
|
fontScale: {
|
|
34
|
-
...((
|
|
34
|
+
...((w = e.typography) == null ? void 0 : w.fontScale) || {},
|
|
35
35
|
...((x = t.typography) == null ? void 0 : x.fontScale) || {}
|
|
36
36
|
},
|
|
37
37
|
lineHeight: {
|
|
38
|
-
...((
|
|
39
|
-
...((
|
|
38
|
+
...((T = e.typography) == null ? void 0 : T.lineHeight) || {},
|
|
39
|
+
...((A = t.typography) == null ? void 0 : A.lineHeight) || {}
|
|
40
40
|
},
|
|
41
41
|
letterSpacing: {
|
|
42
42
|
...((v = e.typography) == null ? void 0 : v.letterSpacing) || {},
|
|
@@ -54,8 +54,8 @@ function i(e, t) {
|
|
|
54
54
|
blockControls: { ...((P = e.components) == null ? void 0 : P.blockControls) || {}, ...((R = t.components) == null ? void 0 : R.blockControls) || {} },
|
|
55
55
|
box: { ...((M = e.components) == null ? void 0 : M.box) || {}, ...((D = t.components) == null ? void 0 : D.box) || {} },
|
|
56
56
|
breadcrumb: { ...((J = e.components) == null ? void 0 : J.breadcrumb) || {}, ...((N = t.components) == null ? void 0 : N.breadcrumb) || {} },
|
|
57
|
-
card: { ...((
|
|
58
|
-
contextMenu: { ...((
|
|
57
|
+
card: { ...((V = e.components) == null ? void 0 : V.card) || {}, ...((L = t.components) == null ? void 0 : L.card) || {} },
|
|
58
|
+
contextMenu: { ...((_ = e.components) == null ? void 0 : _.contextMenu) || {}, ...((j = t.components) == null ? void 0 : j.contextMenu) || {} },
|
|
59
59
|
alert: { ...((F = e.components) == null ? void 0 : F.alert) || {}, ...((U = t.components) == null ? void 0 : U.alert) || {} },
|
|
60
60
|
alertDialog: { ...((q = e.components) == null ? void 0 : q.alertDialog) || {}, ...((B = t.components) == null ? void 0 : B.alertDialog) || {} },
|
|
61
61
|
appHeader: { ...((G = e.components) == null ? void 0 : G.appHeader) || {}, ...((Q = t.components) == null ? void 0 : Q.appHeader) || {} },
|
|
@@ -88,7 +88,7 @@ function ge(e, t) {
|
|
|
88
88
|
const n = typeof t == "function" ? t(e) : t;
|
|
89
89
|
return i(e, n);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function we({ tokens: e, children: t, storageKey: n = "editora.theme.tokens" }) {
|
|
92
92
|
const p = se(null), c = e && Object.keys(e).length ? e : null, m = () => {
|
|
93
93
|
if (typeof window < "u" && n)
|
|
94
94
|
try {
|
|
@@ -142,7 +142,7 @@ function xe() {
|
|
|
142
142
|
return e;
|
|
143
143
|
}
|
|
144
144
|
export {
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
we as ThemeProvider,
|
|
146
|
+
we as default,
|
|
147
147
|
xe as useTheme
|
|
148
148
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react");require("
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react");require("@editora/ui-core/runtime");const e=require("../AlertDialogProvider.cjs.js");exports.AlertDialogProvider=e.AlertDialogProvider;exports.default=e.AlertDialogProvider;exports.useAlertDialog=e.useAlertDialog;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import "react";
|
|
3
|
-
import "
|
|
3
|
+
import "@editora/ui-core/runtime";
|
|
4
4
|
import { AlertDialogProvider as l, AlertDialogProvider as t, useAlertDialog as a } from "../AlertDialogProvider.esm.js";
|
|
5
5
|
export {
|
|
6
6
|
l as AlertDialogProvider,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react");require("
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react");require("@editora/ui-core/runtime");const e=require("../DialogProvider.cjs.js");exports.DialogProvider=e.DialogProvider;exports.default=e.DialogProvider;exports.useDialog=e.useDialog;
|