@solibo/solibo-ui 1.0.12 → 1.0.13
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/dist/assets/index17.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.cjs.map +1 -1
- package/dist/components/chip/index.js +21 -14
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +3 -3
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/menu/index.cjs +1 -1
- package/dist/components/menu/index.cjs.map +1 -1
- package/dist/components/menu/index.js +56 -52
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +1 -1
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.cjs.map +1 -1
- package/dist/components/popover/index.js +21 -21
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.cjs.map +1 -1
- package/dist/components/search/index.js +14 -14
- package/dist/components/search/index.js.map +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +2 -2
- package/dist/{icons-BIi_mYLy.js → icons-Bq3diTRm.js} +8 -2
- package/dist/icons-Bq3diTRm.js.map +1 -0
- package/dist/icons-ovA21Oao.cjs +2 -0
- package/dist/icons-ovA21Oao.cjs.map +1 -0
- package/dist/{index-CWD8Jp0A.cjs → index-BcY9DZZ8.cjs} +2 -2
- package/dist/{index-CWD8Jp0A.cjs.map → index-BcY9DZZ8.cjs.map} +1 -1
- package/dist/{index-DVXi-Ryi.cjs → index-CjI8oRpS.cjs} +2 -2
- package/dist/{index-DVXi-Ryi.cjs.map → index-CjI8oRpS.cjs.map} +1 -1
- package/dist/{index-yIe5PqD1.js → index-ClZkChEh.js} +2 -2
- package/dist/{index-yIe5PqD1.js.map → index-ClZkChEh.js.map} +1 -1
- package/dist/{index-Clex8VE6.js → index-DwzLUapm.js} +2 -2
- package/dist/{index-Clex8VE6.js.map → index-DwzLUapm.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.js +2 -2
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/icons-BIi_mYLy.js.map +0 -1
- package/dist/icons-CR-eUx2p.cjs +0 -2
- package/dist/icons-CR-eUx2p.cjs.map +0 -1
package/dist/assets/index17.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._popover_1e3fx_1{display:inline-block;position:relative}._inline_1e3fx_6{line-height:0;visibility:hidden}._inline_1e3fx_6[data-open=true],._inline_1e3fx_6:focus-within{visibility:visible}a:hover>._inline_1e3fx_6,a:focus-within>._inline_1e3fx_6{visibility:visible}._popover-panel_1e3fx_21{background-color:var(--colors-semantic-bg-surface);border:var(--shape-border-width-default) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-lg);box-shadow:var(--shape-box-shadow-sm-position-x) var(--shape-box-shadow-sm-position-y) var(--shape-box-shadow-sm-blur) var(--shape-box-shadow-sm-spread) var(--shape-box-shadow-sm-color);font-family:var(--utils-tokens-font-family);margin-top:var(--shape-spacing-2xs);max-height:90vh;max-width:90vw;overflow:auto;padding:var(--shape-spacing-xs);position:absolute;z-index:3}._popover-panel_1e3fx_21 button{justify-content:left}._below_1e3fx_42{margin-top:var(--shape-spacing-2xs);top:100%}._above_1e3fx_47{bottom:100%;margin-bottom:var(--shape-spacing-2xs)}._inline-panel_1e3fx_52{bottom:auto;margin:0}._left_1e3fx_57{right:0;transform-origin:top right}._right_1e3fx_62{left:0;transform-origin:top left}._trigger_1e3fx_67{color:var(--colors-semantic-content-secondary);padding:var(--scale-8)}._trigger_1e3fx_67:focus-visible{outline:var(--scale-2) solid var(--colors-semantic-border-focus);outline-offset:var(--scale-2)}._inline-trigger_1e3fx_77{color:var(--colors-semantic-content-secondary);cursor:pointer;display:inline-flex}._inline-trigger_1e3fx_77:focus-visible{outline:var(--scale-2) solid var(--colors-semantic-border-focus);outline-offset:var(--scale-2)}@media (width < 768px){._inline_1e3fx_6{visibility:unset}}
|
package/dist/assets/index34.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._chip_1b6k8_3{align-items:center;background:var(--colors-semantic-primary-primary-subtle);border:var(--shape-border-width-default) solid var(--colors-semantic-primary-primary-subtle-border);border-radius:var(--shape-border-radius-radius-xl);color:var(--colors-semantic-primary-on-primary-subtle);display:inline-flex;font-size:var(--typography-font-sizes-label-sm);gap:var(--shape-spacing-2xs);justify-content:center;line-height:var(--typography-font-sizes-label-lg);padding:var(--shape-spacing-2xs)}._delete_1b6k8_18{position:relative;border-radius:var(--shape-border-radius-radius-lg);padding:var(--shape-spacing-2xs);transition:background-color var(--utils-tokens-transition-duration)}._delete_1b6k8_18:after{content:"";position:absolute;inset:var(--utils-tokens-negative-unit)}._delete_1b6k8_18:hover{background:var(--colors-semantic-interactive-pressed)}._divider_1b6k8_30{background-color:currentcolor;flex:none;height:var(--typography-font-sizes-label-sm);margin:auto var(--shape-spacing-2xs);width:var(--shape-border-width-default)}._label_1b6k8_38,._link_1b6k8_39{border-radius:var(--shape-border-radius-radius-lg);color:inherit;min-width:0;padding:var(--shape-spacing-2xs) var(--shape-spacing-xs);transition:background-color var(--utils-tokens-transition-duration)}._label_1b6k8_38:hover,._link_1b6k8_39:hover{background:var(--colors-semantic-interactive-pressed)}._link_1b6k8_39:focus-visible,._delete_1b6k8_18:focus-visible{outline:solid var(--shape-outline-focus) var(--colors-semantic-border-focus);outline-offset:var(--shape-spacing-3xs)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index33.css');const e=require("react/jsx-runtime"),x=require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index33.css');const e=require("react/jsx-runtime"),x=require("../../icons-ovA21Oao.cjs"),b=require("../loading/index.cjs"),h="_checkbox_1glqu_3",u={checkbox:h},k=({checked:s,disabled:t,isLoading:c,label:o,onChange:n,...i})=>{const r={"--icon-svg":x.iconSVG("check")};return e.jsxs("label",{className:u.checkbox,"data-component":"checkbox",children:[e.jsx("input",{checked:s,disabled:t||c,onChange:n,type:"checkbox",style:r,...i}),c&&e.jsx(b.Loading,{size:16,sticky:!0}),o&&o]})};exports.Checkbox=k;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { i as x } from "../../icons-
|
|
2
|
+
import { i as x } from "../../icons-Bq3diTRm.js";
|
|
3
3
|
import { Loading as k } from "../loading/index.js";
|
|
4
4
|
import '../../assets/index33.css';const b = "_checkbox_1glqu_3", m = {
|
|
5
5
|
checkbox: b
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index34.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index34.css');const e=require("react/jsx-runtime"),l=require("../button/index.cjs"),r=require("../link/index.cjs"),d="_chip_1b6k8_3",p="_divider_1b6k8_30",_="_label_1b6k8_38",k="_link_1b6k8_39",i={chip:d,delete:"_delete_1b6k8_18",divider:p,label:_,link:k},b=({accessibleLabel:o,label:n,link:t,onDelete:a,...c})=>e.jsxs("span",{className:i.chip,...c,"data-component":"chip",children:[t?e.jsx(r.Link,{className:i.link,onClick:s=>s.stopPropagation(),to:t,children:n}):e.jsx("span",{className:i.label,children:n}),e.jsx("span",{"aria-hidden":"true",className:i.divider}),e.jsx(l.Button,{"aria-label":o??`Delete ${n}`,className:i.delete,icon:"x",onClick:s=>{s.stopPropagation(),a()},variant:"simple"})]});exports.Chip=b;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport { Button } from '../button';\nimport { Link } from '../link';\nimport styles from './styles.module.css';\n\nexport type ChipProps = Omit<ComponentPropsWithoutRef<'span'>, 'children'> & {\n accessibleLabel?: string;\n label: string;\n link?: string;\n onDelete: () => void;\n};\n\nexport const Chip = ({ accessibleLabel, label, link, onDelete, ...props }: ChipProps) => {\n return (\n <span\n className={styles.chip}\n {...props}\n >\n {link ? (\n <Link\n className={styles.link}\n onClick={(event) => event.stopPropagation()}\n to={link}\n >\n {label}\n </Link>\n ) : (\n <span className={styles.label}>{label}</span>\n )}\n <span\n aria-hidden='true'\n className={styles.divider}\n />\n <Button\n aria-label={accessibleLabel ?? `Delete ${label}`}\n className={styles.delete}\n icon='x'\n onClick={(event) => {\n event.stopPropagation();\n onDelete();\n }}\n variant='simple'\n />\n </span>\n );\n};\n"],"names":["Chip","accessibleLabel","label","link","onDelete","props","jsxs","styles","chip","Link","event","stopPropagation","jsx","divider","Button","delete"],"mappings":"kUAaaA,EAAOA,CAAC,CAAEC,gBAAAA,EAAiBC,MAAAA,EAAOC,KAAAA,EAAMC,SAAAA,EAAU,GAAGC,CAAiB,IAE/EC,OAAC,QACC,UAAWC,EAAOC,KAClB,GAAIH,EAAM,iBAAA,OAETF,SAAAA,CAAAA,QACEM,OAAA,CACC,UAAWF,EAAOJ,KAClB,WAAoBO,EAAMC,gBAAAA,EAC1B,GAAIR,EAEHD,WACH,EAEAU,EAAAA,IAAC,QAAK,UAAWL,EAAOL,MAAQA,SAAAA,CAAAA,CAAM,QAEvC,OAAA,CACC,cAAY,OACZ,UAAWK,EAAOM,QAAQ,EAE5BD,EAAAA,IAACE,EAAAA,OAAA,CACC,aAAYb,GAAmB,UAAUC,CAAK,GAC9C,UAAWK,EAAOQ,OAClB,KAAK,IACL,QAAUL,GAAU,CAClBA,EAAMC,gBAAAA,EACNP,EAAAA,CACF,EACA,QAAQ,QAAA,CAAQ,CAAA,EAEpB"}
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Button as r } from "../button/index.js";
|
|
3
|
+
import { Link as p } from "../link/index.js";
|
|
4
|
+
import '../../assets/index34.css';const d = "_chip_1b6k8_3", _ = "_divider_1b6k8_30", m = "_label_1b6k8_38", k = "_link_1b6k8_39", e = {
|
|
5
|
+
chip: d,
|
|
6
|
+
delete: "_delete_1b6k8_18",
|
|
7
|
+
divider: _,
|
|
8
|
+
label: m,
|
|
9
|
+
link: k
|
|
10
|
+
}, N = ({
|
|
6
11
|
accessibleLabel: t,
|
|
7
|
-
label:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/* @__PURE__ */
|
|
12
|
+
label: a,
|
|
13
|
+
link: s,
|
|
14
|
+
onDelete: o,
|
|
15
|
+
...l
|
|
16
|
+
}) => /* @__PURE__ */ c("span", { className: e.chip, ...l, "data-component": "chip", children: [
|
|
17
|
+
s ? /* @__PURE__ */ i(p, { className: e.link, onClick: (n) => n.stopPropagation(), to: s, children: a }) : /* @__PURE__ */ i("span", { className: e.label, children: a }),
|
|
18
|
+
/* @__PURE__ */ i("span", { "aria-hidden": "true", className: e.divider }),
|
|
19
|
+
/* @__PURE__ */ i(r, { "aria-label": t ?? `Delete ${a}`, className: e.delete, icon: "x", onClick: (n) => {
|
|
20
|
+
n.stopPropagation(), o();
|
|
21
|
+
}, variant: "simple" })
|
|
15
22
|
] });
|
|
16
23
|
export {
|
|
17
|
-
|
|
24
|
+
N as Chip
|
|
18
25
|
};
|
|
19
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport { Button } from '../button';\nimport { Link } from '../link';\nimport styles from './styles.module.css';\n\nexport type ChipProps = Omit<ComponentPropsWithoutRef<'span'>, 'children'> & {\n accessibleLabel?: string;\n label: string;\n link?: string;\n onDelete: () => void;\n};\n\nexport const Chip = ({ accessibleLabel, label, link, onDelete, ...props }: ChipProps) => {\n return (\n <span\n className={styles.chip}\n {...props}\n >\n {link ? (\n <Link\n className={styles.link}\n onClick={(event) => event.stopPropagation()}\n to={link}\n >\n {label}\n </Link>\n ) : (\n <span className={styles.label}>{label}</span>\n )}\n <span\n aria-hidden='true'\n className={styles.divider}\n />\n <Button\n aria-label={accessibleLabel ?? `Delete ${label}`}\n className={styles.delete}\n icon='x'\n onClick={(event) => {\n event.stopPropagation();\n onDelete();\n }}\n variant='simple'\n />\n </span>\n );\n};\n"],"names":["Chip","accessibleLabel","label","link","onDelete","props","jsxs","styles","chip","Link","event","stopPropagation","jsx","divider","Button","delete"],"mappings":";;;;;;;;;GAaaA,IAAOA,CAAC;AAAA,EAAEC,iBAAAA;AAAAA,EAAiBC,OAAAA;AAAAA,EAAOC,MAAAA;AAAAA,EAAMC,UAAAA;AAAAA,EAAU,GAAGC;AAAiB,MAE/E,gBAAAC,EAAC,UACC,WAAWC,EAAOC,MAClB,GAAIH,GAAM,kBAAA,QAETF,UAAAA;AAAAA,EAAAA,sBACEM,GAAA,EACC,WAAWF,EAAOJ,MAClB,SAAUO,OAAUA,EAAMC,gBAAAA,GAC1B,IAAIR,GAEHD,aACH,IAEA,gBAAAU,EAAC,UAAK,WAAWL,EAAOL,OAAQA,UAAAA,EAAAA,CAAM;AAAA,oBAEvC,QAAA,EACC,eAAY,QACZ,WAAWK,EAAOM,SAAQ;AAAA,EAE5B,gBAAAD,EAACE,GAAA,EACC,cAAYb,KAAmB,UAAUC,CAAK,IAC9C,WAAWK,EAAOQ,QAClB,MAAK,KACL,SAAUL,CAAAA,MAAU;AAClBA,IAAAA,EAAMC,gBAAAA,GACNP,EAAAA;AAAAA,EACF,GACA,SAAQ,SAAA,CAAQ;AAAA,GAEpB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const s=require("react/jsx-runtime"),E=require("../../classix-5H4IWnMA.cjs"),a=require("react"),F=require("../button/index.cjs"),ce=require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const s=require("react/jsx-runtime"),E=require("../../classix-5H4IWnMA.cjs"),a=require("react"),F=require("../button/index.cjs"),ce=require("../../icons-ovA21Oao.cjs"),X=require("../../index-BcY9DZZ8.cjs"),ue=require("../list/index.cjs"),N=require("../../index-CjI8oRpS.cjs");function V(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(V).join(" "):a.isValidElement(t)?V(t.props.children):""}function de(t){return a.isValidElement(t)&&t.type==="option"}function pe(t){return a.isValidElement(t)&&t.type==="optgroup"}function fe(t){return a.isValidElement(t)&&t.type===a.Fragment}function me(t){return a.isValidElement(t)&&t.type===N.Select}function W(t,i,r=!1){const l=[];return a.Children.forEach(t,n=>{if(fe(n))l.push(...W(n.props.children,i,r));else if(de(n)){const c=V(n.props.children).trim(),f=n.props.value!=null?String(n.props.value):c;l.push({disabled:r||!!n.props.disabled,groupLabel:i,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&f===""),label:n.props.children,selected:!!n.props.selected,text:c,value:f})}else pe(n)&&l.push(...W(n.props.children,n.props.label,r||!!n.props.disabled))}),l}function be(t){const i=t.trim();if(!i)return null;const l=[.../[*?]/.test(i)?i:`*${i}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${l}$`,"i")}function _e(t,i){const r=be(i),l=t.filter(n=>!n.hidden&&!n.isPlaceholder);return r?l.filter(n=>r.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):l}function he(t,i){return t.find(r=>r.value===i)??t.find(r=>r.isPlaceholder)??t[0]}function ye(t,i,r){var l,n;return i!=null?String(i):r!=null?String(r):((l=t.find(c=>c.selected))==null?void 0:l.value)??((n=t[0])==null?void 0:n.value)??""}function xe(t){if(me(t)){const{children:i,placeholder:r,...l}=t.props;return{children:s.jsxs(s.Fragment,{children:[r&&s.jsx("option",{hidden:!0,value:"",children:r}),i]}),props:l}}return{children:t.props.children,props:t.props}}const ge="_combobox_1bqyf_3",ve="_dropdown_1bqyf_27",je="_empty_1bqyf_30",qe="_group_1bqyf_31",we="_placeholder_1bqyf_32",Se="_filter_1bqyf_40",Ce="_native_1bqyf_52",Ee="_option_1bqyf_62",Ne="_options_1bqyf_84",Ve="_panel_1bqyf_108",Le="_selected_1bqyf_132",Re="_text_1bqyf_136",$e="_trigger_1bqyf_144",Be="_minimal_1bqyf_180",Ie="_inline_1bqyf_235",De="_label_1bqyf_267",o={combobox:ge,"combobox-input":"_combobox-input_1bqyf_12",dropdown:ve,empty:je,group:qe,placeholder:we,filter:Se,native:Ce,option:Ee,options:Ne,panel:Ve,selected:Le,text:Re,trigger:$e,minimal:Be,inline:Ie,label:De,"inline-field":"_inline-field_1bqyf_273"};function Y(t,i){return{"--icon-svg":ce.iconSVG(t).replace("currentColor",i)}}const Pe=({children:t,className:i,combobox:r=!1,createOption:l,emptyLabel:n="No matches found",label:c,renderOption:f,searchPlaceholder:L="Filter",selectedItems:Z,variant:h="default",...ee})=>{const R=xe(t),{defaultValue:te,onChange:$,value:B,...ne}=R.props,g=N.sanitizeSelectProps(ne),M=a.useRef(null),Q=a.useRef(null),v=a.useId(),z=a.useRef(null),m=a.useRef(null),y=W(R.children),x=B!=null,I=ye(y,B,te),[D,P]=a.useState(()=>I),[u,p]=a.useState(!1),[j,q]=a.useState(""),w=x?String(B):D,O={default:N.resolveColor("--colors-semantic-content-secondary"),white:N.resolveColor("--color-white","white")},T=h==="minimal"?O.white:O.default,S=he(y,w),re=Y("chevron",T),le=Y("search",T),A=_e(y,j),b=j.trim(),C=!!(r&&l&&b&&l.isValid(b)),se=c&&h==="inline"?X.formatInlineLabel(c):c,G=e=>e?(f==null?void 0:f({groupLabel:e.groupLabel,isSelected:e.value===w,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";a.useEffect(()=>{!x&&!y.some(e=>e.value===D)&&P(I)},[I,D,x,y]),a.useEffect(()=>{var e;if(!u){q("");return}(e=m.current)==null||e.focus()},[u]),a.useEffect(()=>{if(!u)return;const e=d=>{var _;(_=Q.current)!=null&&_.contains(d.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);const oe=e=>{x||P(e.target.value),$==null||$(e)},k=()=>{var e;p(!1),r||(e=M.current)==null||e.focus()},K=()=>{var e;q(""),p(!0),(e=m.current)==null||e.focus()},H=()=>{!l||!C||(l.onCreate(b),K())},ie=e=>{var U;x||P(e);const d=z.current;if(!d){k();return}const _=(U=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:U.set;_==null||_.call(d,e),d.dispatchEvent(new Event("change",{bubbles:!0})),r?K():k()},ae=e=>{e.key==="Escape"&&k(),e.key==="Enter"&&e.target===m.current&&C&&(e.preventDefault(),H())},J=s.jsxs("div",{className:E.t(o.dropdown,h==="inline"&&o.inline,h==="minimal"&&o.minimal,i),onKeyDown:ae,ref:Q,...ee,children:[s.jsx("select",{...g,"aria-hidden":"true",className:o.native,onChange:oe,ref:z,tabIndex:-1,value:w,children:R.children}),r?s.jsxs("div",{className:o.combobox,onClick:()=>{var e;return(e=m.current)==null?void 0:e.focus()},children:[Z,s.jsx("input",{"aria-autocomplete":"list","aria-expanded":u,"aria-label":g["aria-label"]??c??L,className:o["combobox-input"],disabled:g.disabled,onChange:e=>{q(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:L||void 0,ref:m,role:"combobox",type:"text",value:j})]}):s.jsx(F.Button,{"aria-expanded":u,"aria-haspopup":"dialog","aria-labelledby":c?`${v} ${v}-value`:void 0,className:E.t(o.trigger,(S==null?void 0:S.isPlaceholder)&&o.placeholder),"data-open":u?"true":void 0,disabled:g.disabled,onClick:()=>p(e=>!e),ref:M,style:re,variant:"tertiary",children:s.jsx("span",{className:o.text,id:`${v}-value`,children:G(S)})}),u&&s.jsxs("div",{className:o.panel,children:[!r&&s.jsx(X.Input,{"aria-label":"Filter",className:o.filter,icon:"search",onChange:e=>q(e.target.value),placeholder:L,ref:m,style:le,type:"search",value:j}),s.jsxs(ue.List,{"aria-label":"Dropdown",className:o.options,children:[A.map(e=>{const d=e.value===w;return s.jsx("li",{"data-component":"dropdown",children:s.jsxs(F.Button,{"aria-label":d?`${e.text}, selected`:e.text,className:E.t(o.option,d&&o.selected),disabled:e.disabled,onClick:()=>ie(e.value),variant:"tertiary",children:[s.jsx("span",{className:o.text,children:G(e)}),e.groupLabel&&s.jsx("small",{className:o.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),C&&l&&s.jsx("li",{children:s.jsx(F.Button,{"aria-label":V(l.render(b))||b,className:o.option,onClick:H,variant:"tertiary",children:s.jsx("span",{className:o.text,children:l.render(b)})})}),A.length===0&&!C&&s.jsx("li",{className:o.empty,children:n})]})]})]});return c?s.jsxs("div",{className:E.t(o.label,h==="inline"&&o["inline-field"]),"data-component":"dropdown",children:[s.jsx("span",{id:v,children:se}),J]}):J};exports.Dropdown=Pe;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,10 +2,10 @@ import { jsxs as p, Fragment as pe, jsx as s } from "react/jsx-runtime";
|
|
|
2
2
|
import { t as V } from "../../classix-DG18itHa.js";
|
|
3
3
|
import fe, { Children as me, isValidElement as v, useRef as I, useId as be, useState as W, useEffect as Q } from "react";
|
|
4
4
|
import { Button as z } from "../button/index.js";
|
|
5
|
-
import { i as he } from "../../icons-
|
|
6
|
-
import { f as _e, I as ye } from "../../index-
|
|
5
|
+
import { i as he } from "../../icons-Bq3diTRm.js";
|
|
6
|
+
import { f as _e, I as ye } from "../../index-ClZkChEh.js";
|
|
7
7
|
import { List as ge } from "../list/index.js";
|
|
8
|
-
import { S as ve, s as xe, r as ee } from "../../index-
|
|
8
|
+
import { S as ve, s as xe, r as ee } from "../../index-DwzLUapm.js";
|
|
9
9
|
import '../../assets/index39.css';function L(t) {
|
|
10
10
|
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(L).join(" ") : v(t) ? L(t.props.children) : "";
|
|
11
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";require('../../assets/index41.css');var m0=Object.defineProperty;var b0=(n,e,t)=>e in n?m0(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Gt=(n,e,t)=>b0(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),j=require("react"),$s=require("react-dom"),Ur=require("../../classix-5H4IWnMA.cjs"),y0=require("../file/index.cjs"),Ue=require("../button/index.cjs"),_0=require("../dropzone/index.cjs"),ze=require("../icon/index.cjs"),Ws=require("../../index-
|
|
1
|
+
"use strict";require('../../assets/index41.css');var m0=Object.defineProperty;var b0=(n,e,t)=>e in n?m0(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Gt=(n,e,t)=>b0(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),j=require("react"),$s=require("react-dom"),Ur=require("../../classix-5H4IWnMA.cjs"),y0=require("../file/index.cjs"),Ue=require("../button/index.cjs"),_0=require("../dropzone/index.cjs"),ze=require("../icon/index.cjs"),Ws=require("../../index-BcY9DZZ8.cjs"),x0=require("../toolbar/index.cjs");function v0(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const ju=v0(j);function hn(n){return{}}const mu={},w0={},Ia={},It={},tn={},Mn={},nn={},bu={},ii={},Rn={},Bn={},Ge={},Ji={},Xi={},S0={},Pa={},T0={},Da={},C0={},La={},Ma={},zr={},E0={},Ra={},Ba={},Fa={},k0={},N0={},A0={},Hs={},qa={},O0={},ja={},Ua={},I0={},yu={},Zi={},si={},P0={},D0={},mr={},br={},L0={},M0={},R0={},Fe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,B0=Fe&&"documentMode"in document?document.documentMode:null,Pe=Fe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),_t=Fe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$r=!(!Fe||!("InputEvent"in window)||B0)&&"getTargetRanges"in new window.InputEvent("input"),_u=Fe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Xn=Fe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,F0=Fe&&/Android/.test(navigator.userAgent),za=Fe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),q0=Fe&&F0&&za,Qi=Fe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!za,Zn=1,wt=3,Dt=0,$a=1,sn=2,j0=0,U0=1,z0=2,Wr=4,Hr=8,Yi=128,$0=112|(3|Wr|Hr)|Yi,es=1,ts=2,ns=3,rs=4,us=5,is=6,xu=_u||Xn||Qi?" ":"",rt=`
|
|
2
2
|
|
|
3
3
|
`,W0=_t?" ":xu,Wa="֑-߿יִ-﷽ﹰ-ﻼ",Ha="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",H0=new RegExp("^[^"+Ha+"]*["+Wa+"]"),V0=new RegExp("^[^"+Wa+"]*["+Ha+"]"),Lt={bold:1,code:16,highlight:Yi,italic:2,strikethrough:Wr,subscript:32,superscript:64,underline:Hr},G0={directionless:1,unmergeable:2},Vs={center:ts,end:is,justify:rs,left:es,right:ns,start:us},K0={[ts]:"center",[is]:"end",[rs]:"justify",[es]:"left",[ns]:"right",[us]:"start"},J0={normal:0,segmented:2,token:1},X0={[j0]:"normal",[z0]:"segmented",[U0]:"token"};function Z0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var R=Z0(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Vr(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}const Q0=100;let oi=!1,ss=0;function Y0(n){ss=n.timeStamp}function Uu(n,e,t){const r=n.nodeName==="BR",u=e.__lexicalLineBreak;return u&&(n===u||r&&n.previousSibling===u)||r&&wu(n,t)!==void 0}function ef(n,e,t){const r=Oe(t._window);let u=null,i=null;r!==null&&r.anchorNode===n&&(u=r.anchorOffset,i=r.focusOffset);const s=n.nodeValue;s!==null&&fs(e,s,u,i,!1)}function tf(n,e,t){if(D(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===wt&&t.isAttached()}function nf(n,e,t,r){for(let u=n;u&&!bf(u);u=Yn(u)){const i=wu(u,e);if(i!==void 0){const s=he(i,t);if(s)return re(s)?void 0:[u,s]}else if(u===r)return[r,el(t)]}}function Va(n,e,t){oi=!0;const r=performance.now()-ss>Q0;try{Ce(n,()=>{const u=q()||function(c){return c.getEditorState().read(()=>{const d=q();return d!==null?d.clone():null})}(n),i=new Map,s=n.getRootElement(),o=n._editorState,a=n._blockCursorElement;let l=!1,f="";for(let c=0;c<e.length;c++){const d=e[c],p=d.type,m=d.target,g=nf(m,n,o,s);if(!g)continue;const[y,b]=g;if(p==="characterData")r&&M(b)&&tf(u,m,b)&&ef(m,b,n);else if(p==="childList"){l=!0;const v=d.addedNodes;for(let S=0;S<v.length;S++){const I=v[S],T=Qa(I),P=I.parentNode;if(P!=null&&I!==a&&T===null&&!Uu(I,P,n)){if(_t){const $=I.innerText||I.nodeValue;$&&(f+=$)}P.removeChild(I)}}const w=d.removedNodes,C=w.length;if(C>0){let S=0;for(let I=0;I<C;I++){const T=w[I];(Uu(T,m,n)||a===T)&&(m.appendChild(T),S++)}C!==S&&i.set(y,b)}}}if(i.size>0)for(const[c,d]of i)d.reconcileObservedMutation(c,n);const h=t.takeRecords();if(h.length>0){for(let c=0;c<h.length;c++){const d=h[c],p=d.addedNodes,m=d.target;for(let g=0;g<p.length;g++){const y=p[g],b=y.parentNode;b==null||y.nodeName!=="BR"||Uu(y,m,n)||b.removeChild(y)}}t.takeRecords()}u!==null&&(l&&(u.dirty=!0,Ae(u)),_t&&ul(n)&&u.insertRawText(f))})}finally{oi=!1}}function Ga(n){const e=n._observer;e!==null&&Va(n,e.takeRecords(),e)}function Ka(n){(function(e){ss===0&&Tu(e).addEventListener("textInput",Y0,!0)})(n),n._observer=new MutationObserver((e,t)=>{Va(n,e,t)})}function Gs(n,e){const t=n.__mode,r=n.__format,u=n.__style,i=e.__mode,s=e.__format,o=e.__style;return!(t!==null&&t!==i||r!==null&&r!==s||u!==null&&u!==o)}function Ks(n,e){const t=n.mergeWithSibling(e),r=oe()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Js(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&M(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Gs(e,r)){r=Ks(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&M(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Gs(r,t)){r=Ks(r,t);break}break}t.remove()}}else r.remove()}function Ja(n){return Xs(n.anchor),Xs(n.focus),n}function Xs(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,u;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),u=!0):(r=e.getChildAtIndex(t),u=!1),M(r)){n.set(r.__key,u?r.getTextContentSize():0,"text");break}if(!k(r))break;n.set(r.__key,u?r.getChildrenSize():0,"element")}}let rf=1;const uf=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function os(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return re(on(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&vu(e)==null)}function Qn(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!os(e)&&Xa(e)===n}catch{return!1}}function as(n){return n instanceof Au}function Xa(n){let e=n;for(;e!=null;){const t=vu(e);if(as(t))return t;e=Yn(e)}return null}function vu(n){return n?n.__lexicalEditor:null}function At(n){return n.isToken()||n.isSegmented()}function sf(n){return n.nodeType===wt}function Gr(n){let e=n;for(;e!=null;){if(sf(e))return e;e=e.firstChild}return null}function Kr(n,e,t){const r=Lt[e];if(t!==null&&(n&r)==(t&r))return n;let u=n^r;return e==="subscript"?u&=-65:e==="superscript"&&(u&=-33),u}function Za(n){return M(n)||xt(n)||re(n)}function of(n,e){if(e!=null)return void(n.__key=e);ve(),Tl();const t=oe(),r=ot(),u=""+rf++;r._nodeMap.set(u,n),k(n)?t._dirtyElements.set(u,!0):t._dirtyLeaves.add(u),t._cloneNotNeeded.add(u),t._dirtyType=$a,n.__key=u}function Pt(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),u=n.getPreviousSibling(),i=n.getNextSibling();if(u===null)if(i!==null){const s=i.getWritable();r.__first=i.__key,s.__prev=null}else r.__first=null;else{const s=u.getWritable();if(i!==null){const o=i.getWritable();o.__prev=s.__key,s.__next=o.__key}else s.__next=null;t.__prev=null}if(i===null)if(u!==null){const s=u.getWritable();r.__last=u.__key,s.__next=null}else r.__last=null;else{const s=i.getWritable();if(u!==null){const o=u.getWritable();o.__next=s.__key,s.__prev=o.__key}else s.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function Jr(n){Tl();const e=n.getLatest(),t=e.__parent,r=ot(),u=oe(),i=r._nodeMap,s=u._dirtyElements;t!==null&&function(a,l,f){let h=a;for(;h!==null;){if(f.has(h))return;const c=l.get(h);if(c===void 0)break;f.set(h,!1),h=c.__parent}}(t,i,s);const o=e.__key;u._dirtyType=$a,k(n)?s.set(o,!0):u._dirtyLeaves.add(o)}function me(n){ve();const e=oe(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=he(t);r!==null&&r.getWritable()}if(n!==null){const r=he(n);r!==null&&r.getWritable()}}}function gt(){return ur()?null:oe()._compositionKey}function he(n,e){const t=(e||ot())._nodeMap.get(n);return t===void 0?null:t}function Qa(n,e){const t=wu(n,oe());return t!==void 0?he(t,e):null}function wu(n,e){return n[`__lexicalKey_${e._key}`]}function on(n,e){let t=n;for(;t!=null;){const r=Qa(t,e);if(r!==null)return r;t=Yn(t)}return null}function Ya(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Zs(n){return n.read(()=>ce().getTextContent())}function ce(){return el(ot())}function el(n){return n._nodeMap.get("root")}function Ae(n){ve();const e=ot();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Yt(n){const e=oe(),t=function(r,u){let i=r;for(;i!=null;){const s=wu(i,u);if(s!==void 0)return s;i=Yn(i)}return null}(n,e);return t===null?n===e.getRootElement()?he("root"):null:he(t)}function Qs(n,e){return e?n.getTextContentSize():0}function tl(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function ls(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function nl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function rl(n){return n.nodeType===wt?n.nodeValue:null}function cs(n,e,t){const r=Oe(e._window);if(r===null)return;const u=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(u!==null){let o=rl(u);const a=on(u);if(o!==null&&M(a)){if(o===xu&&t){const l=t.length;o=t,i=l,s=l}o!==null&&fs(a,o,i,s,n)}}}function fs(n,e,t,r,u){let i=n;if(i.isAttached()&&(u||!i.isDirty())){const s=i.isComposing();let o=e;(s||u)&&e[e.length-1]===xu&&(o=e.slice(0,-1));const a=i.getTextContent();if(u||o!==a){if(o===""){if(me(null),_u||Xn||Qi)i.remove();else{const m=oe();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const l=i.getParent(),f=rr(),h=i.getTextContentSize(),c=gt(),d=i.getKey();if(i.isToken()||c!==null&&d===c&&!s||D(f)&&(l!==null&&!l.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===n.__key&&f.focus.offset===h&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const p=q();if(!D(p)||t===null||r===null)return void i.setTextContent(o);if(p.setTextNodeRange(i,t,i,r),i.isSegmented()){const m=le(i.getTextContent());i.replace(m),i=m}i.setTextContent(o)}}}function af(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),u=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||u||function(i){const s=i.getPreviousSibling();return(M(s)||k(s)&&s.isInline())&&!s.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||u)}function Ys(n){return n==="ArrowLeft"}function eo(n){return n==="ArrowRight"}function En(n,e){return Pe?n:e}function to(n){return n==="Enter"}function _n(n){return n==="Backspace"}function xn(n){return n==="Delete"}function no(n,e,t){return n.toLowerCase()==="a"&&En(e,t)}function lf(){const n=ce();Ae(Ja(n.select(0,n.getChildrenSize())))}function Nn(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const u=n[e];if(typeof u=="string"){const i=Vr(u);return t[e]=i,i}return u}function ds(n,e,t,r,u){if(t.size===0)return;const i=r.__type,s=r.__key,o=e.get(i);o===void 0&&R(33,i);const a=o.klass;let l=n.get(a);l===void 0&&(l=new Map,n.set(a,l));const f=l.get(s),h=f==="destroyed"&&u==="created";(f===void 0||h)&&l.set(s,h?"updated":u)}function ro(n,e,t){const r=n.getParent();let u=t,i=n;return r!==null&&(e&&t===0?(u=i.getIndexWithinParent(),i=r):e||t!==i.getChildrenSize()||(u=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(e?u-1:u)}function Fn(n,e){const t=n.offset;if(n.type==="element")return ro(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const u=e?r.getPreviousSibling():r.getNextSibling();return u===null?ro(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):u}}return null}function ul(n){const e=Tu(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function F(n,e,t){return kl(n,e,t)}function Su(n){return!ye(n)&&!n.isLastChild()&&!n.isInline()}function Xr(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&R(75,e),t}function Yn(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function An(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Tu(n){const e=n._window;return e===null&&R(78),e}function cf(n){let e=n.getParentOrThrow();for(;e!==null;){if(ut(e))return e;e=e.getParentOrThrow()}return e}function ut(n){return ye(n)||k(n)&&n.isShadowRoot()}function St(n){const e=oe(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&R(200,n.constructor.name,t);const{replace:u,replaceWithKlass:i}=r;if(u!==null){const s=u(n),o=s.constructor;return i!==null?s instanceof i||R(201,i.name,i.getType(),o.name,o.getType(),n.constructor.name,t):s instanceof n.constructor&&o!==n.constructor||R(202,o.name,o.getType(),n.constructor.name,t),s.__key===n.__key&&R(203,n.constructor.name,t,o.name,o.getType()),s}return n}function zu(n,e){!ye(n.getParent())||k(e)||re(e)||R(99)}function $u(n){return(re(n)||k(n)&&!n.canBeEmpty())&&!n.isInline()}function hs(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function ff(n,e,t){let r=n._blockCursorElement;if(D(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const u=t.anchor,i=u.getNode(),s=u.offset;let o=!1,a=null;if(s===i.getChildrenSize())$u(i.getChildAtIndex(s-1))&&(o=!0);else{const l=i.getChildAtIndex(s);if(l!==null&&$u(l)){const f=l.getPreviousSibling();(f===null||$u(f))&&(o=!0,a=n.getElementByKey(l.__key))}}if(o){const l=n.getElementByKey(i.__key);return r===null&&(n._blockCursorElement=r=function(f){const h=f.theme,c=document.createElement("div");c.contentEditable="false",c.setAttribute("data-lexical-cursor","true");let d=h.blockCursor;if(d!==void 0){if(typeof d=="string"){const p=Vr(d);d=h.blockCursor=p}d!==void 0&&c.classList.add(...d)}return c}(n._config)),e.style.caretColor="transparent",void(a===null?l.appendChild(r):l.insertBefore(r,a))}}r!==null&&hs(r,n,e)}function Oe(n){return Fe?(n||window).getSelection():null}function df(n){return Ut(n)&&n.tagName==="A"}function Ut(n){return n.nodeType===1}function uo(n){return n.nodeType===11}function ai(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function Zr(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function ht(n){if(re(n)&&!n.isInline())return!0;if(!k(n)||ut(n))return!1;const e=n.getFirstChild(),t=e===null||xt(e)||M(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function vn(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function hf(){return oe()}const io=new WeakMap,pf=new Map;function gf(n){if(!n._readOnly&&n.isEmpty())return pf;n._readOnly||R(192);let e=io.get(n);if(!e){e=new Map,io.set(n,e);for(const[t,r]of n._nodeMap){const u=r.__type;let i=e.get(u);i||(i=new Map,e.set(u,i)),i.set(t,r)}}return e}function ps(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function mf(n,e){const t=(parseInt(n.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function bf(n){return n.__lexicalUnmanaged===!0}function il(n,e,t,r,u,i){let s=n.getFirstChild();for(;s!==null;){const o=s.__key;s.__parent===e&&(k(s)&&il(s,o,t,r,u,i),t.has(o)||i.delete(o),u.push(o)),s=s.getNextSibling()}}let vt,_e,qn,Cu,li,ci,Mt,Be,fi,jn,de="",be="",We=null,De="",tt="",sl=!1,Un=!1,Lr=null;function Qr(n,e){const t=Mt.get(n);if(e!==null){const r=pi(n);r.parentNode===e&&e.removeChild(r)}if(Be.has(n)||_e._keyToDOMMap.delete(n),k(t)){const r=eu(t,Mt);di(r,0,r.length-1,null)}t!==void 0&&ds(jn,qn,Cu,t,"destroyed")}function di(n,e,t,r){let u=e;for(;u<=t;++u){const i=n[u];i!==void 0&&Qr(i,r)}}function Nt(n,e){n.setProperty("text-align",e)}const yf="40px";function ol(n,e){const t=vt.theme.indent;if(typeof t=="string"){const u=n.classList.contains(t);e>0&&!u?n.classList.add(t):e<1&&u&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||yf;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function al(n,e){const t=n.style;e===0?Nt(t,""):e===es?Nt(t,"left"):e===ts?Nt(t,"center"):e===ns?Nt(t,"right"):e===rs?Nt(t,"justify"):e===us?Nt(t,"start"):e===is&&Nt(t,"end")}function Yr(n,e){const t=Be.get(n);t===void 0&&R(60);const r=t.createDOM(vt,_e);if(function(u,i,s){const o=s._keyToDOMMap;(function(a,l,f){a[`__lexicalKey_${l._key}`]=f})(i,s,u),o.set(u,i)}(n,r,_e),M(t)?r.setAttribute("data-lexical-text","true"):re(t)&&r.setAttribute("data-lexical-decorator","true"),k(t)){const u=t.__indent,i=t.__size;if(u!==0&&ol(r,u),i!==0){const o=i-1;(function(a,l,f,h){const c=be;be="",hi(a,f,0,l,f.getDOMSlot(h)),cl(f,h),be=c})(eu(t,Be),o,t,r)}const s=t.__format;s!==0&&al(r,s),t.isInline()||ll(null,t,r),Su(t)&&(de+=rt,tt+=rt)}else{const u=t.getTextContent();if(re(t)){const i=t.decorate(_e,vt);i!==null&&fl(n,i),r.contentEditable="false"}else M(t)&&(t.isDirectionless()||(be+=u));de+=u,tt+=u}return e!==null&&e.insertChild(r),ds(jn,qn,Cu,t,"created"),r}function hi(n,e,t,r,u){const i=de;de="";let s=t;for(;s<=r;++s){Yr(n[s],u);const o=Be.get(n[s]);o!==null&&M(o)&&(We===null&&(We=o.getFormat()),De===""&&(De=o.getStyle()))}Su(e)&&(de+=rt),u.element.__lexicalTextContent=de,de=i+de}function so(n,e){if(n){const t=n.__last;if(t){const r=e.get(t);if(r)return xt(r)?"line-break":re(r)&&r.isInline()?"decorator":null}return"empty"}return null}function ll(n,e,t){const r=so(n,Mt),u=so(e,Be);r!==u&&e.getDOMSlot(t).setManagedLineBreak(u)}function cl(n,e){const t=e.__lexicalDirTextContent||"",r=e.__lexicalDir||"";if(t!==be||r!==Lr){const i=be==="",s=i?Lr:(u=be,H0.test(u)?"rtl":V0.test(u)?"ltr":null);if(s!==r){const o=e.classList,a=vt.theme;let l=r!==null?a[r]:void 0,f=s!==null?a[s]:void 0;if(l!==void 0){if(typeof l=="string"){const h=Vr(l);l=a[r]=h}o.remove(...l)}if(s===null||i&&s==="ltr")e.removeAttribute("dir");else{if(f!==void 0){if(typeof f=="string"){const h=Vr(f);f=a[s]=h}f!==void 0&&o.add(...f)}e.dir=s}Un||(n.getWritable().__dir=s)}Lr=s,e.__lexicalDirTextContent=be,e.__lexicalDir=s}var u}function _f(n,e,t){const r=be;var u;be="",We=null,De="",function(i,s,o){const a=de,l=i.__size,f=s.__size;de="";const h=o.element;if(l===1&&f===1){const c=i.__first,d=s.__first;if(c===d)kn(c,h);else{const m=pi(c),g=Yr(d,null);try{h.replaceChild(g,m)}catch(y){if(typeof y=="object"&&y!=null){const b=`${y.toString()} Parent: ${h.tagName}, new child: {tag: ${g.tagName} key: ${d}}, old child: {tag: ${m.tagName}, key: ${c}}.`;throw new Error(b)}throw y}Qr(c,null)}const p=Be.get(d);M(p)&&(We===null&&(We=p.getFormat()),De===""&&(De=p.getStyle()))}else{const c=eu(i,Mt),d=eu(s,Be);if(c.length!==l&&R(227),d.length!==f&&R(228),l===0)f!==0&&hi(d,s,0,f-1,o);else if(f===0){if(l!==0){const p=o.after==null&&o.before==null&&o.element.__lexicalLineBreak==null;di(c,0,l-1,p?null:h),p&&(h.textContent="")}}else(function(p,m,g,y,b,v){const w=y-1,C=b-1;let S,I,T=v.getFirstChild(),P=0,$=0;for(;P<=w&&$<=C;){const N=m[P],B=g[$];if(N===B)T=Wu(kn(B,v.element)),P++,$++;else{S===void 0&&(S=new Set(m)),I===void 0&&(I=new Set(g));const O=I.has(N),A=S.has(B);if(O)if(A){const U=Xr(_e,B);U===T?T=Wu(kn(B,v.element)):(v.withBefore(T).insertChild(U),kn(B,v.element)),P++,$++}else Yr(B,v.withBefore(T)),$++;else T=Wu(pi(N)),Qr(N,v.element),P++}const x=Be.get(B);x!==null&&M(x)&&(We===null&&(We=x.getFormat()),De===""&&(De=x.getStyle()))}const _=P>w,E=$>C;if(_&&!E){const N=g[C+1],B=N===void 0?null:_e.getElementByKey(N);hi(g,p,$,C,v.withBefore(B))}else E&&!_&&di(m,P,w,v.element)})(s,c,d,l,f,o)}Su(s)&&(de+=rt),h.__lexicalTextContent=de,de=a+de}(n,e,e.getDOMSlot(t)),cl(e,t),Bt(u=e)&&We!=null&&We!==u.__textFormat&&!Un&&(u.setTextFormat(We),u.setTextStyle(De)),function(i){Bt(i)&&De!==""&&De!==i.__textStyle&&!Un&&i.setTextStyle(De)}(e),be=r}function eu(n,e){const t=[];let r=n.__first;for(;r!==null;){const u=e.get(r);u===void 0&&R(101),t.push(r),r=u.__next}return t}function kn(n,e){const t=Mt.get(n);let r=Be.get(n);t!==void 0&&r!==void 0||R(61);const u=sl||ci.has(n)||li.has(n),i=Xr(_e,n);if(t===r&&!u){if(k(t)){const s=i.__lexicalTextContent;s!==void 0&&(de+=s,tt+=s);const o=i.__lexicalDirTextContent;o!==void 0&&(be+=o)}else{const s=t.getTextContent();M(t)&&!t.isDirectionless()&&(be+=s),tt+=s,de+=s}return i}if(t!==r&&u&&ds(jn,qn,Cu,r,"updated"),r.updateDOM(t,i,vt)){const s=Yr(n,null);return e===null&&R(62),e.replaceChild(s,i),Qr(n,null),s}if(k(t)&&k(r)){const s=r.__indent;s!==t.__indent&&ol(i,s);const o=r.__format;o!==t.__format&&al(i,o),u&&(_f(t,r,i),ye(r)||r.isInline()||ll(t,r,i)),Su(r)&&(de+=rt,tt+=rt)}else{const s=r.getTextContent();if(re(r)){const o=r.decorate(_e,vt);o!==null&&fl(n,o)}else M(r)&&!r.isDirectionless()&&(be+=s);de+=s,tt+=s}if(!Un&&ye(r)&&r.__cachedText!==tt){const s=r.getWritable();s.__cachedText=tt,r=s}return i}function fl(n,e){let t=_e._pendingDecorators;const r=_e._decorators;if(t===null){if(r[n]===e)return;t=Ya(_e)}t[n]=e}function Wu(n){let e=n.nextSibling;return e!==null&&e===_e._blockCursorElement&&(e=e.nextSibling),e}function xf(n,e,t,r,u,i){de="",tt="",be="",sl=r===sn,Lr=null,_e=t,vt=t._config,qn=t._nodes,Cu=_e._listeners.mutation,li=u,ci=i,Mt=n._nodeMap,Be=e._nodeMap,Un=e._readOnly,fi=new Map(t._keyToDOMMap);const s=new Map;return jn=s,kn("root",null),_e=void 0,qn=void 0,li=void 0,ci=void 0,Mt=void 0,Be=void 0,vt=void 0,fi=void 0,jn=void 0,s}function pi(n){const e=fi.get(n);return e===void 0&&R(75,n),e}const Ze=Object.freeze({}),gi=30,mi=[["keydown",function(n,e){if(On=n.timeStamp,dl=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:u,metaKey:i,altKey:s}=n;if(!F(e,S0,n)&&t!=null){if(function(o,a,l,f){return eo(o)&&!a&&!f&&!l}(t,u,s,i))F(e,Pa,n);else if(function(o,a,l,f,h){return eo(o)&&!f&&!l&&(a||h)}(t,u,r,s,i))F(e,T0,n);else if(function(o,a,l,f){return Ys(o)&&!a&&!f&&!l}(t,u,s,i))F(e,Da,n);else if(function(o,a,l,f,h){return Ys(o)&&!f&&!l&&(a||h)}(t,u,r,s,i))F(e,C0,n);else if(function(o,a,l){return function(f){return f==="ArrowUp"}(o)&&!a&&!l}(t,u,i))F(e,La,n);else if(function(o,a,l){return function(f){return f==="ArrowDown"}(o)&&!a&&!l}(t,u,i))F(e,Ma,n);else if(function(o,a){return to(o)&&a}(t,r))In=!0,F(e,zr,n);else if(function(o){return o===" "}(t))F(e,E0,n);else if(function(o,a){return Pe&&a&&o.toLowerCase()==="o"}(t,u))n.preventDefault(),In=!0,F(e,tn,!0);else if(function(o,a){return to(o)&&!a}(t,r))In=!1,F(e,zr,n);else if(function(o,a,l,f){return Pe?!a&&!l&&(_n(o)||o.toLowerCase()==="h"&&f):!(f||a||l)&&_n(o)}(t,s,i,u))_n(t)?F(e,Ra,n):(n.preventDefault(),F(e,It,!0));else if(function(o){return o==="Escape"}(t))F(e,Ba,n);else if(function(o,a,l,f,h){return Pe?!(l||f||h)&&(xn(o)||o.toLowerCase()==="d"&&a):!(a||f||h)&&xn(o)}(t,u,r,s,i))xn(t)?F(e,Fa,n):(n.preventDefault(),F(e,It,!1));else if(function(o,a,l){return _n(o)&&(Pe?a:l)}(t,s,u))n.preventDefault(),F(e,Rn,!0);else if(function(o,a,l){return xn(o)&&(Pe?a:l)}(t,s,u))n.preventDefault(),F(e,Rn,!1);else if(function(o,a){return Pe&&a&&_n(o)}(t,i))n.preventDefault(),F(e,Bn,!0);else if(function(o,a){return Pe&&a&&xn(o)}(t,i))n.preventDefault(),F(e,Bn,!1);else if(function(o,a,l,f){return o.toLowerCase()==="b"&&!a&&En(l,f)}(t,s,i,u))n.preventDefault(),F(e,Ge,"bold");else if(function(o,a,l,f){return o.toLowerCase()==="u"&&!a&&En(l,f)}(t,s,i,u))n.preventDefault(),F(e,Ge,"underline");else if(function(o,a,l,f){return o.toLowerCase()==="i"&&!a&&En(l,f)}(t,s,i,u))n.preventDefault(),F(e,Ge,"italic");else if(function(o,a,l,f){return o==="Tab"&&!a&&!l&&!f}(t,s,u,i))F(e,k0,n);else if(function(o,a,l,f){return o.toLowerCase()==="z"&&!a&&En(l,f)}(t,r,i,u))n.preventDefault(),F(e,Ji,void 0);else if(function(o,a,l,f){return Pe?o.toLowerCase()==="z"&&l&&a:o.toLowerCase()==="y"&&f||o.toLowerCase()==="z"&&f&&a}(t,r,i,u))n.preventDefault(),F(e,Xi,void 0);else{const o=e._editorState._selection;o===null||D(o)?!_t&&no(t,i,u)&&(n.preventDefault(),F(e,si,n)):function(a,l,f,h){return!l&&a.toLowerCase()==="c"&&(Pe?f:h)}(t,r,i,u)?(n.preventDefault(),F(e,yu,n)):function(a,l,f,h){return!l&&a.toLowerCase()==="x"&&(Pe?f:h)}(t,r,i,u)?(n.preventDefault(),F(e,Zi,n)):no(t,i,u)&&(n.preventDefault(),F(e,si,n))}(function(o,a,l,f){return o||a||l||f})(u,r,s,i)&&F(e,R0,n)}}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&Ce(e,()=>{re(on(t))||(yi=!0)})}],["compositionstart",function(n,e){Ce(e,()=>{const t=q();if(D(t)&&!e.isComposing()){const r=t.anchor,u=t.anchor.getNode();me(r.key),(n.timeStamp<On+gi||r.type==="element"||!t.isCollapsed()||u.getFormat()!==t.format||M(u)&&u.getStyle()!==t.style)&&F(e,nn,W0)}})}],["compositionend",function(n,e){_t?wn=!0:Ce(e,()=>{Hu(e,n.data)})}],["input",function(n,e){n.stopPropagation(),Ce(e,()=>{const t=q(),r=n.data,u=ml(n);if(r!=null&&D(t)&&gl(t,u,r,n.timeStamp,!1)){wn&&(Hu(e,r),wn=!1);const i=t.anchor.getNode(),s=Oe(e._window);if(s===null)return;const o=t.isBackward(),a=o?t.anchor.offset:t.focus.offset,l=o?t.focus.offset:t.anchor.offset;$r&&!t.isCollapsed()&&M(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===rl(s.anchorNode)||F(e,nn,r);const f=r.length;_t&&f>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=f),_u||Xn||Qi||!e.isComposing()||(On=0,me(null))}else cs(!1,e,r!==null?r:void 0),wn&&(Hu(e,r||void 0),wn=!1);ve(),Ga(oe())}),Xt=null}],["click",function(n,e){Ce(e,()=>{const t=q(),r=Oe(e._window),u=rr();if(r){if(D(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!ye(s)&&ce().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&u!==null&&t.is(u)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&s!==t.focus.getNode()&&(k(s)?s.select(0):s.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const i=r.anchorNode;if(i!==null){const s=i.nodeType;(s===Zn||s===wt)&&Ae(ms(u,r,e,n))}}}F(e,Ia,n)})}],["cut",Ze],["copy",Ze],["dragstart",Ze],["dragover",Ze],["dragend",Ze],["paste",Ze],["focus",Ze],["blur",Ze],["drop",Ze]];$r&&mi.push(["beforeinput",(n,e)=>function(t,r){const u=t.inputType,i=ml(t);u==="deleteCompositionText"||_t&&ul(r)||u!=="insertCompositionText"&&Ce(r,()=>{const s=q();if(u==="deleteContentBackward"){if(s===null){const d=rr();if(!D(d))return;Ae(d.clone())}if(D(s)){const d=s.anchor.key===s.focus.key;if(o=t.timeStamp,dl==="MediaLast"&&o<On+gi&&r.isComposing()&&d){if(me(null),On=0,setTimeout(()=>{Ce(r,()=>{me(null)})},gi),D(s)){const p=s.anchor.getNode();p.markDirty(),s.format=p.getFormat(),M(p)||R(142),s.style=p.getStyle()}}else{me(null),t.preventDefault();const p=s.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),y=s.anchor.offset===0&&s.focus.offset===m.length;q0&&d&&!y&&g||F(r,It,!0)}return}}var o;if(!D(s))return;const a=t.data;Xt!==null&&cs(!1,r,Xt),s.dirty&&Xt===null||!s.isCollapsed()||ye(s.anchor.getNode())||i===null||s.applyDOMRange(i),Xt=null;const l=s.anchor,f=s.focus,h=l.getNode(),c=f.getNode();if(u!=="insertText"&&u!=="insertTranspose")switch(t.preventDefault(),u){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":F(r,nn,t);break;case"insertFromComposition":me(null),F(r,nn,t);break;case"insertLineBreak":me(null),F(r,tn,!1);break;case"insertParagraph":me(null),In&&!Xn?(In=!1,F(r,tn,!1)):F(r,Mn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":F(r,bu,t);break;case"deleteByComposition":(function(d,p){return d!==p||k(d)||k(p)||!d.isToken()||!p.isToken()})(h,c)&&F(r,ii,t);break;case"deleteByDrag":case"deleteByCut":F(r,ii,t);break;case"deleteContent":F(r,It,!1);break;case"deleteWordBackward":F(r,Rn,!0);break;case"deleteWordForward":F(r,Rn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":F(r,Bn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":F(r,Bn,!1);break;case"formatStrikeThrough":F(r,Ge,"strikethrough");break;case"formatBold":F(r,Ge,"bold");break;case"formatItalic":F(r,Ge,"italic");break;case"formatUnderline":F(r,Ge,"underline");break;case"historyUndo":F(r,Ji,void 0);break;case"historyRedo":F(r,Xi,void 0)}else{if(a===`
|
|
4
4
|
`)t.preventDefault(),F(r,tn,!1);else if(a===rt)t.preventDefault(),F(r,Mn,void 0);else if(a==null&&t.dataTransfer){const d=t.dataTransfer.getData("text/plain");t.preventDefault(),s.insertRawText(d)}else a!=null&&gl(s,i,a,t.timeStamp,!0)?(t.preventDefault(),F(r,nn,a)):Xt=a;hl=t.timeStamp}})}(n,e)]);let On=0,dl=null,hl=0,Xt=null;const tu=new WeakMap;let bi=!1,yi=!1,In=!1,wn=!1,pl=[0,"",0,"root",0];function gl(n,e,t,r,u){const i=n.anchor,s=n.focus,o=i.getNode(),a=oe(),l=Oe(a._window),f=l!==null?l.anchorNode:null,h=i.key,c=a.getElementByKey(h),d=t.length;return h!==s.key||!M(o)||(!u&&(!$r||hl<r+50)||o.isDirty()&&d<2||tl(t))&&i.offset!==s.offset&&!o.isComposing()||At(o)||o.isDirty()&&d>1||(u||!$r)&&c!==null&&!o.isComposing()&&f!==Gr(c)||l!==null&&e!==null&&(!e.collapsed||e.startContainer!==l.anchorNode||e.startOffset!==l.anchorOffset)||o.getFormat()!==n.format||o.getStyle()!==n.style||af(n,o)}function oo(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===wt&&e!==0&&e!==n.nodeValue.length}function ao(n,e,t){const{anchorNode:r,anchorOffset:u,focusNode:i,focusOffset:s}=n;bi&&(bi=!1,oo(r,u)&&oo(i,s))||Ce(e,()=>{if(!t)return void Ae(null);if(!Qn(e,r,i))return;const o=q();if(D(o)){const a=o.anchor,l=a.getNode();if(o.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(o.dirty=!0);const f=Tu(e).event,h=f?f.timeStamp:performance.now(),[c,d,p,m,g]=pl,y=ce(),b=e.isComposing()===!1&&y.getTextContent()==="";if(h<g+200&&a.offset===p&&a.key===m)o.format=c,o.style=d;else if(a.type==="text")M(l)||R(141),o.format=l.getFormat(),o.style=l.getStyle();else if(a.type==="element"&&!b){const v=a.getNode();o.style="",v instanceof pn&&v.getChildrenSize()===0?(o.format=v.getTextFormat(),o.style=v.getTextStyle()):o.format=0}}else{const f=a.key,h=o.focus.key,c=o.getNodes(),d=c.length,p=o.isBackward(),m=p?s:u,g=p?u:s,y=p?h:f,b=p?f:h;let v=$0,w=!1;for(let C=0;C<d;C++){const S=c[C],I=S.getTextContentSize();if(M(S)&&I!==0&&!(C===0&&S.__key===y&&m===I||C===d-1&&S.__key===b&&g===0)&&(w=!0,v&=S.getFormat(),v===0))break}o.format=w?v:0}}F(e,mu,void 0)})}function ml(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Hu(n,e){const t=n._compositionKey;if(me(null),t!==null&&e!=null){if(e===""){const r=he(t),u=Gr(n.getElementByKey(t));return void(u!==null&&u.nodeValue!==null&&M(r)&&fs(r,u.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
@@ -10,7 +10,7 @@ import { File as I0 } from "../file/index.js";
|
|
|
10
10
|
import { Button as $e } from "../button/index.js";
|
|
11
11
|
import { Dropzone as P0 } from "../dropzone/index.js";
|
|
12
12
|
import { Icon as We } from "../icon/index.js";
|
|
13
|
-
import { I as Xs } from "../../index-
|
|
13
|
+
import { I as Xs } from "../../index-ClZkChEh.js";
|
|
14
14
|
import { Toolbar as D0 } from "../toolbar/index.js";
|
|
15
15
|
function yn(n) {
|
|
16
16
|
return {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index46.css');const m=require("react/jsx-runtime"),r=require("../../classix-5H4IWnMA.cjs"),t=require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index46.css');const m=require("react/jsx-runtime"),r=require("../../classix-5H4IWnMA.cjs"),t=require("../../icons-ovA21Oao.cjs"),l="_icon_ihnm9_1",_="_small_ihnm9_10",g="_medium_ihnm9_15",d="_large_ihnm9_20",u="_danger_ihnm9_25",n={icon:l,small:_,medium:g,large:d,danger:u,"gap-right":"_gap-right_ihnm9_29","gap-left":"_gap-left_ihnm9_33"},h={large:n.large,medium:n.medium,small:n.small},p={danger:n.danger},y=({fill:i,gap:e="none",name:o,size:a="medium",variant:s})=>{const c={maskImage:t.iconSVG(o,i??!1)};return m.jsx("span",{"aria-hidden":"true",className:r.t(e!=="none"&&n[`gap-${e}`],h[a],n.icon,s&&p[s]),style:c,"data-component":"icon"})},I=()=>Object.keys(t.iconPaths);exports.Icon=y;exports.Icons=I;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { t as r } from "../../classix-DG18itHa.js";
|
|
3
|
-
import { i as c, a as l } from "../../icons-
|
|
3
|
+
import { i as c, a as l } from "../../icons-Bq3diTRm.js";
|
|
4
4
|
import '../../assets/index46.css';const _ = "_icon_ihnm9_1", g = "_small_ihnm9_10", d = "_medium_ihnm9_15", h = "_large_ihnm9_20", p = "_danger_ihnm9_25", n = {
|
|
5
5
|
icon: _,
|
|
6
6
|
small: g,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("react");require("../../icons-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("react");require("../../icons-ovA21Oao.cjs");const e=require("../../index-BcY9DZZ8.cjs");require("../../use-touched-D_TJ8wDc.cjs");exports.Input=e.Input;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../classix-DG18itHa.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../../icons-
|
|
5
|
-
import { I as a } from "../../index-
|
|
4
|
+
import "../../icons-Bq3diTRm.js";
|
|
5
|
+
import { I as a } from "../../index-ClZkChEh.js";
|
|
6
6
|
import "../../use-touched-DXIJVVzz.js";
|
|
7
7
|
export {
|
|
8
8
|
a as Input
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index16.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index16.css');const a=require("react/jsx-runtime"),h=require("../../classix-5H4IWnMA.cjs"),p=require("react"),v=require("../button/index.cjs"),g=require("../icon/index.cjs"),j=require("../list/index.cjs"),m=require("../popover/index.cjs"),D="_list_z7awx_3",y="_item_z7awx_15",w="_active_z7awx_38",q="_danger_z7awx_47",f={list:D,item:y,active:w,danger:q};function k(o){return[...o].sort((r,c)=>+!!r.isDanger-+!!c.isDanger)}const _=({itemRefs:o,items:r,menuAccessibleLabel:c,onKeyDown:i,onSelect:l,usesMenuSemantics:u=!1})=>a.jsx(j.List,{"aria-label":c,className:f.list,onKeyDown:i,role:u?"menu":void 0,"data-component":"menulist",children:k(r).map((e,t)=>a.jsx("li",{role:u?"none":void 0,children:a.jsxs(v.Button,{"aria-current":e.isActive?"true":void 0,"aria-label":e.accessibleLabel,className:h.t(f.item,e.isActive&&f.active,e.isDanger&&f.danger),disabled:e.disabled,onClick:()=>l(e),ref:d=>{o&&(o.current[t]=d)},role:u?"menuitem":void 0,variant:"tertiary",children:[e.icon&&a.jsx(g.Icon,{fill:!0,gap:"right",name:e.icon,size:"small"}),a.jsx("span",{children:e.label})]})},e.id??t))});function z(o){return o.filter(r=>!!(r&&!r.disabled))}const B=({close:o,initialFocus:r,items:c,menuAccessibleLabel:i,onItemSelect:l})=>{const u=p.useRef([]),e=p.useCallback(n=>{const s=z(u.current);if(s.length===0)return;if(n==="first"){s[0].focus();return}if(n==="last"){s[s.length-1].focus();return}const x=s.indexOf(document.activeElement),b=n==="next"?(x+1)%s.length:(x-1+s.length)%s.length;s[b].focus()},[]);p.useEffect(()=>{e(r??"first")},[e,r]);const t=n=>{if(n.key==="ArrowDown"){n.preventDefault(),e("next");return}if(n.key==="ArrowUp"){n.preventDefault(),e("previous");return}if(n.key==="Home"){n.preventDefault(),e("first");return}n.key==="End"&&(n.preventDefault(),e("last"))},d=n=>{var s;(s=n.onSelect)==null||s.call(n),l==null||l(n),o()};return a.jsx(_,{itemRefs:u,items:c,menuAccessibleLabel:i,onKeyDown:t,onSelect:d,usesMenuSemantics:!0,"data-component":"menupanel"})},M=({inline:o=!1,items:r,menuAccessibleLabel:c="Menu",onItemSelect:i,triggerAccessibleLabel:l="Open menu",variant:u="popover"})=>{if(u==="simple"){const e=t=>{var d;(d=t.onSelect)==null||d.call(t),i==null||i(t)};return a.jsx(_,{items:r,menuAccessibleLabel:c,onSelect:e,"data-component":"menu"})}return a.jsx(m.Popover,{inline:o,triggerAccessibleLabel:l,triggerAriaHasPopup:"menu",triggerButtonContent:a.jsx(g.Icon,{name:"dots",size:"medium"}),"data-component":"menu",children:({close:e,initialFocus:t})=>a.jsx(B,{close:e,initialFocus:t,items:r,menuAccessibleLabel:c,onItemSelect:i})})};exports.Menu=M;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/menu/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { Button } from '@/components/button';\nimport { Icon } from '@/components/icon';\nimport { type IconName } from '@/components/icon/icons';\nimport { List } from '@/components/list';\nimport { Popover, type PopoverInitialFocus, type PopoverRenderProps } from '@/components/popover';\n\nimport styles from './styles.module.css';\n\nexport type MenuItem = {\n accessibleLabel?: string;\n disabled?: boolean;\n icon?: IconName;\n id?: string;\n isActive?: boolean;\n isDanger?: boolean;\n label: React.ReactNode;\n onSelect?: () => void;\n};\n\ntype MenuSharedProps = {\n items: MenuItem[];\n menuAccessibleLabel?: string;\n onItemSelect?: (item: MenuItem) => void;\n};\n\ntype PopoverMenuProps = {\n inline?: boolean;\n triggerAccessibleLabel?: string;\n variant?: 'popover';\n};\n\ntype SimpleMenuProps = {\n inline?: never;\n triggerAccessibleLabel?: never;\n variant: 'simple';\n};\n\nexport type MenuProps = MenuSharedProps & (PopoverMenuProps | SimpleMenuProps);\n\ntype MenuFocusTarget = 'first' | 'last' | 'next' | 'previous';\n\ntype MenuListProps = Pick<MenuSharedProps, 'items' | 'menuAccessibleLabel'> & {\n itemRefs?: React.RefObject<Array<HTMLButtonElement | null>>;\n onKeyDown?: React.KeyboardEventHandler<HTMLUListElement>;\n onSelect: (item: MenuItem) => void;\n usesMenuSemantics?: boolean;\n};\n\ntype MenuPanelProps = MenuSharedProps & {\n close: PopoverRenderProps['close'];\n initialFocus?: PopoverInitialFocus;\n};\n\nconst MenuList = ({\n itemRefs,\n items,\n menuAccessibleLabel,\n onKeyDown,\n onSelect,\n usesMenuSemantics = false,\n}: MenuListProps) => (\n <List\n aria-label={menuAccessibleLabel}\n className={styles.list}\n onKeyDown={onKeyDown}\n role={usesMenuSemantics ? 'menu' : undefined}\n >\n {items.map((item, index) => (\n <li\n key={item.id ?? index}\n role={usesMenuSemantics ? 'none' : undefined}\n >\n <Button\n aria-current={item.isActive ? 'true' : undefined}\n aria-label={item.accessibleLabel}\n className={cx(\n styles.item,\n item.isActive && styles.active,\n item.isDanger && styles.danger\n )}\n disabled={item.disabled}\n onClick={() => onSelect(item)}\n ref={(node) => {\n if (itemRefs) itemRefs.current[index] = node;\n }}\n role={usesMenuSemantics ? 'menuitem' : undefined}\n variant='tertiary'\n >\n {item.icon && (\n <Icon\n fill\n gap='right'\n name={item.icon}\n size='small'\n />\n )}\n <span>{item.label}</span>\n </Button>\n </li>\n ))}\n </List>\n);\n\nfunction getFocusableItems(items: Array<HTMLButtonElement | null>) {\n return items.filter((item): item is HTMLButtonElement => Boolean(item && !item.disabled));\n}\n\nconst MenuPanel = ({\n close,\n initialFocus,\n items,\n menuAccessibleLabel,\n onItemSelect,\n}: MenuPanelProps) => {\n const itemRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const focusItem = useCallback((target: MenuFocusTarget) => {\n const focusableItems = getFocusableItems(itemRefs.current);\n\n if (focusableItems.length === 0) {\n return;\n }\n\n if (target === 'first') {\n focusableItems[0].focus();\n return;\n }\n\n if (target === 'last') {\n focusableItems[focusableItems.length - 1].focus();\n return;\n }\n\n const currentIndex = focusableItems.indexOf(document.activeElement as HTMLButtonElement);\n const nextIndex =\n target === 'next'\n ? (currentIndex + 1) % focusableItems.length\n : (currentIndex - 1 + focusableItems.length) % focusableItems.length;\n\n focusableItems[nextIndex].focus();\n }, []);\n\n useEffect(() => {\n focusItem(initialFocus ?? 'first');\n }, [focusItem, initialFocus]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n focusItem('next');\n return;\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n focusItem('previous');\n return;\n }\n\n if (event.key === 'Home') {\n event.preventDefault();\n focusItem('first');\n return;\n }\n\n if (event.key === 'End') {\n event.preventDefault();\n focusItem('last');\n }\n };\n\n const handleItemSelect = (item: MenuItem) => {\n item.onSelect?.();\n onItemSelect?.(item);\n close();\n };\n\n return (\n <MenuList\n itemRefs={itemRefs}\n items={items}\n menuAccessibleLabel={menuAccessibleLabel}\n onKeyDown={handleKeyDown}\n onSelect={handleItemSelect}\n usesMenuSemantics\n />\n );\n};\n\nexport const Menu = ({\n inline = false,\n items,\n menuAccessibleLabel = 'Menu',\n onItemSelect,\n triggerAccessibleLabel = 'Open menu',\n variant = 'popover',\n}: MenuProps) => {\n if (variant === 'simple') {\n const handleItemSelect = (item: MenuItem) => {\n item.onSelect?.();\n onItemSelect?.(item);\n };\n\n return (\n <MenuList\n items={items}\n menuAccessibleLabel={menuAccessibleLabel}\n onSelect={handleItemSelect}\n />\n );\n }\n\n return (\n <Popover\n inline={inline}\n triggerAccessibleLabel={triggerAccessibleLabel}\n triggerAriaHasPopup='menu'\n triggerButtonContent={\n <Icon\n name='dots'\n size='medium'\n />\n }\n >\n {({ close, initialFocus }) => (\n <MenuPanel\n close={close}\n initialFocus={initialFocus}\n items={items}\n menuAccessibleLabel={menuAccessibleLabel}\n onItemSelect={onItemSelect}\n />\n )}\n </Popover>\n );\n};\n"],"names":["
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/menu/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { Button } from '@/components/button';\nimport { Icon } from '@/components/icon';\nimport { type IconName } from '@/components/icon/icons';\nimport { List } from '@/components/list';\nimport { Popover, type PopoverInitialFocus, type PopoverRenderProps } from '@/components/popover';\n\nimport styles from './styles.module.css';\n\nexport type MenuItem = {\n accessibleLabel?: string;\n disabled?: boolean;\n icon?: IconName;\n id?: string;\n isActive?: boolean;\n isDanger?: boolean;\n label: React.ReactNode;\n onSelect?: () => void;\n};\n\ntype MenuSharedProps = {\n items: MenuItem[];\n menuAccessibleLabel?: string;\n onItemSelect?: (item: MenuItem) => void;\n};\n\ntype PopoverMenuProps = {\n inline?: boolean;\n triggerAccessibleLabel?: string;\n variant?: 'popover';\n};\n\ntype SimpleMenuProps = {\n inline?: never;\n triggerAccessibleLabel?: never;\n variant: 'simple';\n};\n\nexport type MenuProps = MenuSharedProps & (PopoverMenuProps | SimpleMenuProps);\n\ntype MenuFocusTarget = 'first' | 'last' | 'next' | 'previous';\n\ntype MenuListProps = Pick<MenuSharedProps, 'items' | 'menuAccessibleLabel'> & {\n itemRefs?: React.RefObject<Array<HTMLButtonElement | null>>;\n onKeyDown?: React.KeyboardEventHandler<HTMLUListElement>;\n onSelect: (item: MenuItem) => void;\n usesMenuSemantics?: boolean;\n};\n\ntype MenuPanelProps = MenuSharedProps & {\n close: PopoverRenderProps['close'];\n initialFocus?: PopoverInitialFocus;\n};\n\nfunction sortDangerItemsLast(items: MenuItem[]) {\n return [...items].sort(\n (left, right) => Number(Boolean(left.isDanger)) - Number(Boolean(right.isDanger))\n );\n}\n\nconst MenuList = ({\n itemRefs,\n items,\n menuAccessibleLabel,\n onKeyDown,\n onSelect,\n usesMenuSemantics = false,\n}: MenuListProps) => (\n <List\n aria-label={menuAccessibleLabel}\n className={styles.list}\n onKeyDown={onKeyDown}\n role={usesMenuSemantics ? 'menu' : undefined}\n >\n {sortDangerItemsLast(items).map((item, index) => (\n <li\n key={item.id ?? index}\n role={usesMenuSemantics ? 'none' : undefined}\n >\n <Button\n aria-current={item.isActive ? 'true' : undefined}\n aria-label={item.accessibleLabel}\n className={cx(\n styles.item,\n item.isActive && styles.active,\n item.isDanger && styles.danger\n )}\n disabled={item.disabled}\n onClick={() => onSelect(item)}\n ref={(node) => {\n if (itemRefs) itemRefs.current[index] = node;\n }}\n role={usesMenuSemantics ? 'menuitem' : undefined}\n variant='tertiary'\n >\n {item.icon && (\n <Icon\n fill\n gap='right'\n name={item.icon}\n size='small'\n />\n )}\n <span>{item.label}</span>\n </Button>\n </li>\n ))}\n </List>\n);\n\nfunction getFocusableItems(items: Array<HTMLButtonElement | null>) {\n return items.filter((item): item is HTMLButtonElement => Boolean(item && !item.disabled));\n}\n\nconst MenuPanel = ({\n close,\n initialFocus,\n items,\n menuAccessibleLabel,\n onItemSelect,\n}: MenuPanelProps) => {\n const itemRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\n const focusItem = useCallback((target: MenuFocusTarget) => {\n const focusableItems = getFocusableItems(itemRefs.current);\n\n if (focusableItems.length === 0) {\n return;\n }\n\n if (target === 'first') {\n focusableItems[0].focus();\n return;\n }\n\n if (target === 'last') {\n focusableItems[focusableItems.length - 1].focus();\n return;\n }\n\n const currentIndex = focusableItems.indexOf(document.activeElement as HTMLButtonElement);\n const nextIndex =\n target === 'next'\n ? (currentIndex + 1) % focusableItems.length\n : (currentIndex - 1 + focusableItems.length) % focusableItems.length;\n\n focusableItems[nextIndex].focus();\n }, []);\n\n useEffect(() => {\n focusItem(initialFocus ?? 'first');\n }, [focusItem, initialFocus]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n focusItem('next');\n return;\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n focusItem('previous');\n return;\n }\n\n if (event.key === 'Home') {\n event.preventDefault();\n focusItem('first');\n return;\n }\n\n if (event.key === 'End') {\n event.preventDefault();\n focusItem('last');\n }\n };\n\n const handleItemSelect = (item: MenuItem) => {\n item.onSelect?.();\n onItemSelect?.(item);\n close();\n };\n\n return (\n <MenuList\n itemRefs={itemRefs}\n items={items}\n menuAccessibleLabel={menuAccessibleLabel}\n onKeyDown={handleKeyDown}\n onSelect={handleItemSelect}\n usesMenuSemantics\n />\n );\n};\n\nexport const Menu = ({\n inline = false,\n items,\n menuAccessibleLabel = 'Menu',\n onItemSelect,\n triggerAccessibleLabel = 'Open menu',\n variant = 'popover',\n}: MenuProps) => {\n if (variant === 'simple') {\n const handleItemSelect = (item: MenuItem) => {\n item.onSelect?.();\n onItemSelect?.(item);\n };\n\n return (\n <MenuList\n items={items}\n menuAccessibleLabel={menuAccessibleLabel}\n onSelect={handleItemSelect}\n />\n );\n }\n\n return (\n <Popover\n inline={inline}\n triggerAccessibleLabel={triggerAccessibleLabel}\n triggerAriaHasPopup='menu'\n triggerButtonContent={\n <Icon\n name='dots'\n size='medium'\n />\n }\n >\n {({ close, initialFocus }) => (\n <MenuPanel\n close={close}\n initialFocus={initialFocus}\n items={items}\n menuAccessibleLabel={menuAccessibleLabel}\n onItemSelect={onItemSelect}\n />\n )}\n </Popover>\n );\n};\n"],"names":["sortDangerItemsLast","items","sort","left","right","Number","Boolean","isDanger","MenuList","itemRefs","menuAccessibleLabel","onKeyDown","onSelect","usesMenuSemantics","jsx","List","styles","list","undefined","map","item","index","jsxs","Button","isActive","accessibleLabel","cx","active","danger","disabled","node","current","icon","Icon","label","id","getFocusableItems","filter","MenuPanel","close","initialFocus","onItemSelect","useRef","focusItem","useCallback","target","focusableItems","length","focus","currentIndex","indexOf","document","activeElement","nextIndex","useEffect","handleKeyDown","event","key","preventDefault","handleItemSelect","Menu","inline","triggerAccessibleLabel","variant","Popover"],"mappings":"oaAwDA,SAASA,EAAoBC,EAAmB,CAC9C,MAAO,CAAC,GAAGA,CAAK,EAAEC,KAChB,CAACC,EAAMC,IAAUC,CAAOC,EAAQH,EAAKI,SAAaF,CAAOC,EAAQF,EAAMG,QACzE,CACF,CAEA,MAAMC,EAAWA,CAAC,CAChBC,SAAAA,EACAR,MAAAA,EACAS,oBAAAA,EACAC,UAAAA,EACAC,SAAAA,EACAC,kBAAAA,EAAoB,EACP,IACbC,EAAAA,IAACC,EAAAA,KAAA,CACC,aAAYL,EACZ,UAAWM,EAAOC,KAClB,UAAAN,EACA,KAAME,EAAoB,OAASK,OAAU,iBAAA,WAE5ClB,SAAAA,EAAoBC,CAAK,EAAEkB,IAAI,CAACC,EAAMC,IACrCP,EAAAA,IAAC,KAAA,CAEC,KAAMD,EAAoB,OAASK,OAEnC,SAAAI,EAAAA,KAACC,EAAAA,OAAA,CACC,eAAcH,EAAKI,SAAW,OAASN,OACvC,aAAYE,EAAKK,gBACjB,UAAWC,EAAAA,EACTV,EAAOI,KACPA,EAAKI,UAAYR,EAAOW,OACxBP,EAAKb,UAAYS,EAAOY,MAC1B,EACA,SAAUR,EAAKS,SACf,QAAS,IAAMjB,EAASQ,CAAI,EAC5B,IAAMU,GAAS,CACTrB,IAAUA,EAASsB,QAAQV,CAAK,EAAIS,EAC1C,EACA,KAAMjB,EAAoB,WAAaK,OACvC,QAAQ,WAEPE,SAAAA,CAAAA,EAAKY,MACJlB,EAAAA,IAACmB,EAAAA,KAAA,CACC,KAAI,GACJ,IAAI,QACJ,KAAMb,EAAKY,KACX,KAAK,OAAA,CAAO,EAGhBlB,EAAAA,IAAC,OAAA,CAAMM,SAAAA,EAAKc,KAAAA,CAAM,CAAA,CAAA,CACpB,CAAA,EA5BKd,EAAKe,IAAMd,CA6BlB,CACD,CAAA,CACH,EAGF,SAASe,EAAkBnC,EAAwC,CACjE,OAAOA,EAAMoC,OAAQjB,GAAoCd,GAAQc,GAAQ,CAACA,EAAKS,SAAS,CAC1F,CAEA,MAAMS,EAAYA,CAAC,CACjBC,MAAAA,EACAC,aAAAA,EACAvC,MAAAA,EACAS,oBAAAA,EACA+B,aAAAA,CACc,IAAM,CACpB,MAAMhC,EAAWiC,EAAAA,OAAwC,EAAE,EAErDC,EAAYC,cAAaC,GAA4B,CACzD,MAAMC,EAAiBV,EAAkB3B,EAASsB,OAAO,EAEzD,GAAIe,EAAeC,SAAW,EAC5B,OAGF,GAAIF,IAAW,QAAS,CACtBC,EAAe,CAAC,EAAEE,MAAAA,EAClB,MACF,CAEA,GAAIH,IAAW,OAAQ,CACrBC,EAAeA,EAAeC,OAAS,CAAC,EAAEC,MAAAA,EAC1C,MACF,CAEA,MAAMC,EAAeH,EAAeI,QAAQC,SAASC,aAAkC,EACjFC,EACJR,IAAW,QACNI,EAAe,GAAKH,EAAeC,QACnCE,EAAe,EAAIH,EAAeC,QAAUD,EAAeC,OAElED,EAAeO,CAAS,EAAEL,MAAAA,CAC5B,EAAG,CAAA,CAAE,EAELM,EAAAA,UAAU,IAAM,CACdX,EAAUH,GAAgB,OAAO,CACnC,EAAG,CAACG,EAAWH,CAAY,CAAC,EAE5B,MAAMe,EAAiBC,GAAiD,CACtE,GAAIA,EAAMC,MAAQ,YAAa,CAC7BD,EAAME,eAAAA,EACNf,EAAU,MAAM,EAChB,MACF,CAEA,GAAIa,EAAMC,MAAQ,UAAW,CAC3BD,EAAME,eAAAA,EACNf,EAAU,UAAU,EACpB,MACF,CAEA,GAAIa,EAAMC,MAAQ,OAAQ,CACxBD,EAAME,eAAAA,EACNf,EAAU,OAAO,EACjB,MACF,CAEIa,EAAMC,MAAQ,QAChBD,EAAME,eAAAA,EACNf,EAAU,MAAM,EAEpB,EAEMgB,EAAoBvC,GAAmB,QAC3CA,EAAAA,EAAKR,WAALQ,MAAAA,EAAAA,KAAAA,GACAqB,GAAAA,MAAAA,EAAerB,GACfmB,EAAAA,CACF,EAEA,OACEzB,EAAAA,IAACN,EAAA,CACC,SAAAC,EACA,MAAAR,EACA,oBAAAS,EACA,UAAW6C,EACX,SAAUI,EACV,kBAAiB,GAAA,iBAAA,WAAA,CAAA,CAGvB,EAEaC,EAAOA,CAAC,CACnBC,OAAAA,EAAS,GACT5D,MAAAA,EACAS,oBAAAA,EAAsB,OACtB+B,aAAAA,EACAqB,uBAAAA,EAAyB,YACzBC,QAAAA,EAAU,SACD,IAAM,CACf,GAAIA,IAAY,SAAU,CACxB,MAAMJ,EAAoBvC,GAAmB,QAC3CA,EAAAA,EAAKR,WAALQ,MAAAA,EAAAA,KAAAA,GACAqB,GAAAA,MAAAA,EAAerB,EACjB,EAEA,aACGZ,EAAA,CACC,MAAAP,EACA,oBAAAS,EACA,SAAUiD,EAAiB,iBAAA,OAAA,CAGjC,CAEA,aACGK,EAAAA,QAAA,CACC,OAAAH,EACA,uBAAAC,EACA,oBAAoB,OACpB,qBACEhD,EAAAA,IAACmB,EAAAA,KAAA,CACC,KAAK,OACL,KAAK,QAAA,GAER,iBAAA,OAEA,SAAA,CAAC,CAAEM,MAAAA,EAAOC,aAAAA,CAAAA,UACRF,EAAA,CACC,MAAAC,EACA,aAAAC,EACA,MAAAvC,EACA,oBAAAS,EACA,aAAA+B,EAA2B,EAGjC,CAEJ"}
|
|
@@ -1,56 +1,60 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import { t as x } from "../../classix-DG18itHa.js";
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { Button as
|
|
3
|
+
import { useRef as D, useCallback as _, useEffect as b } from "react";
|
|
4
|
+
import { Button as w } from "../button/index.js";
|
|
5
5
|
import { Icon as m } from "../icon/index.js";
|
|
6
|
-
import { List as
|
|
6
|
+
import { List as y } from "../list/index.js";
|
|
7
7
|
import { Popover as k } from "../popover/index.js";
|
|
8
|
-
import '../../assets/index16.css';const z = "_list_z7awx_3",
|
|
8
|
+
import '../../assets/index16.css';const z = "_list_z7awx_3", B = "_item_z7awx_15", A = "_active_z7awx_38", N = "_danger_z7awx_47", d = {
|
|
9
9
|
list: z,
|
|
10
|
-
item:
|
|
11
|
-
active:
|
|
12
|
-
danger:
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
menuAccessibleLabel: u,
|
|
17
|
-
onKeyDown: l,
|
|
18
|
-
onSelect: c,
|
|
19
|
-
usesMenuSemantics: i = !1
|
|
20
|
-
}) => /* @__PURE__ */ a(D, { "aria-label": u, className: d.list, onKeyDown: l, role: i ? "menu" : void 0, "data-component": "menulist", children: o.map((e, t) => /* @__PURE__ */ a("li", { role: i ? "none" : void 0, children: /* @__PURE__ */ v(y, { "aria-current": e.isActive ? "true" : void 0, "aria-label": e.accessibleLabel, className: x(d.item, e.isActive && d.active, e.isDanger && d.danger), disabled: e.disabled, onClick: () => c(e), ref: (f) => {
|
|
21
|
-
s && (s.current[t] = f);
|
|
22
|
-
}, role: i ? "menuitem" : void 0, variant: "tertiary", children: [
|
|
23
|
-
e.icon && /* @__PURE__ */ a(m, { fill: !0, gap: "right", name: e.icon, size: "small" }),
|
|
24
|
-
/* @__PURE__ */ a("span", { children: e.label })
|
|
25
|
-
] }) }, e.id ?? t)) });
|
|
26
|
-
function E(s) {
|
|
27
|
-
return s.filter((o) => !!(o && !o.disabled));
|
|
10
|
+
item: B,
|
|
11
|
+
active: A,
|
|
12
|
+
danger: N
|
|
13
|
+
};
|
|
14
|
+
function C(t) {
|
|
15
|
+
return [...t].sort((r, l) => +!!r.isDanger - +!!l.isDanger);
|
|
28
16
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
items: u,
|
|
17
|
+
const g = ({
|
|
18
|
+
itemRefs: t,
|
|
19
|
+
items: r,
|
|
33
20
|
menuAccessibleLabel: l,
|
|
34
|
-
|
|
21
|
+
onKeyDown: i,
|
|
22
|
+
onSelect: u,
|
|
23
|
+
usesMenuSemantics: c = !1
|
|
24
|
+
}) => /* @__PURE__ */ s(y, { "aria-label": l, className: d.list, onKeyDown: i, role: c ? "menu" : void 0, "data-component": "menulist", children: C(r).map((e, a) => /* @__PURE__ */ s("li", { role: c ? "none" : void 0, children: /* @__PURE__ */ v(w, { "aria-current": e.isActive ? "true" : void 0, "aria-label": e.accessibleLabel, className: x(d.item, e.isActive && d.active, e.isDanger && d.danger), disabled: e.disabled, onClick: () => u(e), ref: (f) => {
|
|
25
|
+
t && (t.current[a] = f);
|
|
26
|
+
}, role: c ? "menuitem" : void 0, variant: "tertiary", children: [
|
|
27
|
+
e.icon && /* @__PURE__ */ s(m, { fill: !0, gap: "right", name: e.icon, size: "small" }),
|
|
28
|
+
/* @__PURE__ */ s("span", { children: e.label })
|
|
29
|
+
] }) }, e.id ?? a)) });
|
|
30
|
+
function E(t) {
|
|
31
|
+
return t.filter((r) => !!(r && !r.disabled));
|
|
32
|
+
}
|
|
33
|
+
const K = ({
|
|
34
|
+
close: t,
|
|
35
|
+
initialFocus: r,
|
|
36
|
+
items: l,
|
|
37
|
+
menuAccessibleLabel: i,
|
|
38
|
+
onItemSelect: u
|
|
35
39
|
}) => {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
40
|
+
const c = D([]), e = _((n) => {
|
|
41
|
+
const o = E(c.current);
|
|
42
|
+
if (o.length === 0)
|
|
39
43
|
return;
|
|
40
44
|
if (n === "first") {
|
|
41
|
-
|
|
45
|
+
o[0].focus();
|
|
42
46
|
return;
|
|
43
47
|
}
|
|
44
48
|
if (n === "last") {
|
|
45
|
-
|
|
49
|
+
o[o.length - 1].focus();
|
|
46
50
|
return;
|
|
47
51
|
}
|
|
48
|
-
const p =
|
|
49
|
-
|
|
52
|
+
const p = o.indexOf(document.activeElement), h = n === "next" ? (p + 1) % o.length : (p - 1 + o.length) % o.length;
|
|
53
|
+
o[h].focus();
|
|
50
54
|
}, []);
|
|
51
55
|
return b(() => {
|
|
52
|
-
e(
|
|
53
|
-
}, [e,
|
|
56
|
+
e(r ?? "first");
|
|
57
|
+
}, [e, r]), /* @__PURE__ */ s(g, { itemRefs: c, items: l, menuAccessibleLabel: i, onKeyDown: (n) => {
|
|
54
58
|
if (n.key === "ArrowDown") {
|
|
55
59
|
n.preventDefault(), e("next");
|
|
56
60
|
return;
|
|
@@ -65,24 +69,24 @@ const K = ({
|
|
|
65
69
|
}
|
|
66
70
|
n.key === "End" && (n.preventDefault(), e("last"));
|
|
67
71
|
}, onSelect: (n) => {
|
|
68
|
-
var
|
|
69
|
-
(
|
|
72
|
+
var o;
|
|
73
|
+
(o = n.onSelect) == null || o.call(n), u == null || u(n), t();
|
|
70
74
|
}, usesMenuSemantics: !0, "data-component": "menupanel" });
|
|
71
|
-
},
|
|
72
|
-
inline:
|
|
73
|
-
items:
|
|
74
|
-
menuAccessibleLabel:
|
|
75
|
-
onItemSelect:
|
|
76
|
-
triggerAccessibleLabel:
|
|
77
|
-
variant:
|
|
78
|
-
}) =>
|
|
75
|
+
}, R = ({
|
|
76
|
+
inline: t = !1,
|
|
77
|
+
items: r,
|
|
78
|
+
menuAccessibleLabel: l = "Menu",
|
|
79
|
+
onItemSelect: i,
|
|
80
|
+
triggerAccessibleLabel: u = "Open menu",
|
|
81
|
+
variant: c = "popover"
|
|
82
|
+
}) => c === "simple" ? /* @__PURE__ */ s(g, { items: r, menuAccessibleLabel: l, onSelect: (a) => {
|
|
79
83
|
var f;
|
|
80
|
-
(f =
|
|
81
|
-
}, "data-component": "menu" }) : /* @__PURE__ */
|
|
84
|
+
(f = a.onSelect) == null || f.call(a), i == null || i(a);
|
|
85
|
+
}, "data-component": "menu" }) : /* @__PURE__ */ s(k, { inline: t, triggerAccessibleLabel: u, triggerAriaHasPopup: "menu", triggerButtonContent: /* @__PURE__ */ s(m, { name: "dots", size: "medium" }), "data-component": "menu", children: ({
|
|
82
86
|
close: e,
|
|
83
|
-
initialFocus:
|
|
84
|
-
}) => /* @__PURE__ */
|
|
87
|
+
initialFocus: a
|
|
88
|
+
}) => /* @__PURE__ */ s(K, { close: e, initialFocus: a, items: r, menuAccessibleLabel: l, onItemSelect: i }) });
|
|
85
89
|
export {
|
|
86
|
-
|
|
90
|
+
R as Menu
|
|
87
91
|
};
|
|
88
92
|
//# sourceMappingURL=index.js.map
|