@editora/ui-react 0.1.13 → 0.1.15
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/Button.cjs.js +1 -1
- package/dist/Button.esm.js +44 -44
- 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/Sidebar.cjs.js +105 -1
- package/dist/Sidebar.esm.js +10130 -287
- 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/Button.d.ts.map +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/Sidebar.d.ts.map +1 -1
- package/dist/components/ThemeProvider.cjs.js +1 -1
- package/dist/components/ThemeProvider.esm.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +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);
|
package/dist/Button.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 v=require("react"),T=require("./_internals-a238f8ce.js"),k=u=>u&&u.__esModule?u:{default:u},
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("react"),T=require("./_internals-a238f8ce.js"),k=u=>u&&u.__esModule?u:{default:u},s=k(v);function p(u,n,r){if(r==null||!r){u.removeAttribute(n);return}u.setAttribute(n,"")}function e(u,n,r){if(!r){u.removeAttribute(n);return}u.setAttribute(n,r)}const P=s.default.forwardRef(function({children:n,onClick:r,variant:A,size:o,recipe:_,radius:f,scale:y,icon:B,startIcon:M,endIcon:h,loading:a,loadingLabel:b,state:d,tone:S,block:g,headless:x,disabled:R,animation:w,theme:i,type:l,ariaLabel:m,...q},N){const E=v.useRef(null),j=typeof window<"u"?s.default.useLayoutEffect:s.default.useEffect;v.useImperativeHandle(N,()=>E.current),v.useEffect(()=>{T.warnIfElementNotRegistered("ui-button","Button")},[]),v.useEffect(()=>{const t=E.current;if(!t||!r)return;const c=O=>r(O);return t.addEventListener("click",c),()=>t.removeEventListener("click",c)},[r]),j(()=>{const t=E.current;if(!t)return;e(t,"variant",A),o&&o!=="md"?e(t,"size",o):t.removeAttribute("size"),e(t,"icon",B);const c=d||(a?"loading":"idle");c==="idle"?t.removeAttribute("state"):e(t,"state",c),p(t,"loading",!!a),p(t,"block",!!g),p(t,"headless",!!x),p(t,"disabled",!!R),e(t,"animation",w),i&&i!=="default"?e(t,"theme",i):t.removeAttribute("theme"),e(t,"tone",S),l&&l!=="button"?e(t,"type",l):t.removeAttribute("type"),b!==void 0&&e(t,"loading-label",b),m!==void 0&&e(t,"aria-label",m),e(t,"recipe",_),e(t,"radius",f!=null?String(f):void 0),f==="full"?t.style.setProperty("--ui-btn-radius","999px"):t.style.removeProperty("--ui-btn-radius"),e(t,"scale",y)},[A,o,_,f,y,B,a,d,g,x,R,w,i,S,l,b,m]);const D={ref:E,...q,variant:A,size:o&&o!=="md"?o:void 0,recipe:_,radius:f!=null?String(f):void 0,scale:y,icon:B,animation:w,tone:S,type:l&&l!=="button"?l:void 0,loading:a?"":void 0,block:g?"":void 0,headless:x?"":void 0,disabled:R?"":void 0,theme:i&&i!=="default"?i:void 0,state:d&&d!=="idle"?d:void 0,"loading-label":b,"aria-label":m},H=M==null?null:s.default.createElement("span",{slot:"prefix","aria-hidden":"true"},M),I=h==null?null:s.default.createElement("span",{slot:"suffix","aria-hidden":"true"},h);return s.default.createElement("ui-button",D,H,n,I)});P.displayName="Button";exports.Button=P;exports.default=P;
|
package/dist/Button.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
2
|
+
import s, { useRef as F, useImperativeHandle as G, useEffect as N } from "react";
|
|
3
3
|
import { w as J } from "./_internals-68620b0c.mjs";
|
|
4
|
-
function
|
|
4
|
+
function p(f, u, r) {
|
|
5
5
|
if (r == null || !r) {
|
|
6
6
|
f.removeAttribute(u);
|
|
7
7
|
return;
|
|
@@ -15,69 +15,69 @@ function e(f, u, r) {
|
|
|
15
15
|
}
|
|
16
16
|
f.setAttribute(u, r);
|
|
17
17
|
}
|
|
18
|
-
const K =
|
|
18
|
+
const K = s.forwardRef(function({
|
|
19
19
|
children: u,
|
|
20
20
|
onClick: r,
|
|
21
|
-
variant:
|
|
21
|
+
variant: A,
|
|
22
22
|
size: o,
|
|
23
|
-
recipe:
|
|
24
|
-
radius:
|
|
25
|
-
scale:
|
|
26
|
-
icon:
|
|
27
|
-
startIcon:
|
|
28
|
-
endIcon:
|
|
23
|
+
recipe: E,
|
|
24
|
+
radius: l,
|
|
25
|
+
scale: x,
|
|
26
|
+
icon: w,
|
|
27
|
+
startIcon: P,
|
|
28
|
+
endIcon: h,
|
|
29
29
|
loading: v,
|
|
30
30
|
loadingLabel: m,
|
|
31
|
-
state:
|
|
32
|
-
tone:
|
|
33
|
-
block:
|
|
34
|
-
headless:
|
|
35
|
-
disabled:
|
|
36
|
-
animation:
|
|
37
|
-
theme:
|
|
38
|
-
type:
|
|
31
|
+
state: d,
|
|
32
|
+
tone: y,
|
|
33
|
+
block: B,
|
|
34
|
+
headless: R,
|
|
35
|
+
disabled: S,
|
|
36
|
+
animation: g,
|
|
37
|
+
theme: i,
|
|
38
|
+
type: n,
|
|
39
39
|
ariaLabel: b,
|
|
40
|
-
...
|
|
41
|
-
},
|
|
42
|
-
const a = F(null),
|
|
43
|
-
G(
|
|
40
|
+
..._
|
|
41
|
+
}, H) {
|
|
42
|
+
const a = F(null), I = typeof window < "u" ? s.useLayoutEffect : s.useEffect;
|
|
43
|
+
G(H, () => a.current), N(() => {
|
|
44
44
|
J("ui-button", "Button");
|
|
45
|
-
}, []),
|
|
45
|
+
}, []), N(() => {
|
|
46
46
|
const t = a.current;
|
|
47
47
|
if (!t || !r)
|
|
48
48
|
return;
|
|
49
49
|
const c = (D) => r(D);
|
|
50
50
|
return t.addEventListener("click", c), () => t.removeEventListener("click", c);
|
|
51
|
-
}, [r]),
|
|
51
|
+
}, [r]), I(() => {
|
|
52
52
|
const t = a.current;
|
|
53
53
|
if (!t)
|
|
54
54
|
return;
|
|
55
|
-
e(t, "variant",
|
|
56
|
-
const c =
|
|
57
|
-
c === "idle" ? t.removeAttribute("state") : e(t, "state", c),
|
|
58
|
-
}, [
|
|
55
|
+
e(t, "variant", A), o && o !== "md" ? e(t, "size", o) : t.removeAttribute("size"), e(t, "icon", w);
|
|
56
|
+
const c = d || (v ? "loading" : "idle");
|
|
57
|
+
c === "idle" ? t.removeAttribute("state") : e(t, "state", c), p(t, "loading", !!v), p(t, "block", !!B), p(t, "headless", !!R), p(t, "disabled", !!S), e(t, "animation", g), i && i !== "default" ? e(t, "theme", i) : t.removeAttribute("theme"), e(t, "tone", y), n && n !== "button" ? e(t, "type", n) : t.removeAttribute("type"), m !== void 0 && e(t, "loading-label", m), b !== void 0 && e(t, "aria-label", b), e(t, "recipe", E), e(t, "radius", l != null ? String(l) : void 0), l === "full" ? t.style.setProperty("--ui-btn-radius", "999px") : t.style.removeProperty("--ui-btn-radius"), e(t, "scale", x);
|
|
58
|
+
}, [A, o, E, l, x, w, v, d, B, R, S, g, i, y, n, m, b]);
|
|
59
59
|
const j = {
|
|
60
60
|
ref: a,
|
|
61
|
-
...
|
|
62
|
-
variant:
|
|
61
|
+
..._,
|
|
62
|
+
variant: A,
|
|
63
63
|
size: o && o !== "md" ? o : void 0,
|
|
64
|
-
recipe:
|
|
65
|
-
radius:
|
|
66
|
-
scale:
|
|
67
|
-
icon:
|
|
68
|
-
animation:
|
|
69
|
-
tone:
|
|
70
|
-
type:
|
|
64
|
+
recipe: E,
|
|
65
|
+
radius: l != null ? String(l) : void 0,
|
|
66
|
+
scale: x,
|
|
67
|
+
icon: w,
|
|
68
|
+
animation: g,
|
|
69
|
+
tone: y,
|
|
70
|
+
type: n && n !== "button" ? n : void 0,
|
|
71
71
|
loading: v ? "" : void 0,
|
|
72
|
-
block:
|
|
73
|
-
headless:
|
|
74
|
-
disabled:
|
|
75
|
-
theme:
|
|
76
|
-
state:
|
|
72
|
+
block: B ? "" : void 0,
|
|
73
|
+
headless: R ? "" : void 0,
|
|
74
|
+
disabled: S ? "" : void 0,
|
|
75
|
+
theme: i && i !== "default" ? i : void 0,
|
|
76
|
+
state: d && d !== "idle" ? d : void 0,
|
|
77
77
|
"loading-label": m,
|
|
78
78
|
"aria-label": b
|
|
79
|
-
}, k =
|
|
80
|
-
return
|
|
79
|
+
}, k = P == null ? null : s.createElement("span", { slot: "prefix", "aria-hidden": "true" }, P), q = h == null ? null : s.createElement("span", { slot: "suffix", "aria-hidden": "true" }, h);
|
|
80
|
+
return s.createElement("ui-button", j, k, u, q);
|
|
81
81
|
});
|
|
82
82
|
K.displayName = "Button";
|
|
83
83
|
export {
|
|
@@ -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
|
};
|