@namroodinc/liquid-editorial 0.6.3 → 0.6.5
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 +74 -2
- package/UPGRADING.md +128 -0
- package/dist/chunks/{Avatar-C1q2AUD-.js → Avatar-BtblwihO.js} +2 -2
- package/dist/chunks/{Avatar-C1q2AUD-.js.map → Avatar-BtblwihO.js.map} +1 -1
- package/dist/chunks/{Avatar-BTKqaJLP.cjs → Avatar-C9ublbzK.cjs} +2 -2
- package/dist/chunks/{Avatar-BTKqaJLP.cjs.map → Avatar-C9ublbzK.cjs.map} +1 -1
- package/dist/chunks/{Board-Ct1t69ot.cjs → Board-CUt4j2-8.cjs} +2 -2
- package/dist/chunks/{Board-Ct1t69ot.cjs.map → Board-CUt4j2-8.cjs.map} +1 -1
- package/dist/chunks/{Board-BYPzybjf.js → Board-z688-51u.js} +2 -2
- package/dist/chunks/{Board-BYPzybjf.js.map → Board-z688-51u.js.map} +1 -1
- package/dist/chunks/ColourField-BqhYB4ZE.cjs +2 -0
- package/dist/chunks/ColourField-BqhYB4ZE.cjs.map +1 -0
- package/dist/chunks/{ColourField-Do0rHk-Y.js → ColourField-DXGpNP08.js} +7 -3
- package/dist/chunks/ColourField-DXGpNP08.js.map +1 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs +2 -0
- package/dist/chunks/DatePicker-01sor8iD.cjs.map +1 -0
- package/dist/chunks/{DatePicker-B8L-oodC.js → DatePicker-DJAqXUDJ.js} +3 -3
- package/dist/chunks/DatePicker-DJAqXUDJ.js.map +1 -0
- package/dist/chunks/{FormEditor-a3kHVLQB.cjs → FormEditor-BbsvbufQ.cjs} +2 -2
- package/dist/chunks/{FormEditor-a3kHVLQB.cjs.map → FormEditor-BbsvbufQ.cjs.map} +1 -1
- package/dist/chunks/{FormEditor-CwQN8tRw.js → FormEditor-C5XtP-N7.js} +3 -3
- package/dist/chunks/{FormEditor-CwQN8tRw.js.map → FormEditor-C5XtP-N7.js.map} +1 -1
- package/dist/chunks/{Icon-D7GrTtqc.cjs → Icon-WOhlu6Rp.cjs} +2 -2
- package/dist/chunks/Icon-WOhlu6Rp.cjs.map +1 -0
- package/dist/chunks/{Icon-BZjGAu8D.js → Icon-spaFBU4S.js} +34 -33
- package/dist/chunks/Icon-spaFBU4S.js.map +1 -0
- package/dist/chunks/Message-CaX8Y1Xb.js +74 -0
- package/dist/chunks/Message-CaX8Y1Xb.js.map +1 -0
- package/dist/chunks/Message-DU31JAb3.cjs +2 -0
- package/dist/chunks/Message-DU31JAb3.cjs.map +1 -0
- package/dist/chunks/{useTooltip-D6cJji8v.js → useTooltip-C5gvEoYk.js} +2 -1
- package/dist/chunks/{useTooltip-D6cJji8v.js.map → useTooltip-C5gvEoYk.js.map} +1 -1
- package/dist/chunks/{useTooltip-CCf79zE9.cjs → useTooltip-bTE_a2Xn.cjs} +2 -2
- package/dist/chunks/{useTooltip-CCf79zE9.cjs.map → useTooltip-bTE_a2Xn.cjs.map} +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Banner/index.cjs +2 -0
- package/dist/components/Banner/index.cjs.map +1 -0
- package/dist/components/Banner/index.d.cts +6 -0
- package/dist/components/Banner/index.d.cts.map +1 -0
- package/dist/components/Banner/index.d.ts +6 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +18 -0
- package/dist/components/Banner/index.js.map +1 -0
- package/dist/components/Banner/style.css +6 -0
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.js +5 -1
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.d.cts +6 -0
- package/dist/components/EditLayout/index.d.cts.map +1 -1
- package/dist/components/EditLayout/index.d.ts +6 -0
- package/dist/components/EditLayout/index.d.ts.map +1 -1
- package/dist/components/EditLayout/index.js +104 -97
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EditLayout/style.css +8 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/Icon/icons.d.cts +1 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +1 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.js +5 -1
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Popover/style.css +2 -1
- package/dist/components/Popover/useTooltip.d.cts.map +1 -1
- package/dist/components/Popover/useTooltip.d.ts.map +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.cjs.map +1 -1
- package/dist/components/Table/index.js +2 -2
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +35 -60
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/Toast/style.css +5 -50
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -15
- package/dist/internal/Message.d.cts +23 -0
- package/dist/internal/Message.d.cts.map +1 -0
- package/dist/internal/Message.d.ts +23 -0
- package/dist/internal/Message.d.ts.map +1 -0
- package/dist/message.css +122 -0
- package/dist/styles.css +2 -0
- package/dist/tokens.css +36 -12
- package/package.json +1 -1
- package/dist/chunks/ColourField-DDGuWWNH.cjs +0 -2
- package/dist/chunks/ColourField-DDGuWWNH.cjs.map +0 -1
- package/dist/chunks/ColourField-Do0rHk-Y.js.map +0 -1
- package/dist/chunks/DatePicker-B8L-oodC.js.map +0 -1
- package/dist/chunks/DatePicker-hjpY6Sti.cjs +0 -2
- package/dist/chunks/DatePicker-hjpY6Sti.cjs.map +0 -1
- package/dist/chunks/Icon-BZjGAu8D.js.map +0 -1
- package/dist/chunks/Icon-D7GrTtqc.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip-
|
|
1
|
+
{"version":3,"file":"useTooltip-C5gvEoYk.js","names":["isComposing","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isEnabled","content","anchorRef","useRef","id","useId","isOpen","setIsOpen","useState","hasOpened","setHasOpened","hovered","timer","useEffect","dismiss","show","hide","enter","leave","handlers","Popover","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!isEnabled && isOpen) {\n // Disabling closes it, so re-enabling later cannot reopen it unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (isEnabled) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":";;;;;AAcA,IAAMC,IAAc;AAgBpB,SAASC,EACP,GACA,GACA;CACA,QAAQ,MAAa;EAEnB,AADAC,IAASC,CAAK,GACTA,EAAM,oBACTC,EAAKD,CAAK;CAEd;AACF;AAOA,SAASE,EAAmB,GAAwB;CAClD,IAAMC,IAAS,OAAO,WAAa,MAAc,OAAO,SAAS;CACjE,IAAI,CAACC,KAAU,CAACD,KAAU,CAACC,EAAO,SAASD,CAAM,GAC/C,OAAO;CAET,IAAI;EACF,OAAOA,EAAO,QAAQ,gBAAgB;CACxC,QAAQ;EAEN,OAAO;CACT;AACF;AAOA,SAAgBE,EACd,GACA,EAAE,cAAW,iBAA8B,CAAC,GAC5C;CACA,IAAMC,IACJC,MAAY,MAASA,KAAY,QAAiCA,MAAY,IAC1EC,IAAYC,EAAiB,IAAI,GACjCC,IAAKC,EAAM,GACX,CAACC,GAAQC,KAAaC,EAAS,EAAK,GAEpC,CAACC,GAAWC,KAAgBF,EAAS,EAAK,GAC1CG,IAAUR,EAAO,EAAK,GACtBS,IAAQT,EAAkD,KAAA,CAAS;CAQzE,AAPI,CAACH,KAAaM,KAEhBC,EAAU,EAAK,GAGjBM,cAAsB,aAAaD,EAAM,OAAO,GAAG,CAAC,CAAC,GAErDC,QAAgB;EACd,IAAI,CAACP,GACH;EAEF,IAAMQ,KAAW,MAAyB;GACxC,AAAIpB,EAAM,QAAQ,YAAYA,EAAM,oBAAoBJ,EAAYI,CAAK,MAKzEA,EAAM,eAAe,GACrBa,EAAU,EAAK;EACjB;EAEA,OADA,SAAS,iBAAiB,WAAWO,CAAO,SAC/B,SAAS,oBAAoB,WAAWA,CAAO;CAC9D,GAAG,CAACR,CAAM,CAAC;CAEX,IAAMS,UAAa;EAEjB,AADA,aAAaH,EAAM,OAAO,GACtBZ,MACFO,EAAU,EAAI,GACdG,EAAa,EAAI;CAErB,GACMM,UAAa;EAEjB,AADA,aAAaJ,EAAM,OAAO,GAC1B,EAAM,UAAU,iBAAiB;GAC/B,AAAI,CAACD,EAAQ,WAAW,CAACf,EAAmBM,EAAU,OAAO,KAC3DK,EAAU,EAAK;EAEnB,GAAGhB,CAAW;CAChB,GACM0B,UAAc;EAElB,AADA,EAAQ,UAAU,IAClBF,EAAK;CACP,GACMG,UAAc;EAElB,AADA,EAAQ,UAAU,IAClBF,EAAK;CACP;CAEA,OAAO;EACL;EAEA,aAAahB,KAAaM,IAASF,IAAK,KAAA;EAExC,eAAe,IAAsC,CAAC,OAAO;GAC3D,cAAcZ,EAAQ2B,EAAS,cAAcF,CAAK;GAClD,cAAczB,EAAQ2B,EAAS,cAAcD,CAAK;GAClD,SAAS1B,EAAQ2B,EAAS,SAASJ,CAAI;GACvC,QAAQvB,EAAQ2B,EAAS,QAAQH,CAAI;EACvC;EACA,OACEhB,KAAaS,IACX,kBAACW,GAAD;GACa;GACH;GACJ;GACJ,MAAK;GACM;GACX,WAAW;IAAC;IAAqB;IAAoB;IAAcC;GAAS,CAAC,CAC1E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;GAEX,UAAA,kBAAC,QAAD;IACE,WAAU;IACV,cAAcJ;IACd,cAAcC;IAEb,UAAAjB;GACG,CAAA;EACC,CAAA,IACP;CACR;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./isComposing-BrBcAANm.cjs"),t=require("../components/Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=100;function a(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function o(e){let t=typeof document>`u`?null:document.activeElement;if(!e||!t||!e.contains(t))return!1;try{return t.matches(`:focus-visible`)}catch{return!0}}function s(s,{placement:c,className:l}={}){let u=s!==!1&&s!=null&&s!==``,d=(0,n.useRef)(null),f=(0,n.useId)(),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),_=(0,n.useRef)(!1),v=(0,n.useRef)(void 0);!u&&p&&m(!1),(0,n.useEffect)(()=>()=>clearTimeout(v.current),[]),(0,n.useEffect)(()=>{if(!p)return;let t=t=>{t.key!==`Escape`||t.defaultPrevented||e.t(t)||(t.preventDefault(),m(!1))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[p]);let y=()=>{clearTimeout(v.current),u&&(m(!0),g(!0))},b=()=>{clearTimeout(v.current),v.current=setTimeout(()=>{!_.current&&!o(d.current)&&m(!1)},i)},x=()=>{_.current=!0,y()},S=()=>{_.current=!1,b()};return{anchorRef:d,description:u&&p?f:void 0,triggerProps:(e={})=>({onMouseEnter:a(e.onMouseEnter,x),onMouseLeave:a(e.onMouseLeave,S),onFocus:a(e.onFocus,y),onBlur:a(e.onBlur,b)}),panel:u&&h?(0,r.jsx)(t.Popover,{anchorRef:d,isOpen:p,id:f,role:`tooltip`,placement:c,className:[`ds-surface-raised`,`ds-tooltip`,l].filter(Boolean).join(` `),children:(0,r.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:x,onMouseLeave:S,children:s})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
2
|
-
//# sourceMappingURL=useTooltip-
|
|
1
|
+
const e=require("./isComposing-BrBcAANm.cjs"),t=require("../components/Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=100;function a(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function o(e){let t=typeof document>`u`?null:document.activeElement;if(!e||!t||!e.contains(t))return!1;try{return t.matches(`:focus-visible`)}catch{return!0}}function s(s,{placement:c,className:l}={}){let u=s!==!1&&s!=null&&s!==``,d=(0,n.useRef)(null),f=(0,n.useId)(),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),_=(0,n.useRef)(!1),v=(0,n.useRef)(void 0);!u&&p&&m(!1),(0,n.useEffect)(()=>()=>clearTimeout(v.current),[]),(0,n.useEffect)(()=>{if(!p)return;let t=t=>{t.key!==`Escape`||t.defaultPrevented||e.t(t)||(t.preventDefault(),m(!1))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[p]);let y=()=>{clearTimeout(v.current),u&&(m(!0),g(!0))},b=()=>{clearTimeout(v.current),v.current=setTimeout(()=>{!_.current&&!o(d.current)&&m(!1)},i)},x=()=>{_.current=!0,y()},S=()=>{_.current=!1,b()};return{anchorRef:d,description:u&&p?f:void 0,triggerProps:(e={})=>({onMouseEnter:a(e.onMouseEnter,x),onMouseLeave:a(e.onMouseLeave,S),onFocus:a(e.onFocus,y),onBlur:a(e.onBlur,b)}),panel:u&&h?(0,r.jsx)(t.Popover,{anchorRef:d,isOpen:p,id:f,role:`tooltip`,placement:c,className:[`ds-surface-raised`,`ds-field-surface`,`ds-tooltip`,l].filter(Boolean).join(` `),children:(0,r.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:x,onMouseLeave:S,children:s})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
2
|
+
//# sourceMappingURL=useTooltip-bTE_a2Xn.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip-
|
|
1
|
+
{"version":3,"file":"useTooltip-bTE_a2Xn.cjs","names":["useRef","useId","useState","isComposing","Popover","require_isComposing","require_components_Popover_index","react","react_jsx_runtime","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isEnabled","content","anchorRef","id","isOpen","setIsOpen","hasOpened","setHasOpened","hovered","timer","dismiss","show","hide","enter","leave","handlers","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!isEnabled && isOpen) {\n // Disabling closes it, so re-enabling later cannot reopen it unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (isEnabled) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave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AAG,CAACN,CAAM,CAAC,EAEX,IAAMO,MAAa,CACjB,aAAaF,EAAM,OAAO,EACtBT,IACFK,EAAU,EAAI,EACdE,EAAa,EAAI,EAErB,EACMK,MAAa,CACjB,aAAaH,EAAM,OAAO,EAC1B,EAAM,QAAU,eAAiB,CAC3B,CAACD,EAAQ,SAAW,CAACZ,EAAmBM,EAAU,OAAO,GAC3DG,EAAU,EAAK,CAEnB,EAAGd,CAAW,CAChB,EACMsB,MAAc,CAClB,EAAQ,QAAU,GAClBF,EAAK,CACP,EACMG,MAAc,CAClB,EAAQ,QAAU,GAClBF,EAAK,CACP,EAEA,MAAO,CACL,YAEA,YAAaZ,GAAaI,EAASD,EAAK,IAAA,GAExC,cAAe,EAAsC,CAAC,KAAO,CAC3D,aAAcX,EAAQuB,EAAS,aAAcF,CAAK,EAClD,aAAcrB,EAAQuB,EAAS,aAAcD,CAAK,EAClD,QAAStB,EAAQuB,EAAS,QAASJ,CAAI,EACvC,OAAQnB,EAAQuB,EAAS,OAAQH,CAAI,CACvC,GACA,MACEZ,GAAaM,GACX,EAAAhB,EAAA,IAAA,CAACJ,EAAAA,QAAD,CACa,YACH,SACJ,KACJ,KAAK,UACM,YACX,UAAW,CAAC,oBAAqB,mBAAoB,aAAc8B,CAAS,CAAC,CAC1E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,EAEX,UAAA,EAAA1B,EAAA,IAAA,CAAC,OAAD,CACE,UAAU,sBACV,aAAcuB,EACd,aAAcC,EAEb,SAAAb,CACG,CAAA,CACC,CAAA,EACP,IACR,CACF,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-WOhlu6Rp.cjs"),t=require("../Button/index.cjs"),n=require("../Skeleton/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a({icon:t,label:n}){return(0,i.jsx)(`span`,{className:`ds-asset-card__placeholder ds-asset-tile__placeholder`,children:(0,i.jsx)(e.t,{name:t,size:24,"aria-label":n})})}function o({src:e,alt:t}){let[o,s]=(0,r.useState)(`loading`),[c,l]=(0,r.useState)(),u=(0,r.useCallback)(e=>{s(`loaded`),e.naturalWidth&&e.naturalHeight&&l(e.naturalWidth/e.naturalHeight)},[]),d=(0,r.useCallback)(e=>{e?.complete&&(e.naturalWidth>0?u(e):e.decode().then(()=>u(e),()=>{}))},[u]);return o===`failed`?(0,i.jsx)(a,{icon:`alert-triangle`,label:t?`${t} (preview unavailable)`:`Preview unavailable`}):(0,i.jsxs)(i.Fragment,{children:[o===`loading`&&(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb-skeleton ds-asset-tile__thumb-skeleton`}),(0,i.jsx)(`img`,{ref:d,src:e,alt:t,loading:`lazy`,"data-loaded":o===`loaded`||void 0,style:c?{"--asset-ratio":c}:void 0,onLoad:e=>u(e.currentTarget),onError:()=>s(`failed`)})]})}var s=e=>/^on[A-Z]/.test(e),c=!1;function l(e){(0,r.useEffect)(()=>{e&&!c&&process.env.NODE_ENV!==`production`&&(c=!0,console.warn("AssetCard: `linkProps` replaces `onSelect`, so the thumbnail navigates and `onSelect` is never called. Pass one of them, and put selection on an `actions` control."))},[e])}function u({name:e,linkProps:{href:t,tabIndex:n,className:a,...o},isPending:c,isSelected:l}){let u=(0,r.useId)(),d=c?Object.fromEntries(Object.entries(o).filter(([e])=>!s(e))):o,f=[o[`aria-describedby`],l&&u].filter(Boolean).join(` `);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`a`,{...d,href:c?void 0:t,tabIndex:c?void 0:n,role:c?`link`:o.role,"aria-label":o[`aria-label`]??e,"aria-disabled":c||o[`aria-disabled`],"aria-describedby":f||void 0,className:[`ds-asset-card__hit ds-asset-tile__hit ds-asset-card__link ds-asset-tile__link`,a].filter(Boolean).join(` `)}),l?(0,i.jsx)(`span`,{id:u,hidden:!0,children:`Selected`}):null]})}function d({linkProps:e,onSelect:n,...r}){let{name:a,isPending:o,isSelected:s}=r;return l(!!(e&&n)),e?(0,i.jsx)(u,{...r,linkProps:e}):n?(0,i.jsx)(t.Button,{variant:`simple`,className:`ds-asset-card__hit ds-asset-tile__hit`,"aria-pressed":s,"aria-label":a,isDisabled:o,onClick:n}):null}var f=(0,r.forwardRef)(function({name:t,src:n,alt:r=``,icon:s=`image`,fit:c=`cover`,meta:l,description:u,isSelected:f=!1,isPending:p=!1,onSelect:m,linkProps:h,actions:g,footer:_,className:v,...y},b){return(0,i.jsxs)(`div`,{ref:b,className:[`ds-asset-card`,`ds-asset-tile`,v].filter(Boolean).join(` `),"data-fit":c,"data-selected":f||void 0,"data-pending":p||void 0,...y,children:[(0,i.jsxs)(`div`,{className:`ds-asset-card__thumb ds-asset-tile__thumb`,children:[n?(0,i.jsx)(o,{src:n,alt:r},n):(0,i.jsx)(a,{icon:s}),p&&(0,i.jsxs)(`span`,{className:`ds-asset-card__pending ds-asset-tile__pending`,role:`status`,children:[(0,i.jsx)(e.t,{name:`spinner`,size:20,className:`ds-asset-card__spinner ds-asset-tile__spinner ds-icon--spin`}),(0,i.jsx)(`span`,{className:`ds-asset-card__pending-label ds-asset-tile__pending-label`,children:`Uploading`})]}),g?(0,i.jsx)(`div`,{className:`ds-asset-card__actions ds-asset-tile__actions`,children:g}):null,(0,i.jsx)(d,{name:t,linkProps:h,onSelect:m,isPending:p,isSelected:f})]}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text ds-asset-tile__text`,children:[(0,i.jsx)(`span`,{className:`ds-asset-card__name ds-asset-tile__name`,children:t}),l?(0,i.jsx)(`div`,{className:`ds-asset-card__meta ds-asset-tile__meta`,children:l}):null,u?(0,i.jsx)(`div`,{className:`ds-asset-card__description`,children:u}):null]}),_?(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:_}):null]})});function p({index:e=0,description:t=!1,footer:r=!1}){let a={animationDelay:`calc(var(--skeleton-stagger) * ${e})`};return(0,i.jsxs)(`div`,{className:`ds-asset-card ds-asset-tile`,"data-loading":`true`,"aria-hidden":`true`,children:[(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb ds-asset-tile__thumb`,style:a}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text ds-asset-tile__text`,children:[(0,i.jsx)(n.Skeleton,{shape:`text`,width:`80%`,style:a}),(0,i.jsx)(n.Skeleton,{shape:`text`,width:`45%`,style:a}),t&&(0,i.jsx)(n.Skeleton,{shape:`text`,width:`65%`,style:a})]}),r&&(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:(0,i.jsx)(n.Skeleton,{shape:`block`,width:`45%`,style:{...a,blockSize:`var(--field-height-sm)`}})})]})}exports.AssetCard=f,exports.AssetCardSkeleton=p;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Icon-
|
|
1
|
+
import { t as e } from "../../chunks/Icon-spaFBU4S.js";
|
|
2
2
|
import { Button as t } from "../Button/index.js";
|
|
3
3
|
import { Skeleton as n } from "../Skeleton/index.js";
|
|
4
4
|
import { forwardRef as r, useCallback as i, useEffect as a, useId as o, useState as s } from "react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-WOhlu6Rp.cjs"),t=require("../Grid/index.cjs"),n=require("../AssetCard/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a(...e){return e.filter(Boolean).join(` `)}var o=(0,r.forwardRef)(function({isLoading:e=!1,loadingCount:r=8,loadingCard:o,className:s,children:c,...l},u){return(0,i.jsx)(t.Grid,{ref:u,columns:`auto`,gap:`md`,minColumnWidth:`var(--asset-tile-min-width)`,className:a(`ds-asset-grid`,s),"aria-busy":e||void 0,...l,children:e?Array.from({length:r},(e,t)=>(0,i.jsx)(n.AssetCardSkeleton,{...o,index:t},t)):c})});function s({title:t,description:n,action:r}){return(0,i.jsxs)(`div`,{className:`ds-asset-empty`,children:[(0,i.jsx)(e.t,{name:`image`,size:24}),(0,i.jsx)(`span`,{className:`ds-asset-empty__title`,children:t}),n&&(0,i.jsx)(`span`,{className:`ds-asset-empty__description`,children:n}),r]})}exports.AssetGrid=o,exports.AssetGridEmpty=s,exports.AssetTile=n.AssetCard,exports.AssetTileSkeleton=n.AssetCardSkeleton;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Icon-
|
|
1
|
+
import { t as e } from "../../chunks/Icon-spaFBU4S.js";
|
|
2
2
|
import { Grid as t } from "../Grid/index.js";
|
|
3
3
|
import { AssetCard as n, AssetCardSkeleton as r } from "../AssetCard/index.js";
|
|
4
4
|
import { forwardRef as i } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-C9ublbzK.cjs");exports.Avatar=e.t,exports.AvatarGroup=e.n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Avatar, n as AvatarGroup } from "../../chunks/Avatar-
|
|
1
|
+
export { t as Avatar, n as AvatarGroup } from "../../chunks/Avatar-BtblwihO.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-DU31JAb3.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({className:t,...r},i){return(0,n.jsx)(e.t,{"aria-atomic":!1,...r,ref:i,appearance:`inline`,classPrefix:`ds-banner`,className:[`ds-banner`,t].filter(Boolean).join(` `)})});exports.Banner=r;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","Message","require_Message","react","react_jsx_runtime","Banner","props","className"],"sources":["../../../src/components/Banner/index.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { Message, type MessageProps, type MessageTone } from \"../../internal/Message\";\nimport \"./style.css\";\n\nexport type BannerTone = MessageTone;\nexport type BannerProps = Omit<MessageProps, \"appearance\" | \"classPrefix\">;\n\n/** A persistent message about the current view. The parent owns dismissal. */\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { className, ...props },\n ref,\n) {\n return (\n <Message\n // Later changes announce only the text that changed, not the whole\n // banner with its action and dismiss labels.\n aria-atomic={false}\n {...props}\n ref={ref}\n appearance=\"inline\"\n classPrefix=\"ds-banner\"\n className={[\"ds-banner\", className].filter(Boolean).join(\" \")}\n />\n );\n});\n"],"mappings":"A,8KAQA,IAAaK,GAAA,EAASL,EAAAA,WAAAA,CAAwC,SAC5D,CAAE,YAAW,GAAGM,GAChB,EACA,CACA,OACE,EAAAF,EAAA,IAAA,CAACH,EAAAA,EAAD,CAGE,cAAa,GACb,GAAIK,EACC,MACL,WAAW,SACX,YAAY,YACZ,UAAW,CAAC,YAAaC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAC7D,CAAA,CAEL,CAAC,E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type MessageProps, type MessageTone } from "../../internal/Message.cjs";
|
|
2
|
+
export type BannerTone = MessageTone;
|
|
3
|
+
export type BannerProps = Omit<MessageProps, "appearance" | "classPrefix">;
|
|
4
|
+
/** A persistent message about the current view. The parent owns dismissal. */
|
|
5
|
+
export declare const Banner: import("react").ForwardRefExoticComponent<BannerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Banner/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;AACrC,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,GAAG,aAAa,CAAC,CAAC;AAE3E,8EAA8E;AAC9E,eAAO,MAAM,MAAM,wGAgBjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type MessageProps, type MessageTone } from "../../internal/Message.js";
|
|
2
|
+
export type BannerTone = MessageTone;
|
|
3
|
+
export type BannerProps = Omit<MessageProps, "appearance" | "classPrefix">;
|
|
4
|
+
/** A persistent message about the current view. The parent owns dismissal. */
|
|
5
|
+
export declare const Banner: import("react").ForwardRefExoticComponent<BannerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Banner/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;AACrC,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,GAAG,aAAa,CAAC,CAAC;AAE3E,8EAA8E;AAC9E,eAAO,MAAM,MAAM,wGAgBjB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as e } from "../../chunks/Message-CaX8Y1Xb.js";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Banner/index.tsx
|
|
5
|
+
var r = t(function({ className: t, ...r }, i) {
|
|
6
|
+
return /* @__PURE__ */ n(e, {
|
|
7
|
+
"aria-atomic": !1,
|
|
8
|
+
...r,
|
|
9
|
+
ref: i,
|
|
10
|
+
appearance: "inline",
|
|
11
|
+
classPrefix: "ds-banner",
|
|
12
|
+
className: ["ds-banner", t].filter(Boolean).join(" ")
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { r as Banner };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Message","Banner","forwardRef","props","className"],"sources":["../../../src/components/Banner/index.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { Message, type MessageProps, type MessageTone } from \"../../internal/Message\";\nimport \"./style.css\";\n\nexport type BannerTone = MessageTone;\nexport type BannerProps = Omit<MessageProps, \"appearance\" | \"classPrefix\">;\n\n/** A persistent message about the current view. The parent owns dismissal. */\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { className, ...props },\n ref,\n) {\n return (\n <Message\n // Later changes announce only the text that changed, not the whole\n // banner with its action and dismiss labels.\n aria-atomic={false}\n {...props}\n ref={ref}\n appearance=\"inline\"\n classPrefix=\"ds-banner\"\n className={[\"ds-banner\", className].filter(Boolean).join(\" \")}\n />\n );\n});\n"],"mappings":";;;;AAQA,IAAaC,IAASC,EAAwC,SAC5D,EAAE,cAAW,GAAGC,KAChB,GACA;CACA,OACE,kBAACH,GAAD;EAGE,eAAa;EACb,GAAIG;EACC;EACL,YAAW;EACX,aAAY;EACZ,WAAW,CAAC,aAAaC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;CAC7D,CAAA;AAEL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-CUt4j2-8.cjs");exports.Board=e.t,exports.BoardCard=e.n,exports.BoardColumn=e.r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-
|
|
1
|
+
export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-z688-51u.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-WOhlu6Rp.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({variant:t=`neutral`,size:r=`md`,iconStart:i,iconEnd:a,isIconOnly:o=!1,isDisabled:s=!1,isPending:c=!1,isFocusableWhenDisabled:l=!1,className:u,children:d,type:f=`button`,onClick:p,...m},h){let g=r===`lg`?20:16,_=s||c,v=_&&l;return(0,n.jsxs)(`button`,{ref:h,type:f,disabled:_&&!l,"aria-disabled":v||void 0,"data-variant":t,"data-size":r,"data-icon-only":o||void 0,"data-pending":c||void 0,className:[`ds-button`,u].filter(Boolean).join(` `),...m,onClick:v?e=>e.preventDefault():p,children:[c?(0,n.jsx)(e.t,{name:`spinner`,size:g,className:`ds-button__spinner ds-icon--spin`}):i&&(0,n.jsx)(e.t,{name:i,size:g}),(!o||!i&&!c)&&d,a&&!o&&(0,n.jsx)(e.t,{name:a,size:g})]})});exports.Button=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/ColourField-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/ColourField-BqhYB4ZE.cjs");exports.ColourField=e.t,exports.ColourPanel=e.n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ColourField, n as ColourPanel } from "../../chunks/ColourField-
|
|
1
|
+
export { t as ColourField, n as ColourPanel } from "../../chunks/ColourField-DXGpNP08.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/DatePicker-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/DatePicker-01sor8iD.cjs");exports.Calendar=e.t,exports.DateField=e.n,exports.DateRangeField=e.r,exports.formatIsoDate=e.i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Calendar, n as DateField, r as DateRangeField, i as formatIsoDate } from "../../chunks/DatePicker-
|
|
1
|
+
export { t as Calendar, n as DateField, r as DateRangeField, i as formatIsoDate } from "../../chunks/DatePicker-DJAqXUDJ.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/transitionDuration-B4UnScFc.cjs"),n=require("../../chunks/mergeRefs-Bc3qS0Tt.cjs"),r=require("../../chunks/useModalDialog-Cgus9408.cjs"),i=require("../../chunks/portalScope-BVA1-Ypu.cjs");let a=require("react"),o=require("react-dom"),s=require("react/jsx-runtime");function c(e,n){let[r,i]=(0,a.useState)(e),[o,s]=(0,a.useState)(!1);return r!==e&&(i(e),s(!e)),(0,a.useEffect)(()=>{if(!o||e)return;let r=t.t(n.current),i=window.setTimeout(()=>s(!1),r);return()=>window.clearTimeout(i)},[o,e,n]),[o,s]}var l=(0,a.forwardRef)(function({isOpen:t,onClose:l,title:u,description:d,side:f=`end`,size:p=`md`,variant:m=`default`,closeLabel:h=`Close`,portalContainer:g,footer:_,className:v,children:y,...b},x){let S=(0,a.useRef)(null),C=(0,a.useRef)(null),w=(0,a.useRef)(null),T=(0,a.useId)(),E=(0,a.useId)(),[D,O]=c(t,C),{onScrimMouseDown:k}=r.t({isOpen:t,panelRef:S,onClose:l,initialFocus:m===`navigation`?()=>w.current:void 0,preventScroll:!0,container:g});return i.n(C,t,{keepDir:b.dir!==void 0}),!t&&!D||typeof document>`u`?null:(0,o.createPortal)((0,s.jsx)(`div`,{ref:e=>{C.current=e,e&&(e.inert=!t)},className:`ds-drawer-scrim`,dir:b.dir,"data-side":f,"data-variant":m,"data-contained":g?``:void 0,"data-state":t?`open`:`closed`,"aria-hidden":!t||void 0,onTransitionEnd:e=>{e.target===e.currentTarget&&e.propertyName===`opacity`&&!t&&O(!1)},onMouseDown:k,children:(0,s.jsxs)(`div`,{...b,ref:n.t(S,x),role:`dialog`,"aria-modal":`true`,"aria-labelledby":b[`aria-label`]?void 0:b[`aria-labelledby`]??T,"aria-describedby":d?E:void 0,tabIndex:-1,"data-side":f,"data-size":p,"data-variant":m,className:[`ds-drawer`,v].filter(Boolean).join(` `),children:[(0,s.jsxs)(`header`,{className:`ds-drawer__head`,children:[(0,s.jsxs)(`div`,{className:`ds-drawer__titles`,children:[(0,s.jsx)(`h2`,{id:T,className:`ds-drawer__title`,children:u}),d&&(0,s.jsx)(`p`,{id:E,className:`ds-drawer__description`,children:d})]}),(0,s.jsx)(e.Button,{ref:w,variant:`simple`,size:m===`navigation`?`lg`:`sm`,isIconOnly:!0,iconStart:`x`,className:m===`navigation`?`ds-drawer__close`:void 0,"aria-label":h,onClick:l})]}),(0,s.jsx)(`div`,{className:`ds-drawer__body`,children:y}),_&&(0,s.jsx)(`footer`,{className:`ds-drawer__footer`,children:_})]})}),g??document.body)});exports.Drawer=l;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/transitionDuration-B4UnScFc.cjs"),n=require("../../chunks/mergeRefs-Bc3qS0Tt.cjs"),r=require("../../chunks/useModalDialog-Cgus9408.cjs"),i=require("../../chunks/portalScope-BVA1-Ypu.cjs");let a=require("react"),o=require("react-dom"),s=require("react/jsx-runtime");function c(e,n){let[r,i]=(0,a.useState)(e),[o,s]=(0,a.useState)(!1);return r!==e&&(i(e),s(!e)),(0,a.useEffect)(()=>{if(!o||e)return;let r=t.t(n.current),i=window.setTimeout(()=>s(!1),r);return()=>window.clearTimeout(i)},[o,e,n]),[o,s]}var l=(0,a.forwardRef)(function({isOpen:t,onClose:l,title:u,description:d,side:f=`end`,size:p=`md`,variant:m=`default`,closeLabel:h=`Close`,portalContainer:g,footer:_,className:v,children:y,...b},x){let S=(0,a.useRef)(null),C=(0,a.useRef)(null),w=(0,a.useRef)(null),T=(0,a.useId)(),E=(0,a.useId)(),[D,O]=c(t,C),{onScrimMouseDown:k}=r.t({isOpen:t,panelRef:S,onClose:l,initialFocus:m===`navigation`?()=>w.current:void 0,preventScroll:!0,container:g});return i.n(C,t,{keepDir:b.dir!==void 0}),!t&&!D||typeof document>`u`?null:(0,o.createPortal)((0,s.jsx)(`div`,{ref:e=>{C.current=e,e&&(e.inert=!t)},className:`ds-drawer-scrim`,dir:b.dir,"data-side":f,"data-variant":m,"data-contained":g?``:void 0,"data-state":t?`open`:`closed`,"aria-hidden":!t||void 0,onTransitionEnd:e=>{e.target===e.currentTarget&&e.propertyName===`opacity`&&!t&&O(!1)},onMouseDown:k,children:(0,s.jsxs)(`div`,{...b,ref:n.t(S,x),role:`dialog`,"aria-modal":`true`,"aria-labelledby":b[`aria-label`]?void 0:b[`aria-labelledby`]??T,"aria-describedby":d?E:void 0,tabIndex:-1,"data-side":f,"data-size":p,"data-variant":m,className:[`ds-drawer`,`ds-field-surface`,v].filter(Boolean).join(` `),children:[(0,s.jsxs)(`header`,{className:`ds-drawer__head`,children:[(0,s.jsxs)(`div`,{className:`ds-drawer__titles`,children:[(0,s.jsx)(`h2`,{id:T,className:`ds-drawer__title`,children:u}),d&&(0,s.jsx)(`p`,{id:E,className:`ds-drawer__description`,children:d})]}),(0,s.jsx)(e.Button,{ref:w,variant:`simple`,size:m===`navigation`?`lg`:`sm`,isIconOnly:!0,iconStart:`x`,className:m===`navigation`?`ds-drawer__close`:void 0,"aria-label":h,onClick:l})]}),(0,s.jsx)(`div`,{className:`ds-drawer__body`,children:y}),_&&(0,s.jsx)(`footer`,{className:`ds-drawer__footer`,children:_})]})}),g??document.body)});exports.Drawer=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useState","transitionDurationMs","forwardRef","useRef","useId","useModalDialog","createPortal","mergeRefs","Button","require_components_Button_index","require_transitionDuration","require_mergeRefs","require_useModalDialog","require_portalScope","react","react_dom","react_jsx_runtime","useDrawerExit","previousOpen","setPreviousOpen","isOpen","exiting","setExiting","duration","scrimRef","timeout","Drawer","rest","panelRef","closeRef","titleId","descriptionId","variant","portalContainer","node","side","event","onScrimMouseDown","ref","description","size","className","title","closeLabel","onClose","footer"],"sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n return [exiting, setExiting] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, setExiting] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown } = useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus: variant === \"navigation\" ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = !isOpen;\n }\n }}\n className=\"ds-drawer-scrim\"\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={!isOpen || undefined}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n }}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n data-side={side}\n data-size={size}\n data-variant={variant}\n className={[\"ds-drawer\", className].filter(Boolean).join(\" \")}\n >\n <header className=\"ds-drawer__head\">\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer\">{footer}</footer>}\n </div>\n </div>,\n portalContainer ?? document.body,\n );\n});\n"],"mappings":"A,2YA4CA,SAASiB,EAAc,EAAiB,EAA4C,CAClF,GAAM,CAACC,EAAcC,IAAA,EAAmBnB,EAAAA,SAAAA,CAASoB,CAAM,EACjD,CAACC,EAASC,IAAA,EAActB,EAAAA,SAAAA,CAAS,EAAK,EAiB5C,OAfIkB,IAAiBE,IACnBD,EAAgBC,CAAM,EACtBE,EAAW,C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,IAAA,GACvC,aAAYb,EAAS,OAAS,SAC9B,cAAa,CAACA,GAAU,IAAA,GACxB,gBAAkB,GAAU,CACtBgB,EAAM,SAAWA,EAAM,eAAiBA,EAAM,eAAiB,WAAa,CAAChB,GAC/EE,EAAW,EAAK,CAEpB,EACA,YAAae,EAEb,UAAA,EAAArB,EAAA,KAAA,CAAC,MAAD,CACE,GAAIW,EACJ,IAAKpB,EAAAA,EAAUqB,EAAUU,CAAG,EAC5B,KAAK,SACL,aAAW,OACX,kBAAiBX,EAAK,cAAgB,IAAA,GAAaA,EAAK,oBAAsBG,EAC9E,mBAAkBS,EAAcR,EAAgB,IAAA,GAChD,SAAU,GACV,YAAWI,EACX,YAAWK,EACX,eAAcR,EACd,UAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useState","transitionDurationMs","forwardRef","useRef","useId","useModalDialog","createPortal","mergeRefs","Button","require_components_Button_index","require_transitionDuration","require_mergeRefs","require_useModalDialog","require_portalScope","react","react_dom","react_jsx_runtime","useDrawerExit","previousOpen","setPreviousOpen","isOpen","exiting","setExiting","duration","scrimRef","timeout","Drawer","rest","panelRef","closeRef","titleId","descriptionId","variant","portalContainer","node","side","event","onScrimMouseDown","ref","description","size","className","title","closeLabel","onClose","footer"],"sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n return [exiting, setExiting] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, setExiting] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown } = useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus: variant === \"navigation\" ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = !isOpen;\n }\n }}\n className=\"ds-drawer-scrim\"\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={!isOpen || undefined}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n }}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n data-side={side}\n data-size={size}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <header className=\"ds-drawer__head\">\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer\">{footer}</footer>}\n </div>\n </div>,\n portalContainer ?? document.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ACA,UAAU,IACV,UAAWA,IAAY,aAAe,mBAAqB,IAAA,GAC3D,aAAYW,EACZ,QAASC,CACV,CAAA,CACK,C,IACR,EAAA5B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,kBAAmB,UAAc,CAAA,EAC/C6B,IAAU,EAAA7B,EAAA,IAAA,CAAC,SAAD,CAAQ,UAAU,oBAAqB,SAAA6B,CAAe,CAAA,CAC9D,C,EACF,CAAA,EACLZ,GAAmB,SAAS,IAC9B,CACF,CAAC,E"}
|
|
@@ -54,7 +54,11 @@ var m = a(function({ isOpen: t, onClose: a, title: o, description: l, side: m =
|
|
|
54
54
|
"data-side": m,
|
|
55
55
|
"data-size": h,
|
|
56
56
|
"data-variant": g,
|
|
57
|
-
className: [
|
|
57
|
+
className: [
|
|
58
|
+
"ds-drawer",
|
|
59
|
+
"ds-field-surface",
|
|
60
|
+
b
|
|
61
|
+
].filter(Boolean).join(" "),
|
|
58
62
|
children: [
|
|
59
63
|
/* @__PURE__ */ f("header", {
|
|
60
64
|
className: "ds-drawer__head",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["mergeRefs","useModalDialog","useInheritedPortalScope","useDrawerExit","previousOpen","setPreviousOpen","useState","isOpen","exiting","setExiting","useEffect","duration","transitionDurationMs","scrimRef","timeout","Drawer","forwardRef","rest","panelRef","useRef","closeRef","titleId","useId","descriptionId","variant","portalContainer","createPortal","node","side","event","onScrimMouseDown","ref","description","size","className","title","Button","closeLabel","onClose","footer"],"sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n return [exiting, setExiting] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, setExiting] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown } = useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus: variant === \"navigation\" ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = !isOpen;\n }\n }}\n className=\"ds-drawer-scrim\"\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={!isOpen || undefined}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n }}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n data-side={side}\n data-size={size}\n data-variant={variant}\n className={[\"ds-drawer\", className].filter(Boolean).join(\" \")}\n >\n <header className=\"ds-drawer__head\">\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer\">{footer}</footer>}\n </div>\n </div>,\n portalContainer ?? document.body,\n );\n});\n"],"mappings":";;;;;;;;;AA4CA,SAASG,EAAc,GAAiB,GAA4C;CAClF,IAAM,CAACC,GAAcC,KAAmBC,EAASC,CAAM,GACjD,CAACC,GAASC,KAAcH,EAAS,EAAK;CAiB5C,OAfIF,MAAiBG,MACnBF,EAAgBE,CAAM,GACtBE,EAAW,CAACF,CAAM,IAGpBG,QAAgB;EACd,IAAI,CAACF,KAAWD,GACd;EAGF,IAAMI,IAAWC,EAAqBC,EAAS,OAAQ,GACjDC,IAAU,OAAO,iBAAiBL,EAAW,EAAK,GAAGE,CAAQ;EACnE,aAAa,OAAO,aAAaG,CAAO;CAC1C,GAAG;EAACN;EAASD;EAAQM;CAAQ,CAAC,GAEvB,CAACL,GAASC,CAAU;AAC7B;AAQA,IAAaM,IAASC,EAAwC,SAC5D,EACE,WACA,YACA,UACA,gBACA,UAAO,OACP,UAAO,MACP,aAAU,WACV,gBAAa,SACb,oBACA,WACA,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAWC,EAA8B,IAAI,GAC7CN,IAAWM,EAA8B,IAAI,GAC7CC,IAAWD,EAAiC,IAAI,GAChDE,IAAUC,EAAM,GAChBC,IAAgBD,EAAM,GACtB,CAACd,GAASC,KAAcN,EAAcI,GAAQM,CAAQ,GACtD,EAAE,wBAAqBZ,EAAe;EAC1C;EACA;EACA;EACA,cAAcuB,MAAY,qBAAqBJ,EAAS,UAAU,KAAA;EAElE,eAAe;EACf,WAAWK;CACb,CAAC;CAOD,OANAvB,EAAwBW,GAAUN,GAAQ,EAAE,SAASU,EAAK,QAAQ,KAAA,EAAU,CAAC,GAExE,CAACV,KAAU,CAACC,KAAY,OAAO,WAAa,MACxC,OAGFkB,EACL,kBAAC,OAAD;EACE,MAAM,MAAS;GAEb,AADA,EAAS,UAAUC,GACfA,MACF,EAAK,QAAQ,CAACpB;EAElB;EACA,WAAU;EACV,KAAKU,EAAK;EACV,aAAWW;EACX,gBAAcJ;EACd,kBAAgBC,IAAkB,KAAK,KAAA;EACvC,cAAYlB,IAAS,SAAS;EAC9B,eAAa,CAACA,KAAU,KAAA;EACxB,kBAAkB,MAAU;GAC1B,AAAIsB,EAAM,WAAWA,EAAM,iBAAiBA,EAAM,iBAAiB,aAAa,CAACtB,KAC/EE,EAAW,EAAK;EAEpB;EACA,aAAaqB;EAEb,UAAA,kBAAC,OAAD;GACE,GAAIb;GACJ,KAAKjB,EAAUkB,GAAUa,CAAG;GAC5B,MAAK;GACL,cAAW;GACX,mBAAiBd,EAAK,gBAAgB,KAAA,IAAaA,EAAK,sBAAsBI;GAC9E,oBAAkBW,IAAcT,IAAgB,KAAA;GAChD,UAAU;GACV,aAAWK;GACX,aAAWK;GACX,gBAAcT;GACd,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","names":["mergeRefs","useModalDialog","useInheritedPortalScope","useDrawerExit","previousOpen","setPreviousOpen","useState","isOpen","exiting","setExiting","useEffect","duration","transitionDurationMs","scrimRef","timeout","Drawer","forwardRef","rest","panelRef","useRef","closeRef","titleId","useId","descriptionId","variant","portalContainer","createPortal","node","side","event","onScrimMouseDown","ref","description","size","className","title","Button","closeLabel","onClose","footer"],"sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n return [exiting, setExiting] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, setExiting] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown } = useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus: variant === \"navigation\" ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = !isOpen;\n }\n }}\n className=\"ds-drawer-scrim\"\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={!isOpen || undefined}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n }}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n data-side={side}\n data-size={size}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <header className=\"ds-drawer__head\">\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer\">{footer}</footer>}\n </div>\n </div>,\n portalContainer ?? document.body,\n );\n});\n"],"mappings":";;;;;;;;;AA4CA,SAASG,EAAc,GAAiB,GAA4C;CAClF,IAAM,CAACC,GAAcC,KAAmBC,EAASC,CAAM,GACjD,CAACC,GAASC,KAAcH,EAAS,EAAK;CAiB5C,OAfIF,MAAiBG,MACnBF,EAAgBE,CAAM,GACtBE,EAAW,CAACF,CAAM,IAGpBG,QAAgB;EACd,IAAI,CAACF,KAAWD,GACd;EAGF,IAAMI,IAAWC,EAAqBC,EAAS,OAAQ,GACjDC,IAAU,OAAO,iBAAiBL,EAAW,EAAK,GAAGE,CAAQ;EACnE,aAAa,OAAO,aAAaG,CAAO;CAC1C,GAAG;EAACN;EAASD;EAAQM;CAAQ,CAAC,GAEvB,CAACL,GAASC,CAAU;AAC7B;AAQA,IAAaM,IAASC,EAAwC,SAC5D,EACE,WACA,YACA,UACA,gBACA,UAAO,OACP,UAAO,MACP,aAAU,WACV,gBAAa,SACb,oBACA,WACA,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAWC,EAA8B,IAAI,GAC7CN,IAAWM,EAA8B,IAAI,GAC7CC,IAAWD,EAAiC,IAAI,GAChDE,IAAUC,EAAM,GAChBC,IAAgBD,EAAM,GACtB,CAACd,GAASC,KAAcN,EAAcI,GAAQM,CAAQ,GACtD,EAAE,wBAAqBZ,EAAe;EAC1C;EACA;EACA;EACA,cAAcuB,MAAY,qBAAqBJ,EAAS,UAAU,KAAA;EAElE,eAAe;EACf,WAAWK;CACb,CAAC;CAOD,OANAvB,EAAwBW,GAAUN,GAAQ,EAAE,SAASU,EAAK,QAAQ,KAAA,EAAU,CAAC,GAExE,CAACV,KAAU,CAACC,KAAY,OAAO,WAAa,MACxC,OAGFkB,EACL,kBAAC,OAAD;EACE,MAAM,MAAS;GAEb,AADA,EAAS,UAAUC,GACfA,MACF,EAAK,QAAQ,CAACpB;EAElB;EACA,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@@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-WOhlu6Rp.cjs"),t=require("../Button/index.cjs"),n=require("../../chunks/mergeRefs-Bc3qS0Tt.cjs"),r=require("../../chunks/portalScope-BVA1-Ypu.cjs"),i=require("../Drawer/index.cjs"),a=require("../../chunks/observeElementWidth-BCJM2FAw.cjs"),o=require("../../chunks/movableHost-CajG9_5Z.cjs");let s=require("react"),c=require("react-dom"),l=require("react/jsx-runtime");var u=360,d=600,f=900;function ee(e){return e<u?`tight`:e<d?`compact`:e<f?`narrow`:`wide`}var p={clean:`No changes`,dirty:`Unsaved changes`,saving:`Saving…`,saved:`Saved`,error:`Couldn't save`,offline:`Offline · kept in this tab`},m={clean:void 0,dirty:void 0,saving:`spinner`,saved:`check`,error:`alert-triangle`,offline:`clock`},h=new Set([`clean`,`dirty`]);function g(e){return typeof e==`string`?e.trim()!==``:e!=null&&typeof e!=`boolean`}function _({saveState:t,savedAgo:n,statusLabel:r}){let i=m[t],a=h.has(t)&&g(r)?r:void 0;return(0,l.jsxs)(`div`,{className:`ds-edit-layout__status`,"data-state":t,role:`status`,"aria-live":`polite`,children:[i&&(0,l.jsx)(e.t,{name:i,className:t===`saving`?`ds-icon--spin`:void 0}),t===`dirty`&&(0,l.jsx)(`span`,{className:`ds-edit-layout__dirty`,"aria-hidden":`true`}),(0,l.jsxs)(`span`,{title:typeof a==`string`?a:void 0,children:[a??p[t],t===`saved`&&n?(0,l.jsxs)(l.Fragment,{children:[` `,n]}):null]})]})}function v({text:e,bodyRef:n,onKeepEditing:r}){let i=(0,s.useRef)(null),a=(0,s.useRef)(null);return(0,s.useEffect)(()=>{a.current=document.activeElement;let e=requestAnimationFrame(()=>i.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,l.jsxs)(`div`,{className:`ds-edit-layout__confirmation`,children:[(0,l.jsx)(`strong`,{children:e}),(0,l.jsx)(t.Button,{ref:i,size:`xs`,onClick:()=>{r?.(),requestAnimationFrame(()=>{(a.current?.isConnected?a.current:n.current?.querySelector(`input, textarea, button, [contenteditable='true']`))?.focus({preventScroll:!0})})},children:`Keep editing`})]})}function y({backLabel:e,onBack:n,compact:r,status:i,actions:a,confirmLeave:o,confirmation:s,onLeave:c,detailsToggle:u}){return(0,l.jsxs)(`header`,{className:`ds-edit-layout__bar`,children:[(0,l.jsx)(t.Button,{variant:`simple`,size:`sm`,iconStart:`arrow-left`,isIconOnly:r,"aria-label":`Back to ${e}`,onClick:n,children:e}),o?s:i,(0,l.jsxs)(`div`,{className:`ds-edit-layout__actions`,children:[o?(0,l.jsx)(t.Button,{variant:`danger`,size:`sm`,onClick:c,children:`Leave anyway`}):a,r&&u]})]})}function b({label:e,detailsId:n,expanded:r,opensSheet:i,sheetOpen:a,toggleRef:o,contentRef:s,collapsed:c,onToggle:u}){return(0,l.jsxs)(`aside`,{className:`ds-edit-layout__rail`,"aria-label":e,children:[(0,l.jsxs)(`header`,{className:`ds-edit-layout__rail-head`,children:[r&&(0,l.jsx)(`span`,{children:e}),(0,l.jsx)(t.Button,{ref:o,variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:r?`chevrons-right`:`chevrons-left`,className:`ds-edit-layout__toggle`,"aria-label":`${r?`Collapse`:`Expand`} ${e}`,"aria-expanded":r||a,"aria-controls":n,"aria-haspopup":i?`dialog`:void 0,onClick:u})]}),r?(0,l.jsx)(`div`,{id:n,ref:s,className:`ds-edit-layout__rail-content`}):(0,l.jsx)(`div`,{className:`ds-edit-layout__rail-icons`,children:c?c(u):(0,l.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`info`,"aria-label":`Show ${e}`,onClick:u})})]})}var x=(0,s.forwardRef)(function({backLabel:e,onBack:u,saveState:d=`clean`,statusLabel:f,savedAgo:p,actions:m,rail:h,railCollapsed:g,railLabel:x=`Details`,railOpen:S,defaultRailOpen:C=!0,onRailToggle:w,confirmLeave:T=!1,confirmText:E=`Leave without saving?`,onKeepEditing:D,onLeave:O,children:k,className:A,onFocus:j,...M},N){let P=(0,s.useRef)(null),te=(0,s.useMemo)(()=>n.t(P,N),[N]),F=(0,s.useRef)(null),I=(0,s.useRef)(null),L=(0,s.useRef)(null),R=(0,s.useRef)(null),z=(0,s.useRef)(null),[B]=(0,s.useState)(()=>o.t(`ds-edit-layout__rail-host`)),[V,H]=(0,s.useState)(`wide`),[U,W]=(0,s.useState)(C),[G,K]=(0,s.useState)(!1),[q,J]=(0,s.useState)(!1),Y=(0,s.useId)(),X=V===`tight`||V===`compact`,Z=V!==`wide`,Q=!Z&&(S??U);G&&(T||!Z)&&K(!1),(0,s.useLayoutEffect)(()=>{let e;return a.t(P.current,t=>{let n=ee(t);n!==e&&(e=n,J(!1),H(n))})},[]),(0,s.useLayoutEffect)(()=>{B&&o.n(B,L.current??R.current,z.current)}),(0,s.useEffect)(()=>{let e=z.current;e&&r.i(e)&&r.i(document.activeElement)&&I.current?.focus({preventScroll:!0})},[V,Q,G]);let $=()=>{Z?K(!0):(J(!0),W(!Q),w?.(!Q))},ne=typeof h==`function`?h(()=>(0,c.flushSync)(()=>K(!1))):h;return(0,l.jsxs)(`div`,{...M,ref:te,className:[`ds-edit-layout`,A].filter(Boolean).join(` `),"data-compact":X||void 0,"data-tight":V===`tight`||void 0,"data-expanded":Q||void 0,"data-animate":q||void 0,onFocus:e=>{z.current=e.target,j?.(e)},children:[(0,l.jsxs)(`div`,{className:`ds-edit-layout__main`,children:[(0,l.jsx)(y,{backLabel:e,onBack:u,compact:X,status:(0,l.jsx)(_,{saveState:d,statusLabel:f,savedAgo:p}),actions:m,confirmLeave:T,confirmation:(0,l.jsx)(v,{text:E,bodyRef:F,onKeepEditing:D}),onLeave:O,detailsToggle:(0,l.jsx)(t.Button,{ref:I,variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`info`,"aria-label":x,"aria-haspopup":`dialog`,"aria-expanded":G,"aria-controls":Y,onClick:$})}),(0,l.jsx)(`div`,{ref:F,className:`ds-edit-layout__body`,children:(0,l.jsx)(`div`,{className:`ds-edit-layout__content`,children:k})})]}),!X&&(0,l.jsx)(b,{label:x,detailsId:Y,expanded:Q,opensSheet:Z,sheetOpen:G,toggleRef:I,contentRef:L,collapsed:g,onToggle:$}),(0,l.jsx)(i.Drawer,{id:Z?Y:void 0,dir:M.dir,isOpen:G,onClose:()=>K(!1),side:`end`,size:`md`,title:x,closeLabel:`Close ${x}`,className:`ds-edit-layout__sheet`,children:Z&&(0,l.jsx)(`div`,{ref:R,className:`ds-edit-layout__rail-content`})}),B&&(0,c.createPortal)(ne,B)]})});exports.EditLayout=x;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Icon","_Fragment","useRef","Button","forwardRef","useMemo","mergeRefs","useState","createMovableHost","useId","observeElementWidth","cannotHoldFocus","flushSync","Drawer","createPortal","require_Icon","require_components_Button_index","require_mergeRefs","require_portalScope","require_components_Drawer_index","require_observeElementWidth","require_movableHost","react","react_dom","react_jsx_runtime","TIGHT_WIDTH","COMPACT_WIDTH","WIDE_WIDTH","layoutMode","width","statusLabels","statusIcons","SaveStatus","icon","saveState","savedAgo","LeaveConfirmation","keepRef","origin","frame","text","onKeepEditing","bodyRef","EditActionBar","compact","backLabel","onBack","confirmLeave","confirmation","status","onLeave","actions","detailsToggle","DetailsRail","label","expanded","toggleRef","sheetOpen","detailsId","opensSheet","onToggle","contentRef","collapsed","EditLayout","rest","rootRef","mergedRef","ref","railSlotRef","sheetSlotRef","lastFocus","railHost","mode","setMode","localOpen","setLocalOpen","defaultRailOpen","sheet","setSheet","animate","setAnimate","narrow","railOpen","current","next","last","toggle","onRailToggle","railContent","rail","className","event","onFocus","confirmText","railLabel","railCollapsed"],"sources":["../../../src/components/EditLayout/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { Drawer } from \"../Drawer\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport { createMovableHost, moveHost } from \"../../internal/movableHost\";\nimport \"./style.css\";\n\nexport type EditSaveState = \"clean\" | \"dirty\" | \"saving\" | \"saved\" | \"error\" | \"offline\";\n\nexport interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {\n backLabel: string;\n onBack: () => void;\n saveState?: EditSaveState;\n savedAgo?: ReactNode;\n actions?: ReactNode;\n /** A render slot can close the Details sheet before opening another dialog. */\n rail: ReactNode | ((closeDetails: () => void) => ReactNode);\n /** Custom collapsed controls receive the accessible expand action. */\n railCollapsed?: (expand: () => void) => ReactNode;\n railLabel?: string;\n railOpen?: boolean;\n defaultRailOpen?: boolean;\n onRailToggle?: (open: boolean) => void;\n confirmLeave?: boolean;\n confirmText?: string;\n onKeepEditing?: () => void;\n onLeave?: () => void;\n children?: ReactNode;\n}\n\n/** Below this width, the action bar's gaps and padding contract. */\nconst TIGHT_WIDTH = 360;\n/** Below this width, Details opens from the action bar. */\nconst COMPACT_WIDTH = 600;\n/** From this width, the rail follows the open/closed preference. */\nconst WIDE_WIDTH = 900;\n\ntype LayoutMode = \"tight\" | \"compact\" | \"narrow\" | \"wide\";\n\nfunction layoutMode(width: number): LayoutMode {\n if (width < TIGHT_WIDTH) {\n return \"tight\";\n }\n if (width < COMPACT_WIDTH) {\n return \"compact\";\n }\n if (width < WIDE_WIDTH) {\n return \"narrow\";\n }\n return \"wide\";\n}\n\nconst statusLabels: Record<EditSaveState, string> = {\n clean: \"No changes\",\n dirty: \"Unsaved changes\",\n saving: \"Saving…\",\n saved: \"Saved\",\n error: \"Couldn't save\",\n offline: \"Offline · kept in this tab\",\n};\n\nconst statusIcons: Record<EditSaveState, IconName | undefined> = {\n clean: undefined,\n dirty: undefined,\n saving: \"spinner\",\n saved: \"check\",\n error: \"alert-triangle\",\n offline: \"clock\",\n};\n\ninterface SaveStatusProps {\n saveState: EditSaveState;\n savedAgo?: ReactNode;\n}\n\nfunction SaveStatus({ saveState, savedAgo }: SaveStatusProps) {\n const icon = statusIcons[saveState];\n return (\n <div\n className=\"ds-edit-layout__status\"\n data-state={saveState}\n role=\"status\"\n aria-live=\"polite\"\n >\n {icon && (\n <Icon\n name={icon}\n className={saveState === \"saving\" ? \"ds-icon--spin\" : undefined}\n />\n )}\n {saveState === \"dirty\" && (\n <span\n className=\"ds-edit-layout__dirty\"\n aria-hidden=\"true\"\n />\n )}\n <span>\n {statusLabels[saveState]}\n {saveState === \"saved\" && savedAgo ? <> {savedAgo}</> : null}\n </span>\n </div>\n );\n}\n\ninterface LeaveConfirmationProps {\n text: string;\n /** Keep editing falls back to the first control here when its origin is gone. */\n bodyRef: RefObject<HTMLDivElement | null>;\n onKeepEditing?: () => void;\n}\n\n/** Takes focus while shown; Keep editing returns it to where the user was. */\nfunction LeaveConfirmation({ text, bodyRef, onKeepEditing }: LeaveConfirmationProps) {\n const keepRef = useRef<HTMLButtonElement>(null);\n const origin = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n origin.current = document.activeElement as HTMLElement | null;\n const frame = requestAnimationFrame(() => keepRef.current?.focus({ preventScroll: true }));\n return () => cancelAnimationFrame(frame);\n }, []);\n\n const keepEditing = () => {\n onKeepEditing?.();\n requestAnimationFrame(() => {\n const destination = origin.current?.isConnected\n ? origin.current\n : bodyRef.current?.querySelector<HTMLElement>(\n \"input, textarea, button, [contenteditable='true']\",\n );\n destination?.focus({ preventScroll: true });\n });\n };\n\n return (\n <div className=\"ds-edit-layout__confirmation\">\n <strong>{text}</strong>\n <Button\n ref={keepRef}\n size=\"xs\"\n onClick={keepEditing}\n >\n Keep editing\n </Button>\n </div>\n );\n}\n\ninterface EditActionBarProps {\n backLabel: string;\n onBack: () => void;\n compact: boolean;\n status: ReactNode;\n actions?: ReactNode;\n /** Replaces the status and actions while set. */\n confirmLeave: boolean;\n confirmation: ReactNode;\n onLeave?: () => void;\n /** Shown only in compact layouts, where Details opens as a sheet. */\n detailsToggle: ReactNode;\n}\n\nfunction EditActionBar({\n backLabel,\n onBack,\n compact,\n status,\n actions,\n confirmLeave,\n confirmation,\n onLeave,\n detailsToggle,\n}: EditActionBarProps) {\n return (\n <header className=\"ds-edit-layout__bar\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"arrow-left\"\n isIconOnly={compact}\n aria-label={`Back to ${backLabel}`}\n onClick={onBack}\n >\n {backLabel}\n </Button>\n {confirmLeave ? confirmation : status}\n <div className=\"ds-edit-layout__actions\">\n {confirmLeave ? (\n <Button\n variant=\"danger\"\n size=\"sm\"\n onClick={onLeave}\n >\n Leave anyway\n </Button>\n ) : (\n actions\n )}\n {compact && detailsToggle}\n </div>\n </header>\n );\n}\n\ninterface DetailsRailProps {\n label: string;\n detailsId: string;\n expanded: boolean;\n /** Below the wide breakpoint, the toggle opens the Details sheet instead. */\n opensSheet: boolean;\n sheetOpen: boolean;\n toggleRef: RefObject<HTMLButtonElement | null>;\n /** Receives the rail content while the rail is expanded. */\n contentRef: RefObject<HTMLDivElement | null>;\n collapsed?: (expand: () => void) => ReactNode;\n onToggle: () => void;\n}\n\nfunction DetailsRail({\n label,\n detailsId,\n expanded,\n opensSheet,\n sheetOpen,\n toggleRef,\n contentRef,\n collapsed,\n onToggle,\n}: DetailsRailProps) {\n return (\n <aside\n className=\"ds-edit-layout__rail\"\n aria-label={label}\n >\n <header className=\"ds-edit-layout__rail-head\">\n {expanded && <span>{label}</span>}\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart={expanded ? \"chevrons-right\" : \"chevrons-left\"}\n className=\"ds-edit-layout__toggle\"\n aria-label={`${expanded ? \"Collapse\" : \"Expand\"} ${label}`}\n aria-expanded={expanded || sheetOpen}\n aria-controls={detailsId}\n aria-haspopup={opensSheet ? \"dialog\" : undefined}\n onClick={onToggle}\n />\n </header>\n {expanded ? (\n <div\n id={detailsId}\n ref={contentRef}\n className=\"ds-edit-layout__rail-content\"\n />\n ) : (\n <div className=\"ds-edit-layout__rail-icons\">\n {collapsed ? (\n collapsed(onToggle)\n ) : (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={`Show ${label}`}\n onClick={onToggle}\n />\n )}\n </div>\n )}\n </aside>\n );\n}\n\n/** Presentation only: the consumer owns saving, routing and persisted preferences. */\nexport const EditLayout = forwardRef<HTMLDivElement, EditLayoutProps>(function EditLayout(\n {\n backLabel,\n onBack,\n saveState = \"clean\",\n savedAgo,\n actions,\n rail,\n railCollapsed,\n railLabel = \"Details\",\n railOpen,\n defaultRailOpen = true,\n onRailToggle,\n confirmLeave = false,\n confirmText = \"Leave without saving?\",\n onKeepEditing,\n onLeave,\n children,\n className,\n onFocus,\n ...rest\n },\n ref,\n) {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const railSlotRef = useRef<HTMLDivElement>(null);\n const sheetSlotRef = useRef<HTMLDivElement>(null);\n const lastFocus = useRef<Element | null>(null);\n // Rail content renders once, into a node that moves between the rail and\n // the sheet, so uncontrolled fields keep their values across modes.\n const [railHost] = useState(() => createMovableHost(\"ds-edit-layout__rail-host\"));\n const [mode, setMode] = useState<LayoutMode>(\"wide\");\n const [localOpen, setLocalOpen] = useState(defaultRailOpen);\n const [sheet, setSheet] = useState(false);\n const [animate, setAnimate] = useState(false);\n const detailsId = useId();\n const compact = mode === \"tight\" || mode === \"compact\";\n const narrow = mode !== \"wide\";\n const expanded = !narrow && (railOpen ?? localOpen);\n\n // Leave confirmation and the wide rail both replace the Details sheet.\n if (sheet && (confirmLeave || !narrow)) {\n setSheet(false);\n }\n\n // Measure before the first paint, then re-render only when a breakpoint is crossed.\n useLayoutEffect(() => {\n let current: LayoutMode | undefined;\n return observeElementWidth(rootRef.current!, (width) => {\n const next = layoutMode(width);\n if (next === current) {\n return;\n }\n current = next;\n // Crossing a breakpoint is not a deliberate toggle, so it doesn't animate.\n setAnimate(false);\n setMode(next);\n });\n }, []);\n\n // Moving a node drops its focus; keep the user in the field they were in.\n useLayoutEffect(() => {\n if (railHost) {\n moveHost(railHost, railSlotRef.current ?? sheetSlotRef.current, lastFocus.current);\n }\n });\n\n // A breakpoint, a collapse or a closing sheet can remove the focused control.\n // Hand focus to the Details toggle that replaced it.\n useEffect(() => {\n const last = lastFocus.current;\n if (last && cannotHoldFocus(last) && cannotHoldFocus(document.activeElement)) {\n toggleRef.current?.focus({ preventScroll: true });\n }\n }, [mode, expanded, sheet]);\n\n const toggle = () => {\n if (narrow) {\n setSheet(true);\n return;\n }\n setAnimate(true);\n setLocalOpen(!expanded);\n onRailToggle?.(!expanded);\n };\n const closeDetails = () => flushSync(() => setSheet(false));\n const railContent = typeof rail === \"function\" ? rail(closeDetails) : rail;\n\n return (\n <div\n {...rest}\n ref={mergedRef}\n className={[\"ds-edit-layout\", className].filter(Boolean).join(\" \")}\n data-compact={compact || undefined}\n data-tight={mode === \"tight\" || undefined}\n data-expanded={expanded || undefined}\n data-animate={animate || undefined}\n onFocus={(event) => {\n lastFocus.current = event.target;\n onFocus?.(event);\n }}\n >\n <div className=\"ds-edit-layout__main\">\n <EditActionBar\n backLabel={backLabel}\n onBack={onBack}\n compact={compact}\n status={\n <SaveStatus\n saveState={saveState}\n savedAgo={savedAgo}\n />\n }\n actions={actions}\n confirmLeave={confirmLeave}\n confirmation={\n <LeaveConfirmation\n text={confirmText}\n bodyRef={bodyRef}\n onKeepEditing={onKeepEditing}\n />\n }\n onLeave={onLeave}\n detailsToggle={\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={railLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={sheet}\n aria-controls={detailsId}\n onClick={toggle}\n />\n }\n />\n <div\n ref={bodyRef}\n className=\"ds-edit-layout__body\"\n >\n <div className=\"ds-edit-layout__content\">{children}</div>\n </div>\n </div>\n {!compact && (\n <DetailsRail\n label={railLabel}\n detailsId={detailsId}\n expanded={expanded}\n opensSheet={narrow}\n sheetOpen={sheet}\n toggleRef={toggleRef}\n contentRef={railSlotRef}\n collapsed={railCollapsed}\n onToggle={toggle}\n />\n )}\n <Drawer\n id={narrow ? detailsId : undefined}\n dir={rest.dir}\n isOpen={sheet}\n onClose={() => setSheet(false)}\n side=\"end\"\n size=\"md\"\n title={railLabel}\n closeLabel={`Close ${railLabel}`}\n className=\"ds-edit-layout__sheet\"\n >\n {narrow && (\n <div\n ref={sheetSlotRef}\n className=\"ds-edit-layout__rail-content\"\n />\n )}\n </Drawer>\n {railHost && createPortal(railContent, railHost)}\n </div>\n );\n});\n"],"mappings":"A,sdA+CA,IAAMyB,EAAc,IAEdC,EAAgB,IAEhBC,EAAa,IAInB,SAASC,EAAW,EAA2B,CAU7C,OATIC,EAAQJ,EACH,QAELI,EAAQH,EACH,UAELG,EAAQF,EACH,SAEF,MACT,CAEA,IAAMG,EAA8C,CAClD,MAAO,aACP,MAAO,kBACP,OAAQ,UACR,MAAO,QACP,MAAO,gBACP,QAAS,4BACX,EAEMC,EAA2D,CAC/D,MAAO,IAAA,GACP,MAAO,IAAA,GACP,OAAQ,UACR,MAAO,QACP,MAAO,iBACP,QAAS,OACX,EAOA,SAASC,EAAW,CAAE,YAAW,YAA6B,CAC5D,IAAMC,EAAOF,EAAYG,GACzB,OACE,EAAAV,EAAA,KAAA,CAAC,MAAD,CACE,UAAU,yBACV,aA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,EAaE,EAAAnE,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,uBAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACmB,EAAD,CACa,YACH,SACC,UACT,QACE,EAAAnB,EAAA,IAAA,CAACQ,EAAD,CACa,YACD,UACX,CAAA,EAEM,UACK,eACd,cACE,EAAAR,EAAA,IAAA,CAACY,EAAD,CACE,KAAMyD,EACG,UACM,eAChB,CAAA,EAEM,UACT,eACE,EAAArE,EAAA,IAAA,CAACrB,EAAAA,OAAD,CACE,IAAKqD,EACL,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,OACV,aAAYsC,EACZ,gBAAc,SACd,gBAAejB,EACf,gBAAenB,EACf,QAAS4B,CACV,CAAA,CAEJ,CAAA,GACD,EAAA9D,EAAA,IAAA,CAAC,MAAD,CACE,IAAKkB,EACL,UAAU,uBAEV,UAAA,EAAAlB,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0BAA2B,UAAc,CAAA,CACrD,CAAA,CACF,C,GACJ,CAACoB,IACA,EAAApB,EAAA,IAAA,CAAC6B,EAAD,CACE,MAAOyC,EACI,YACD,WACV,WAAYb,EACZ,UAAWJ,EACA,YACX,WAAYT,EACZ,UAAW2B,EACX,SAAUT,CACX,CAAA,GAEH,EAAA9D,EAAA,IAAA,CAACX,EAAAA,OAAD,CACE,GAAIoE,EAASvB,EAAY,IAAA,GACzB,IAAKM,EAAK,IACV,OAAQa,EACR,YAAeC,EAAS,EAAK,EAC7B,KAAK,MACL,KAAK,KACL,MAAOgB,EACP,WAAY,SAASA,IACrB,UAAU,wBAET,SAAAb,IACC,EAAAzD,EAAA,IAAA,CAAC,MAAD,CACE,IAAK6C,EACL,UAAU,8BACX,CAAA,CAEG,CAAA,EACPE,IAAA,EAAYzD,EAAAA,aAAAA,CAAa0E,GAAajB,CAAQ,CAC5C,C,EAET,CAAC,E"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Icon","_Fragment","useRef","Button","forwardRef","useMemo","mergeRefs","useState","createMovableHost","useId","observeElementWidth","cannotHoldFocus","flushSync","Drawer","createPortal","require_Icon","require_components_Button_index","require_mergeRefs","require_portalScope","require_components_Drawer_index","require_observeElementWidth","require_movableHost","react","react_dom","react_jsx_runtime","TIGHT_WIDTH","COMPACT_WIDTH","WIDE_WIDTH","layoutMode","width","statusLabels","statusIcons","relabelledStates","hasContent","node","SaveStatus","icon","saveState","custom","statusLabel","savedAgo","LeaveConfirmation","keepRef","origin","frame","text","onKeepEditing","bodyRef","EditActionBar","compact","backLabel","onBack","confirmLeave","confirmation","status","onLeave","actions","detailsToggle","DetailsRail","label","expanded","toggleRef","sheetOpen","detailsId","opensSheet","onToggle","contentRef","collapsed","EditLayout","rest","rootRef","mergedRef","ref","railSlotRef","sheetSlotRef","lastFocus","railHost","mode","setMode","localOpen","setLocalOpen","defaultRailOpen","sheet","setSheet","animate","setAnimate","narrow","railOpen","current","next","last","toggle","onRailToggle","railContent","rail","className","event","onFocus","confirmText","railLabel","railCollapsed"],"sources":["../../../src/components/EditLayout/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal, flushSync } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { Drawer } from \"../Drawer\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport { createMovableHost, moveHost } from \"../../internal/movableHost\";\nimport \"./style.css\";\n\nexport type EditSaveState = \"clean\" | \"dirty\" | \"saving\" | \"saved\" | \"error\" | \"offline\";\n\nexport interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {\n backLabel: string;\n onBack: () => void;\n saveState?: EditSaveState;\n /**\n * Replaces the `clean` or `dirty` message, for example on a read-only record.\n * Saving, saved, error and offline keep their standard messages, and\n * `saveState` always controls the indicator and colour. Empty values are ignored.\n */\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n actions?: ReactNode;\n /** A render slot can close the Details sheet before opening another dialog. */\n rail: ReactNode | ((closeDetails: () => void) => ReactNode);\n /** Custom collapsed controls receive the accessible expand action. */\n railCollapsed?: (expand: () => void) => ReactNode;\n railLabel?: string;\n railOpen?: boolean;\n defaultRailOpen?: boolean;\n onRailToggle?: (open: boolean) => void;\n confirmLeave?: boolean;\n confirmText?: string;\n onKeepEditing?: () => void;\n onLeave?: () => void;\n children?: ReactNode;\n}\n\n/** Below this width, the action bar's gaps and padding contract. */\nconst TIGHT_WIDTH = 360;\n/** Below this width, Details opens from the action bar. */\nconst COMPACT_WIDTH = 600;\n/** From this width, the rail follows the open/closed preference. */\nconst WIDE_WIDTH = 900;\n\ntype LayoutMode = \"tight\" | \"compact\" | \"narrow\" | \"wide\";\n\nfunction layoutMode(width: number): LayoutMode {\n if (width < TIGHT_WIDTH) {\n return \"tight\";\n }\n if (width < COMPACT_WIDTH) {\n return \"compact\";\n }\n if (width < WIDE_WIDTH) {\n return \"narrow\";\n }\n return \"wide\";\n}\n\nconst statusLabels: Record<EditSaveState, string> = {\n clean: \"No changes\",\n dirty: \"Unsaved changes\",\n saving: \"Saving…\",\n saved: \"Saved\",\n error: \"Couldn't save\",\n offline: \"Offline · kept in this tab\",\n};\n\nconst statusIcons: Record<EditSaveState, IconName | undefined> = {\n clean: undefined,\n dirty: undefined,\n saving: \"spinner\",\n saved: \"check\",\n error: \"alert-triangle\",\n offline: \"clock\",\n};\n\n/** Save progress, outcomes and connection loss always keep their standard messages. */\nconst relabelledStates: ReadonlySet<EditSaveState> = new Set([\"clean\", \"dirty\"]);\n\nfunction hasContent(node: ReactNode) {\n if (typeof node === \"string\") {\n return node.trim() !== \"\";\n }\n return node !== null && node !== undefined && typeof node !== \"boolean\";\n}\n\ninterface SaveStatusProps {\n saveState: EditSaveState;\n statusLabel?: ReactNode;\n savedAgo?: ReactNode;\n}\n\nfunction SaveStatus({ saveState, savedAgo, statusLabel }: SaveStatusProps) {\n const icon = statusIcons[saveState];\n const custom =\n relabelledStates.has(saveState) && hasContent(statusLabel) ? statusLabel : undefined;\n return (\n <div\n className=\"ds-edit-layout__status\"\n data-state={saveState}\n role=\"status\"\n aria-live=\"polite\"\n >\n {icon && (\n <Icon\n name={icon}\n className={saveState === \"saving\" ? \"ds-icon--spin\" : undefined}\n />\n )}\n {saveState === \"dirty\" && (\n <span\n className=\"ds-edit-layout__dirty\"\n aria-hidden=\"true\"\n />\n )}\n {/* The title recovers a custom string clipped beyond two lines. */}\n <span title={typeof custom === \"string\" ? custom : undefined}>\n {custom ?? statusLabels[saveState]}\n {saveState === \"saved\" && savedAgo ? <> {savedAgo}</> : null}\n </span>\n </div>\n );\n}\n\ninterface LeaveConfirmationProps {\n text: string;\n /** Keep editing falls back to the first control here when its origin is gone. */\n bodyRef: RefObject<HTMLDivElement | null>;\n onKeepEditing?: () => void;\n}\n\n/** Takes focus while shown; Keep editing returns it to where the user was. */\nfunction LeaveConfirmation({ text, bodyRef, onKeepEditing }: LeaveConfirmationProps) {\n const keepRef = useRef<HTMLButtonElement>(null);\n const origin = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n origin.current = document.activeElement as HTMLElement | null;\n const frame = requestAnimationFrame(() => keepRef.current?.focus({ preventScroll: true }));\n return () => cancelAnimationFrame(frame);\n }, []);\n\n const keepEditing = () => {\n onKeepEditing?.();\n requestAnimationFrame(() => {\n const destination = origin.current?.isConnected\n ? origin.current\n : bodyRef.current?.querySelector<HTMLElement>(\n \"input, textarea, button, [contenteditable='true']\",\n );\n destination?.focus({ preventScroll: true });\n });\n };\n\n return (\n <div className=\"ds-edit-layout__confirmation\">\n <strong>{text}</strong>\n <Button\n ref={keepRef}\n size=\"xs\"\n onClick={keepEditing}\n >\n Keep editing\n </Button>\n </div>\n );\n}\n\ninterface EditActionBarProps {\n backLabel: string;\n onBack: () => void;\n compact: boolean;\n status: ReactNode;\n actions?: ReactNode;\n /** Replaces the status and actions while set. */\n confirmLeave: boolean;\n confirmation: ReactNode;\n onLeave?: () => void;\n /** Shown only in compact layouts, where Details opens as a sheet. */\n detailsToggle: ReactNode;\n}\n\nfunction EditActionBar({\n backLabel,\n onBack,\n compact,\n status,\n actions,\n confirmLeave,\n confirmation,\n onLeave,\n detailsToggle,\n}: EditActionBarProps) {\n return (\n <header className=\"ds-edit-layout__bar\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"arrow-left\"\n isIconOnly={compact}\n aria-label={`Back to ${backLabel}`}\n onClick={onBack}\n >\n {backLabel}\n </Button>\n {confirmLeave ? confirmation : status}\n <div className=\"ds-edit-layout__actions\">\n {confirmLeave ? (\n <Button\n variant=\"danger\"\n size=\"sm\"\n onClick={onLeave}\n >\n Leave anyway\n </Button>\n ) : (\n actions\n )}\n {compact && detailsToggle}\n </div>\n </header>\n );\n}\n\ninterface DetailsRailProps {\n label: string;\n detailsId: string;\n expanded: boolean;\n /** Below the wide breakpoint, the toggle opens the Details sheet instead. */\n opensSheet: boolean;\n sheetOpen: boolean;\n toggleRef: RefObject<HTMLButtonElement | null>;\n /** Receives the rail content while the rail is expanded. */\n contentRef: RefObject<HTMLDivElement | null>;\n collapsed?: (expand: () => void) => ReactNode;\n onToggle: () => void;\n}\n\nfunction DetailsRail({\n label,\n detailsId,\n expanded,\n opensSheet,\n sheetOpen,\n toggleRef,\n contentRef,\n collapsed,\n onToggle,\n}: DetailsRailProps) {\n return (\n <aside\n className=\"ds-edit-layout__rail\"\n aria-label={label}\n >\n <header className=\"ds-edit-layout__rail-head\">\n {expanded && <span>{label}</span>}\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart={expanded ? \"chevrons-right\" : \"chevrons-left\"}\n className=\"ds-edit-layout__toggle\"\n aria-label={`${expanded ? \"Collapse\" : \"Expand\"} ${label}`}\n aria-expanded={expanded || sheetOpen}\n aria-controls={detailsId}\n aria-haspopup={opensSheet ? \"dialog\" : undefined}\n onClick={onToggle}\n />\n </header>\n {expanded ? (\n <div\n id={detailsId}\n ref={contentRef}\n className=\"ds-edit-layout__rail-content\"\n />\n ) : (\n <div className=\"ds-edit-layout__rail-icons\">\n {collapsed ? (\n collapsed(onToggle)\n ) : (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={`Show ${label}`}\n onClick={onToggle}\n />\n )}\n </div>\n )}\n </aside>\n );\n}\n\n/** Presentation only: the consumer owns saving, routing and persisted preferences. */\nexport const EditLayout = forwardRef<HTMLDivElement, EditLayoutProps>(function EditLayout(\n {\n backLabel,\n onBack,\n saveState = \"clean\",\n statusLabel,\n savedAgo,\n actions,\n rail,\n railCollapsed,\n railLabel = \"Details\",\n railOpen,\n defaultRailOpen = true,\n onRailToggle,\n confirmLeave = false,\n confirmText = \"Leave without saving?\",\n onKeepEditing,\n onLeave,\n children,\n className,\n onFocus,\n ...rest\n },\n ref,\n) {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const railSlotRef = useRef<HTMLDivElement>(null);\n const sheetSlotRef = useRef<HTMLDivElement>(null);\n const lastFocus = useRef<Element | null>(null);\n // Rail content renders once, into a node that moves between the rail and\n // the sheet, so uncontrolled fields keep their values across modes.\n const [railHost] = useState(() => createMovableHost(\"ds-edit-layout__rail-host\"));\n const [mode, setMode] = useState<LayoutMode>(\"wide\");\n const [localOpen, setLocalOpen] = useState(defaultRailOpen);\n const [sheet, setSheet] = useState(false);\n const [animate, setAnimate] = useState(false);\n const detailsId = useId();\n const compact = mode === \"tight\" || mode === \"compact\";\n const narrow = mode !== \"wide\";\n const expanded = !narrow && (railOpen ?? localOpen);\n\n // Leave confirmation and the wide rail both replace the Details sheet.\n if (sheet && (confirmLeave || !narrow)) {\n setSheet(false);\n }\n\n // Measure before the first paint, then re-render only when a breakpoint is crossed.\n useLayoutEffect(() => {\n let current: LayoutMode | undefined;\n return observeElementWidth(rootRef.current!, (width) => {\n const next = layoutMode(width);\n if (next === current) {\n return;\n }\n current = next;\n // Crossing a breakpoint is not a deliberate toggle, so it doesn't animate.\n setAnimate(false);\n setMode(next);\n });\n }, []);\n\n // Moving a node drops its focus; keep the user in the field they were in.\n useLayoutEffect(() => {\n if (railHost) {\n moveHost(railHost, railSlotRef.current ?? sheetSlotRef.current, lastFocus.current);\n }\n });\n\n // A breakpoint, a collapse or a closing sheet can remove the focused control.\n // Hand focus to the Details toggle that replaced it.\n useEffect(() => {\n const last = lastFocus.current;\n if (last && cannotHoldFocus(last) && cannotHoldFocus(document.activeElement)) {\n toggleRef.current?.focus({ preventScroll: true });\n }\n }, [mode, expanded, sheet]);\n\n const toggle = () => {\n if (narrow) {\n setSheet(true);\n return;\n }\n setAnimate(true);\n setLocalOpen(!expanded);\n onRailToggle?.(!expanded);\n };\n const closeDetails = () => flushSync(() => setSheet(false));\n const railContent = typeof rail === \"function\" ? rail(closeDetails) : rail;\n\n return (\n <div\n {...rest}\n ref={mergedRef}\n className={[\"ds-edit-layout\", className].filter(Boolean).join(\" \")}\n data-compact={compact || undefined}\n data-tight={mode === \"tight\" || undefined}\n data-expanded={expanded || undefined}\n data-animate={animate || undefined}\n onFocus={(event) => {\n lastFocus.current = event.target;\n onFocus?.(event);\n }}\n >\n <div className=\"ds-edit-layout__main\">\n <EditActionBar\n backLabel={backLabel}\n onBack={onBack}\n compact={compact}\n status={\n <SaveStatus\n saveState={saveState}\n statusLabel={statusLabel}\n savedAgo={savedAgo}\n />\n }\n actions={actions}\n confirmLeave={confirmLeave}\n confirmation={\n <LeaveConfirmation\n text={confirmText}\n bodyRef={bodyRef}\n onKeepEditing={onKeepEditing}\n />\n }\n onLeave={onLeave}\n detailsToggle={\n <Button\n ref={toggleRef}\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"info\"\n aria-label={railLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={sheet}\n aria-controls={detailsId}\n onClick={toggle}\n />\n }\n />\n <div\n ref={bodyRef}\n className=\"ds-edit-layout__body\"\n >\n <div className=\"ds-edit-layout__content\">{children}</div>\n </div>\n </div>\n {!compact && (\n <DetailsRail\n label={railLabel}\n detailsId={detailsId}\n expanded={expanded}\n opensSheet={narrow}\n sheetOpen={sheet}\n toggleRef={toggleRef}\n contentRef={railSlotRef}\n collapsed={railCollapsed}\n onToggle={toggle}\n />\n )}\n <Drawer\n id={narrow ? detailsId : undefined}\n dir={rest.dir}\n isOpen={sheet}\n onClose={() => setSheet(false)}\n side=\"end\"\n size=\"md\"\n title={railLabel}\n closeLabel={`Close ${railLabel}`}\n className=\"ds-edit-layout__sheet\"\n >\n {narrow && (\n <div\n ref={sheetSlotRef}\n className=\"ds-edit-layout__rail-content\"\n />\n )}\n </Drawer>\n {railHost && createPortal(railContent, railHost)}\n </div>\n );\n});\n"],"mappings":"A,sdAqDA,IAAMyB,EAAc,IAEdC,EAAgB,IAEhBC,EAAa,IAInB,SAASC,GAAW,EAA2B,CAU7C,OATIC,EAAQJ,EACH,QAELI,EAAQH,EACH,UAELG,EAAQF,EACH,SAEF,MACT,CAEA,IAAMG,EAA8C,CAClD,MAAO,aACP,MAAO,kBACP,OAAQ,UACR,MAAO,QACP,MAAO,gBACP,QAAS,4BACX,EAEMC,EAA2D,CAC/D,MAAO,IAAA,GACP,MAAO,IAAA,GACP,OAAQ,UACR,MAAO,QACP,MAAO,iBACP,QAAS,OACX,EAGMC,EAA+C,IAAI,IAAI,CAAC,QAAS,OAAO,CAAC,EAE/E,SAASC,EAAW,EAAiB,CAInC,OAHI,OAAOC,GAAS,SACXA,EAAK,KAAK,IAAM,GAElBA,GAAS,MAA8B,OAAOA,GAAS,SAChE,CAQA,SAASC,EAAW,CAAE,YAAW,WAAU,e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EAAA9D,EAAA,IAAA,CAAC,MAAD,CACE,IAAKkD,EACL,UAAU,8BACX,CAAA,CAEG,CAAA,EACPE,IAAA,EAAY9D,EAAAA,aAAAA,CAAa+E,GAAajB,CAAQ,CAC5C,C,EAET,CAAC,E"}
|
|
@@ -4,6 +4,12 @@ export interface EditLayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
backLabel: string;
|
|
5
5
|
onBack: () => void;
|
|
6
6
|
saveState?: EditSaveState;
|
|
7
|
+
/**
|
|
8
|
+
* Replaces the `clean` or `dirty` message, for example on a read-only record.
|
|
9
|
+
* Saving, saved, error and offline keep their standard messages, and
|
|
10
|
+
* `saveState` always controls the indicator and colour. Empty values are ignored.
|
|
11
|
+
*/
|
|
12
|
+
statusLabel?: ReactNode;
|
|
7
13
|
savedAgo?: ReactNode;
|
|
8
14
|
actions?: ReactNode;
|
|
9
15
|
/** A render slot can close the Details sheet before opening another dialog. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/EditLayout/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAUf,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzF,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+EAA+E;IAC/E,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,YAAY,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC,CAAC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