@editora/ui-react 0.1.11 → 0.1.12
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 +12 -0
- package/dist/AlertDialogProvider.cjs.js +1 -1
- package/dist/AlertDialogProvider.esm.js +1 -1
- package/dist/DialogProvider.cjs.js +1 -1
- package/dist/DialogProvider.esm.js +1 -1
- package/dist/Icon.cjs.js +1 -1
- package/dist/Icon.esm.js +40 -38
- package/dist/SplitButton.cjs.js +396 -1
- package/dist/SplitButton.esm.js +658 -49
- package/dist/ThemeProvider.cjs.js +1 -1
- package/dist/ThemeProvider.esm.js +4 -4
- 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/Icon.d.ts +2 -0
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/SplitButton.cjs.js +1 -1
- package/dist/components/SplitButton.d.ts +4 -2
- package/dist/components/SplitButton.d.ts.map +1 -1
- package/dist/components/SplitButton.esm.js +3 -2
- package/dist/components/ThemeProvider.cjs.js +1 -1
- package/dist/components/ThemeProvider.esm.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +344 -327
- package/dist/{runtime-3cc1c386-b4118dbe.mjs → runtime-4ac0107b-3a3f8a32.mjs} +230 -248
- package/dist/runtime-4ac0107b-b526ae0d.js +1 -0
- package/package.json +1 -1
- package/dist/runtime-3cc1c386-9d1b191c.js +0 -1
package/README.md
CHANGED
|
@@ -15,6 +15,18 @@ This package gives React-friendly props, typed callback details, and hooks/provi
|
|
|
15
15
|
npm install @editora/ui-react @editora/ui-core
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
If you only need sortable as a standalone package, use:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @editora/ui-sortable
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
And for the standalone React wrapper only:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Sortable } from '@editora/ui-sortable/react';
|
|
28
|
+
```
|
|
29
|
+
|
|
18
30
|
Peer dependencies:
|
|
19
31
|
- `react`
|
|
20
32
|
- `react-dom`
|
|
@@ -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("./runtime-
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),b=require("./runtime-4ac0107b-b526ae0d.js"),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:s}){const n=o.useRef(null);n.current||(n.current=b.oe()),o.useEffect(()=>{var e;(e=n.current)==null||e.setDefaults(s||null)},[s]),o.useEffect(()=>{var l;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)),(l=n.current)==null||l.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"),a=Math.max(0,A-1);a===0?(e.removeAttribute(i),t&&((d=e.parentElement)==null||d.removeChild(e))):e.setAttribute(i,String(a))}},[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,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import v, { createContext as A, useRef as b, useEffect as m, useMemo as C, useContext as h } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { o as x } from "./runtime-4ac0107b-3a3f8a32.mjs";
|
|
4
4
|
const d = A(null), n = "data-ui-alert-dialog-react-host-refcount";
|
|
5
5
|
function P({
|
|
6
6
|
children: o,
|
|
@@ -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"),
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),v=require("./runtime-4ac0107b-b526ae0d.js"),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=v.pe()),o.useEffect(()=>{var s;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)),(s=r.current)==null||s.setContainer(e),()=>{var a,l;if((a=r.current)==null||a.destroy("unmount"),r.current=null,!e||!e.isConnected)return;const b=Number(e.getAttribute(i)||"1"),c=Math.max(0,b-1);c===0?(e.removeAttribute(i),n&&((l=e.parentElement)==null||l.removeChild(e))):e.setAttribute(i,String(c))}},[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 _(){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=_;
|
|
@@ -1,6 +1,6 @@
|
|
|
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 { p as x } from "./runtime-4ac0107b-3a3f8a32.mjs";
|
|
4
4
|
const d = p(null), n = "data-ui-dialog-react-host-refcount";
|
|
5
5
|
function R({ children: o, hostId: i = "ui-dialog-react-host" }) {
|
|
6
6
|
const t = b(null);
|
package/dist/Icon.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("react"),h=o=>o&&o.__esModule?o:{default:o},r=h(P),u=r.default.forwardRef(function({children:v,name:a,iconVariant:c,iconWeight:s,size:e,color:f,secondaryColor:p,variant:i,tone:d,shape:t,spin:b,pulse:_,badge:g,label:m,decorative:w,strokeWidth:l,absoluteStrokeWidth:y,strokeLinecap:I,strokeLinejoin:S,rotate:n,flip:M,rtl:R,...j},k){const N={ref:k,...j,name:a||void 0,"icon-variant":c||void 0,"icon-weight":s||void 0,size:e!=null&&e!==""?String(e):void 0,color:f||void 0,"secondary-color":p||void 0,variant:i&&i!=="default"?i:void 0,tone:d&&d!=="default"?d:void 0,shape:t&&t!=="default"?t:void 0,spin:b?"":void 0,pulse:_?"":void 0,badge:g?"":void 0,label:m||void 0,decorative:w?"":void 0,"stroke-width":l!=null&&l!==""?String(l):void 0,"absolute-stroke-width":y?"":void 0,"stroke-linecap":I||void 0,"stroke-linejoin":S||void 0,rotate:typeof n=="number"&&Number.isFinite(n)?n:void 0,flip:M||void 0,rtl:R?"":void 0};return r.default.createElement("ui-icon",N,v)});u.displayName="Icon";exports.Icon=u;exports.default=u;
|
package/dist/Icon.esm.js
CHANGED
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
children:
|
|
1
|
+
import v from "react";
|
|
2
|
+
const h = v.forwardRef(function({
|
|
3
|
+
children: l,
|
|
4
4
|
name: r,
|
|
5
5
|
iconVariant: a,
|
|
6
|
+
iconWeight: c,
|
|
6
7
|
size: o,
|
|
7
|
-
color:
|
|
8
|
-
secondaryColor:
|
|
8
|
+
color: u,
|
|
9
|
+
secondaryColor: f,
|
|
9
10
|
variant: i,
|
|
10
11
|
tone: d,
|
|
11
12
|
shape: e,
|
|
12
|
-
spin:
|
|
13
|
-
pulse:
|
|
14
|
-
badge:
|
|
15
|
-
label:
|
|
16
|
-
decorative:
|
|
13
|
+
spin: s,
|
|
14
|
+
pulse: p,
|
|
15
|
+
badge: m,
|
|
16
|
+
label: b,
|
|
17
|
+
decorative: g,
|
|
17
18
|
strokeWidth: n,
|
|
18
|
-
absoluteStrokeWidth:
|
|
19
|
-
strokeLinecap:
|
|
20
|
-
strokeLinejoin:
|
|
21
|
-
rotate:
|
|
22
|
-
flip:
|
|
23
|
-
rtl:
|
|
24
|
-
...
|
|
25
|
-
},
|
|
26
|
-
const
|
|
27
|
-
ref:
|
|
28
|
-
...
|
|
19
|
+
absoluteStrokeWidth: w,
|
|
20
|
+
strokeLinecap: y,
|
|
21
|
+
strokeLinejoin: I,
|
|
22
|
+
rotate: t,
|
|
23
|
+
flip: k,
|
|
24
|
+
rtl: N,
|
|
25
|
+
...R
|
|
26
|
+
}, S) {
|
|
27
|
+
const _ = {
|
|
28
|
+
ref: S,
|
|
29
|
+
...R,
|
|
29
30
|
name: r || void 0,
|
|
30
31
|
"icon-variant": a || void 0,
|
|
32
|
+
"icon-weight": c || void 0,
|
|
31
33
|
size: o != null && o !== "" ? String(o) : void 0,
|
|
32
|
-
color:
|
|
33
|
-
"secondary-color":
|
|
34
|
+
color: u || void 0,
|
|
35
|
+
"secondary-color": f || void 0,
|
|
34
36
|
variant: i && i !== "default" ? i : void 0,
|
|
35
37
|
tone: d && d !== "default" ? d : void 0,
|
|
36
38
|
shape: e && e !== "default" ? e : void 0,
|
|
37
|
-
spin:
|
|
38
|
-
pulse:
|
|
39
|
-
badge:
|
|
40
|
-
label:
|
|
41
|
-
decorative:
|
|
39
|
+
spin: s ? "" : void 0,
|
|
40
|
+
pulse: p ? "" : void 0,
|
|
41
|
+
badge: m ? "" : void 0,
|
|
42
|
+
label: b || void 0,
|
|
43
|
+
decorative: g ? "" : void 0,
|
|
42
44
|
"stroke-width": n != null && n !== "" ? String(n) : void 0,
|
|
43
|
-
"absolute-stroke-width":
|
|
44
|
-
"stroke-linecap":
|
|
45
|
-
"stroke-linejoin":
|
|
46
|
-
rotate: typeof
|
|
47
|
-
flip:
|
|
48
|
-
rtl:
|
|
45
|
+
"absolute-stroke-width": w ? "" : void 0,
|
|
46
|
+
"stroke-linecap": y || void 0,
|
|
47
|
+
"stroke-linejoin": I || void 0,
|
|
48
|
+
rotate: typeof t == "number" && Number.isFinite(t) ? t : void 0,
|
|
49
|
+
flip: k || void 0,
|
|
50
|
+
rtl: N ? "" : void 0
|
|
49
51
|
};
|
|
50
|
-
return
|
|
52
|
+
return v.createElement("ui-icon", _, l);
|
|
51
53
|
});
|
|
52
|
-
|
|
54
|
+
h.displayName = "Icon";
|
|
53
55
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
h as Icon,
|
|
57
|
+
h as default
|
|
56
58
|
};
|
package/dist/SplitButton.cjs.js
CHANGED
|
@@ -1,2 +1,397 @@
|
|
|
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 ae=require("react"),oe=require("react-dom"),se=i=>i&&i.__esModule?i:{default:i},t=se(ae),P="editora-split-button-styles",de=`
|
|
3
|
+
.ed-split-button {
|
|
4
|
+
--ed-split-radius: 12px;
|
|
5
|
+
--ed-split-bg: var(--ui-color-primary, #2563eb);
|
|
6
|
+
--ed-split-bg-hover: color-mix(in srgb, var(--ed-split-bg) 84%, #0f172a 16%);
|
|
7
|
+
--ed-split-border: 1px solid color-mix(in srgb, var(--ui-color-border, #cbd5e1) 70%, transparent);
|
|
8
|
+
--ed-split-text: #ffffff;
|
|
9
|
+
--ed-split-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ed-split-bg) 20%, transparent);
|
|
10
|
+
--ed-split-menu-bg: var(--ui-color-surface, #ffffff);
|
|
11
|
+
--ed-split-menu-text: var(--ui-color-text, #0f172a);
|
|
12
|
+
--ed-split-menu-muted: color-mix(in srgb, var(--ed-split-menu-text) 58%, transparent);
|
|
13
|
+
--ed-split-menu-border: 1px solid color-mix(in srgb, var(--ui-color-border, #cbd5e1) 64%, transparent);
|
|
14
|
+
--ed-split-menu-shadow: 0 22px 44px rgba(2, 6, 23, 0.16), 0 2px 8px rgba(2, 6, 23, 0.08);
|
|
15
|
+
--ed-split-menu-radius: 14px;
|
|
16
|
+
--ed-split-menu-gap: 2px;
|
|
17
|
+
--ed-split-menu-item-radius: 10px;
|
|
18
|
+
--ed-split-menu-item-min-height: 44px;
|
|
19
|
+
--ed-split-menu-item-padding: 10px 10px;
|
|
20
|
+
--ed-split-menu-accent: color-mix(in srgb, var(--ed-split-bg) 12%, transparent);
|
|
21
|
+
--ed-split-menu-accent-strong: color-mix(in srgb, var(--ed-split-bg) 18%, transparent);
|
|
22
|
+
--ed-split-menu-accent-border: color-mix(in srgb, var(--ed-split-bg) 24%, transparent);
|
|
23
|
+
--ed-split-menu-danger: var(--ui-color-danger, #dc2626);
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
position: relative;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
font-family: "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ed-split-button--neutral {
|
|
31
|
+
--ed-split-bg: #ffffff;
|
|
32
|
+
--ed-split-bg-hover: #f8fafc;
|
|
33
|
+
--ed-split-border: 1px solid color-mix(in srgb, #0f172a 12%, transparent);
|
|
34
|
+
--ed-split-text: #0f172a;
|
|
35
|
+
--ed-split-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 24px rgba(15, 23, 42, 0.08);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ed-split-button--flat {
|
|
39
|
+
--ed-split-radius: 10px;
|
|
40
|
+
--ed-split-bg: #ffffff;
|
|
41
|
+
--ed-split-bg-hover: #f1f5f9;
|
|
42
|
+
--ed-split-border: 1px solid #dbe4f0;
|
|
43
|
+
--ed-split-text: #0f172a;
|
|
44
|
+
--ed-split-shadow: none;
|
|
45
|
+
--ed-split-menu-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ed-split-button--contrast {
|
|
49
|
+
--ed-split-bg: #111827;
|
|
50
|
+
--ed-split-bg-hover: #0b1220;
|
|
51
|
+
--ed-split-text: #f8fafc;
|
|
52
|
+
--ed-split-shadow: 0 1px 2px rgba(15, 23, 42, 0.2), 0 16px 36px rgba(15, 23, 42, 0.18);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ed-split-button--compact {
|
|
56
|
+
--ed-split-radius: 10px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ed-split-button--square {
|
|
60
|
+
--ed-split-radius: 0px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ed-split-button__group {
|
|
64
|
+
display: inline-grid;
|
|
65
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
border: var(--ed-split-border);
|
|
68
|
+
border-radius: var(--ed-split-radius);
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
background: var(--ed-split-bg);
|
|
71
|
+
color: var(--ed-split-text);
|
|
72
|
+
box-shadow: var(--ed-split-shadow);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ed-split-button__primary,
|
|
76
|
+
.ed-split-button__toggle {
|
|
77
|
+
appearance: none;
|
|
78
|
+
border: 0;
|
|
79
|
+
margin: 0;
|
|
80
|
+
background: transparent;
|
|
81
|
+
color: inherit;
|
|
82
|
+
font: 600 14px/1.2 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
transition: background-color 130ms ease, color 130ms ease;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ed-split-button__primary {
|
|
88
|
+
min-height: 40px;
|
|
89
|
+
padding: 0 14px;
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
gap: 8px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ed-split-button__toggle {
|
|
97
|
+
min-height: 40px;
|
|
98
|
+
inline-size: 42px;
|
|
99
|
+
display: inline-grid;
|
|
100
|
+
place-items: center;
|
|
101
|
+
border-inline-start: 1px solid color-mix(in srgb, currentColor 16%, transparent);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ed-split-button__primary:hover,
|
|
105
|
+
.ed-split-button__primary:focus-visible,
|
|
106
|
+
.ed-split-button__toggle:hover,
|
|
107
|
+
.ed-split-button__toggle:focus-visible,
|
|
108
|
+
.ed-split-button[data-open="true"] .ed-split-button__toggle {
|
|
109
|
+
background: var(--ed-split-bg-hover);
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.ed-split-button--compact .ed-split-button__primary,
|
|
114
|
+
.ed-split-button--compact .ed-split-button__toggle {
|
|
115
|
+
min-height: 36px;
|
|
116
|
+
font-size: 13px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ed-split-button--compact .ed-split-button__primary {
|
|
120
|
+
padding-inline: 12px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ed-split-button--compact .ed-split-button__toggle {
|
|
124
|
+
inline-size: 38px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ed-split-button--comfortable .ed-split-button__primary,
|
|
128
|
+
.ed-split-button--comfortable .ed-split-button__toggle {
|
|
129
|
+
min-height: 44px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ed-split-button--comfortable .ed-split-button__primary {
|
|
133
|
+
padding-inline: 16px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ed-split-button--comfortable .ed-split-button__toggle {
|
|
137
|
+
inline-size: 46px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ed-split-button__toggleIcon {
|
|
141
|
+
inline-size: 14px;
|
|
142
|
+
block-size: 14px;
|
|
143
|
+
display: block;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.ed-split-button[aria-disabled="true"] {
|
|
147
|
+
opacity: 0.72;
|
|
148
|
+
pointer-events: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.ed-split-button__menu {
|
|
152
|
+
--ed-split-bg: var(--ui-color-primary, #2563eb);
|
|
153
|
+
--ed-split-menu-bg: var(--ui-color-surface, #ffffff);
|
|
154
|
+
--ed-split-menu-text: var(--ui-color-text, #0f172a);
|
|
155
|
+
--ed-split-menu-muted: color-mix(in srgb, var(--ed-split-menu-text) 58%, transparent);
|
|
156
|
+
--ed-split-menu-border: 1px solid color-mix(in srgb, var(--ui-color-border, #cbd5e1) 64%, transparent);
|
|
157
|
+
--ed-split-menu-shadow: 0 22px 44px rgba(2, 6, 23, 0.16), 0 2px 8px rgba(2, 6, 23, 0.08);
|
|
158
|
+
--ed-split-menu-radius: 14px;
|
|
159
|
+
--ed-split-menu-gap: 2px;
|
|
160
|
+
--ed-split-menu-item-radius: 10px;
|
|
161
|
+
--ed-split-menu-item-min-height: 44px;
|
|
162
|
+
--ed-split-menu-item-padding: 10px 10px;
|
|
163
|
+
--ed-split-menu-accent: color-mix(in srgb, var(--ed-split-bg) 12%, transparent);
|
|
164
|
+
--ed-split-menu-accent-strong: color-mix(in srgb, var(--ed-split-bg) 18%, transparent);
|
|
165
|
+
--ed-split-menu-accent-border: color-mix(in srgb, var(--ed-split-bg) 24%, transparent);
|
|
166
|
+
--ed-split-menu-danger: var(--ui-color-danger, #dc2626);
|
|
167
|
+
position: fixed;
|
|
168
|
+
z-index: 1600;
|
|
169
|
+
display: grid;
|
|
170
|
+
gap: 8px;
|
|
171
|
+
min-width: 240px;
|
|
172
|
+
max-width: min(360px, calc(100vw - 16px));
|
|
173
|
+
max-height: min(420px, calc(100vh - 16px));
|
|
174
|
+
overflow: hidden auto;
|
|
175
|
+
padding: 8px;
|
|
176
|
+
box-sizing: border-box;
|
|
177
|
+
border: var(--ed-split-menu-border);
|
|
178
|
+
border-radius: calc(var(--ed-split-menu-radius) + 2px);
|
|
179
|
+
background: var(--ed-split-menu-bg);
|
|
180
|
+
color: var(--ed-split-menu-text);
|
|
181
|
+
box-shadow: var(--ed-split-menu-shadow);
|
|
182
|
+
outline: none;
|
|
183
|
+
opacity: 0;
|
|
184
|
+
transform: translateY(-4px) scale(0.985);
|
|
185
|
+
animation: ed-split-button-menu-in 150ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.ed-split-button__menu--neutral {
|
|
189
|
+
--ed-split-bg: #2563eb;
|
|
190
|
+
--ed-split-menu-bg: #ffffff;
|
|
191
|
+
--ed-split-menu-text: #0f172a;
|
|
192
|
+
--ed-split-menu-muted: color-mix(in srgb, var(--ed-split-menu-text) 58%, transparent);
|
|
193
|
+
--ed-split-menu-border: 1px solid color-mix(in srgb, #0f172a 12%, transparent);
|
|
194
|
+
--ed-split-menu-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.ed-split-button__menu--flat {
|
|
198
|
+
--ed-split-bg: #2563eb;
|
|
199
|
+
--ed-split-menu-bg: #ffffff;
|
|
200
|
+
--ed-split-menu-text: #0f172a;
|
|
201
|
+
--ed-split-menu-muted: color-mix(in srgb, var(--ed-split-menu-text) 58%, transparent);
|
|
202
|
+
--ed-split-menu-border: 1px solid #dbe4f0;
|
|
203
|
+
--ed-split-menu-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
|
|
204
|
+
--ed-split-menu-accent: #eef4ff;
|
|
205
|
+
--ed-split-menu-accent-strong: #e0ecff;
|
|
206
|
+
--ed-split-menu-accent-border: color-mix(in srgb, #2563eb 20%, transparent);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.ed-split-button__menu--contrast {
|
|
210
|
+
--ed-split-bg: #2563eb;
|
|
211
|
+
--ed-split-menu-bg: #111827;
|
|
212
|
+
--ed-split-menu-text: #f8fafc;
|
|
213
|
+
--ed-split-menu-muted: color-mix(in srgb, var(--ed-split-menu-text) 58%, transparent);
|
|
214
|
+
--ed-split-menu-border: 1px solid #334155;
|
|
215
|
+
--ed-split-menu-shadow: 0 18px 36px rgba(15, 23, 42, 0.3), 0 2px 8px rgba(15, 23, 42, 0.2);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.ed-split-button__menu[data-placement="top"] {
|
|
219
|
+
transform-origin: bottom left;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.ed-split-button__menu[data-placement="bottom"] {
|
|
223
|
+
transform-origin: top left;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.ed-split-button__menuHeader {
|
|
227
|
+
display: grid;
|
|
228
|
+
gap: 4px;
|
|
229
|
+
padding: 4px 6px 2px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.ed-split-button__menuHeading {
|
|
233
|
+
margin: 0;
|
|
234
|
+
font: 700 13px/1.25 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
235
|
+
letter-spacing: 0.015em;
|
|
236
|
+
color: var(--ed-split-menu-text);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.ed-split-button__menuDescription {
|
|
240
|
+
margin: 0;
|
|
241
|
+
font: 500 12px/1.5 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
242
|
+
color: var(--ed-split-menu-muted);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.ed-split-button__list {
|
|
246
|
+
display: grid;
|
|
247
|
+
gap: var(--ed-split-menu-gap);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.ed-split-button__menu--compact {
|
|
251
|
+
--ed-split-menu-gap: 1px;
|
|
252
|
+
--ed-split-menu-item-radius: 8px;
|
|
253
|
+
--ed-split-menu-item-min-height: 38px;
|
|
254
|
+
--ed-split-menu-item-padding: 8px 10px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.ed-split-button__menu--airy {
|
|
258
|
+
--ed-split-menu-gap: 4px;
|
|
259
|
+
--ed-split-menu-item-radius: 14px;
|
|
260
|
+
--ed-split-menu-item-min-height: 50px;
|
|
261
|
+
--ed-split-menu-item-padding: 12px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.ed-split-button__menu--flat {
|
|
265
|
+
--ed-split-menu-radius: 10px;
|
|
266
|
+
--ed-split-menu-item-radius: 8px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.ed-split-button__menu--soft {
|
|
270
|
+
--ed-split-menu-radius: 18px;
|
|
271
|
+
--ed-split-menu-item-radius: 14px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.ed-split-button__menu--square {
|
|
275
|
+
--ed-split-menu-radius: 0px;
|
|
276
|
+
--ed-split-menu-item-radius: 0px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.ed-split-button__item {
|
|
280
|
+
inline-size: 100%;
|
|
281
|
+
min-inline-size: 0;
|
|
282
|
+
min-block-size: var(--ed-split-menu-item-min-height);
|
|
283
|
+
box-sizing: border-box;
|
|
284
|
+
display: grid;
|
|
285
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
286
|
+
align-items: center;
|
|
287
|
+
gap: 10px;
|
|
288
|
+
padding: var(--ed-split-menu-item-padding);
|
|
289
|
+
border: 1px solid transparent;
|
|
290
|
+
border-radius: var(--ed-split-menu-item-radius);
|
|
291
|
+
background: transparent;
|
|
292
|
+
color: inherit;
|
|
293
|
+
text-align: left;
|
|
294
|
+
font: 500 13px/1.35 "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
295
|
+
cursor: pointer;
|
|
296
|
+
transition:
|
|
297
|
+
background-color 130ms ease,
|
|
298
|
+
border-color 130ms ease,
|
|
299
|
+
color 130ms ease,
|
|
300
|
+
box-shadow 130ms ease;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.ed-split-button__item:hover,
|
|
304
|
+
.ed-split-button__item[data-active="true"] {
|
|
305
|
+
background: var(--ed-split-menu-accent);
|
|
306
|
+
border-color: var(--ed-split-menu-accent-border);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.ed-split-button__item[data-active="true"] {
|
|
310
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ed-split-bg) 12%, transparent);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.ed-split-button__item:active {
|
|
314
|
+
background: var(--ed-split-menu-accent-strong);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.ed-split-button__item:focus-visible {
|
|
318
|
+
outline: none;
|
|
319
|
+
background: var(--ed-split-menu-accent);
|
|
320
|
+
border-color: var(--ed-split-menu-accent-border);
|
|
321
|
+
box-shadow:
|
|
322
|
+
inset 0 0 0 1px color-mix(in srgb, var(--ed-split-bg) 12%, transparent),
|
|
323
|
+
0 0 0 3px color-mix(in srgb, var(--ed-split-bg) 14%, transparent);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.ed-split-button__item[aria-disabled="true"] {
|
|
327
|
+
opacity: 0.52;
|
|
328
|
+
cursor: not-allowed;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.ed-split-button__item--danger {
|
|
332
|
+
color: color-mix(in srgb, var(--ed-split-menu-danger) 88%, var(--ed-split-menu-text));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.ed-split-button__item--danger .ed-split-button__itemDescription {
|
|
336
|
+
color: color-mix(in srgb, var(--ed-split-menu-danger) 68%, transparent);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.ed-split-button__item--danger:hover,
|
|
340
|
+
.ed-split-button__item--danger[data-active="true"],
|
|
341
|
+
.ed-split-button__item--danger:focus-visible {
|
|
342
|
+
border-color: color-mix(in srgb, var(--ed-split-menu-danger) 28%, transparent);
|
|
343
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ed-split-menu-danger) 14%, transparent);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.ed-split-button__itemText {
|
|
347
|
+
min-inline-size: 0;
|
|
348
|
+
display: grid;
|
|
349
|
+
gap: 2px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.ed-split-button__itemLabel {
|
|
353
|
+
display: block;
|
|
354
|
+
min-inline-size: 0;
|
|
355
|
+
overflow: hidden;
|
|
356
|
+
text-overflow: ellipsis;
|
|
357
|
+
white-space: nowrap;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.ed-split-button__itemDescription {
|
|
361
|
+
display: -webkit-box;
|
|
362
|
+
min-inline-size: 0;
|
|
363
|
+
overflow: hidden;
|
|
364
|
+
-webkit-box-orient: vertical;
|
|
365
|
+
-webkit-line-clamp: 2;
|
|
366
|
+
white-space: normal;
|
|
367
|
+
color: var(--ed-split-menu-muted);
|
|
368
|
+
font-size: 12px;
|
|
369
|
+
line-height: 1.4;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.ed-split-button__itemShortcut {
|
|
373
|
+
white-space: nowrap;
|
|
374
|
+
color: var(--ed-split-menu-muted);
|
|
375
|
+
font: 600 12px/1 "IBM Plex Mono", "SFMono-Regular", "SF Mono", Consolas, monospace;
|
|
376
|
+
letter-spacing: 0.03em;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
@keyframes ed-split-button-menu-in {
|
|
380
|
+
from {
|
|
381
|
+
opacity: 0;
|
|
382
|
+
transform: translateY(-4px) scale(0.985);
|
|
383
|
+
}
|
|
384
|
+
to {
|
|
385
|
+
opacity: 1;
|
|
386
|
+
transform: translateY(0) scale(1);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
@media (prefers-reduced-motion: reduce) {
|
|
391
|
+
.ed-split-button__menu {
|
|
392
|
+
animation: none;
|
|
393
|
+
opacity: 1;
|
|
394
|
+
transform: none;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
`;function pe(){if(typeof document>"u"||document.getElementById(P))return;const i=document.createElement("style");i.id=P,i.textContent=de,document.head.appendChild(i)}function D(...i){return i.filter(Boolean).join(" ")}function L(i){return i.findIndex(u=>!u.disabled)}function G(i,u,w){var f;if(!i.length)return-1;let d=u;for(let m=0;m<i.length;m+=1)if(d=(d+w+i.length)%i.length,!((f=i[d])!=null&&f.disabled))return d;return-1}function J(i,u){const d=(u==="first"?i:[...i].reverse()).findIndex(f=>!f.disabled);return d<0?-1:u==="first"?d:i.length-1-d}const F=t.default.forwardRef(function({children:u,className:w,label:d="Run action",menuLabel:f="Open action menu",menuHeading:m,menuDescription:k,variant:E="primary",density:W="default",shape:T="default",menuDensity:$="default",menuShape:q="default",disabled:x=!1,items:l=[],onPrimaryAction:B,onSelect:I,style:Q,...X},Z){const z=t.default.useRef(null),H=t.default.useRef(null),N=t.default.useRef(null),_=t.default.useRef(null),U=t.default.useRef([]),[o,M]=t.default.useState(!1),[a,b]=t.default.useState(-1),[s,j]=t.default.useState(null),K=t.default.useId(),Y=t.default.useId();t.default.useImperativeHandle(Z,()=>z.current),t.default.useLayoutEffect(()=>{pe()},[]);const v=t.default.useCallback(()=>{const e=H.current,n=_.current;if(!e||!n)return;const r=e.getBoundingClientRect(),c=window.innerWidth||document.documentElement.clientWidth||0,p=window.innerHeight||document.documentElement.clientHeight||0,A=Math.max(260,Math.round(r.width));n.style.minWidth=`${A}px`;const g=n.getBoundingClientRect(),O=Math.max(0,p-r.bottom-8),le=Math.max(0,r.top-8),V=O<g.height&&le>O;let h=V?r.top-g.height-6:r.bottom+6,y=r.left;y+g.width>c-8&&(y=c-g.width-8),y<8&&(y=8),h<8&&(h=8),h+g.height>p-8&&(h=Math.max(8,p-g.height-8)),j({top:Math.round(h),left:Math.round(y),minWidth:A,placement:V?"top":"bottom"})},[]);t.default.useEffect(()=>{var n;if(!o){j(null);return}const e=a>=0&&!((n=l[a])!=null&&n.disabled)?a:L(l);b(e)},[o,l,a]),t.default.useLayoutEffect(()=>{if(!o)return;v();const e=requestAnimationFrame(()=>{var c,p;v();try{(c=_.current)==null||c.focus({preventScroll:!0})}catch{(p=_.current)==null||p.focus()}}),n=()=>v(),r=()=>v();return window.addEventListener("resize",n,{passive:!0}),window.addEventListener("scroll",r,!0),()=>{cancelAnimationFrame(e),window.removeEventListener("resize",n),window.removeEventListener("scroll",r,!0)}},[o,v]),t.default.useEffect(()=>{if(!o)return;const e=n=>{var c,p;const r=n.target;r&&((c=z.current)!=null&&c.contains(r))||r&&((p=_.current)!=null&&p.contains(r))||M(!1)};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[o]),t.default.useEffect(()=>{o||queueMicrotask(()=>{var e,n;try{(e=N.current)==null||e.focus({preventScroll:!0})}catch{(n=N.current)==null||n.focus()}})},[o]),t.default.useEffect(()=>{if(!o||a<0)return;const e=U.current[a];!e||typeof e.scrollIntoView!="function"||e.scrollIntoView({block:"nearest"})},[o,a]);const R=t.default.useCallback(e=>{const n=l[e];!n||n.disabled||(I==null||I({index:e,value:n.value,label:n.label}),M(!1))},[l,I]),C=t.default.useCallback(()=>{x||l.length===0||M(!0)},[x,l.length]),S=t.default.useCallback(()=>{M(!1)},[]),ee=t.default.useCallback(e=>{(e.key==="ArrowDown"||e.key==="Enter"||e.key===" ")&&(e.preventDefault(),C())},[C]),te=t.default.useCallback(e=>{switch(e.key){case"Escape":e.preventDefault(),S();return;case"Tab":S();return;case"ArrowDown":{e.preventDefault();const n=a>=0?a:L(l)-1,r=G(l,n,1);r>=0&&b(r);return}case"ArrowUp":{e.preventDefault();const n=a>=0?a:L(l)+1,r=G(l,n,-1);r>=0&&b(r);return}case"Home":{e.preventDefault();const n=J(l,"first");n>=0&&b(n);return}case"End":{e.preventDefault();const n=J(l,"last");n>=0&&b(n);return}case"Enter":case" ":{e.preventDefault(),a>=0&&R(a);return}default:return}},[a,S,l,R]),ne=D("ed-split-button",E!=="primary"&&`ed-split-button--${E}`,W!=="default"&&`ed-split-button--${W}`,T!=="default"&&`ed-split-button--${T}`,w),ie=D("ed-split-button__menu",E!=="primary"&&`ed-split-button__menu--${E}`,$!=="default"&&`ed-split-button__menu--${$}`,q!=="default"&&`ed-split-button__menu--${q}`),re=o&&typeof document<"u"?oe.createPortal(t.default.createElement("div",{ref:_,className:ie,role:"menu",tabIndex:-1,"aria-labelledby":m?K:void 0,"aria-describedby":k?Y:void 0,"data-placement":(s==null?void 0:s.placement)||"bottom",onKeyDown:te,style:{top:(s==null?void 0:s.top)??-9999,left:(s==null?void 0:s.left)??-9999,minWidth:s==null?void 0:s.minWidth,visibility:s?"visible":"hidden"}},m||k?t.default.createElement("div",{className:"ed-split-button__menuHeader"},m?t.default.createElement("p",{id:K,className:"ed-split-button__menuHeading"},m):null,k?t.default.createElement("p",{id:Y,className:"ed-split-button__menuDescription"},k):null):null,t.default.createElement("div",{className:"ed-split-button__list"},l.map((e,n)=>t.default.createElement("button",{key:e.value,ref:r=>{U.current[n]=r},type:"button",role:"menuitem",className:D("ed-split-button__item",e.tone==="danger"&&"ed-split-button__item--danger"),"data-active":n===a?"true":void 0,"aria-disabled":e.disabled?"true":void 0,disabled:e.disabled,onPointerMove:()=>{e.disabled||b(n)},onFocus:()=>{e.disabled||b(n)},onClick:()=>R(n)},t.default.createElement("span",{className:"ed-split-button__itemText"},t.default.createElement("span",{className:"ed-split-button__itemLabel"},e.label),e.description?t.default.createElement("span",{className:"ed-split-button__itemDescription"},e.description):null),e.shortcut?t.default.createElement("span",{className:"ed-split-button__itemShortcut"},e.shortcut):null)),u)),document.body):null;return t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{...X,ref:z,className:ne,style:Q,"aria-disabled":x?"true":void 0,"data-open":o?"true":void 0},t.default.createElement("div",{ref:H,className:"ed-split-button__group"},t.default.createElement("button",{type:"button",className:"ed-split-button__primary",disabled:x,onClick:()=>B==null?void 0:B()},d),t.default.createElement("button",{ref:N,type:"button",className:"ed-split-button__toggle","aria-label":f,"aria-haspopup":"menu","aria-expanded":o?"true":"false",disabled:x||l.length===0,onClick:()=>{o?S():C()},onKeyDown:ee},t.default.createElement("svg",{className:"ed-split-button__toggleIcon",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false"},t.default.createElement("path",{d:"m5 8 5 5 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}))))),re)});F.displayName="SplitButton";exports.SplitButton=F;exports.default=F;
|