@ahrowe/ui 0.14.1 → 0.15.1

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.
Files changed (45) hide show
  1. package/dist/esm/common/errorBoundary/errorBoundary.mjs +4 -0
  2. package/dist/esm/common/errorBoundary/errorBoundary.mjs.map +1 -0
  3. package/dist/esm/common/errorBoundary/errorBoundary.module.mjs +2 -0
  4. package/dist/esm/common/errorBoundary/errorBoundary.module.mjs.map +1 -0
  5. package/dist/esm/common/floatingMenu/useFloatingPosition.mjs +1 -1
  6. package/dist/esm/common/floatingMenu/useFloatingPosition.mjs.map +1 -1
  7. package/dist/esm/common/input/input.mjs +1 -1
  8. package/dist/esm/common/input/input.mjs.map +1 -1
  9. package/dist/esm/common/kanbanBoard/KanbanBoard.mjs +2 -2
  10. package/dist/esm/common/kanbanBoard/KanbanBoard.mjs.map +1 -1
  11. package/dist/esm/common/kanbanBoard/KanbanColumn.mjs +1 -1
  12. package/dist/esm/common/kanbanBoard/KanbanColumn.mjs.map +1 -1
  13. package/dist/esm/common/kanbanBoard/kanbanBoard.module.mjs +1 -1
  14. package/dist/esm/common/kanbanBoard/kanbanBoard.module.mjs.map +1 -1
  15. package/dist/esm/common/numberInput/numberInput.mjs +1 -1
  16. package/dist/esm/common/numberInput/numberInput.mjs.map +1 -1
  17. package/dist/esm/common/timeline/timeline.mjs +2 -0
  18. package/dist/esm/common/timeline/timeline.mjs.map +1 -0
  19. package/dist/esm/common/timeline/timeline.module.mjs +2 -0
  20. package/dist/esm/common/timeline/timeline.module.mjs.map +1 -0
  21. package/dist/esm/common/timeline/timeline.types.mjs +2 -0
  22. package/dist/esm/common/timeline/timeline.types.mjs.map +1 -0
  23. package/dist/esm/index.mjs +1 -1
  24. package/dist/index.cjs +7 -5
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/style.css +1 -1
  27. package/dist/types/package/common/errorBoundary/errorBoundary.d.ts +14 -0
  28. package/dist/types/package/common/errorBoundary/errorBoundary.types.d.ts +57 -0
  29. package/dist/types/package/common/errorBoundary/index.d.ts +2 -0
  30. package/dist/types/package/common/kanbanBoard/KanbanBoard.d.ts +1 -1
  31. package/dist/types/package/common/kanbanBoard/KanbanColumn.d.ts +9 -1
  32. package/dist/types/package/common/kanbanBoard/kanbanBoard.types.d.ts +29 -1
  33. package/dist/types/package/common/timeline/index.d.ts +2 -0
  34. package/dist/types/package/common/timeline/timeline.d.ts +2 -0
  35. package/dist/types/package/common/timeline/timeline.types.d.ts +51 -0
  36. package/dist/types/package/index.d.ts +4 -0
  37. package/docs/CLAUDE.md +2 -0
  38. package/docs/Dropdown.md +1 -1
  39. package/docs/ErrorBoundary.md +93 -0
  40. package/docs/FloatingMenu.md +2 -0
  41. package/docs/Input.md +25 -2
  42. package/docs/InputDropdown.md +1 -1
  43. package/docs/KanbanBoard.md +37 -1
  44. package/docs/Timeline.md +127 -0
  45. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ import e from"../accordion/accordion.mjs";import{ButtonSize as t}from"../button/button.types.mjs";import n from"../button/button.mjs";import{showToast as r}from"../toast/toastService.mjs";import i from"./errorBoundary.module.mjs";import a from"react";import o from"classnames";import{FontAwesomeIcon as s}from"@fortawesome/react-fontawesome";import{faArrowRotateRight as c,faCheck as l,faCopy as u,faTriangleExclamation as d}from"@fortawesome/free-solid-svg-icons";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=2e3,h={stackTrace:`Stack trace`,copy:`Copy`,copied:`Copied`,reset:`Try again`,copySuccessToast:`Stack trace copied to clipboard`,copyErrorToast:`Could not copy stack trace`};function g(e,t){let n=[e.stack??`${e.name}: ${e.message}`];return t?.componentStack&&n.push(`Component stack:${t.componentStack}`),n.join(`
2
+
3
+ `)}var _=class extends a.Component{constructor(...e){super(...e),this.state={error:null,errorInfo:null,copied:!1},this.copyResetTimeout=null,this.reset=()=>{this.setState({error:null,errorInfo:null,copied:!1}),this.props.onReset?.()},this.copyStackTrace=async()=>{let{error:e,errorInfo:t}=this.state;if(!e)return;let n={...h,...this.props.labels};try{await navigator.clipboard.writeText(g(e,t)),this.setState({copied:!0}),this.copyResetTimeout&&clearTimeout(this.copyResetTimeout),this.copyResetTimeout=setTimeout(()=>this.setState({copied:!1}),m),r(n.copySuccessToast,{type:`success`})}catch{r(n.copyErrorToast,{type:`error`})}}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.setState({errorInfo:t}),this.props.onError?.(e,t)}componentDidUpdate(e){if(!this.state.error)return;let t=e.resetKeys??[],n=this.props.resetKeys??[];(n.length!==t.length||n.some((e,n)=>e!==t[n]))&&this.reset()}componentWillUnmount(){this.copyResetTimeout&&clearTimeout(this.copyResetTimeout)}render(){let{error:r,errorInfo:a,copied:m}=this.state,{children:_=null,title:v=`Something went wrong`,description:y,labels:b,fallback:x,hideStack:S=!1,className:C,style:w,classNames:T,styles:E,onError:D,onReset:O,resetKeys:k,role:A=`alert`,...j}=this.props;if(!r)return _;let M={...h,...b};return x?typeof x==`function`?x({error:r,errorInfo:a,resetErrorBoundary:this.reset}):x:p(`div`,{...j,role:A,className:o(i.errorBoundary,C,T?.root),style:{...w,...E?.root},children:[p(`div`,{className:o(i.errorBoundaryHeader,T?.header),style:E?.header,children:[f(`div`,{className:o(i.errorBoundaryBadge,T?.badge),style:E?.badge,children:f(s,{icon:d,className:o(i.errorBoundaryIcon,T?.icon),style:E?.icon})}),f(`div`,{className:o(i.errorBoundaryTitle,T?.title),style:E?.title,children:v}),f(`div`,{className:o(i.errorBoundaryDescription,T?.description),style:E?.description,children:y??r.message})]}),!S&&p(e,{title:M.stackTrace,className:o(i.errorBoundaryStack,T?.stack),style:E?.stack,children:[p(`div`,{className:o(i.errorBoundaryStackHeader,T?.stackHeader),style:E?.stackHeader,children:[f(`span`,{className:o(i.errorBoundaryStackLabel,T?.stackLabel),style:E?.stackLabel,children:r.name||`Error`}),f(n,{size:t.Small,icon:m?l:u,onClick:this.copyStackTrace,className:o(i.errorBoundaryCopyButton,m&&i.errorBoundaryCopyButtonActive,T?.copyButton),style:E?.copyButton,children:m?M.copied:M.copy})]}),f(`pre`,{className:o(i.errorBoundaryStackTrace,T?.stackTrace),style:E?.stackTrace,children:g(r,a)})]}),f(`div`,{className:o(i.errorBoundaryActions,T?.actions),style:E?.actions,children:f(n,{onClick:this.reset,icon:c,className:o(i.errorBoundaryResetButton,T?.resetButton),style:E?.resetButton,children:M.reset})})]})}};export{_ as default};
4
+ //# sourceMappingURL=errorBoundary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorBoundary.mjs","names":[],"sources":["../../../../package/common/errorBoundary/errorBoundary.tsx"],"sourcesContent":["import React from 'react';\nimport cx from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faTriangleExclamation, faCopy, faCheck, faArrowRotateRight } from '@fortawesome/free-solid-svg-icons';\n\nimport Button, { ButtonSize } from '../button';\nimport Accordion from '../accordion';\nimport { showToast } from '../toast';\nimport type { ErrorBoundaryLabels, ErrorBoundaryProps, ErrorBoundaryState } from './errorBoundary.types';\nimport styles from './errorBoundary.module.pcss';\n\nconst COPY_FEEDBACK_DURATION = 2000;\n\nconst DEFAULT_LABELS: Required<ErrorBoundaryLabels> = {\n stackTrace: 'Stack trace',\n copy: 'Copy',\n copied: 'Copied',\n reset: 'Try again',\n copySuccessToast: 'Stack trace copied to clipboard',\n copyErrorToast: 'Could not copy stack trace',\n};\n\nfunction formatStackTrace(error: Error, errorInfo: React.ErrorInfo | null): string {\n const parts = [error.stack ?? `${error.name}: ${error.message}`];\n if (errorInfo?.componentStack) parts.push(`Component stack:${errorInfo.componentStack}`);\n return parts.join('\\n\\n');\n}\n\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState = { error: null, errorInfo: null, copied: false };\n\n private copyResetTimeout: ReturnType<typeof setTimeout> | null = null;\n\n static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState> {\n return { error };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n this.setState({ errorInfo });\n this.props.onError?.(error, errorInfo);\n }\n\n componentDidUpdate(prevProps: ErrorBoundaryProps): void {\n if (!this.state.error) return;\n const prevKeys = prevProps.resetKeys ?? [];\n const nextKeys = this.props.resetKeys ?? [];\n const changed = nextKeys.length !== prevKeys.length || nextKeys.some((key, i) => key !== prevKeys[i]);\n if (changed) this.reset();\n }\n\n componentWillUnmount(): void {\n if (this.copyResetTimeout) clearTimeout(this.copyResetTimeout);\n }\n\n private reset = (): void => {\n this.setState({ error: null, errorInfo: null, copied: false });\n this.props.onReset?.();\n };\n\n private copyStackTrace = async (): Promise<void> => {\n const { error, errorInfo } = this.state;\n if (!error) return;\n const labels = { ...DEFAULT_LABELS, ...this.props.labels };\n try {\n await navigator.clipboard.writeText(formatStackTrace(error, errorInfo));\n this.setState({ copied: true });\n if (this.copyResetTimeout) clearTimeout(this.copyResetTimeout);\n this.copyResetTimeout = setTimeout(() => this.setState({ copied: false }), COPY_FEEDBACK_DURATION);\n showToast(labels.copySuccessToast, { type: 'success' });\n } catch {\n showToast(labels.copyErrorToast, { type: 'error' });\n }\n };\n\n render(): React.ReactNode {\n const { error, errorInfo, copied } = this.state;\n // onError/onReset/resetKeys are consumed elsewhere (getDerivedStateFromError,\n // componentDidCatch, componentDidUpdate) and must not land on the root element via `rest`.\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const {\n children = null,\n title = 'Something went wrong',\n description,\n labels: labelOverrides,\n fallback,\n hideStack = false,\n className,\n style,\n classNames,\n styles: slotStyles,\n onError,\n onReset,\n resetKeys,\n role = 'alert',\n ...rest\n } = this.props;\n\n if (!error) return children;\n\n const labels = { ...DEFAULT_LABELS, ...labelOverrides };\n\n if (fallback) {\n return typeof fallback === 'function'\n ? fallback({ error, errorInfo, resetErrorBoundary: this.reset })\n : fallback;\n }\n\n return (\n <div\n {...rest}\n role={role}\n className={cx(styles.errorBoundary, className, classNames?.root)}\n style={{ ...style, ...slotStyles?.root }}\n >\n <div className={cx(styles.errorBoundaryHeader, classNames?.header)} style={slotStyles?.header}>\n <div className={cx(styles.errorBoundaryBadge, classNames?.badge)} style={slotStyles?.badge}>\n <FontAwesomeIcon\n icon={faTriangleExclamation}\n className={cx(styles.errorBoundaryIcon, classNames?.icon)}\n style={slotStyles?.icon as React.CSSProperties & Record<`--fa-font-${string}`, string>}\n />\n </div>\n <div className={cx(styles.errorBoundaryTitle, classNames?.title)} style={slotStyles?.title}>\n {title}\n </div>\n <div className={cx(styles.errorBoundaryDescription, classNames?.description)} style={slotStyles?.description}>\n {description ?? error.message}\n </div>\n </div>\n\n {!hideStack && (\n <Accordion\n title={labels.stackTrace}\n className={cx(styles.errorBoundaryStack, classNames?.stack)}\n style={slotStyles?.stack}\n >\n <div className={cx(styles.errorBoundaryStackHeader, classNames?.stackHeader)} style={slotStyles?.stackHeader}>\n <span className={cx(styles.errorBoundaryStackLabel, classNames?.stackLabel)} style={slotStyles?.stackLabel}>\n {error.name || 'Error'}\n </span>\n <Button\n size={ButtonSize.Small}\n icon={copied ? faCheck : faCopy}\n onClick={this.copyStackTrace}\n className={cx(styles.errorBoundaryCopyButton, copied && styles.errorBoundaryCopyButtonActive, classNames?.copyButton)}\n style={slotStyles?.copyButton}\n >\n {copied ? labels.copied : labels.copy}\n </Button>\n </div>\n <pre className={cx(styles.errorBoundaryStackTrace, classNames?.stackTrace)} style={slotStyles?.stackTrace}>\n {formatStackTrace(error, errorInfo)}\n </pre>\n </Accordion>\n )}\n\n <div className={cx(styles.errorBoundaryActions, classNames?.actions)} style={slotStyles?.actions}>\n <Button\n onClick={this.reset}\n icon={faArrowRotateRight}\n className={cx(styles.errorBoundaryResetButton, classNames?.resetButton)}\n style={slotStyles?.resetButton}\n >\n {labels.reset}\n </Button>\n </div>\n </div>\n );\n }\n}\n\nexport default ErrorBoundary;\n"],"mappings":"mgBAWA,IAAM,EAAyB,IAEzB,EAAgD,CACpD,WAAY,cACZ,KAAM,OAC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AW,EAAG,EAAO,mBAAoB,GAAY,KAAK,EAC1D,MAAO,GAAY,eAHrB,CAKE,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,yBAA0B,GAAY,WAAW,EAAG,MAAO,GAAY,qBAAjG,CACE,EAAC,OAAD,CAAM,UAAW,EAAG,EAAO,wBAAyB,GAAY,UAAU,EAAG,MAAO,GAAY,oBAC7F,EAAM,MAAQ,OACX,CAAA,EACN,EAAC,EAAD,CACE,KAAM,EAAW,MACjB,KAAM,EAAS,EAAU,EACzB,QAAS,KAAK,eACd,UAAW,EAAG,EAAO,wBAAyB,GAAU,EAAO,8BAA+B,GAAY,UAAU,EACpH,MAAO,GAAY,oBAElB,EAAS,EAAO,OAAS,EAAO,IAC3B,CAAA,CACL,IACL,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,wBAAyB,GAAY,UAAU,EAAG,MAAO,GAAY,oBAC5F,EAAiB,EAAO,CAAS,CAC/B,CAAA,CACI,IAGb,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,qBAAsB,GAAY,OAAO,EAAG,MAAO,GAAY,iBACvF,EAAC,EAAD,CACE,QAAS,KAAK,MACd,KAAM,EACN,UAAW,EAAG,EAAO,yBAA0B,GAAY,WAAW,EACtE,MAAO,GAAY,qBAElB,EAAO,KACF,CAAA,CACL,CAAA,CACF,GAET,CACF"}
@@ -0,0 +1,2 @@
1
+ var e={errorBoundary:`errorBoundary_XdPM0`,errorBoundaryHeader:`errorBoundaryHeader_2PdRz`,errorBoundaryBadge:`errorBoundaryBadge_TyXdO`,errorBoundaryBadgeIn:`errorBoundaryBadgeIn_Q-MMB`,errorBoundaryIcon:`errorBoundaryIcon_PcZ4H`,errorBoundaryTitle:`errorBoundaryTitle_X9tEE`,errorBoundaryFadeUp:`errorBoundaryFadeUp_2qx5d`,errorBoundaryDescription:`errorBoundaryDescription_NELdD`,errorBoundaryStack:`errorBoundaryStack_BUkBD`,errorBoundaryStackHeader:`errorBoundaryStackHeader_uimLH`,errorBoundaryStackLabel:`errorBoundaryStackLabel_D-19W`,errorBoundaryCopyButton:`errorBoundaryCopyButton_e09KC`,errorBoundaryCopyButtonActive:`errorBoundaryCopyButtonActive_OBPiV`,errorBoundaryStackTrace:`errorBoundaryStackTrace_DskzG`,errorBoundaryActions:`errorBoundaryActions_h3GMQ`};export{e as default};
2
+ //# sourceMappingURL=errorBoundary.module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorBoundary.module.mjs","names":[],"sources":["../../../../package/common/errorBoundary/errorBoundary.module.pcss"],"sourcesContent":["@keyframes errorBoundaryBadgeIn {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes errorBoundaryFadeUp {\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.errorBoundary {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 20px;\n padding: 36px 28px;\n border-radius: var(--default-border-radius);\n background: var(--background-accent);\n border: 1px solid var(--border-color);\n box-shadow: var(--card-shadow);\n color: var(--text-color);\n font-family: var(--default-font);\n box-sizing: border-box;\n overflow: hidden;\n isolation: isolate;\n\n &::before {\n content: '';\n position: absolute;\n top: -30px;\n left: 50%;\n width: 260px;\n height: 180px;\n transform: translateX(-50%);\n background: radial-gradient(closest-side, color-mix(in srgb, var(--error-color) 16%, transparent), transparent);\n pointer-events: none;\n z-index: -1;\n }\n\n &Header {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n text-align: center;\n max-width: 420px;\n }\n\n &Badge {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 52px;\n height: 52px;\n border-radius: 50%;\n background: var(--error-lighter);\n box-shadow: 0 0 0 6px color-mix(in srgb, var(--error-color) 8%, transparent);\n margin-bottom: 4px;\n animation: errorBoundaryBadgeIn 0.35s ease-out;\n }\n\n &Icon {\n font-size: 20px;\n color: var(--error-color, #ef4444);\n }\n\n &Title {\n font-weight: var(--header-font-weight, 700);\n font-size: 17px;\n animation: errorBoundaryFadeUp 0.3s ease-out 0.05s backwards;\n }\n\n &Description {\n color: var(--text-dark);\n font-size: 14px;\n line-height: 1.5;\n word-break: break-word;\n animation: errorBoundaryFadeUp 0.3s ease-out 0.1s backwards;\n }\n\n &Stack {\n align-self: stretch;\n width: 100%;\n text-align: left;\n animation: errorBoundaryFadeUp 0.3s ease-out 0.15s backwards;\n }\n\n &StackHeader {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n margin-bottom: 10px;\n }\n\n &StackLabel {\n font-family: var(--monospace-font, monospace);\n font-size: 11px;\n font-weight: 700;\n letter-spacing: 0.02em;\n text-transform: uppercase;\n color: var(--error-color, #ef4444);\n background: var(--error-lighter);\n padding: 3px 8px;\n border-radius: 999px;\n }\n\n &CopyButton {\n flex-shrink: 0;\n\n &Active {\n color: var(--success-color) !important;\n }\n }\n\n &StackTrace {\n margin: 0;\n padding: 12px;\n border-radius: var(--default-border-radius);\n background: var(--background);\n color: var(--text-dark);\n font-family: var(--monospace-font, monospace);\n font-size: 12px;\n line-height: 1.6;\n white-space: pre-wrap;\n word-break: break-word;\n max-height: 320px;\n overflow: auto;\n }\n\n &Actions {\n display: flex;\n justify-content: center;\n animation: errorBoundaryFadeUp 0.3s ease-out 0.2s backwards;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .errorBoundaryBadge,\n .errorBoundaryTitle,\n .errorBoundaryDescription,\n .errorBoundaryStack,\n .errorBoundaryActions {\n animation: none;\n }\n}\n"],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{getScrollableAncestors as e,isHiddenByAnyAncestor as t}from"../utils/scrollAncestors.mjs";import{useLayoutEffect as n}from"react";function r({isOpen:r,triggerRef:i,anchorRef:a,panelRef:o,flipClassName:s,placement:c=`bottom`}){n(()=>{if(!r)return;let n,l;function u(){let r=i.current,d=a.current;if(!r||!d){n=requestAnimationFrame(u);return}let f=e(r);function p(){let e=r.getBoundingClientRect(),n=o.current?.offsetHeight??0,i=window.innerHeight-e.bottom,a=e.top,l=c===`top`?a:i,u=l<n&&(c===`top`?i:a)>l,p=c===`top`?!u:u;d.classList.toggle(s,u),d.style.top=`${p?e.top-d.offsetHeight:e.bottom}px`,d.style.left=`${e.left}px`,d.style.visibility=t(e,f)?`hidden`:``}p();let m=[window,...f];m.forEach(e=>e.addEventListener(`scroll`,p,{passive:!0})),window.addEventListener(`resize`,p),l=()=>{m.forEach(e=>e.removeEventListener(`scroll`,p)),window.removeEventListener(`resize`,p)}}return u(),()=>{n!==void 0&&cancelAnimationFrame(n),l?.()}},[r,i,a,o,s,c])}export{r as useFloatingPosition};
1
+ import{getScrollableAncestors as e,isHiddenByAnyAncestor as t}from"../utils/scrollAncestors.mjs";import{useLayoutEffect as n}from"react";function r({isOpen:r,triggerRef:i,anchorRef:a,panelRef:o,flipClassName:s,placement:c=`bottom`}){n(()=>{if(!r)return;let n,l;function u(){let r=i.current,d=a.current;if(!r||!d){n=requestAnimationFrame(u);return}let f=e(r);function p(){let e=r.getBoundingClientRect(),n=o.current?.offsetHeight??0,i=window.innerHeight-e.bottom,a=e.top,l=c===`top`?a:i,u=l<n&&(c===`top`?i:a)>l,p=c===`top`?!u:u;d.classList.toggle(s,u),d.style.top=`${p?e.top-d.offsetHeight:e.bottom}px`,d.style.left=`${e.left}px`,d.style.visibility=t(e,f)?`hidden`:``;let m=o.current;m&&!h.has(m)&&g()}let m=new ResizeObserver(()=>p()),h=new Set;function g(){[d,o.current].forEach(e=>{!e||h.has(e)||(h.add(e),m.observe(e))})}p();let _=[window,...f];_.forEach(e=>e.addEventListener(`scroll`,p,{passive:!0})),window.addEventListener(`resize`,p),l=()=>{_.forEach(e=>e.removeEventListener(`scroll`,p)),window.removeEventListener(`resize`,p),m.disconnect()}}return u(),()=>{n!==void 0&&cancelAnimationFrame(n),l?.()}},[r,i,a,o,s,c])}export{r as useFloatingPosition};
2
2
  //# sourceMappingURL=useFloatingPosition.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFloatingPosition.mjs","names":[],"sources":["../../../../package/common/floatingMenu/useFloatingPosition.ts"],"sourcesContent":["import { useLayoutEffect, type RefObject } from 'react';\nimport { getScrollableAncestors, isHiddenByAnyAncestor } from 'components/common/utils/scrollAncestors';\n\nexport interface UseFloatingPositionArgs {\n isOpen: boolean;\n /** The element the popup is anchored to. */\n triggerRef: RefObject<HTMLElement | null>;\n /** The `position: fixed` element that gets `top`/`left`/`visibility` written to it directly. */\n anchorRef: RefObject<HTMLElement | null>;\n /** The visible panel whose height decides whether there's room to render on the preferred side. */\n panelRef: RefObject<HTMLElement | null>;\n /** Class toggled on `anchorRef` when flipped to the non-preferred side. */\n flipClassName: string;\n /** Preferred side relative to the trigger (default `'bottom'`) — flips to the other side when there's no room. */\n placement?: 'top' | 'bottom';\n}\n\n/**\n * Keeps a portaled, `position: fixed` popup anchored to a trigger element: tracks the\n * trigger across scroll/resize on every real scrolling ancestor, flips above the trigger\n * when there's no room below, and hides (not closes) the popup when the trigger itself\n * scrolls behind a clipping ancestor — matching Floating UI's autoUpdate + hide middleware.\n *\n * Position/visibility are written straight to the DOM via refs, not through React state:\n * going through setState -> re-render -> commit adds a round-trip that lags behind the\n * browser's own scroll painting by at least a frame.\n */\nexport function useFloatingPosition({ isOpen, triggerRef, anchorRef, panelRef, flipClassName, placement = 'bottom' }: UseFloatingPositionArgs) {\n useLayoutEffect(() => {\n if (!isOpen) return;\n\n let rafId: number | undefined;\n let teardown: (() => void) | undefined;\n\n // The anchor/trigger may not be mounted yet on the very first invocation of this\n // effect: a portal target (e.g. BodyEnd's `#bodyEnd` div) can still be missing on\n // the initial render, in which case the portaled content — and this ref — commits\n // one render later. Since refs never change identity, that later commit doesn't\n // re-trigger this effect on its own, so retry on the next frame until it's there.\n function trySetup() {\n const trigger = triggerRef.current;\n const anchor = anchorRef.current;\n if (!trigger || !anchor) {\n rafId = requestAnimationFrame(trySetup);\n return;\n }\n const ancestors = getScrollableAncestors(trigger);\n\n function updatePos() {\n const rect = trigger!.getBoundingClientRect();\n const panelHeight = panelRef.current?.offsetHeight ?? 0;\n const spaceBelow = window.innerHeight - rect.bottom;\n const spaceAbove = rect.top;\n const preferredSpace = placement === 'top' ? spaceAbove : spaceBelow;\n const alternateSpace = placement === 'top' ? spaceBelow : spaceAbove;\n const flip = preferredSpace < panelHeight && alternateSpace > preferredSpace;\n const renderAbove = placement === 'top' ? !flip : flip;\n anchor!.classList.toggle(flipClassName, flip);\n // Shift up by the anchor's own height when rendering above, so this works whether\n // the anchor is a zero-height decorative wrapper (FloatingMenu, whose real panel\n // hangs off it via absolute-positioned CSS) or the visible panel itself\n // (Dropdown) — for the former the shift is a no-op (height 0).\n anchor!.style.top = `${renderAbove ? rect.top - anchor!.offsetHeight : rect.bottom}px`;\n anchor!.style.left = `${rect.left}px`;\n anchor!.style.visibility = isHiddenByAnyAncestor(rect, ancestors) ? 'hidden' : '';\n }\n\n updatePos();\n\n const scrollTargets: (Window | HTMLElement)[] = [window, ...ancestors];\n scrollTargets.forEach((t) => t.addEventListener('scroll', updatePos, { passive: true }));\n window.addEventListener('resize', updatePos);\n teardown = () => {\n scrollTargets.forEach((t) => t.removeEventListener('scroll', updatePos));\n window.removeEventListener('resize', updatePos);\n };\n }\n\n trySetup();\n\n return () => {\n if (rafId !== undefined) cancelAnimationFrame(rafId);\n teardown?.();\n };\n }, [isOpen, triggerRef, anchorRef, panelRef, flipClassName, placement]);\n}"],"mappings":"yIA2BA,SAAgB,EAAoB,CAAE,SAAQ,aAAY,YAAW,WAAU,gBAAe,YAAY,UAAqC,CAC7I,MAAsB,CACpB,GAAI,CAAC,EAAQ,OAEb,IAAI,EACA,EAOJ,SAAS,GAAW,CAClB,IAAM,EAAU,EAAW,QACrB,EAAS,EAAU,QACzB,GAAI,CAAC,GAAW,CAAC,EAAQ,CACvB,EAAQ,sBAAsB,CAAQ,EACtC,MACF,CACA,IAAM,EAAY,EAAuB,CAAO,EAEhD,SAAS,GAAY,CACnB,IAAM,EAAO,EAAS,sBAAsB,EACtC,EAAc,EAAS,SAAS,cAAgB,EAChD,EAAa,OAAO,YAAc,EAAK,OACvC,EAAa,EAAK,IAClB,EAAiB,IAAc,MAAQ,EAAa,EAEpD,EAAO,EAAiB,IADP,IAAc,MAAQ,EAAa,GACI,EACxD,EAAc,IAAc,MAAQ,CAAC,EAAO,EAClD,EAAQ,UAAU,OAAO,EAAe,CAAI,EAK5C,EAAQ,MAAM,IAAM,GAAG,EAAc,EAAK,IAAM,EAAQ,aAAe,EAAK,OAAO,IACnF,EAAQ,MAAM,KAAO,GAAG,EAAK,KAAK,IAClC,EAAQ,MAAM,WAAa,EAAsB,EAAM,CAAS,EAAI,SAAW,EACjF,CAEA,EAAU,EAEV,IAAM,EAA0C,CAAC,OAAQ,GAAG,CAAS,EACrE,EAAc,QAAS,GAAM,EAAE,iBAAiB,SAAU,EAAW,CAAE,QAAS,EAAK,CAAC,CAAC,EACvF,OAAO,iBAAiB,SAAU,CAAS,EAC3C,MAAiB,CACf,EAAc,QAAS,GAAM,EAAE,oBAAoB,SAAU,CAAS,CAAC,EACvE,OAAO,oBAAoB,SAAU,CAAS,CAChD,CACF,CAIA,OAFA,EAAS,MAEI,CACP,IAAU,IAAA,IAAW,qBAAqB,CAAK,EACnD,IAAW,CACb,CACF,EAAG,CAAC,EAAQ,EAAY,EAAW,EAAU,EAAe,CAAS,CAAC,CACxE"}
1
+ {"version":3,"file":"useFloatingPosition.mjs","names":[],"sources":["../../../../package/common/floatingMenu/useFloatingPosition.ts"],"sourcesContent":["import { useLayoutEffect, type RefObject } from 'react';\nimport { getScrollableAncestors, isHiddenByAnyAncestor } from 'components/common/utils/scrollAncestors';\n\nexport interface UseFloatingPositionArgs {\n isOpen: boolean;\n /** The element the popup is anchored to. */\n triggerRef: RefObject<HTMLElement | null>;\n /** The `position: fixed` element that gets `top`/`left`/`visibility` written to it directly. */\n anchorRef: RefObject<HTMLElement | null>;\n /** The visible panel whose height decides whether there's room to render on the preferred side. */\n panelRef: RefObject<HTMLElement | null>;\n /** Class toggled on `anchorRef` when flipped to the non-preferred side. */\n flipClassName: string;\n /** Preferred side relative to the trigger (default `'bottom'`) — flips to the other side when there's no room. */\n placement?: 'top' | 'bottom';\n}\n\n/**\n * Keeps a portaled, `position: fixed` popup anchored to a trigger element: tracks the\n * trigger across scroll/resize on every real scrolling ancestor, flips above the trigger\n * when there's no room below, and hides (not closes) the popup when the trigger itself\n * scrolls behind a clipping ancestor — matching Floating UI's autoUpdate + hide middleware.\n *\n * Position/visibility are written straight to the DOM via refs, not through React state:\n * going through setState -> re-render -> commit adds a round-trip that lags behind the\n * browser's own scroll painting by at least a frame.\n */\nexport function useFloatingPosition({ isOpen, triggerRef, anchorRef, panelRef, flipClassName, placement = 'bottom' }: UseFloatingPositionArgs) {\n useLayoutEffect(() => {\n if (!isOpen) return;\n\n let rafId: number | undefined;\n let teardown: (() => void) | undefined;\n\n // The anchor/trigger may not be mounted yet on the very first invocation of this\n // effect: a portal target (e.g. BodyEnd's `#bodyEnd` div) can still be missing on\n // the initial render, in which case the portaled content — and this ref — commits\n // one render later. Since refs never change identity, that later commit doesn't\n // re-trigger this effect on its own, so retry on the next frame until it's there.\n function trySetup() {\n const trigger = triggerRef.current;\n const anchor = anchorRef.current;\n if (!trigger || !anchor) {\n rafId = requestAnimationFrame(trySetup);\n return;\n }\n const ancestors = getScrollableAncestors(trigger);\n\n function updatePos() {\n const rect = trigger!.getBoundingClientRect();\n const panelHeight = panelRef.current?.offsetHeight ?? 0;\n const spaceBelow = window.innerHeight - rect.bottom;\n const spaceAbove = rect.top;\n const preferredSpace = placement === 'top' ? spaceAbove : spaceBelow;\n const alternateSpace = placement === 'top' ? spaceBelow : spaceAbove;\n const flip = preferredSpace < panelHeight && alternateSpace > preferredSpace;\n const renderAbove = placement === 'top' ? !flip : flip;\n anchor!.classList.toggle(flipClassName, flip);\n // Shift up by the anchor's own height when rendering above, so this works whether\n // the anchor is a zero-height decorative wrapper (FloatingMenu, whose real panel\n // hangs off it via absolute-positioned CSS) or the visible panel itself\n // (Dropdown) — for the former the shift is a no-op (height 0).\n anchor!.style.top = `${renderAbove ? rect.top - anchor!.offsetHeight : rect.bottom}px`;\n anchor!.style.left = `${rect.left}px`;\n anchor!.style.visibility = isHiddenByAnyAncestor(rect, ancestors) ? 'hidden' : '';\n // The panel can mount a commit later than the anchor; once it's observed this\n // is a single Set lookup, so it costs nothing on the scroll path.\n const panel = panelRef.current;\n if (panel && !observed.has(panel)) observeSizeTargets();\n }\n\n // The panel's own height feeds both the flip decision and, when rendering above,\n // the top offset — so a popup whose content changes size while open (a filtered\n // list shrinking, an async list loading in) has to be re-measured, or it keeps a\n // top computed for its old height and ends up detached from the trigger.\n const resizeObserver = new ResizeObserver(() => updatePos());\n const observed = new Set<Element>();\n function observeSizeTargets() {\n // Both, since they're the same element for a panel-as-anchor consumer (Dropdown)\n // but not for a zero-height wrapper whose content sits inside it (FloatingMenu).\n // Called from updatePos too: the panel can mount a commit later than the anchor.\n [anchor, panelRef.current].forEach((el) => {\n if (!el || observed.has(el)) return;\n observed.add(el);\n resizeObserver.observe(el);\n });\n }\n\n updatePos();\n\n const scrollTargets: (Window | HTMLElement)[] = [window, ...ancestors];\n scrollTargets.forEach((t) => t.addEventListener('scroll', updatePos, { passive: true }));\n window.addEventListener('resize', updatePos);\n teardown = () => {\n scrollTargets.forEach((t) => t.removeEventListener('scroll', updatePos));\n window.removeEventListener('resize', updatePos);\n resizeObserver.disconnect();\n };\n }\n\n trySetup();\n\n return () => {\n if (rafId !== undefined) cancelAnimationFrame(rafId);\n teardown?.();\n };\n }, [isOpen, triggerRef, anchorRef, panelRef, flipClassName, placement]);\n}"],"mappings":"yIA2BA,SAAgB,EAAoB,CAAE,SAAQ,aAAY,YAAW,WAAU,gBAAe,YAAY,UAAqC,CAC7I,MAAsB,CACpB,GAAI,CAAC,EAAQ,OAEb,IAAI,EACA,EAOJ,SAAS,GAAW,CAClB,I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,OAFA,EAAS,MAEI,CACP,IAAU,IAAA,IAAW,qBAAqB,CAAK,EACnD,IAAW,CACb,CACF,EAAG,CAAC,EAAQ,EAAY,EAAW,EAAU,EAAe,CAAS,CAAC,CACxE"}
@@ -1,2 +1,2 @@
1
- import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../tooltip/tooltip.mjs";import n from"../animatedIcon/animatedIcon.mjs";import r from"./input.module.mjs";import{InputIconPosition as i,InputType as a}from"./input.types.mjs";import ee,{useCallback as te,useEffect as o,useId as ne,useRef as s,useState as c}from"react";import l from"classnames";import{FontAwesomeIcon as u}from"@fortawesome/react-fontawesome";import{faEnvelope as re,faEye as ie,faEyeSlash as ae,faPen as oe,faPhone as se,faSearch as ce,faXmark as d}from"@fortawesome/free-solid-svg-icons";import{jsx as f,jsxs as p}from"react/jsx-runtime";function m(m){let{name:h=``,id:le,label:g=``,errorMessage:ue=``,isValid:de=!0,className:fe=``,style:pe,value:_=``,icon:me=null,iconPosition:he,onChange:v=()=>{},onFocus:ge=null,onBlur:_e=null,onMouseEnter:ve=null,onMouseLeave:ye=null,isUppercase:be=!1,isRequired:xe=!1,tabIndex:Se=0,type:y=void 0,isRow:Ce=!1,onIconClick:b=null,parse:we=null,formValidator:x=null,autoFocus:S=!1,suffix:C=null,upperRightLabel:w=null,labelInBorder:Te=!1,showCancel:Ee=!1,onClearClicked:De,min:Oe=null,max:ke=null,placeholder:T=``,useMatLabelStyle:E=!0,alwaysFloatLabel:Ae=!1,autoComplete:je=null,onClick:Me=()=>null,readOnly:D=!1,customInput:O,alwaysShowCancel:Ne=!1,multiline:k=!1,rows:A,autoResize:j=!1,classNames:M,styles:N,disabled:P=!1,...F}=e(`Input`,m),[I,L]=c(!1),[Pe,R]=c(!1),[z,Fe]=c(!1),[,Ie]=c(0),B=s(null),V=s(x),Le=ne(),Re=le||h||Le,ze=te(()=>{let e=B.current;!e||!j||(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[j]);o(()=>{ze()},[]),o(()=>{S&&B.current&&setTimeout(()=>{B.current?.focus()},1)},[S]),o(()=>{V.current=x;let e=V.current;if(!e)return;e.label=g??``,e.validate();let t=()=>Ie(e=>e+1);return e.registerOnUpdateListener(t),()=>{e.removeOnUpdateListener(t)}},[x,g]);let Be=()=>x?x.touched&&x.hasError():!de||!!ue,Ve=()=>!!(xe||x&&x.validators.find(e=>e.validatorId===`required`)),He=e=>{R(!0),ve&&ve(e)},Ue=e=>{R(!1),ye&&ye(e)},We=e=>{L(!0),ge&&ge(e)},Ge=e=>{V.current&&(V.current.touched=!0),L(!1),_e&&_e(e)},Ke=e=>{let t,n;typeof e==`string`?n=e:(t=e,n=e.target.value),we&&(n=we(n)),x&&x.set(n),v&&v(n,t),ze()},qe=()=>{if(y!==a.Email)return y===a.Phone?`tel`:y===a.Search?`search`:y===`password`&&z?`text`:y},Je=()=>{if(y===a.Email)return`email`;if(y===a.Phone)return`tel`;if(y===a.Search)return`search`},H=y&&y!==a.Date&&y!==a.Iban&&y!==a.HasNoIcon,Ye=y===a.Search||y===a.Password,U=!!me,Xe=U&&!Ye,Ze=y===a.Email||y===a.Phone||y===a.Search,W=(he??(!E&&Ze?i.Left:i.Right))===i.Left,G={className:l(r.inputFieldIcon,{[r.inputFieldIconNotClickable]:!b,[r.inputFieldIconLeft]:W}),onClick:b??void 0},K=me,Qe=Xe&&K?ee.cloneElement(K,{className:l(r.inputFieldIcon,{[r.inputFieldIconNotClickable]:!b&&!K.props.onClick,[r.inputFieldIconLeft]:W},K.props.className),onClick:b??K.props.onClick}):null,$e=(H||U)&&W,et={className:l(r.inputFieldIcon,r.inputFieldIconPassword,{[r.inputFieldIconLeft]:W}),onClick:()=>Fe(!z)},q=Be(),J=g;J&&Ve()&&(J=`${J} *`);let tt=Ve()?f(`span`,{className:r.requiredMark,children:`*`}):null,Y=x?x.value:_,X=I&&!D,Z=E&&(Ae||X||Y||y===a.Date),Q=y===a.Search&&!!Y;function $(){x&&x.set(``),v?.(``),De?.()}return p(`div`,{className:l(r.input,{[r.inputIconLeft]:$e},fe),style:pe,children:[p(`label`,{htmlFor:Re,className:l(r.inputLabel,M?.label,{[r.inputLabelColumn]:!Ce,[r.inputLabelInBorder]:Te}),style:N?.label,children:[g&&!E?p(`span`,{className:r.inputLabelText,children:[g,tt]}):null,w&&f(`div`,{className:l(r.inputUpperRightLabel,M?.upperRightLabel),style:N?.upperRightLabel,children:w}),p(`div`,{className:l(r.inputContainer,{[r.inputContainerMultiline]:k},M?.container),style:N?.container,onMouseEnter:He,onMouseLeave:Ue,children:[Qe,ee.cloneElement(O||f(k?`textarea`:`input`,{}),{...F,className:l(r.inputField,{[r.inputFieldUppercase]:be,[r.inputFieldDate]:y===a.Date,[r.inputFieldDefault]:y!==a.Date,[r.inputFieldWithIcon]:H||U,[r.inputFieldWithIconLeft]:$e,[r.inputFieldMultiline]:k,[r.inputFieldMultilineAutoResize]:k&&j,[r.inputFieldReadOnly]:D&&!P},M?.input),name:h,id:Re,value:x?x.value:_,tabIndex:Se,ref:O?void 0:B,onChange:Ke,onFocus:We,onBlur:Ge,placeholder:E?``:T,autoComplete:je,onClick:Me,readOnly:D,disabled:P,...!k&&{type:qe(),inputMode:F.inputMode??Je(),min:Oe,max:ke},...k&&A!==void 0&&{rows:A}}),C&&f(`div`,{className:l(r.inputFieldSuffix,M?.suffix),style:N?.suffix,children:C})]}),f(`fieldset`,{className:l(r.inputFieldset,M?.fieldset,{[r.inputFieldsetNoNotch]:!g,[r.inputContainerBorderFocused]:X,[r.inputContainerBorderSearchFocused]:y===a.Search&&(X||_),[r.inputContainerBorderInvalid]:q,[r.inputContainerBorderError]:q}),style:N?.fieldset,children:f(`legend`,{className:l(r.inputFieldsetLegend,{[r.inputFieldsetLegendActive]:Z}),children:f(`span`,{children:J})})}),E&&g&&p(`div`,{className:l(r.inputMatLabel,{[r.inputMatLabelFloating]:Z,[r.inputMatLabelMultiline]:k&&!Z}),children:[g,tt]}),E&&T&&f(`div`,{className:l(r.inputPlaceholder,X&&!Y&&r.inputPlaceholderShown,k&&r.inputPlaceholderMultiline),children:T}),f(t,{variant:`error`,message:x?x.getCurrentErrorMessage():ue||``,isVisible:q&&(I||Pe)})]}),y===a.Phone&&!U&&f(u,{icon:se,...G}),y===a.Email&&!U&&f(u,{icon:re,...G}),y===a.Edit&&!U&&f(u,{icon:oe,...G}),y===a.Search&&f(n,{icon:Q?d:ce,className:l(r.inputFieldIcon,{[r.inputFieldIconNotClickable]:!Q,[r.inputFieldIconLeft]:W}),onClick:Q?$:void 0}),y===a.Password&&f(u,{icon:z?ae:ie,...et}),(Ee&&_&&(I||Pe)||Ne)&&y!==a.Search&&f(u,{icon:d,className:r.inputFieldIcon,onClick:$,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1)})]})}export{m as default};
1
+ import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../tooltip/tooltip.mjs";import n from"../animatedIcon/animatedIcon.mjs";import r from"./input.module.mjs";import{InputIconPosition as i,InputType as a}from"./input.types.mjs";import ee,{useCallback as te,useEffect as o,useId as ne,useRef as s,useState as c}from"react";import l from"classnames";import{FontAwesomeIcon as u}from"@fortawesome/react-fontawesome";import{faEnvelope as re,faEye as ie,faEyeSlash as ae,faPen as oe,faPhone as se,faSearch as ce,faXmark as d}from"@fortawesome/free-solid-svg-icons";import{jsx as f,jsxs as p}from"react/jsx-runtime";function m(m){let{name:h=``,id:le,label:g=``,errorMessage:ue=``,isValid:de=!0,className:fe=``,style:pe,value:me=``,icon:he=null,iconPosition:ge,onChange:_=()=>{},onFocus:_e=null,onBlur:ve=null,onMouseEnter:ye=null,onMouseLeave:be=null,isUppercase:xe=!1,isRequired:Se=!1,tabIndex:Ce=0,type:v=void 0,isRow:we=!1,onIconClick:y=null,parse:b=null,formValidator:x=null,autoFocus:S=!1,suffix:C=null,upperRightLabel:w=null,labelInBorder:Te=!1,showCancel:Ee=!1,onClearClicked:De,min:Oe=null,max:ke=null,placeholder:T=``,useMatLabelStyle:E=!0,alwaysFloatLabel:Ae=!1,autoComplete:je=null,onClick:Me=()=>null,readOnly:D=!1,customInput:O,alwaysShowCancel:Ne=!1,multiline:k=!1,rows:A,autoResize:j=!1,classNames:M,styles:N,disabled:P=!1,...F}=e(`Input`,m),[I,Pe]=c(!1),[Fe,L]=c(!1),[R,Ie]=c(!1),[,Le]=c(0),z=s(null),B=s(x),Re=ne(),ze=le||h||Re,Be=te(()=>{let e=z.current;!e||!j||(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[j]);o(()=>{Be()},[]),o(()=>{S&&z.current&&setTimeout(()=>{z.current?.focus()},1)},[S]),o(()=>{B.current=x;let e=B.current;if(!e)return;e.label=g??``,e.validate();let t=()=>Le(e=>e+1);return e.registerOnUpdateListener(t),()=>{e.removeOnUpdateListener(t)}},[x,g]);let Ve=()=>x?x.touched&&x.hasError():!de||!!ue,He=()=>!!(Se||x&&x.validators.find(e=>e.validatorId===`required`)),Ue=e=>{L(!0),ye&&ye(e)},We=e=>{L(!1),be&&be(e)},Ge=e=>{Pe(!0),_e&&_e(e)},Ke=e=>{B.current&&(B.current.touched=!0),Pe(!1),ve&&ve(e)},qe=e=>{let t,n;typeof e==`string`?n=e:(t=e,n=e.target.value),b&&(n=b(n)),x&&x.set(n),_&&_(n,t),Be()},Je=()=>{if(v!==a.Email)return v===a.Phone?`tel`:v===a.Search?`search`:v===`password`&&R?`text`:v},Ye=()=>{if(v===a.Email)return`email`;if(v===a.Phone)return`tel`;if(v===a.Search)return`search`},V=v&&v!==a.Date&&v!==a.Iban&&v!==a.HasNoIcon,Xe=v===a.Search||v===a.Password,H=!!he,Ze=H&&!Xe,Qe=v===a.Email||v===a.Phone||v===a.Search,U=(ge??(!E&&Qe?i.Left:i.Right))===i.Left,W={className:l(r.inputFieldIcon,{[r.inputFieldIconNotClickable]:!y,[r.inputFieldIconLeft]:U}),onClick:y??void 0},G=he,$e=Ze&&G?ee.cloneElement(G,{className:l(r.inputFieldIcon,{[r.inputFieldIconNotClickable]:!y&&!G.props.onClick,[r.inputFieldIconLeft]:U},G.props.className),onClick:y??G.props.onClick}):null,et=(V||H)&&U,tt={className:l(r.inputFieldIcon,r.inputFieldIconPassword,{[r.inputFieldIconLeft]:U}),onClick:()=>Ie(!R)},K=Ve(),q=g;q&&He()&&(q=`${q} *`);let nt=He()?f(`span`,{className:r.requiredMark,children:`*`}):null,J=x?x.value:me,Y=I&&!D,X=E&&(Ae||Y||J||v===a.Date),Z=v===a.Search&&!!J,Q=O?.props;function $(){x&&x.set(``),_?.(``),De?.()}return p(`div`,{className:l(r.input,{[r.inputIconLeft]:et},fe),style:pe,children:[p(`label`,{htmlFor:ze,className:l(r.inputLabel,M?.label,{[r.inputLabelColumn]:!we,[r.inputLabelInBorder]:Te}),style:N?.label,children:[g&&!E?p(`span`,{className:r.inputLabelText,children:[g,nt]}):null,w&&f(`div`,{className:l(r.inputUpperRightLabel,M?.upperRightLabel),style:N?.upperRightLabel,children:w}),p(`div`,{className:l(r.inputContainer,{[r.inputContainerMultiline]:k},M?.container),style:N?.container,onMouseEnter:Ue,onMouseLeave:We,children:[$e,ee.cloneElement(O||f(k?`textarea`:`input`,{}),{...F,className:l(r.inputField,{[r.inputFieldUppercase]:xe,[r.inputFieldDate]:v===a.Date,[r.inputFieldDefault]:v!==a.Date,[r.inputFieldWithIcon]:V||H,[r.inputFieldWithIconLeft]:et,[r.inputFieldMultiline]:k,[r.inputFieldMultilineAutoResize]:k&&j,[r.inputFieldReadOnly]:D&&!P},M?.input,Q?.className),style:Q?.style||N?.input?{...Q?.style,...N?.input}:void 0,name:h,id:ze,value:J,tabIndex:Ce,ref:O?void 0:z,onChange:qe,onFocus:Ge,onBlur:Ke,placeholder:E?``:T,autoComplete:je,onClick:Me,readOnly:D,disabled:P,...!k&&{type:Je(),inputMode:F.inputMode??Ye(),min:Oe,max:ke},...k&&A!==void 0&&{rows:A}}),C&&f(`div`,{className:l(r.inputFieldSuffix,M?.suffix),style:N?.suffix,children:C})]}),f(`fieldset`,{className:l(r.inputFieldset,M?.fieldset,{[r.inputFieldsetNoNotch]:!g,[r.inputContainerBorderFocused]:Y,[r.inputContainerBorderSearchFocused]:v===a.Search&&(Y||!!J),[r.inputContainerBorderInvalid]:K,[r.inputContainerBorderError]:K}),style:N?.fieldset,children:f(`legend`,{className:l(r.inputFieldsetLegend,{[r.inputFieldsetLegendActive]:X}),children:f(`span`,{children:q})})}),E&&g&&p(`div`,{className:l(r.inputMatLabel,{[r.inputMatLabelFloating]:X,[r.inputMatLabelMultiline]:k&&!X}),children:[g,nt]}),E&&T&&f(`div`,{className:l(r.inputPlaceholder,Y&&!J&&r.inputPlaceholderShown,k&&r.inputPlaceholderMultiline),children:T}),f(t,{variant:`error`,message:x?x.getCurrentErrorMessage():ue||``,isVisible:K&&(I||Fe)})]}),v===a.Phone&&!H&&f(u,{icon:se,...W}),v===a.Email&&!H&&f(u,{icon:re,...W}),v===a.Edit&&!H&&f(u,{icon:oe,...W}),v===a.Search&&f(n,{icon:Z?d:ce,className:l(r.inputFieldIcon,{[r.inputFieldIconNotClickable]:!Z,[r.inputFieldIconLeft]:U}),onClick:Z?$:void 0}),v===a.Password&&f(u,{icon:R?ae:ie,...tt}),(Ee&&J&&(I||Fe)||Ne)&&v!==a.Search&&f(u,{icon:d,className:r.inputFieldIcon,onClick:$,onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1)})]})}export{m as default};
2
2
  //# sourceMappingURL=input.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.mjs","names":[],"sources":["../../../../package/common/input/input.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback, useId } from 'react';\nimport cx from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faPhone,\n faPen,\n faEnvelope,\n faSearch,\n faXmark,\n faEye as passwordHiddenIcon,\n faEyeSlash as passwordShownIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport Tooltip from 'components/common/tooltip';\nimport AnimatedIcon from 'components/common/animatedIcon';\nimport { useComponentDefaults } from 'components/common/configProvider';\nimport styles from './input.module.pcss';\nimport type { InputProps } from './input.types';\nimport { InputType, InputIconPosition } from './input.types';\n\nfunction Input(props: InputProps) {\n const {\n name = '',\n id,\n label = '',\n errorMessage = '',\n isValid = true,\n className = '',\n style,\n value = '',\n icon = null,\n iconPosition,\n onChange = () => {},\n onFocus: onFocusProp = null,\n onBlur: onBlurProp = null,\n onMouseEnter: onMouseEnterProp = null,\n onMouseLeave: onMouseLeaveProp = null,\n isUppercase = false,\n isRequired = false,\n tabIndex = 0,\n type = undefined,\n isRow = false,\n onIconClick = null,\n parse = null,\n formValidator = null,\n autoFocus = false,\n suffix = null,\n upperRightLabel = null,\n labelInBorder = false,\n showCancel = false,\n onClearClicked,\n min = null,\n max = null,\n placeholder = '',\n useMatLabelStyle = true,\n alwaysFloatLabel = false,\n autoComplete = null,\n onClick = () => null,\n readOnly = false,\n customInput,\n alwaysShowCancel = false,\n multiline = false,\n rows,\n autoResize = false,\n classNames,\n styles: slotStyles,\n disabled = false,\n ...rest\n } = useComponentDefaults('Input', props);\n const [isFocused, setIsFocused] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [isPasswordShown, setIsPasswordShown] = useState(false);\n const [, forceUpdate] = useState(0);\n\n const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n const fvRef = useRef(formValidator);\n\n const generatedId = useId();\n const inputId = id || name || generatedId;\n\n const resizeTextarea = useCallback(() => {\n const el = inputRef.current;\n if (!el || !autoResize) return;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n }, [autoResize]);\n\n useEffect(() => {\n resizeTextarea();\n }, []);\n\n useEffect(() => {\n if (autoFocus && inputRef.current) {\n setTimeout(() => { inputRef.current?.focus(); }, 1);\n }\n }, [autoFocus]);\n\n useEffect(() => {\n fvRef.current = formValidator;\n const fv = fvRef.current;\n if (!fv) return;\n fv.label = label ?? '';\n fv.validate();\n const listener = () => forceUpdate(n => n + 1);\n fv.registerOnUpdateListener(listener);\n return () => { fv.removeOnUpdateListener(listener); };\n }, [formValidator, label]);\n\n const hasError = (): boolean => {\n return formValidator\n ? (formValidator.touched && formValidator.hasError())\n : (!isValid || !!errorMessage);\n };\n\n const computedIsRequired = (): boolean => {\n return !!(isRequired || (formValidator && formValidator.validators.find(\n (v) => (v as { validatorId?: string }).validatorId === 'required'\n )));\n };\n\n const onMouseEnterHandler = (event: React.MouseEvent) => {\n setIsHovered(true);\n if (onMouseEnterProp) onMouseEnterProp(event);\n };\n\n const onMouseLeaveHandler = (event: React.MouseEvent) => {\n setIsHovered(false);\n if (onMouseLeaveProp) onMouseLeaveProp(event);\n };\n\n const onFocusHandler = (event: React.FocusEvent) => {\n setIsFocused(true);\n if (onFocusProp) onFocusProp(event);\n };\n\n const onBlurHandler = (event: React.FocusEvent) => {\n if (fvRef.current) fvRef.current.touched = true;\n setIsFocused(false);\n if (onBlurProp) onBlurProp(event);\n };\n\n const onChangeHandler = (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | string): void => {\n let parsedEvent: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | undefined;\n let val: string;\n\n if (typeof event !== 'string') {\n parsedEvent = event;\n val = event.target.value;\n } else {\n val = event;\n }\n\n if (parse) val = parse(val);\n if (formValidator) formValidator.set(val);\n if (onChange) onChange(val, parsedEvent);\n resizeTextarea();\n };\n\n const getInputType = (): string | undefined => {\n if (type === InputType.Email) return undefined;\n if (type === InputType.Phone) return 'tel';\n if (type === InputType.Search) return 'search';\n if (type === 'password' && isPasswordShown) return 'text';\n return type;\n };\n\n const getInputMode = (): React.HTMLAttributes<HTMLInputElement>['inputMode'] => {\n if (type === InputType.Email) return 'email';\n if (type === InputType.Phone) return 'tel';\n if (type === InputType.Search) return 'search';\n return undefined;\n };\n\n const hasIcon =\n type &&\n type !== InputType.Date &&\n type !== InputType.Iban &&\n type !== InputType.HasNoIcon;\n\n const isFunctionalIconType = type === InputType.Search || type === InputType.Password;\n const hasCustomIcon = !!icon;\n const customIconApplies = hasCustomIcon && !isFunctionalIconType;\n\n const defaultsLeftWithoutMatLabel = type === InputType.Email || type === InputType.Phone || type === InputType.Search;\n const resolvedIconPosition = iconPosition ?? (!useMatLabelStyle && defaultsLeftWithoutMatLabel ? InputIconPosition.Left : InputIconPosition.Right);\n const iconIsLeft = resolvedIconPosition === InputIconPosition.Left;\n\n const iconProps = {\n className: cx(styles.inputFieldIcon, {\n [styles.inputFieldIconNotClickable]: !onIconClick,\n [styles.inputFieldIconLeft]: iconIsLeft,\n }),\n onClick: onIconClick ?? undefined,\n };\n\n const customIcon = icon as React.ReactElement<{ className?: string; onClick?: React.MouseEventHandler }> | null;\n const renderedIcon = customIconApplies && customIcon\n ? React.cloneElement(customIcon, {\n className: cx(\n styles.inputFieldIcon,\n {\n [styles.inputFieldIconNotClickable]: !onIconClick && !customIcon.props.onClick,\n [styles.inputFieldIconLeft]: iconIsLeft,\n },\n customIcon.props.className,\n ),\n onClick: onIconClick ?? customIcon.props.onClick,\n })\n : null;\n\n const hasLeftIcon = (hasIcon || hasCustomIcon) && iconIsLeft;\n\n const passwordIconProps = {\n className: cx(styles.inputFieldIcon, styles.inputFieldIconPassword, { [styles.inputFieldIconLeft]: iconIsLeft }),\n onClick: () => setIsPasswordShown(!isPasswordShown),\n };\n\n const hasErr = hasError();\n\n let editedLabel = label;\n if (editedLabel && computedIsRequired()) editedLabel = `${editedLabel} *`;\n const requiredMark = computedIsRequired() ? <span className={styles.requiredMark}>*</span> : null;\n\n const currVal = formValidator ? formValidator.value : value;\n const showFocus = isFocused && !readOnly;\n const shouldFloatLabel = useMatLabelStyle && (alwaysFloatLabel || showFocus || currVal || type === InputType.Date);\n\n const isSearchCleared = type === InputType.Search && !!currVal;\n\n function handleClear() {\n if (formValidator) formValidator.set('');\n onChange?.('');\n onClearClicked?.();\n }\n\n return (\n <div className={cx(styles.input, { [styles.inputIconLeft]: hasLeftIcon }, className)} style={style}>\n <label\n htmlFor={inputId}\n className={cx(styles.inputLabel, classNames?.label, {\n [styles.inputLabelColumn]: !isRow,\n [styles.inputLabelInBorder]: labelInBorder,\n })}\n style={slotStyles?.label}\n >\n {label && !useMatLabelStyle ? (\n <span className={styles.inputLabelText}>\n {label}\n {requiredMark}\n </span>\n ) : null}\n {upperRightLabel && (\n <div className={cx(styles.inputUpperRightLabel, classNames?.upperRightLabel)} style={slotStyles?.upperRightLabel}>\n {upperRightLabel}\n </div>\n )}\n <div\n className={cx(styles.inputContainer, { [styles.inputContainerMultiline]: multiline }, classNames?.container)}\n style={slotStyles?.container}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n >\n {renderedIcon}\n {React.cloneElement(customInput || (multiline ? <textarea /> : <input />), {\n ...rest,\n className: cx(\n styles.inputField,\n {\n [styles.inputFieldUppercase]: isUppercase,\n [styles.inputFieldDate]: type === InputType.Date,\n [styles.inputFieldDefault]: type !== InputType.Date,\n [styles.inputFieldWithIcon]: hasIcon || hasCustomIcon,\n [styles.inputFieldWithIconLeft]: hasLeftIcon,\n [styles.inputFieldMultiline]: multiline,\n [styles.inputFieldMultilineAutoResize]: multiline && autoResize,\n [styles.inputFieldReadOnly]: readOnly && !disabled,\n },\n classNames?.input\n ),\n name,\n id: inputId,\n value: formValidator ? formValidator.value : value,\n tabIndex,\n ref: customInput ? undefined : inputRef,\n onChange: onChangeHandler,\n onFocus: onFocusHandler,\n onBlur: onBlurHandler,\n placeholder: !useMatLabelStyle ? placeholder : '',\n autoComplete,\n onClick,\n readOnly,\n disabled,\n ...(!multiline && { type: getInputType(), inputMode: rest.inputMode ?? getInputMode(), min, max }),\n ...(multiline && rows !== undefined && { rows }),\n })}\n {suffix && <div className={cx(styles.inputFieldSuffix, classNames?.suffix)} style={slotStyles?.suffix}>{suffix}</div>}\n </div>\n <fieldset\n className={cx(styles.inputFieldset, classNames?.fieldset, {\n [styles.inputFieldsetNoNotch]: !label,\n [styles.inputContainerBorderFocused]: showFocus,\n [styles.inputContainerBorderSearchFocused]:\n type === InputType.Search && (showFocus || value),\n [styles.inputContainerBorderInvalid]: hasErr,\n [styles.inputContainerBorderError]: hasErr,\n })}\n style={slotStyles?.fieldset}\n >\n <legend\n className={cx(styles.inputFieldsetLegend, {\n [styles.inputFieldsetLegendActive]: shouldFloatLabel,\n })}\n >\n <span>{editedLabel}</span>\n </legend>\n </fieldset>\n {useMatLabelStyle && label && (\n <div\n className={cx(styles.inputMatLabel, {\n [styles.inputMatLabelFloating]: shouldFloatLabel,\n [styles.inputMatLabelMultiline]: multiline && !shouldFloatLabel,\n })}\n >\n {label}\n {requiredMark}\n </div>\n )}\n {useMatLabelStyle && placeholder && (\n <div\n className={cx(\n styles.inputPlaceholder,\n showFocus && !currVal && styles.inputPlaceholderShown,\n multiline && styles.inputPlaceholderMultiline,\n )}\n >\n {placeholder}\n </div>\n )}\n <Tooltip\n variant=\"error\"\n message={formValidator ? formValidator.getCurrentErrorMessage() : (errorMessage || '')}\n isVisible={hasErr && (isFocused || isHovered)}\n />\n </label>\n\n {type === InputType.Phone && !hasCustomIcon && <FontAwesomeIcon icon={faPhone} {...iconProps} />}\n {type === InputType.Email && !hasCustomIcon && <FontAwesomeIcon icon={faEnvelope} {...iconProps} />}\n {type === InputType.Edit && !hasCustomIcon && <FontAwesomeIcon icon={faPen} {...iconProps} />}\n {type === InputType.Search && (\n <AnimatedIcon\n icon={isSearchCleared ? faXmark : faSearch}\n className={cx(styles.inputFieldIcon, {\n [styles.inputFieldIconNotClickable]: !isSearchCleared,\n [styles.inputFieldIconLeft]: iconIsLeft,\n })}\n onClick={isSearchCleared ? handleClear : undefined}\n />\n )}\n {type === InputType.Password && (\n <FontAwesomeIcon\n icon={isPasswordShown ? passwordShownIcon : passwordHiddenIcon}\n {...passwordIconProps}\n />\n )}\n\n {((showCancel && value && (isFocused || isHovered)) || alwaysShowCancel) && type !== InputType.Search && (\n <FontAwesomeIcon\n icon={faXmark}\n className={styles.inputFieldIcon}\n onClick={handleClear}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n />\n )}\n </div>\n );\n}\n\nexport default Input;\n"],"mappings":"6oBAmBA,SAAS,EAAM,EAAmB,CAChC,GAAM,CACN,OAAO,GACP,MACA,QAAQ,GACR,gBAAe,GACf,WAAU,GACV,aAAY,GACZ,SACA,QAAQ,GACR,QAAO,KACP,gBACA,eAAiB,CAAC,EAClB,QAAS,GAAc,KACvB,OAAQ,GAAa,KACrB,aAAc,GAAmB,KACjC,aAAc,GAAmB,KACjC,eAAc,GACd,cAAa,GACb,YAAW,EACX,OAAO,IAAA,GACP,SAAQ,GACR,cAAc,KACd,SAAQ,KACR,gBAAgB,KAChB,YAAY,GACZ,SAAS,KACT,kBAAkB,KAClB,iBAAgB,GAChB,cAAa,GACb,kBACA,OAAM,KACN,OAAM,KACN,cAAc,GACd,mBAAmB,GACnB,oBAAmB,GACnB,gBAAe,KACf,eAAgB,KAChB,WAAW,GACX,cACA,oBAAmB,GACnB,YAAY,GACZ,OACA,aAAa,GACb,aACA,OAAQ,EACR,WAAW,GACX,GAAG,GACC,EAAqB,QAAS,CAAK,EACjC,CAAC,EAAW,GAAgB,EAAS,EAAK,EAC1C,CAAC,GAAW,GAAgB,EAAS,EAAK,EAC1C,CAAC,EAAiB,IAAsB,EAAS,EAAK,EACtD,EAAG,IAAe,EAAS,CAAC,EAE5B,EAAW,EAA+C,IAAI,EAC9D,EAAQ,EAAO,CAAa,EAE5B,GAAc,GAAM,EACpB,GAAU,IAAM,GAAQ,GAExB,GAAiB,OAAkB,CACvC,IAAM,EAAK,EAAS,QAChB,CAAC,GAAM,CAAC,IACZ,EAAG,MAAM,OAAS,OAClB,EAAG,MAAM,OAAS,GAAG,EAAG,aAAa,IACvC,EAAG,CAAC,CAAU,CAAC,EAEf,MAAgB,CACd,GAAe,CACjB,EAAG,CAAC,CAAC,EAEL,MAAgB,CACV,GAAa,EAAS,SACxB,eAAiB,CAAE,EA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AAkB,EAAU,GAClC,UAAW,EAAG,EAAO,eAAgB,EAClC,EAAO,4BAA6B,CAAC,GACrC,EAAO,oBAAqB,CAC/B,CAAC,EACD,QAAS,EAAkB,EAAc,IAAA,EAC1C,CAAA,EAEF,IAAS,EAAU,UAClB,EAAC,EAAD,CACE,KAAM,EAAkB,GAAoB,GAC5C,GAAI,EACL,CAAA,GAGA,IAAc,IAAU,GAAa,KAAe,KAAqB,IAAS,EAAU,QAC7F,EAAC,EAAD,CACE,KAAM,EACN,UAAW,EAAO,eAClB,QAAS,EACT,iBAAoB,EAAa,EAAI,EACrC,iBAAoB,EAAa,EAAK,CACvC,CAAA,CAEA,GAET"}
1
+ {"version":3,"file":"input.mjs","names":[],"sources":["../../../../package/common/input/input.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback, useId } from 'react';\nimport cx from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n faPhone,\n faPen,\n faEnvelope,\n faSearch,\n faXmark,\n faEye as passwordHiddenIcon,\n faEyeSlash as passwordShownIcon,\n} from '@fortawesome/free-solid-svg-icons';\nimport Tooltip from 'components/common/tooltip';\nimport AnimatedIcon from 'components/common/animatedIcon';\nimport { useComponentDefaults } from 'components/common/configProvider';\nimport styles from './input.module.pcss';\nimport type { InputProps } from './input.types';\nimport { InputType, InputIconPosition } from './input.types';\n\nfunction Input(props: InputProps) {\n const {\n name = '',\n id,\n label = '',\n errorMessage = '',\n isValid = true,\n className = '',\n style,\n value = '',\n icon = null,\n iconPosition,\n onChange = () => {},\n onFocus: onFocusProp = null,\n onBlur: onBlurProp = null,\n onMouseEnter: onMouseEnterProp = null,\n onMouseLeave: onMouseLeaveProp = null,\n isUppercase = false,\n isRequired = false,\n tabIndex = 0,\n type = undefined,\n isRow = false,\n onIconClick = null,\n parse = null,\n formValidator = null,\n autoFocus = false,\n suffix = null,\n upperRightLabel = null,\n labelInBorder = false,\n showCancel = false,\n onClearClicked,\n min = null,\n max = null,\n placeholder = '',\n useMatLabelStyle = true,\n alwaysFloatLabel = false,\n autoComplete = null,\n onClick = () => null,\n readOnly = false,\n customInput,\n alwaysShowCancel = false,\n multiline = false,\n rows,\n autoResize = false,\n classNames,\n styles: slotStyles,\n disabled = false,\n ...rest\n } = useComponentDefaults('Input', props);\n const [isFocused, setIsFocused] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [isPasswordShown, setIsPasswordShown] = useState(false);\n const [, forceUpdate] = useState(0);\n\n const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n const fvRef = useRef(formValidator);\n\n const generatedId = useId();\n const inputId = id || name || generatedId;\n\n const resizeTextarea = useCallback(() => {\n const el = inputRef.current;\n if (!el || !autoResize) return;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n }, [autoResize]);\n\n useEffect(() => {\n resizeTextarea();\n }, []);\n\n useEffect(() => {\n if (autoFocus && inputRef.current) {\n setTimeout(() => { inputRef.current?.focus(); }, 1);\n }\n }, [autoFocus]);\n\n useEffect(() => {\n fvRef.current = formValidator;\n const fv = fvRef.current;\n if (!fv) return;\n fv.label = label ?? '';\n fv.validate();\n const listener = () => forceUpdate(n => n + 1);\n fv.registerOnUpdateListener(listener);\n return () => { fv.removeOnUpdateListener(listener); };\n }, [formValidator, label]);\n\n const hasError = (): boolean => {\n return formValidator\n ? (formValidator.touched && formValidator.hasError())\n : (!isValid || !!errorMessage);\n };\n\n const computedIsRequired = (): boolean => {\n return !!(isRequired || (formValidator && formValidator.validators.find(\n (v) => (v as { validatorId?: string }).validatorId === 'required'\n )));\n };\n\n const onMouseEnterHandler = (event: React.MouseEvent) => {\n setIsHovered(true);\n if (onMouseEnterProp) onMouseEnterProp(event);\n };\n\n const onMouseLeaveHandler = (event: React.MouseEvent) => {\n setIsHovered(false);\n if (onMouseLeaveProp) onMouseLeaveProp(event);\n };\n\n const onFocusHandler = (event: React.FocusEvent) => {\n setIsFocused(true);\n if (onFocusProp) onFocusProp(event);\n };\n\n const onBlurHandler = (event: React.FocusEvent) => {\n if (fvRef.current) fvRef.current.touched = true;\n setIsFocused(false);\n if (onBlurProp) onBlurProp(event);\n };\n\n const onChangeHandler = (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | string): void => {\n let parsedEvent: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement> | undefined;\n let val: string;\n\n if (typeof event !== 'string') {\n parsedEvent = event;\n val = event.target.value;\n } else {\n val = event;\n }\n\n if (parse) val = parse(val);\n if (formValidator) formValidator.set(val);\n if (onChange) onChange(val, parsedEvent);\n resizeTextarea();\n };\n\n const getInputType = (): string | undefined => {\n if (type === InputType.Email) return undefined;\n if (type === InputType.Phone) return 'tel';\n if (type === InputType.Search) return 'search';\n if (type === 'password' && isPasswordShown) return 'text';\n return type;\n };\n\n const getInputMode = (): React.HTMLAttributes<HTMLInputElement>['inputMode'] => {\n if (type === InputType.Email) return 'email';\n if (type === InputType.Phone) return 'tel';\n if (type === InputType.Search) return 'search';\n return undefined;\n };\n\n const hasIcon =\n type &&\n type !== InputType.Date &&\n type !== InputType.Iban &&\n type !== InputType.HasNoIcon;\n\n const isFunctionalIconType = type === InputType.Search || type === InputType.Password;\n const hasCustomIcon = !!icon;\n const customIconApplies = hasCustomIcon && !isFunctionalIconType;\n\n const defaultsLeftWithoutMatLabel = type === InputType.Email || type === InputType.Phone || type === InputType.Search;\n const resolvedIconPosition = iconPosition ?? (!useMatLabelStyle && defaultsLeftWithoutMatLabel ? InputIconPosition.Left : InputIconPosition.Right);\n const iconIsLeft = resolvedIconPosition === InputIconPosition.Left;\n\n const iconProps = {\n className: cx(styles.inputFieldIcon, {\n [styles.inputFieldIconNotClickable]: !onIconClick,\n [styles.inputFieldIconLeft]: iconIsLeft,\n }),\n onClick: onIconClick ?? undefined,\n };\n\n const customIcon = icon as React.ReactElement<{ className?: string; onClick?: React.MouseEventHandler }> | null;\n const renderedIcon = customIconApplies && customIcon\n ? React.cloneElement(customIcon, {\n className: cx(\n styles.inputFieldIcon,\n {\n [styles.inputFieldIconNotClickable]: !onIconClick && !customIcon.props.onClick,\n [styles.inputFieldIconLeft]: iconIsLeft,\n },\n customIcon.props.className,\n ),\n onClick: onIconClick ?? customIcon.props.onClick,\n })\n : null;\n\n const hasLeftIcon = (hasIcon || hasCustomIcon) && iconIsLeft;\n\n const passwordIconProps = {\n className: cx(styles.inputFieldIcon, styles.inputFieldIconPassword, { [styles.inputFieldIconLeft]: iconIsLeft }),\n onClick: () => setIsPasswordShown(!isPasswordShown),\n };\n\n const hasErr = hasError();\n\n let editedLabel = label;\n if (editedLabel && computedIsRequired()) editedLabel = `${editedLabel} *`;\n const requiredMark = computedIsRequired() ? <span className={styles.requiredMark}>*</span> : null;\n\n const currVal = formValidator ? formValidator.value : value;\n const showFocus = isFocused && !readOnly;\n const shouldFloatLabel = useMatLabelStyle && (alwaysFloatLabel || showFocus || currVal || type === InputType.Date);\n\n const isSearchCleared = type === InputType.Search && !!currVal;\n\n const customInputProps = customInput?.props as\n | { className?: string; style?: React.CSSProperties }\n | undefined;\n\n function handleClear() {\n if (formValidator) formValidator.set('');\n onChange?.('');\n onClearClicked?.();\n }\n\n return (\n <div className={cx(styles.input, { [styles.inputIconLeft]: hasLeftIcon }, className)} style={style}>\n <label\n htmlFor={inputId}\n className={cx(styles.inputLabel, classNames?.label, {\n [styles.inputLabelColumn]: !isRow,\n [styles.inputLabelInBorder]: labelInBorder,\n })}\n style={slotStyles?.label}\n >\n {label && !useMatLabelStyle ? (\n <span className={styles.inputLabelText}>\n {label}\n {requiredMark}\n </span>\n ) : null}\n {upperRightLabel && (\n <div className={cx(styles.inputUpperRightLabel, classNames?.upperRightLabel)} style={slotStyles?.upperRightLabel}>\n {upperRightLabel}\n </div>\n )}\n <div\n className={cx(styles.inputContainer, { [styles.inputContainerMultiline]: multiline }, classNames?.container)}\n style={slotStyles?.container}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n >\n {renderedIcon}\n {React.cloneElement(customInput || (multiline ? <textarea /> : <input />), {\n ...rest,\n className: cx(\n styles.inputField,\n {\n [styles.inputFieldUppercase]: isUppercase,\n [styles.inputFieldDate]: type === InputType.Date,\n [styles.inputFieldDefault]: type !== InputType.Date,\n [styles.inputFieldWithIcon]: hasIcon || hasCustomIcon,\n [styles.inputFieldWithIconLeft]: hasLeftIcon,\n [styles.inputFieldMultiline]: multiline,\n [styles.inputFieldMultilineAutoResize]: multiline && autoResize,\n [styles.inputFieldReadOnly]: readOnly && !disabled,\n },\n classNames?.input,\n customInputProps?.className,\n ),\n style: customInputProps?.style || slotStyles?.input\n ? { ...customInputProps?.style, ...slotStyles?.input }\n : undefined,\n name,\n id: inputId,\n value: currVal,\n tabIndex,\n ref: customInput ? undefined : inputRef,\n onChange: onChangeHandler,\n onFocus: onFocusHandler,\n onBlur: onBlurHandler,\n placeholder: !useMatLabelStyle ? placeholder : '',\n autoComplete,\n onClick,\n readOnly,\n disabled,\n ...(!multiline && { type: getInputType(), inputMode: rest.inputMode ?? getInputMode(), min, max }),\n ...(multiline && rows !== undefined && { rows }),\n })}\n {suffix && <div className={cx(styles.inputFieldSuffix, classNames?.suffix)} style={slotStyles?.suffix}>{suffix}</div>}\n </div>\n <fieldset\n className={cx(styles.inputFieldset, classNames?.fieldset, {\n [styles.inputFieldsetNoNotch]: !label,\n [styles.inputContainerBorderFocused]: showFocus,\n [styles.inputContainerBorderSearchFocused]:\n type === InputType.Search && (showFocus || !!currVal),\n [styles.inputContainerBorderInvalid]: hasErr,\n [styles.inputContainerBorderError]: hasErr,\n })}\n style={slotStyles?.fieldset}\n >\n <legend\n className={cx(styles.inputFieldsetLegend, {\n [styles.inputFieldsetLegendActive]: shouldFloatLabel,\n })}\n >\n <span>{editedLabel}</span>\n </legend>\n </fieldset>\n {useMatLabelStyle && label && (\n <div\n className={cx(styles.inputMatLabel, {\n [styles.inputMatLabelFloating]: shouldFloatLabel,\n [styles.inputMatLabelMultiline]: multiline && !shouldFloatLabel,\n })}\n >\n {label}\n {requiredMark}\n </div>\n )}\n {useMatLabelStyle && placeholder && (\n <div\n className={cx(\n styles.inputPlaceholder,\n showFocus && !currVal && styles.inputPlaceholderShown,\n multiline && styles.inputPlaceholderMultiline,\n )}\n >\n {placeholder}\n </div>\n )}\n <Tooltip\n variant=\"error\"\n message={formValidator ? formValidator.getCurrentErrorMessage() : (errorMessage || '')}\n isVisible={hasErr && (isFocused || isHovered)}\n />\n </label>\n\n {type === InputType.Phone && !hasCustomIcon && <FontAwesomeIcon icon={faPhone} {...iconProps} />}\n {type === InputType.Email && !hasCustomIcon && <FontAwesomeIcon icon={faEnvelope} {...iconProps} />}\n {type === InputType.Edit && !hasCustomIcon && <FontAwesomeIcon icon={faPen} {...iconProps} />}\n {type === InputType.Search && (\n <AnimatedIcon\n icon={isSearchCleared ? faXmark : faSearch}\n className={cx(styles.inputFieldIcon, {\n [styles.inputFieldIconNotClickable]: !isSearchCleared,\n [styles.inputFieldIconLeft]: iconIsLeft,\n })}\n onClick={isSearchCleared ? handleClear : undefined}\n />\n )}\n {type === InputType.Password && (\n <FontAwesomeIcon\n icon={isPasswordShown ? passwordShownIcon : passwordHiddenIcon}\n {...passwordIconProps}\n />\n )}\n\n {((showCancel && currVal && (isFocused || isHovered)) || alwaysShowCancel) && type !== InputType.Search && (\n <FontAwesomeIcon\n icon={faXmark}\n className={styles.inputFieldIcon}\n onClick={handleClear}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n />\n )}\n </div>\n );\n}\n\nexport default Input;\n"],"mappings":"6oBAmBA,SAAS,EAAM,EAAmB,CAChC,GAAM,CACN,OAAO,GACP,MACA,QAAQ,GACR,gBAAe,GACf,WAAU,GACV,aAAY,GACZ,SACA,SAAQ,GACR,QAAO,KACP,gBACA,eAAiB,CAAC,EAClB,QAAS,GAAc,KACvB,OAAQ,GAAa,KACrB,aAAc,GAAmB,KACjC,aAAc,GAAmB,KACjC,eAAc,GACd,cAAa,GACb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Ae,KAAqB,IAAS,EAAU,QAC/F,EAAC,EAAD,CACE,KAAM,EACN,UAAW,EAAO,eAClB,QAAS,EACT,iBAAoB,EAAa,EAAI,EACrC,iBAAoB,EAAa,EAAK,CACvC,CAAA,CAEA,GAET"}
@@ -1,7 +1,7 @@
1
- import e from"./kanbanBoard.module.mjs";import t from"./KanbanColumn.mjs";import{buildAnnouncements as n,columnsEqual as r,isColumnDragData as i,kanbanCollisionDetection as a,kanbanKeyboardCoordinateGetter as o,moveColumn as s,moveItem as c}from"./kanbanBoard.utils.mjs";import{useMemo as l,useRef as u,useState as d}from"react";import f from"classnames";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{DndContext as h,DragOverlay as g,KeyboardSensor as _,MouseSensor as v,TouchSensor as y,useSensor as b,useSensors as x}from"@dnd-kit/core";import{SortableContext as S,horizontalListSortingStrategy as C}from"@dnd-kit/sortable";var w=(e,t)=>t,T={activationConstraint:{distance:8}},E={activationConstraint:{delay:250,tolerance:5}},ee={coordinateGetter:o},D={draggable:`
1
+ import e from"./kanbanBoard.module.mjs";import t from"./KanbanColumn.mjs";import{buildAnnouncements as n,columnsEqual as r,isColumnDragData as i,kanbanCollisionDetection as a,kanbanKeyboardCoordinateGetter as o,moveColumn as s,moveItem as c}from"./kanbanBoard.utils.mjs";import{useMemo as l,useRef as u,useState as d}from"react";import f from"classnames";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{DndContext as h,DragOverlay as g,KeyboardSensor as _,MouseSensor as v,TouchSensor as y,useSensor as b,useSensors as x}from"@dnd-kit/core";import{SortableContext as S,horizontalListSortingStrategy as C}from"@dnd-kit/sortable";var ee=(e,t)=>t,te={activationConstraint:{distance:8}},ne={activationConstraint:{delay:250,tolerance:5}},re={coordinateGetter:o},w={draggable:`
2
2
  To pick up a card or column, press space or enter.
3
3
  While dragging, use the arrow keys to move it — for a card, between positions and columns;
4
4
  for a column, left/right to reorder it.
5
5
  Press space or enter again to drop it, or press escape to cancel.
6
- `};function O({columns:o,items:O,renderItem:k,onChange:A,dragHandle:j,getItemLabel:M=w,getItemDisabled:N,renderEmptyColumn:P,renderColumnActions:F,reorderableColumns:I,collapseEmptyColumns:L,className:R,style:z,classNames:B,styles:V,...te}){let[H,U]=d(null),[W,G]=d(!1),[K,q]=d(null),J=u(null),Y=x(b(v,T),b(y,E),b(_,ee)),X=K??o,Z=l(()=>X.map(e=>e.id),[X]),Q=l(()=>n(X,O,M),[X,O,M]),ne=l(()=>({announcements:Q,screenReaderInstructions:D}),[Q]);function re({active:e}){U(String(e.id)),G(i(e.data.current)),q(o),J.current=null}function ie({active:e,over:t}){if(!t)return;if(i(e.data.current)){let n=String(e.id),r=String(t.id);q(e=>{let t=e??o,i=s(t,n,r);return i===t?e:i});return}let n=String(e.id),r=String(t.id),a=e.rect.current.translated??e.rect.current.initial,l=a?`${a.top}:${a.left}`:null;l!==null&&l===J.current||(J.current=l,q(e=>{let i=e??o,s=c(i,n,r,{activeRect:a,overRect:t.rect});return s===i?e:s}))}function ae({over:e}){if(U(null),G(!1),!e||!K){q(null);return}r(K,o)||A(K),q(null)}function oe(){U(null),G(!1),q(null)}let $=H&&W?X.find(e=>e.id===H):void 0;return m(h,{sensors:Y,collisionDetection:a,onDragStart:re,onDragOver:ie,onDragEnd:ae,onDragCancel:oe,accessibility:ne,children:[p(S,{id:`kanban-columns`,items:Z,strategy:C,children:p(`div`,{...te,className:f(e.board,R),style:z,children:X.map(e=>p(t,{id:e.id,title:e.title,itemIds:e.itemIds,maxItems:e.maxItems,disabled:e.disabled,getItemDisabled:N,emptyPlaceholder:P?.(e),actions:F?.(e),reorderable:I,activeIsColumn:H!==null&&W,collapseEmptyColumns:L,items:O,renderItem:k,dragHandle:j,preserveSizeWhileEmpty:H!==null},e.id))})}),p(g,{children:$?p(`div`,{className:f(e.column,e.columnDragOverlay),children:p(`div`,{className:e.columnHeader,children:p(`span`,{className:e.columnHeaderTitle,children:$.title})})}):H&&!W&&O[H]!==void 0?p(`div`,{className:f(e.dragOverlay,B?.dragOverlay),style:V?.dragOverlay,children:k(O[H],H)}):null})]})}export{O as default};
6
+ `};function T({columns:o,items:T,renderItem:E,onChange:D,dragHandle:O,getItemLabel:k=ee,getItemDisabled:A,renderEmptyColumn:j,renderColumnActions:M,reorderableColumns:N,collapseEmptyColumns:P,columnMaxHeight:F,onLoadMore:I,loadMoreThreshold:L,className:R,style:z,classNames:ie,styles:B,...V}){let[H,U]=d(null),[W,G]=d(!1),[K,q]=d(null),J=u(null),Y=x(b(v,te),b(y,ne),b(_,re)),X=K??o,ae=l(()=>X.map(e=>e.id),[X]),Z=l(()=>n(X,T,k),[X,T,k]),oe=l(()=>({announcements:Z,screenReaderInstructions:w}),[Z]);function se({active:e}){U(String(e.id)),G(i(e.data.current)),q(o),J.current=null}function Q({active:e,over:t}){if(!t)return;if(i(e.data.current)){let n=String(e.id),r=String(t.id);q(e=>{let t=e??o,i=s(t,n,r);return i===t?e:i});return}let n=String(e.id),r=String(t.id),a=e.rect.current.translated??e.rect.current.initial,l=a?`${a.top}:${a.left}`:null;l!==null&&l===J.current||(J.current=l,q(e=>{let i=e??o,s=c(i,n,r,{activeRect:a,overRect:t.rect});return s===i?e:s}))}function ce({over:e}){if(U(null),G(!1),!e||!K){q(null);return}r(K,o)||D(K),q(null)}function le(){U(null),G(!1),q(null)}let $=H&&W?X.find(e=>e.id===H):void 0;return m(h,{sensors:Y,collisionDetection:a,onDragStart:se,onDragOver:Q,onDragEnd:ce,onDragCancel:le,accessibility:oe,children:[p(S,{id:`kanban-columns`,items:ae,strategy:C,children:p(`div`,{...V,className:f(e.board,R),style:z,children:X.map(e=>p(t,{id:e.id,title:e.title,itemIds:e.itemIds,maxItems:e.maxItems,disabled:e.disabled,getItemDisabled:A,emptyPlaceholder:j?.(e),actions:M?.(e),reorderable:N,activeIsColumn:H!==null&&W,collapseEmptyColumns:P,columnMaxHeight:F,hasMore:e.hasMore,onLoadMore:I?()=>I(e.id):void 0,loadMoreThreshold:L,items:T,renderItem:E,dragHandle:O,preserveSizeWhileEmpty:H!==null},e.id))})}),p(g,{children:$?p(`div`,{className:f(e.column,e.columnDragOverlay),children:p(`div`,{className:e.columnHeader,children:p(`span`,{className:e.columnHeaderTitle,children:$.title})})}):H&&!W&&T[H]!==void 0?p(`div`,{className:f(e.dragOverlay,ie?.dragOverlay),style:B?.dragOverlay,children:E(T[H],H)}):null})]})}export{T as default};
7
7
  //# sourceMappingURL=KanbanBoard.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"KanbanBoard.mjs","names":[],"sources":["../../../../package/common/kanbanBoard/KanbanBoard.tsx"],"sourcesContent":["import { useMemo, useRef, useState } from 'react';\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n MouseSensor,\n TouchSensor,\n useSensor,\n useSensors,\n type DragStartEvent,\n type DragOverEvent,\n type DragEndEvent,\n type ScreenReaderInstructions,\n} from '@dnd-kit/core';\nimport { SortableContext, horizontalListSortingStrategy } from '@dnd-kit/sortable';\nimport cx from 'classnames';\n\nimport type { KanbanBoardProps, KanbanColumnDef } from './kanbanBoard.types';\nimport styles from './kanbanBoard.module.pcss';\nimport KanbanColumn from './KanbanColumn';\nimport {\n buildAnnouncements,\n columnsEqual,\n isColumnDragData,\n kanbanCollisionDetection,\n kanbanKeyboardCoordinateGetter,\n moveColumn,\n moveItem,\n} from './kanbanBoard.utils';\n\nconst defaultGetItemLabel = <T,>(_item: T, id: string): string => id;\n\n// Hoisted so these are referentially stable across renders — inline literals here would give\n// `useSensor` a new options object every render (including every dragOver during an active\n// drag), which defeats its own memoization and makes `sensors` a new array each time too.\n//\n// Mouse and touch are split (rather than one combined `PointerSensor`) because they need\n// different activation constraints: a small movement threshold for mouse starts a drag\n// immediately without interfering with clicks, but the same threshold on a touchscreen would\n// hijack an ordinary scroll gesture as soon as the finger moves a few pixels. Touch instead\n// requires a brief press-and-hold before a drag arms, so a normal swipe-to-scroll passes through\n// untouched — the same pattern `VirtualList`'s `longPressDelay` uses.\nconst MOUSE_SENSOR_OPTIONS = { activationConstraint: { distance: 8 } };\nconst TOUCH_SENSOR_OPTIONS = { activationConstraint: { delay: 250, tolerance: 5 } };\nconst KEYBOARD_SENSOR_OPTIONS = { coordinateGetter: kanbanKeyboardCoordinateGetter };\n\nconst SCREEN_READER_INSTRUCTIONS: ScreenReaderInstructions = {\n draggable: `\n To pick up a card or column, press space or enter.\n While dragging, use the arrow keys to move it — for a card, between positions and columns;\n for a column, left/right to reorder it.\n Press space or enter again to drop it, or press escape to cancel.\n `,\n};\n\nfunction KanbanBoard<T = unknown>({\n columns,\n items,\n renderItem,\n onChange,\n dragHandle,\n getItemLabel = defaultGetItemLabel,\n getItemDisabled,\n renderEmptyColumn,\n renderColumnActions,\n reorderableColumns,\n collapseEmptyColumns,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n}: KanbanBoardProps<T>) {\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeIsColumn, setActiveIsColumn] = useState(false);\n const [shadowColumns, setShadowColumns] = useState<KanbanColumnDef[] | null>(null);\n\n // Guards against a self-sustaining reorder loop: applying a card move reflows the columns\n // involved, which can shift a *different* card under an otherwise-stationary pointer. dnd-kit\n // then re-fires `dragOver` with that new `over`, even though the user hasn't moved anything —\n // and if the geometry decision for that new target flips back once applied, the two states\n // (or more) can bounce forever, purely from our own layout changes, eventually tripping React's\n // \"Maximum update depth exceeded\" guard. `activeRect` only changes when the dragged card's own\n // position actually moves (real pointer/keyboard input), so it's used here as a proxy for \"did\n // anything the user did actually change\" — a reorder is only applied once per distinct\n // `activeRect`, which lets a drag settle and then holds still instead of oscillating.\n const lastAppliedActiveRectKeyRef = useRef<string | null>(null);\n\n const sensors = useSensors(\n useSensor(MouseSensor, MOUSE_SENSOR_OPTIONS),\n useSensor(TouchSensor, TOUCH_SENSOR_OPTIONS),\n useSensor(KeyboardSensor, KEYBOARD_SENSOR_OPTIONS)\n );\n\n const displayColumns = shadowColumns ?? columns;\n\n // `SortableContext` memoizes its own derived `items`/context value keyed on this array's\n // *reference*, not its contents — an inline `.map()` here would hand it a new array every\n // render (including every `dragOver` while a drag is in progress, via `shadowColumns`), forcing\n // every column's own `useSortable` to recompute and its whole subtree to re-render on every\n // board render, not just when the column order actually changes. Same class of bug as the\n // sensor options and the `data`/`disabled` objects in `KanbanColumn.tsx`/`KanbanItem.tsx`.\n const columnIds = useMemo(() => displayColumns.map((col) => col.id), [displayColumns]);\n\n const announcements = useMemo(\n () => buildAnnouncements(displayColumns, items, getItemLabel),\n [displayColumns, items, getItemLabel]\n );\n\n const accessibility = useMemo(\n () => ({ announcements, screenReaderInstructions: SCREEN_READER_INSTRUCTIONS }),\n [announcements]\n );\n\n function handleDragStart({ active }: DragStartEvent) {\n setActiveId(String(active.id));\n setActiveIsColumn(isColumnDragData(active.data.current));\n // `moveItem`/`moveColumn` never mutate what's passed in, only returning new objects/arrays\n // for the column(s) actually touched — so seeding the shadow state directly with `columns`\n // (rather than a full deep clone) is safe, and skips an O(total cards) clone on every drag.\n setShadowColumns(columns);\n lastAppliedActiveRectKeyRef.current = null;\n }\n\n function handleDragOver({ active, over }: DragOverEvent) {\n if (!over) return;\n\n if (isColumnDragData(active.data.current)) {\n const activeColumnId = String(active.id);\n const overColumnId = String(over.id);\n\n setShadowColumns((prev) => {\n const base = prev ?? columns;\n const next = moveColumn(base, activeColumnId, overColumnId);\n return next === base ? prev : next;\n });\n return;\n }\n\n const activeItemId = String(active.id);\n const overId = String(over.id);\n const activeRect = active.rect.current.translated ?? active.rect.current.initial;\n\n const activeRectKey = activeRect ? `${activeRect.top}:${activeRect.left}` : null;\n if (activeRectKey !== null && activeRectKey === lastAppliedActiveRectKeyRef.current) {\n return;\n }\n lastAppliedActiveRectKeyRef.current = activeRectKey;\n\n setShadowColumns((prev) => {\n const base = prev ?? columns;\n const next = moveItem(base, activeItemId, overId, { activeRect, overRect: over.rect });\n return next === base ? prev : next;\n });\n }\n\n function handleDragEnd({ over }: DragEndEvent) {\n setActiveId(null);\n setActiveIsColumn(false);\n\n if (!over || !shadowColumns) {\n setShadowColumns(null);\n return;\n }\n\n if (!columnsEqual(shadowColumns, columns)) {\n onChange(shadowColumns);\n }\n setShadowColumns(null);\n }\n\n function handleDragCancel() {\n setActiveId(null);\n setActiveIsColumn(false);\n setShadowColumns(null);\n }\n\n const activeColumn = activeId && activeIsColumn ? displayColumns.find((col) => col.id === activeId) : undefined;\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={kanbanCollisionDetection}\n onDragStart={handleDragStart}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n accessibility={accessibility}\n >\n <SortableContext\n id=\"kanban-columns\"\n items={columnIds}\n strategy={horizontalListSortingStrategy}\n >\n <div {...rest} className={cx(styles.board, className)} style={style}>\n {displayColumns.map((col) => (\n <KanbanColumn\n key={col.id}\n id={col.id}\n title={col.title}\n itemIds={col.itemIds}\n maxItems={col.maxItems}\n disabled={col.disabled}\n getItemDisabled={getItemDisabled}\n emptyPlaceholder={renderEmptyColumn?.(col)}\n actions={renderColumnActions?.(col)}\n reorderable={reorderableColumns}\n activeIsColumn={activeId !== null && activeIsColumn}\n collapseEmptyColumns={collapseEmptyColumns}\n items={items}\n renderItem={renderItem}\n dragHandle={dragHandle}\n preserveSizeWhileEmpty={activeId !== null}\n />\n ))}\n </div>\n </SortableContext>\n <DragOverlay>\n {activeColumn ? (\n <div className={cx(styles.column, styles.columnDragOverlay)}>\n <div className={styles.columnHeader}>\n <span className={styles.columnHeaderTitle}>{activeColumn.title}</span>\n </div>\n </div>\n ) : activeId && !activeIsColumn && items[activeId] !== undefined ? (\n <div className={cx(styles.dragOverlay, classNames?.dragOverlay)} style={slotStyles?.dragOverlay}>{renderItem(items[activeId], activeId)}</div>\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n}\n\nexport default KanbanBoard;\n"],"mappings":"6nBA8BA,IAAM,GAA2B,EAAU,IAAuB,EAY5D,EAAuB,CAAE,qBAAsB,CAAE,SAAU,CAAE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f,QACK,aACA,aACZ,uBAAwB,IAAa,IACtC,EAhBM,EAAI,EAgBV,CACF,CACE,CAAA,CACU,CAAA,EACjB,EAAC,EAAD,CAAA,SACG,EACC,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,OAAQ,EAAO,iBAAiB,WACxD,EAAC,MAAD,CAAK,UAAW,EAAO,sBACrB,EAAC,OAAD,CAAM,UAAW,EAAO,2BAAoB,EAAa,KAAY,CAAA,CAClE,CAAA,CACF,CAAA,EACH,GAAY,CAAC,GAAkB,EAAM,KAAc,IAAA,GACrD,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,YAAa,GAAY,WAAW,EAAG,MAAO,GAAY,qBAAc,EAAW,EAAM,GAAW,CAAQ,CAAO,CAAA,EAC3I,IACO,CAAA,CACH,GAEhB"}
1
+ {"version":3,"file":"KanbanBoard.mjs","names":[],"sources":["../../../../package/common/kanbanBoard/KanbanBoard.tsx"],"sourcesContent":["import { useMemo, useRef, useState } from 'react';\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n MouseSensor,\n TouchSensor,\n useSensor,\n useSensors,\n type DragStartEvent,\n type DragOverEvent,\n type DragEndEvent,\n type ScreenReaderInstructions,\n} from '@dnd-kit/core';\nimport { SortableContext, horizontalListSortingStrategy } from '@dnd-kit/sortable';\nimport cx from 'classnames';\n\nimport type { KanbanBoardProps, KanbanColumnDef } from './kanbanBoard.types';\nimport styles from './kanbanBoard.module.pcss';\nimport KanbanColumn from './KanbanColumn';\nimport {\n buildAnnouncements,\n columnsEqual,\n isColumnDragData,\n kanbanCollisionDetection,\n kanbanKeyboardCoordinateGetter,\n moveColumn,\n moveItem,\n} from './kanbanBoard.utils';\n\nconst defaultGetItemLabel = <T,>(_item: T, id: string): string => id;\n\n// Hoisted so these are referentially stable across renders — inline literals here would give\n// `useSensor` a new options object every render (including every dragOver during an active\n// drag), which defeats its own memoization and makes `sensors` a new array each time too.\n//\n// Mouse and touch are split (rather than one combined `PointerSensor`) because they need\n// different activation constraints: a small movement threshold for mouse starts a drag\n// immediately without interfering with clicks, but the same threshold on a touchscreen would\n// hijack an ordinary scroll gesture as soon as the finger moves a few pixels. Touch instead\n// requires a brief press-and-hold before a drag arms, so a normal swipe-to-scroll passes through\n// untouched — the same pattern `VirtualList`'s `longPressDelay` uses.\nconst MOUSE_SENSOR_OPTIONS = { activationConstraint: { distance: 8 } };\nconst TOUCH_SENSOR_OPTIONS = { activationConstraint: { delay: 250, tolerance: 5 } };\nconst KEYBOARD_SENSOR_OPTIONS = { coordinateGetter: kanbanKeyboardCoordinateGetter };\n\nconst SCREEN_READER_INSTRUCTIONS: ScreenReaderInstructions = {\n draggable: `\n To pick up a card or column, press space or enter.\n While dragging, use the arrow keys to move it — for a card, between positions and columns;\n for a column, left/right to reorder it.\n Press space or enter again to drop it, or press escape to cancel.\n `,\n};\n\nfunction KanbanBoard<T = unknown>({\n columns,\n items,\n renderItem,\n onChange,\n dragHandle,\n getItemLabel = defaultGetItemLabel,\n getItemDisabled,\n renderEmptyColumn,\n renderColumnActions,\n reorderableColumns,\n collapseEmptyColumns,\n columnMaxHeight,\n onLoadMore,\n loadMoreThreshold,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n}: KanbanBoardProps<T>) {\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeIsColumn, setActiveIsColumn] = useState(false);\n const [shadowColumns, setShadowColumns] = useState<KanbanColumnDef[] | null>(null);\n\n // Guards against a self-sustaining reorder loop: applying a card move reflows the columns\n // involved, which can shift a *different* card under an otherwise-stationary pointer. dnd-kit\n // then re-fires `dragOver` with that new `over`, even though the user hasn't moved anything —\n // and if the geometry decision for that new target flips back once applied, the two states\n // (or more) can bounce forever, purely from our own layout changes, eventually tripping React's\n // \"Maximum update depth exceeded\" guard. `activeRect` only changes when the dragged card's own\n // position actually moves (real pointer/keyboard input), so it's used here as a proxy for \"did\n // anything the user did actually change\" — a reorder is only applied once per distinct\n // `activeRect`, which lets a drag settle and then holds still instead of oscillating.\n const lastAppliedActiveRectKeyRef = useRef<string | null>(null);\n\n const sensors = useSensors(\n useSensor(MouseSensor, MOUSE_SENSOR_OPTIONS),\n useSensor(TouchSensor, TOUCH_SENSOR_OPTIONS),\n useSensor(KeyboardSensor, KEYBOARD_SENSOR_OPTIONS)\n );\n\n const displayColumns = shadowColumns ?? columns;\n\n // `SortableContext` memoizes its own derived `items`/context value keyed on this array's\n // *reference*, not its contents — an inline `.map()` here would hand it a new array every\n // render (including every `dragOver` while a drag is in progress, via `shadowColumns`), forcing\n // every column's own `useSortable` to recompute and its whole subtree to re-render on every\n // board render, not just when the column order actually changes. Same class of bug as the\n // sensor options and the `data`/`disabled` objects in `KanbanColumn.tsx`/`KanbanItem.tsx`.\n const columnIds = useMemo(() => displayColumns.map((col) => col.id), [displayColumns]);\n\n const announcements = useMemo(\n () => buildAnnouncements(displayColumns, items, getItemLabel),\n [displayColumns, items, getItemLabel]\n );\n\n const accessibility = useMemo(\n () => ({ announcements, screenReaderInstructions: SCREEN_READER_INSTRUCTIONS }),\n [announcements]\n );\n\n function handleDragStart({ active }: DragStartEvent) {\n setActiveId(String(active.id));\n setActiveIsColumn(isColumnDragData(active.data.current));\n // `moveItem`/`moveColumn` never mutate what's passed in, only returning new objects/arrays\n // for the column(s) actually touched — so seeding the shadow state directly with `columns`\n // (rather than a full deep clone) is safe, and skips an O(total cards) clone on every drag.\n setShadowColumns(columns);\n lastAppliedActiveRectKeyRef.current = null;\n }\n\n function handleDragOver({ active, over }: DragOverEvent) {\n if (!over) return;\n\n if (isColumnDragData(active.data.current)) {\n const activeColumnId = String(active.id);\n const overColumnId = String(over.id);\n\n setShadowColumns((prev) => {\n const base = prev ?? columns;\n const next = moveColumn(base, activeColumnId, overColumnId);\n return next === base ? prev : next;\n });\n return;\n }\n\n const activeItemId = String(active.id);\n const overId = String(over.id);\n const activeRect = active.rect.current.translated ?? active.rect.current.initial;\n\n const activeRectKey = activeRect ? `${activeRect.top}:${activeRect.left}` : null;\n if (activeRectKey !== null && activeRectKey === lastAppliedActiveRectKeyRef.current) {\n return;\n }\n lastAppliedActiveRectKeyRef.current = activeRectKey;\n\n setShadowColumns((prev) => {\n const base = prev ?? columns;\n const next = moveItem(base, activeItemId, overId, { activeRect, overRect: over.rect });\n return next === base ? prev : next;\n });\n }\n\n function handleDragEnd({ over }: DragEndEvent) {\n setActiveId(null);\n setActiveIsColumn(false);\n\n if (!over || !shadowColumns) {\n setShadowColumns(null);\n return;\n }\n\n if (!columnsEqual(shadowColumns, columns)) {\n onChange(shadowColumns);\n }\n setShadowColumns(null);\n }\n\n function handleDragCancel() {\n setActiveId(null);\n setActiveIsColumn(false);\n setShadowColumns(null);\n }\n\n const activeColumn = activeId && activeIsColumn ? displayColumns.find((col) => col.id === activeId) : undefined;\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={kanbanCollisionDetection}\n onDragStart={handleDragStart}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n accessibility={accessibility}\n >\n <SortableContext\n id=\"kanban-columns\"\n items={columnIds}\n strategy={horizontalListSortingStrategy}\n >\n <div {...rest} className={cx(styles.board, className)} style={style}>\n {displayColumns.map((col) => (\n <KanbanColumn\n key={col.id}\n id={col.id}\n title={col.title}\n itemIds={col.itemIds}\n maxItems={col.maxItems}\n disabled={col.disabled}\n getItemDisabled={getItemDisabled}\n emptyPlaceholder={renderEmptyColumn?.(col)}\n actions={renderColumnActions?.(col)}\n reorderable={reorderableColumns}\n activeIsColumn={activeId !== null && activeIsColumn}\n collapseEmptyColumns={collapseEmptyColumns}\n columnMaxHeight={columnMaxHeight}\n hasMore={col.hasMore}\n onLoadMore={onLoadMore ? () => onLoadMore(col.id) : undefined}\n loadMoreThreshold={loadMoreThreshold}\n items={items}\n renderItem={renderItem}\n dragHandle={dragHandle}\n preserveSizeWhileEmpty={activeId !== null}\n />\n ))}\n </div>\n </SortableContext>\n <DragOverlay>\n {activeColumn ? (\n <div className={cx(styles.column, styles.columnDragOverlay)}>\n <div className={styles.columnHeader}>\n <span className={styles.columnHeaderTitle}>{activeColumn.title}</span>\n </div>\n </div>\n ) : activeId && !activeIsColumn && items[activeId] !== undefined ? (\n <div className={cx(styles.dragOverlay, classNames?.dragOverlay)} style={slotStyles?.dragOverlay}>{renderItem(items[activeId], activeId)}</div>\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n}\n\nexport default KanbanBoard;\n"],"mappings":"6nBA8BA,IAAM,IAA2B,EAAU,IAAuB,EAY5D,GAAuB,CAAE,qBAAsB,CAAE,SAAU,CAAE,CAAE,EAC/D,GAAuB,CAAE,qBAAsB,CAAE,MAAO,IAAK,UAAW,CAAE,CAAE,EAC5E,GAA0B,CAAE,iBAAkB,CAA+B,EAE7E,EAAuD,CAC3D,UAAW;;;;;GAMb,EAEA,SAAS,EAAyB,CAChC,UACA,QACA,aACA,WACA,aACA,eAAe,GACf,kBACA,oBACA,sBACA,qBACA,uBACA,kBACA,aACA,oBACA,YACA,QACA,cACA,OAAQ,EACR,GAAG,GACmB,CACtB,GAAM,CAAC,EAAU,GAAe,EAAwB,IAAI,EACtD,CAAC,EAAgB,GAAqB,EAAS,EAAK,EACpD,CAAC,EAAe,GAAoB,EAAmC,IAAI,EAW3E,EAA8B,EAAsB,IAAI,EAExD,EAAU,EACd,EAAU,EAAa,EAAoB,EAC3C,EAAU,EAAa,EAAoB,EAC3C,EAAU,EAAgB,EAAuB,CACnD,EAEM,EAAiB,GAAiB,EAQlC,GAAY,MAAc,EAAe,IAAK,GAAQ,EAAI,EAAE,EAAG,CAAC,CAAc,CAAC,EAE/E,EAAgB,MACd,EAAmB,EAAgB,EAAO,CAAY,EAC5D,CAAC,EAAgB,EAAO,CAAY,CACtC,EAEM,GAAgB,OACb,CAAE,gBAAe,yBAA0B,CAA2B,GAC7E,CAAC,CAAa,CAChB,EAEA,SAAS,GAAgB,CAAE,UAA0B,CACnD,EAAY,OAAO,EAAO,EAAE,CAAC,EAC7B,EAAkB,EAAiB,EA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Ac,GACC,0BAPjB,CASE,EAAC,EAAD,CACE,GAAG,iBACH,MAAO,GACP,SAAU,WAEV,EAAC,MAAD,CAAK,GAAI,EAAM,UAAW,EAAG,EAAO,MAAO,CAAS,EAAU,iBAC3D,EAAe,IAAK,GACnB,EAAC,EAAD,CAEE,GAAI,EAAI,GACR,MAAO,EAAI,MACX,QAAS,EAAI,QACb,SAAU,EAAI,SACd,SAAU,EAAI,SACG,kBACjB,iBAAkB,IAAoB,CAAG,EACzC,QAAS,IAAsB,CAAG,EAClC,YAAa,EACb,eAAgB,IAAa,MAAQ,EACf,uBACL,kBACjB,QAAS,EAAI,QACb,WAAY,MAAmB,EAAW,EAAI,EAAE,EAAI,IAAA,GACjC,oBACZ,QACK,aACA,aACZ,uBAAwB,IAAa,IACtC,EApBM,EAAI,EAoBV,CACF,CACE,CAAA,CACU,CAAA,EACjB,EAAC,EAAD,CAAA,SACG,EACC,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,OAAQ,EAAO,iBAAiB,WACxD,EAAC,MAAD,CAAK,UAAW,EAAO,sBACrB,EAAC,OAAD,CAAM,UAAW,EAAO,2BAAoB,EAAa,KAAY,CAAA,CAClE,CAAA,CACF,CAAA,EACH,GAAY,CAAC,GAAkB,EAAM,KAAc,IAAA,GACrD,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,YAAa,IAAY,WAAW,EAAG,MAAO,GAAY,qBAAc,EAAW,EAAM,GAAW,CAAQ,CAAO,CAAA,EAC3I,IACO,CAAA,CACH,GAEhB"}
@@ -1,2 +1,2 @@
1
- import e from"./kanbanBoard.module.mjs";import t from"./KanbanItem.mjs";import n from"classnames";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{useDroppable as a}from"@dnd-kit/core";import{SortableContext as o,useSortable as s,verticalListSortingStrategy as c}from"@dnd-kit/sortable";import{CSS as l}from"@dnd-kit/utilities";var u={type:`column`},d={draggable:!0,droppable:!0};function f({id:f,title:p,itemIds:m,items:h,renderItem:g,dragHandle:_,preserveSizeWhileEmpty:v,collapseEmptyColumns:y=!0,maxItems:b,disabled:x,getItemDisabled:S,emptyPlaceholder:C,actions:w,reorderable:T,activeIsColumn:E,className:D,style:O,classNames:k,styles:A,...j}){let{setNodeRef:M,isOver:N}=a({id:`column-${f}`,disabled:x}),P=y&&m.length===0&&!v,F=b!=null&&m.length>b,{attributes:I,listeners:L,setNodeRef:R,transform:z,transition:B,isDragging:V,isOver:H}=s({id:f,data:u,disabled:T?!1:d});return i(`div`,{...j,ref:R,id:f,className:n(e.column,N&&!E&&e.columnOver,H&&e.columnDropTarget,P&&e.columnEmpty,F&&e.columnOverLimit,x&&e.columnDisabled,V&&e.columnDragging,D),style:{transform:l.Transform.toString(z),transition:B,...O},children:[i(`div`,{className:n(e.columnHeader,T&&e.columnHeaderReorderable,k?.header),style:A?.header,...T?I:void 0,...T?L:void 0,children:[r(`span`,{className:e.columnHeaderTitle,children:p}),i(`div`,{className:e.columnHeaderTrailing,children:[b!=null&&i(`span`,{className:n(e.columnHeaderCount,F&&e.columnHeaderCountOver,k?.count),style:A?.count,children:[m.length,`/`,b]}),w!=null&&r(`div`,{className:n(e.columnHeaderActions,k?.actions),style:A?.actions,children:w})]})]}),r(o,{id:f,items:m,strategy:c,children:i(`div`,{ref:M,className:n(e.columnItems,k?.items),style:A?.items,children:[m.length===0&&C!=null?r(`div`,{className:n(e.columnPlaceholder,k?.placeholder),style:A?.placeholder,children:C}):null,m.map(e=>r(t,{id:e,dragHandle:_,disabled:x||h[e]!==void 0&&(S?.(h[e],e)??!1),preventAsDropTarget:x,children:h[e]===void 0?null:g(h[e],e)},e))]})})]})}export{f as default};
1
+ import e from"../loading/spinnerLoading/index.mjs";import t from"./kanbanBoard.module.mjs";import n from"./KanbanItem.mjs";import{useCallback as r,useEffect as i,useRef as a,useState as o}from"react";import s from"classnames";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{useDroppable as u}from"@dnd-kit/core";import{SortableContext as d,useSortable as f,verticalListSortingStrategy as p}from"@dnd-kit/sortable";import{CSS as m}from"@dnd-kit/utilities";var h={type:`column`},g={draggable:!0,droppable:!0};function _({id:_,title:v,itemIds:y,items:b,renderItem:x,dragHandle:S,preserveSizeWhileEmpty:C,collapseEmptyColumns:w=!0,maxItems:T,disabled:E,getItemDisabled:D,emptyPlaceholder:O,actions:k,reorderable:A,activeIsColumn:j,columnMaxHeight:M,hasMore:N,onLoadMore:P,loadMoreThreshold:F=100,className:I,style:L,classNames:R,styles:z,...B}){let{setNodeRef:V,isOver:H}=u({id:`column-${_}`,disabled:E}),U=w&&y.length===0&&!C,W=T!=null&&y.length>T,G=a(null),K=r(e=>{G.current=e,V(e)},[V]),q=a(!1),[J,Y]=o(!1),X=r(()=>{!P||q.current||(q.current=!0,Y(!0),Promise.resolve(P()).finally(()=>{q.current=!1,Y(!1)}))},[P]),Z=r(e=>{if(!N)return;let t=e.currentTarget;t.scrollTop+t.clientHeight>=t.scrollHeight-F&&X()},[N,F,X]),Q=a(``);i(()=>{if(!N||!M||J)return;let e=G.current;if(!e||e.clientHeight===0||e.scrollHeight>e.clientHeight)return;let t=`${y.length}:${e.clientHeight}`;Q.current!==t&&(Q.current=t,X())},[N,M,J,y.length,X]);let{attributes:$,listeners:ee,setNodeRef:te,transform:ne,transition:re,isDragging:ie,isOver:ae}=f({id:_,data:h,disabled:A?!1:g});return l(`div`,{...B,ref:te,id:_,className:s(t.column,H&&!j&&t.columnOver,ae&&t.columnDropTarget,U&&t.columnEmpty,W&&t.columnOverLimit,E&&t.columnDisabled,ie&&t.columnDragging,I),style:{transform:m.Transform.toString(ne),transition:re,...L},children:[l(`div`,{className:s(t.columnHeader,A&&t.columnHeaderReorderable,R?.header),style:z?.header,...A?$:void 0,...A?ee:void 0,children:[c(`span`,{className:t.columnHeaderTitle,children:v}),l(`div`,{className:t.columnHeaderTrailing,children:[T!=null&&l(`span`,{className:s(t.columnHeaderCount,W&&t.columnHeaderCountOver,R?.count),style:z?.count,children:[y.length,`/`,T]}),k!=null&&c(`div`,{className:s(t.columnHeaderActions,R?.actions),style:z?.actions,children:k})]})]}),c(d,{id:_,items:y,strategy:p,children:l(`div`,{ref:K,className:s(t.columnItems,R?.items),style:{maxHeight:M,overflowY:M?`auto`:void 0,...z?.items},onScroll:M?Z:void 0,children:[y.length===0&&O!=null?c(`div`,{className:s(t.columnPlaceholder,R?.placeholder),style:z?.placeholder,children:O}):null,y.map(e=>c(n,{id:e,dragHandle:S,disabled:E||b[e]!==void 0&&(D?.(b[e],e)??!1),preventAsDropTarget:E,children:b[e]===void 0?null:x(b[e],e)},e)),J&&c(`div`,{className:s(t.columnLoadingIndicator,R?.loadingIndicator),style:z?.loadingIndicator,children:c(e,{className:t.columnLoadingSpinner})})]})})]})}export{_ as default};
2
2
  //# sourceMappingURL=KanbanColumn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"KanbanColumn.mjs","names":[],"sources":["../../../../package/common/kanbanBoard/KanbanColumn.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useDroppable } from '@dnd-kit/core';\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport cx from 'classnames';\n\nimport type { KanbanColumnProps } from './kanbanBoard.types';\nimport styles from './kanbanBoard.module.pcss';\nimport KanbanItem from './KanbanItem';\n\n// Hoisted so these are referentially stable across renders — inline literals here would give\n// `useSortable` a new `data`/`disabled` object every render (every column re-renders on every\n// `dragOver` while a drag is in progress, via `shadowColumns`), which can spin dnd-kit's own\n// registration effect into a render loop that eventually trips React's \"Maximum update depth\n// exceeded\" guard. Same fix as the sensor options in `KanbanBoard.tsx`.\nconst COLUMN_SORTABLE_DATA = { type: 'column' };\nconst COLUMN_SORTABLE_DISABLED = { draggable: true, droppable: true };\n\ninterface KanbanColumnInternalProps<T> extends KanbanColumnProps {\n itemIds: string[];\n items: Record<string, T>;\n renderItem: (item: T, id: string) => ReactNode;\n dragHandle?: boolean;\n /**\n * Keep the column at its normal flex width even when `itemIds` is empty. Used while a drag\n * is in progress: the empty-column collapse is driven by transient shadow state during a\n * drag, and letting the column shrink mid-drag shifts every column's layout underneath the\n * pointer, which can flip the collision target back and forth forever.\n */\n preserveSizeWhileEmpty?: boolean;\n /** Shrink to a narrow strip when empty — see `KanbanBoardProps.collapseEmptyColumns`. Defaults to `true`. */\n collapseEmptyColumns?: boolean;\n /** Work-in-progress limit — see `KanbanColumnDef.maxItems`. Display-only. */\n maxItems?: number;\n /** Freezes the column — see `KanbanColumnDef.disabled`. */\n disabled?: boolean;\n /** Returns whether a specific card can't be picked up — see `KanbanBoardProps.getItemDisabled`. */\n getItemDisabled?: (item: T, id: string) => boolean;\n /** Custom content shown when the column has no cards — see `KanbanBoardProps.renderEmptyColumn`. */\n emptyPlaceholder?: ReactNode;\n /** Custom header actions — see `KanbanBoardProps.renderColumnActions`. */\n actions?: ReactNode;\n /** Allow the whole column to be dragged (by its header) to reorder it — see `KanbanBoardProps.reorderableColumns`. */\n reorderable?: boolean;\n /**\n * Whether the card currently being dragged (if any) is actually a column. Suppresses the\n * cards drop-target highlight, which otherwise lights up on every column a dragged column\n * passes over — that highlight means \"drop a card here\", which doesn't apply mid-column-drag.\n */\n activeIsColumn?: boolean;\n}\n\nfunction KanbanColumn<T>({\n id,\n title,\n itemIds,\n items,\n renderItem,\n dragHandle,\n preserveSizeWhileEmpty,\n collapseEmptyColumns = true,\n maxItems,\n disabled,\n getItemDisabled,\n emptyPlaceholder,\n actions,\n reorderable,\n activeIsColumn,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n}: KanbanColumnInternalProps<T>) {\n const droppableId = `column-${id}`;\n const { setNodeRef, isOver } = useDroppable({ id: droppableId, disabled });\n const isEmpty = collapseEmptyColumns && itemIds.length === 0 && !preserveSizeWhileEmpty;\n const isOverLimit = maxItems != null && itemIds.length > maxItems;\n\n const {\n attributes: columnAttributes,\n listeners: columnListeners,\n setNodeRef: setColumnNodeRef,\n transform: columnTransform,\n transition: columnTransition,\n isDragging: isColumnDragging,\n isOver: isColumnOver,\n } = useSortable({\n id,\n data: COLUMN_SORTABLE_DATA,\n disabled: reorderable ? false : COLUMN_SORTABLE_DISABLED,\n });\n\n return (\n <div\n {...rest}\n ref={setColumnNodeRef}\n id={id}\n className={cx(\n styles.column,\n isOver && !activeIsColumn && styles.columnOver,\n isColumnOver && styles.columnDropTarget,\n isEmpty && styles.columnEmpty,\n isOverLimit && styles.columnOverLimit,\n disabled && styles.columnDisabled,\n isColumnDragging && styles.columnDragging,\n className\n )}\n style={{ transform: CSS.Transform.toString(columnTransform), transition: columnTransition, ...style }}\n >\n <div\n className={cx(styles.columnHeader, reorderable && styles.columnHeaderReorderable, classNames?.header)}\n style={slotStyles?.header}\n {...(reorderable ? columnAttributes : undefined)}\n {...(reorderable ? columnListeners : undefined)}\n >\n <span className={styles.columnHeaderTitle}>{title}</span>\n <div className={styles.columnHeaderTrailing}>\n {maxItems != null && (\n <span\n className={cx(styles.columnHeaderCount, isOverLimit && styles.columnHeaderCountOver, classNames?.count)}\n style={slotStyles?.count}\n >\n {itemIds.length}/{maxItems}\n </span>\n )}\n {actions != null && (\n <div className={cx(styles.columnHeaderActions, classNames?.actions)} style={slotStyles?.actions}>\n {actions}\n </div>\n )}\n </div>\n </div>\n <SortableContext id={id} items={itemIds} strategy={verticalListSortingStrategy}>\n <div ref={setNodeRef} className={cx(styles.columnItems, classNames?.items)} style={slotStyles?.items}>\n {itemIds.length === 0 && emptyPlaceholder != null ? (\n <div className={cx(styles.columnPlaceholder, classNames?.placeholder)} style={slotStyles?.placeholder}>\n {emptyPlaceholder}\n </div>\n ) : null}\n {itemIds.map((itemId) => (\n <KanbanItem\n key={itemId}\n id={itemId}\n dragHandle={dragHandle}\n disabled={disabled || (items[itemId] !== undefined && (getItemDisabled?.(items[itemId], itemId) ?? false))}\n preventAsDropTarget={disabled}\n >\n {items[itemId] !== undefined ? renderItem(items[itemId], itemId) : null}\n </KanbanItem>\n ))}\n </div>\n </Sortable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uB,GAAY,KAAK,EACtG,MAAO,GAAY,eAFrB,CAIG,EAAQ,OAAO,IAAE,CACd,IAEP,GAAW,MACV,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,oBAAqB,GAAY,OAAO,EAAG,MAAO,GAAY,iBACrF,CACE,CAAA,CAEJ,GACF,IACL,EAAC,EAAD,CAAqB,KAAI,MAAO,EAAS,SAAU,WACjD,EAAC,MAAD,CAAK,IAAK,EAAY,UAAW,EAAG,EAAO,YAAa,GAAY,KAAK,EAAG,MAAO,GAAY,eAA/F,CACG,EAAQ,SAAW,GAAK,GAAoB,KAC3C,EAAC,MAAD,CAAK,UAAW,EAAG,EAAO,kBAAmB,GAAY,WAAW,EAAG,MAAO,GAAY,qBACvF,CACE,CAAA,EACH,KACH,EAAQ,IAAK,GACZ,EAAC,EAAD,CAEE,GAAI,EACQ,aACZ,SAAU,GAAa,EAAM,KAAY,IAAA,KAAc,IAAkB,EAAM,GAAS,CAAM,GAAK,IACnG,oBAAqB,WAEpB,EAAM,KAAY,IAAA,GAAgD,KAApC,EAAW,EAAM,GAAS,CAAM,CACrD,EAPL,CAOK,CACb,CACE,GACU,CAAA,CACd,GAET"}
1
+ {"version":3,"file":"KanbanColumn.mjs","names":[],"sources":["../../../../package/common/kanbanBoard/KanbanColumn.tsx"],"sourcesContent":["import type { ReactNode, UIEvent } from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useDroppable } from '@dnd-kit/core';\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport cx from 'classnames';\n\nimport type { KanbanColumnProps } from './kanbanBoard.types';\nimport styles from './kanbanBoard.module.pcss';\nimport KanbanItem from './KanbanItem';\nimport SpinnerLoading from '../loading/spinnerLoading';\n\n// Hoisted so these are referentially stable across renders — inline literals here would give\n// `useSortable` a new `data`/`disabled` object every render (every column re-renders on every\n// `dragOver` while a drag is in progress, via `shadowColumns`), which can spin dnd-kit's own\n// registration effect into a render loop that eventually trips React's \"Maximum update depth\n// exceeded\" guard. Same fix as the sensor options in `KanbanBoard.tsx`.\nconst COLUMN_SORTABLE_DATA = { type: 'column' };\nconst COLUMN_SORTABLE_DISABLED = { draggable: true, droppable: true };\n\ninterface KanbanColumnInternalProps<T> extends KanbanColumnProps {\n itemIds: string[];\n items: Record<string, T>;\n renderItem: (item: T, id: string) => ReactNode;\n dragHandle?: boolean;\n /**\n * Keep the column at its normal flex width even when `itemIds` is empty. Used while a drag\n * is in progress: the empty-column collapse is driven by transient shadow state during a\n * drag, and letting the column shrink mid-drag shifts every column's layout underneath the\n * pointer, which can flip the collision target back and forth forever.\n */\n preserveSizeWhileEmpty?: boolean;\n /** Shrink to a narrow strip when empty — see `KanbanBoardProps.collapseEmptyColumns`. Defaults to `true`. */\n collapseEmptyColumns?: boolean;\n /** Work-in-progress limit — see `KanbanColumnDef.maxItems`. Display-only. */\n maxItems?: number;\n /** Freezes the column — see `KanbanColumnDef.disabled`. */\n disabled?: boolean;\n /** Returns whether a specific card can't be picked up — see `KanbanBoardProps.getItemDisabled`. */\n getItemDisabled?: (item: T, id: string) => boolean;\n /** Custom content shown when the column has no cards — see `KanbanBoardProps.renderEmptyColumn`. */\n emptyPlaceholder?: ReactNode;\n /** Custom header actions — see `KanbanBoardProps.renderColumnActions`. */\n actions?: ReactNode;\n /** Allow the whole column to be dragged (by its header) to reorder it — see `KanbanBoardProps.reorderableColumns`. */\n reorderable?: boolean;\n /**\n * Whether the card currently being dragged (if any) is actually a column. Suppresses the\n * cards drop-target highlight, which otherwise lights up on every column a dragged column\n * passes over — that highlight means \"drop a card here\", which doesn't apply mid-column-drag.\n */\n activeIsColumn?: boolean;\n /** Bounds the column's height and makes its card list scroll — see `KanbanBoardProps.columnMaxHeight`. */\n columnMaxHeight?: string;\n /** Whether more items exist for this column — see `KanbanColumnDef.hasMore`. */\n hasMore?: boolean;\n /** Requests the next page for this column — see `KanbanBoardProps.onLoadMore`. */\n onLoadMore?: () => void | Promise<void>;\n /** Scroll distance from the bottom that triggers `onLoadMore` — see `KanbanBoardProps.loadMoreThreshold`. */\n loadMoreThreshold?: number;\n}\n\nfunction KanbanColumn<T>({\n id,\n title,\n itemIds,\n items,\n renderItem,\n dragHandle,\n preserveSizeWhileEmpty,\n collapseEmptyColumns = true,\n maxItems,\n disabled,\n getItemDisabled,\n emptyPlaceholder,\n actions,\n reorderable,\n activeIsColumn,\n columnMaxHeight,\n hasMore,\n onLoadMore,\n loadMoreThreshold = 100,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n}: KanbanColumnInternalProps<T>) {\n const droppableId = `column-${id}`;\n const { setNodeRef, isOver } = useDroppable({ id: droppableId, disabled });\n const isEmpty = collapseEmptyColumns && itemIds.length === 0 && !preserveSizeWhileEmpty;\n const isOverLimit = maxItems != null && itemIds.length > maxItems;\n\n const itemsRef = useRef<HTMLDivElement | null>(null);\n const setItemsRef = useCallback(\n (node: HTMLDivElement | null) => {\n itemsRef.current = node;\n setNodeRef(node);\n },\n [setNodeRef]\n );\n const isLoadingMoreRef = useRef(false);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n\n const triggerLoadMore = useCallback(() => {\n if (!onLoadMore || isLoadingMoreRef.current) return;\n isLoadingMoreRef.current = true;\n setIsLoadingMore(true);\n Promise.resolve(onLoadMore()).finally(() => {\n isLoadingMoreRef.current = false;\n setIsLoadingMore(false);\n });\n }, [onLoadMore]);\n\n const handleItemsScroll = useCallback(\n (event: UIEvent<HTMLDivElement>) => {\n if (!hasMore) return;\n const el = event.currentTarget;\n if (el.scrollTop + el.clientHeight >= el.scrollHeight - loadMoreThreshold) triggerLoadMore();\n },\n [hasMore, loadMoreThreshold, triggerLoadMore]\n );\n\n // The scroll trigger above can only fire once the list actually overflows and scrolls. A batch\n // smaller than the column's own visible height never generates a scroll event, which would\n // otherwise dead-end pagination after the first page. Re-probes at most once per (item count,\n // visible height) pair, so settled content can't re-ask a source that already ran dry.\n const fillProbeRef = useRef('');\n useEffect(() => {\n if (!hasMore || !columnMaxHeight || isLoadingMore) return;\n const el = itemsRef.current;\n if (!el || el.clientHeight === 0) return;\n if (el.scrollHeight > el.clientHeight) return;\n const probe = `${itemIds.length}:${el.clientHeight}`;\n if (fillProbeRef.current === probe) return;\n fillProbeRef.current = probe;\n triggerLoadMore();\n }, [hasMore, columnMaxHeight, isLoadingMore, itemIds.length, triggerLoadMore]);\n\n const {\n attributes: columnAttributes,\n listeners: columnListeners,\n setNodeRef: setColumnNodeRef,\n transform: columnTransform,\n transition: columnTransition,\n isDragging: isColumnDragging,\n isOver: isColumnOver,\n } = useSortable({\n id,\n data: COLUMN_SORTABLE_DATA,\n disabled: reorderable ? false : COLUMN_SORTABLE_DISABLED,\n });\n\n return (\n <div\n {...rest}\n ref={setColumnNodeRef}\n id={id}\n className={cx(\n styles.column,\n isOver && !activeIsColumn && styles.columnOver,\n isColumnOver && styles.columnDropTarget,\n isEmpty && styles.columnEmpty,\n isOverLimit && styles.columnOverLimit,\n disabled && styles.columnDisabled,\n isColumnDragging && styles.columnDragging,\n className\n )}\n style={{ transform: CSS.Transform.toString(columnTransform), transition: columnTransition, ...style }}\n >\n <div\n className={cx(styles.columnHeader, reorderable && styles.columnHeaderReorderable, classNames?.header)}\n style={slotStyles?.header}\n {...(reorderable ? columnAttributes : undefined)}\n {...(reorderable ? columnListeners : undefined)}\n >\n <span className={styles.columnHeaderTitle}>{title}</span>\n <div className={styles.columnHeaderTrailing}>\n {maxItems != null && (\n <span\n className={cx(styles.columnHeaderCount, isOverLimit && styles.columnHeaderCountOver, classNames?.count)}\n style={slotStyles?.count}\n >\n {itemIds.length}/{maxItems}\n </span>\n )}\n {actions != null && (\n <div className={cx(styles.columnHeaderActions, classNames?.actions)} style={slotStyles?.actions}>\n {actions}\n </div>\n )}\n </div>\n </div>\n <SortableContext id={id} items={itemIds} strategy={verticalListSortingStrategy}>\n <div\n ref={setItemsRef}\n className={cx(styles.columnItems, classNames?.items)}\n style={{ maxHeight: columnMaxHeight, overflowY: columnMaxHeight ? 'auto' : undefined, ...slotStyles?.items }}\n onScroll={columnMaxHeight ? handleItemsScroll : undefined}\n >\n {itemIds.length === 0 && emptyPlaceholder != null ? (\n <div className={cx(styles.columnPlaceholder, classNames?.placeholder)} style={slotStyles?.placeholder}>\n {emptyPlaceholder}\n </div>\n ) : null}\n {itemIds.map((itemId) => (\n <KanbanItem\n key={itemId}\n id={itemId}\n dragHandle={dragHandle}\n disabled={disabled || (items[itemId] !== undefined && (getItemDisabled?.(items[itemId], itemId) ?? false))}\n preventAsDropTarget={disabled}\n >\n {items[itemId] !== undefined ? renderItem(items[itemId], itemId) : null}\n </KanbanItem>\n ))}\n {isLoadingMore && (\n <div\n className={cx(styles.columnLoadingIndicator, classNames?.loadingIndicator)}\n style={slotStyles?.loadingIndicator}\n >\n <SpinnerLoading className={styles.columnLoadingSpinner} />\n </div>\n )}\n </div>\n </SortableContext>\n </div>\n );\n}\n\nexport default KanbanColumn;\n"],"mappings":"gdAiBA,IAAM,EAAuB,CAAE,KAAM,QAAS,EACxC,EAA2B,CAAE,UAAW,GAAM,UAAW,EAAK,EA4CpE,SAAS,EAAgB,CACvB,KACA,QACA,UACA,QACA,aACA,aACA,yBACA,uBAAuB,GACvB,WACA,WACA,kBACA,mBACA,UACA,cACA,iBACA,kBACA,UACA,aACA,oBAAoB,IACpB,YACA,QACA,aACA,OAAQ,EACR,GAAG,GAC4B,CAE/B,GAAM,CAAE,aAAY,UAAW,EAAa,CAAE,GAAI,UADpB,IACiC,UAAS,CAAC,EACnE,EAAU,GAAwB,EAAQ,SAAW,GAAK,CAAC,EAC3D,EAAc,GAAY,MAAQ,EAAQ,OAAS,EAEnD,EAAW,EAA8B,IAAI,EAC7C,EAAc,EACjB,GAAgC,CAC/B,EAAS,QAAU,EACnB,EAAW,CAAI,CACjB,EACA,CAAC,CAAU,CACb,EACM,EAAmB,EAAO,EAAK,EAC/B,CAAC,EAAe,GAAoB,EAAS,EAAK,EAElD,E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EJ,GACU,CAAA,CACd,GAET"}
@@ -1,2 +1,2 @@
1
- var e={board:`board_6KRdw`,column:`column_NrNeF`,"column-empty":`column-empty_5KYsJ`,columnEmpty:`column-empty_5KYsJ`,"column-over":`column-over_sO7oD`,columnOver:`column-over_sO7oD`,"column-over-limit":`column-over-limit_QmeZF`,columnOverLimit:`column-over-limit_QmeZF`,"column-drop-target":`column-drop-target_mznmc`,columnDropTarget:`column-drop-target_mznmc`,"column-disabled":`column-disabled_ehcz3`,columnDisabled:`column-disabled_ehcz3`,"column-items":`column-items_xY5er`,columnItems:`column-items_xY5er`,"column-dragging":`column-dragging_6F5TK`,columnDragging:`column-dragging_6F5TK`,"column-drag-overlay":`column-drag-overlay_ctehQ`,columnDragOverlay:`column-drag-overlay_ctehQ`,"column-header":`column-header_PLeKG`,columnHeader:`column-header_PLeKG`,"column-header-reorderable":`column-header-reorderable_Jtgii`,columnHeaderReorderable:`column-header-reorderable_Jtgii`,"column-header-title":`column-header-title_FQhHQ`,columnHeaderTitle:`column-header-title_FQhHQ`,"column-header-count":`column-header-count_3t83e`,columnHeaderCount:`column-header-count_3t83e`,"column-header-count-over":`column-header-count-over_AkAdo`,columnHeaderCountOver:`column-header-count-over_AkAdo`,"column-header-trailing":`column-header-trailing_6625D`,columnHeaderTrailing:`column-header-trailing_6625D`,"column-header-actions":`column-header-actions_XKY3t`,columnHeaderActions:`column-header-actions_XKY3t`,"column-placeholder":`column-placeholder_WGyF-`,columnPlaceholder:`column-placeholder_WGyF-`,item:`item_T8CJK`,"item-dragging":`item-dragging_iWurw`,itemDragging:`item-dragging_iWurw`,"item-handled":`item-handled_l28gq`,itemHandled:`item-handled_l28gq`,"item-disabled":`item-disabled_n8Nuq`,itemDisabled:`item-disabled_n8Nuq`,dragOverlay:`dragOverlay_DSyKz`};export{e as default};
1
+ var e={board:`board_6KRdw`,column:`column_NrNeF`,"column-empty":`column-empty_5KYsJ`,columnEmpty:`column-empty_5KYsJ`,"column-over":`column-over_sO7oD`,columnOver:`column-over_sO7oD`,"column-over-limit":`column-over-limit_QmeZF`,columnOverLimit:`column-over-limit_QmeZF`,"column-drop-target":`column-drop-target_mznmc`,columnDropTarget:`column-drop-target_mznmc`,"column-disabled":`column-disabled_ehcz3`,columnDisabled:`column-disabled_ehcz3`,"column-items":`column-items_xY5er`,columnItems:`column-items_xY5er`,"column-dragging":`column-dragging_6F5TK`,columnDragging:`column-dragging_6F5TK`,"column-drag-overlay":`column-drag-overlay_ctehQ`,columnDragOverlay:`column-drag-overlay_ctehQ`,"column-header":`column-header_PLeKG`,columnHeader:`column-header_PLeKG`,"column-header-reorderable":`column-header-reorderable_Jtgii`,columnHeaderReorderable:`column-header-reorderable_Jtgii`,"column-header-title":`column-header-title_FQhHQ`,columnHeaderTitle:`column-header-title_FQhHQ`,"column-header-count":`column-header-count_3t83e`,columnHeaderCount:`column-header-count_3t83e`,"column-header-count-over":`column-header-count-over_AkAdo`,columnHeaderCountOver:`column-header-count-over_AkAdo`,"column-header-trailing":`column-header-trailing_6625D`,columnHeaderTrailing:`column-header-trailing_6625D`,"column-header-actions":`column-header-actions_XKY3t`,columnHeaderActions:`column-header-actions_XKY3t`,"column-placeholder":`column-placeholder_WGyF-`,columnPlaceholder:`column-placeholder_WGyF-`,"column-loading-indicator":`column-loading-indicator_2Q70t`,columnLoadingIndicator:`column-loading-indicator_2Q70t`,"column-loading-spinner":`column-loading-spinner_4ca6l`,columnLoadingSpinner:`column-loading-spinner_4ca6l`,item:`item_T8CJK`,"item-dragging":`item-dragging_iWurw`,itemDragging:`item-dragging_iWurw`,"item-handled":`item-handled_l28gq`,itemHandled:`item-handled_l28gq`,"item-disabled":`item-disabled_n8Nuq`,itemDisabled:`item-disabled_n8Nuq`,dragOverlay:`dragOverlay_DSyKz`};export{e as default};
2
2
  //# sourceMappingURL=kanbanBoard.module.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"kanbanBoard.module.mjs","names":[],"sources":["../../../../package/common/kanbanBoard/kanbanBoard.module.pcss"],"sourcesContent":[".board {\n display: flex;\n gap: var(--spacing-s);\n overflow-x: auto;\n align-items: flex-start;\n width: 100%;\n}\n\n.column {\n background: var(--background-accent-light);\n border-radius: var(--default-border-radius);\n box-shadow: var(--card-shadow);\n flex: 1 1 0;\n display: flex;\n flex-direction: column;\n border: 2px solid transparent;\n transition: border-color 0.15s ease, background 0.15s ease;\n\n &-empty {\n flex: 0 1 0;\n min-width: var(--kanban-empty-column-width, 140px);\n }\n\n &-over {\n border-color: var(--primary-lighter);\n background: var(--background-accent);\n }\n\n &-over-limit {\n border-color: var(--warn-color);\n }\n\n /* A whole column being dragged over this one, reordering — distinct from -over (a card being\n dropped into this column's card list), even though both are dashed-free solid borders here;\n kept as a separate class so consumers can restyle one without affecting the other. */\n &-drop-target {\n border-color: var(--primary-color);\n background: var(--background-accent);\n }\n\n /* Dims only the cards area, not the header — header actions (e.g. an \"add card\" button) are\n consumer-controlled and often meant to stay fully interactive even while the column itself\n is frozen for dragging, and opacity on an ancestor can't be undone by a child's own opacity. */\n &-disabled &-items {\n opacity: 0.6;\n }\n\n &-dragging {\n opacity: 0.4;\n }\n\n &-drag-overlay {\n cursor: grabbing;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), var(--card-shadow);\n min-width: 220px;\n }\n\n &-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--spacing-s);\n padding: var(--spacing-m) var(--spacing-l);\n background: var(--background-accent);\n border-radius: var(--default-border-radius) var(--default-border-radius) 0 0;\n font-size: var(--header-small-font-size);\n font-weight: var(--header-font-weight);\n color: var(--text-color);\n border-bottom: 1px solid var(--border-color);\n\n &-reorderable {\n cursor: grab;\n -webkit-tap-highlight-color: transparent;\n touch-action: none;\n\n &:active {\n cursor: grabbing;\n }\n }\n\n &-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &-count {\n flex-shrink: 0;\n font-size: var(--default-font-size);\n font-weight: var(--default-font-weight);\n color: var(--text-dark);\n\n &-over {\n color: var(--warn-color);\n font-weight: var(--header-font-weight);\n }\n }\n\n &-trailing {\n display: flex;\n align-items: center;\n gap: var(--spacing-s);\n flex-shrink: 0;\n }\n\n &-actions {\n display: flex;\n align-items: center;\n gap: var(--spacing-s);\n }\n }\n\n &-items {\n padding: var(--spacing-m);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-m);\n min-height: 80px;\n flex: 1;\n }\n\n &-placeholder {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n color: var(--text-dark);\n font-size: var(--default-font-size);\n }\n}\n\n.item {\n cursor: grab;\n touch-action: none;\n\n &:active {\n cursor: grabbing;\n }\n\n &-dragging {\n opacity: 0.4;\n }\n\n &-handled {\n cursor: default;\n touch-action: auto;\n\n &:active {\n cursor: default;\n }\n\n [data-drag-handle] {\n cursor: grab;\n -webkit-tap-highlight-color: transparent;\n touch-action: none;\n }\n\n [data-drag-handle]:active {\n cursor: grabbing;\n }\n }\n\n &-disabled {\n cursor: not-allowed;\n\n &:active {\n cursor: not-allowed;\n }\n\n [data-drag-handle] {\n cursor: not-allowed;\n }\n\n [data-drag-handle]:active {\n cursor: not-allowed;\n }\n }\n}\n\n.dragOverlay {\n border-radius: var(--default-border-radius);\n cursor: grabbing;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), var(--card-shadow);\n}\n"],"mappings":""}
1
+ {"version":3,"file":"kanbanBoard.module.mjs","names":[],"sources":["../../../../package/common/kanbanBoard/kanbanBoard.module.pcss"],"sourcesContent":[".board {\n display: flex;\n gap: var(--spacing-s);\n overflow-x: auto;\n align-items: flex-start;\n width: 100%;\n}\n\n.column {\n background: var(--background-accent-light);\n border-radius: var(--default-border-radius);\n box-shadow: var(--card-shadow);\n flex: 1 1 0;\n display: flex;\n flex-direction: column;\n border: 2px solid transparent;\n transition: border-color 0.15s ease, background 0.15s ease;\n\n &-empty {\n flex: 0 1 0;\n min-width: var(--kanban-empty-column-width, 140px);\n }\n\n &-over {\n border-color: var(--primary-lighter);\n background: var(--background-accent);\n }\n\n &-over-limit {\n border-color: var(--warn-color);\n }\n\n /* A whole column being dragged over this one, reordering — distinct from -over (a card being\n dropped into this column's card list), even though both are dashed-free solid borders here;\n kept as a separate class so consumers can restyle one without affecting the other. */\n &-drop-target {\n border-color: var(--primary-color);\n background: var(--background-accent);\n }\n\n /* Dims only the cards area, not the header — header actions (e.g. an \"add card\" button) are\n consumer-controlled and often meant to stay fully interactive even while the column itself\n is frozen for dragging, and opacity on an ancestor can't be undone by a child's own opacity. */\n &-disabled &-items {\n opacity: 0.6;\n }\n\n &-dragging {\n opacity: 0.4;\n }\n\n &-drag-overlay {\n cursor: grabbing;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), var(--card-shadow);\n min-width: 220px;\n }\n\n &-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--spacing-s);\n padding: var(--spacing-m) var(--spacing-l);\n background: var(--background-accent);\n border-radius: var(--default-border-radius) var(--default-border-radius) 0 0;\n font-size: var(--header-small-font-size);\n font-weight: var(--header-font-weight);\n color: var(--text-color);\n border-bottom: 1px solid var(--border-color);\n\n &-reorderable {\n cursor: grab;\n -webkit-tap-highlight-color: transparent;\n touch-action: none;\n\n &:active {\n cursor: grabbing;\n }\n }\n\n &-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &-count {\n flex-shrink: 0;\n font-size: var(--default-font-size);\n font-weight: var(--default-font-weight);\n color: var(--text-dark);\n\n &-over {\n color: var(--warn-color);\n font-weight: var(--header-font-weight);\n }\n }\n\n &-trailing {\n display: flex;\n align-items: center;\n gap: var(--spacing-s);\n flex-shrink: 0;\n }\n\n &-actions {\n display: flex;\n align-items: center;\n gap: var(--spacing-s);\n }\n }\n\n &-items {\n padding: var(--spacing-m);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-m);\n min-height: 80px;\n flex: 1;\n }\n\n &-placeholder {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n color: var(--text-dark);\n font-size: var(--default-font-size);\n }\n\n &-loading-indicator {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--spacing-s) 0;\n }\n\n &-loading-spinner {\n width: 2.6rem;\n height: 2.6rem;\n }\n}\n\n.item {\n cursor: grab;\n touch-action: none;\n\n &:active {\n cursor: grabbing;\n }\n\n &-dragging {\n opacity: 0.4;\n }\n\n &-handled {\n cursor: default;\n touch-action: auto;\n\n &:active {\n cursor: default;\n }\n\n [data-drag-handle] {\n cursor: grab;\n -webkit-tap-highlight-color: transparent;\n touch-action: none;\n }\n\n [data-drag-handle]:active {\n cursor: grabbing;\n }\n }\n\n &-disabled {\n cursor: not-allowed;\n\n &:active {\n cursor: not-allowed;\n }\n\n [data-drag-handle] {\n cursor: not-allowed;\n }\n\n [data-drag-handle]:active {\n cursor: not-allowed;\n }\n }\n}\n\n.dragOverlay {\n border-radius: var(--default-border-radius);\n cursor: grabbing;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), var(--card-shadow);\n}\n"],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../interactableDiv/index.mjs";import n from"../input/input.mjs";import r from"./numberInput.module.mjs";import"react";import i from"classnames";import{FontAwesomeIcon as a}from"@fortawesome/react-fontawesome";import{faChevronDown as o,faChevronUp as s}from"@fortawesome/free-solid-svg-icons";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{NumericFormat as u}from"react-number-format";function d(d){let{value:f,onChange:p,formValidator:m,label:h,error:g,className:_,allowNegative:v=!1,decimalSeparator:y,thousandSeparator:b,prefix:x,suffix:S,decimalScale:C,fixedDecimalScale:w=!0,placeholder:T,sign:E,showArrows:D=!1,step:O=1,readOnly:k=!1,onKeyDown:A,...j}=e(`NumberInput`,d),M=m==null?f:m.value,N=E!=null&&M!=null?Math.abs(Number(M)):M,P=N==null?``:String(N);function F(e){let t=e;t!==void 0&&(E===`-`&&(t=-Math.abs(t)),E===`+`&&(t=Math.abs(t))),m?.set(t??null),p?.(t)}function I(e){if(k)return;let t=(M!=null&&M!==``?Number(M):0)+e;!v&&E!==`-`&&(t=Math.max(0,t)),E===`-`&&(t=Math.min(0,t)),F(t)}function L(e){if(k){A?.(e);return}if(e.key===`ArrowUp`){e.preventDefault(),I(e.shiftKey?O*10:O);return}if(e.key===`ArrowDown`){e.preventDefault(),I(e.shiftKey?-O*10:-O);return}A?.(e)}let R=E===`-`?`-`:E===`+`?`+`:x,z=D&&!k?l(`div`,{className:r.arrows,children:[c(t,{className:r.arrowBtn,tabIndex:-1,onMouseDown:e=>{e.preventDefault(),I(e.shiftKey?O*10:O)},children:c(a,{icon:s})}),c(t,{className:r.arrowBtn,tabIndex:-1,onMouseDown:e=>{e.preventDefault(),I(e.shiftKey?-O*10:-O)},children:c(a,{icon:o})})]}):null;return c(n,{label:h,className:i(r.numberInput,_),value:P,onChange:()=>{},formValidator:null,isValid:m?m.touched?!m.hasError():!0:!g,errorMessage:m?m.getCurrentErrorMessage()??``:g??``,placeholder:T,readOnly:k,suffix:z,inputMode:C===0?`numeric`:`decimal`,customInput:c(u,{onValueChange:e=>F(e.floatValue),allowNegative:E==null?v:!1,decimalSeparator:y,thousandSeparator:b,decimalScale:C,fixedDecimalScale:w,prefix:R,suffix:S,onKeyDown:D?L:A,...j})})}export{d as default};
1
+ import{useComponentDefaults as e}from"../configProvider/useComponentDefaults.mjs";import t from"../interactableDiv/index.mjs";import n from"../input/input.mjs";import r from"./numberInput.module.mjs";import"react";import i from"classnames";import{FontAwesomeIcon as a}from"@fortawesome/react-fontawesome";import{faChevronDown as o,faChevronUp as s}from"@fortawesome/free-solid-svg-icons";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{NumericFormat as u}from"react-number-format";function d(d){let{value:f,onChange:p,formValidator:m,label:h,error:g,className:_,style:v,allowNegative:y=!1,decimalSeparator:b,thousandSeparator:x,prefix:S,suffix:C,decimalScale:w,fixedDecimalScale:T=!0,placeholder:E,sign:D,showArrows:O=!1,step:k=1,readOnly:A=!1,onKeyDown:j,...M}=e(`NumberInput`,d),N=m==null?f:m.value,P=D!=null&&N!=null?Math.abs(Number(N)):N,F=P==null?``:String(P);function I(e){let t=e;t!==void 0&&(D===`-`&&(t=-Math.abs(t)),D===`+`&&(t=Math.abs(t))),m?.set(t??null),p?.(t)}function L(e){if(A)return;let t=(N!=null&&N!==``?Number(N):0)+e;!y&&D!==`-`&&(t=Math.max(0,t)),D===`-`&&(t=Math.min(0,t)),I(t)}function R(e){if(A){j?.(e);return}if(e.key===`ArrowUp`){e.preventDefault(),L(e.shiftKey?k*10:k);return}if(e.key===`ArrowDown`){e.preventDefault(),L(e.shiftKey?-k*10:-k);return}j?.(e)}let z=D===`-`?`-`:D===`+`?`+`:S,B=O&&!A?l(`div`,{className:r.arrows,children:[c(t,{className:r.arrowBtn,tabIndex:-1,onMouseDown:e=>{e.preventDefault(),L(e.shiftKey?k*10:k)},children:c(a,{icon:s})}),c(t,{className:r.arrowBtn,tabIndex:-1,onMouseDown:e=>{e.preventDefault(),L(e.shiftKey?-k*10:-k)},children:c(a,{icon:o})})]}):null;return c(n,{label:h,className:i(r.numberInput,_),style:v,value:F,onChange:()=>{},formValidator:null,isValid:m?m.touched?!m.hasError():!0:!g,errorMessage:m?m.getCurrentErrorMessage()??``:g??``,placeholder:E,readOnly:A,suffix:B,inputMode:w===0?`numeric`:`decimal`,customInput:c(u,{onValueChange:e=>I(e.floatValue),allowNegative:D==null?y:!1,decimalSeparator:b,thousandSeparator:x,decimalScale:w,fixedDecimalScale:T,prefix:z,suffix:C,onKeyDown:O?R:j,...M})})}export{d as default};
2
2
  //# sourceMappingURL=numberInput.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"numberInput.mjs","names":[],"sources":["../../../../package/common/numberInput/numberInput.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport cx from 'classnames';\nimport { NumericFormat, NumericFormatProps } from 'react-number-format';\nimport type { FormValidator } from 'services/formValidation';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faChevronUp, faChevronDown } from '@fortawesome/free-solid-svg-icons';\n\nimport styles from './numberInput.module.pcss';\nimport Input from '../input';\nimport InteractableDiv from '../interactableDiv';\nimport { useComponentDefaults } from '../configProvider';\n\nexport interface NumberInputProps\n extends Omit<NumericFormatProps, 'onValueChange' | 'value' | 'customInput' | 'onChange' | 'step' | 'onKeyDown'> {\n value?: number | string;\n onChange?: (value: number | undefined) => void;\n formValidator?: FormValidator | null;\n label?: string;\n error?: string;\n className?: string;\n allowNegative?: boolean;\n decimalSeparator?: string;\n thousandSeparator?: string | boolean;\n prefix?: string;\n suffix?: string;\n decimalScale?: number;\n /**\n * Whether to pad the value to exactly `decimalScale` decimals. Default `true`\n * (e.g. with `decimalScale={2}`, `12` displays as `12.00`). Set `false` to make\n * `decimalScale` an upper limit only — the user may type fewer decimals and they\n * are kept as-is (`12` stays `12`, `12.1` stays `12.1`), while anything beyond\n * `decimalScale` is still truncated.\n */\n fixedDecimalScale?: boolean;\n placeholder?: string;\n sign?: '+' | '-';\n showArrows?: boolean;\n step?: number;\n readOnly?: boolean;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n}\n\nfunction NumberInput(props: NumberInputProps): ReactElement {\n const {\n value,\n onChange,\n formValidator,\n label,\n error,\n className,\n allowNegative = false,\n decimalSeparator,\n thousandSeparator,\n prefix,\n suffix,\n decimalScale,\n fixedDecimalScale = true,\n placeholder,\n sign,\n showArrows = false,\n step = 1,\n readOnly = false,\n onKeyDown: onKeyDownProp,\n ...rest\n } = useComponentDefaults('NumberInput', props);\n const rawValue = formValidator != null ? formValidator.value as number | string : value;\n // When a sign is forced, display the absolute value — the prefix character carries the sign visually.\n const displayValue = sign != null && rawValue != null ? Math.abs(Number(rawValue)) : rawValue;\n const controlledValue = displayValue != null ? String(displayValue) : '';\n\n function handleValueChange(floatValue: number | undefined) {\n let out = floatValue;\n if (out !== undefined) {\n if (sign === '-') out = -Math.abs(out);\n if (sign === '+') out = Math.abs(out);\n }\n if (formValidator != null) formValidator.set(out ?? null);\n onChange?.(out);\n }\n\n function handleStep(delta: number) {\n if (readOnly) return;\n const current = rawValue != null && rawValue !== '' ? Number(rawValue) : 0;\n let next = current + delta;\n if (!allowNegative && sign !== '-') next = Math.max(0, next);\n if (sign === '-') next = Math.min(0, next);\n handleValueChange(next);\n }\n\n function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n if (readOnly) { onKeyDownProp?.(e); return; }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n handleStep(e.shiftKey ? step * 10 : step);\n return;\n }\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n handleStep(e.shiftKey ? -step * 10 : -step);\n return;\n }\n onKeyDownProp?.(e);\n }\n\n const resolvedPrefix = sign === '-' ? '-' : sign === '+' ? '+' : prefix;\n\n const arrowSuffix = showArrows && !readOnly ? (\n <div className={styles.arrows}>\n <InteractableDiv\n className={styles.arrowBtn}\n tabIndex={-1}\n onMouseDown={(e) => { e.preventDefault(); handleStep(e.shiftKey ? step * 10 : step); }}\n >\n <FontAwesomeIcon icon={faChevronUp} />\n </InteractableDiv>\n <InteractableDiv\n className={styles.arrowBtn}\n tabIndex={-1}\n onMouseDown={(e) => { e.preventDefault(); handleStep(e.shiftKey ? -step * 10 : -step); }}\n >\n <FontAwesomeIcon icon={faChevronDown} />\n </InteractableDiv>\n </div>\n ) : null;\n\n return (\n <Input\n label={label}\n className={cx(styles.numberInput, className)}\n value={controlledValue}\n onChange={() => {}}\n formValidator={null}\n isValid={formValidator ? (formValidator.touched ? !formValidator.hasError() : true) : !error}\n errorMessage={formValidator ? (formValidator.getCurrentErrorMessage() ?? '') : (error ?? '')}\n placeholder={placeholder}\n readOnly={readOnly}\n suffix={arrowSuffix}\n inputMode={decimalScale === 0 ? 'numeric' : 'decimal'}\n customInput={\n <NumericFormat\n onValueChange={(vals) => handleValueChange(vals.floatValue)}\n allowNegative={sign != null ? false : allowNegative}\n decimalSeparator={decimalSeparator}\n thousandSeparator={thousandSeparator}\n decimalScale={decimalScale}\n fixedDecimalScale={fixedDecimalScale}\n prefix={resolvedPrefix}\n suffix={suffix}\n onKeyDown={showArrows ? handleKeyDown : onKeyDownProp}\n {...rest}\n />\n }\n />\n );\n}\n\nexport default NumberInput;\n"],"mappings":"0eA2CA,SAAS,EAAY,EAAuC,CAC1D,GAAM,CACN,QACA,WACA,gBACA,QACA,QACA,YACA,gBAAgB,GAChB,mBACA,oBACA,SACA,SACA,eACA,oBAAoB,GACpB,cACA,OACA,aAAa,GACb,OAAO,EACP,WAAW,GACX,UAAW,EACX,GAAG,GACC,EAAqB,cAAe,CAAK,EACvC,EAAW,GAAiB,KAAgD,EAAzC,EAAc,MAEjD,EAAe,GAAQ,MAAQ,GAAY,KAAO,KAAK,IAAI,OAAO,CAAQ,CAAC,EAAI,EAC/E,EAAkB,GAAgB,KAA8B,GAAvB,OAAO,CAAY,EAElE,SAAS,EAAkB,EAAgC,CACzD,IAAI,EAAM,EACN,IAAQ,IAAA,KACN,IAAS,MAAK,EAAM,CAAC,KAAK,IAAI,CAAG,GACjC,IAAS,MAAK,EAAO,KAAK,IAAI,CAAG,IAEnC,GAAqC,IAAI,GAAO,IAAI,EACxD,IAAW,CAAG,CAChB,CAEA,SAAS,EAAW,EAAe,CACjC,GAAI,EAAU,OAEd,IAAI,GADY,GAAY,MAAQ,IAAa,GAAK,OAAO,CAAQ,EAAI,GACpD,EACjB,CAAC,GAAiB,IAAS,MAAK,EAAO,KAAK,IAAI,EAAG,CAAI,GACvD,IAAS,MAAK,EAAO,KAAK,IAAI,EAAG,CAAI,GACzC,EAAkB,CAAI,CACxB,CAEA,SAAS,EAAc,EAA0C,CAC/D,GAAI,EAAU,CAAE,IAAgB,CAAC,EAAG,MAAQ,CAC5C,GAAI,EAAE,MAAQ,UAAW,CACvB,EAAE,eAAe,EACjB,EAAW,EAAE,SAA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.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport cx from 'classnames';\nimport { NumericFormat, NumericFormatProps } from 'react-number-format';\nimport type { FormValidator } from 'services/formValidation';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faChevronUp, faChevronDown } from '@fortawesome/free-solid-svg-icons';\n\nimport styles from './numberInput.module.pcss';\nimport Input from '../input';\nimport InteractableDiv from '../interactableDiv';\nimport { useComponentDefaults } from '../configProvider';\n\nexport interface NumberInputProps\n extends Omit<NumericFormatProps, 'onValueChange' | 'value' | 'customInput' | 'onChange' | 'step' | 'onKeyDown'> {\n value?: number | string;\n onChange?: (value: number | undefined) => void;\n formValidator?: FormValidator | null;\n label?: string;\n error?: string;\n className?: string;\n allowNegative?: boolean;\n decimalSeparator?: string;\n thousandSeparator?: string | boolean;\n prefix?: string;\n suffix?: string;\n decimalScale?: number;\n /**\n * Whether to pad the value to exactly `decimalScale` decimals. Default `true`\n * (e.g. with `decimalScale={2}`, `12` displays as `12.00`). Set `false` to make\n * `decimalScale` an upper limit only — the user may type fewer decimals and they\n * are kept as-is (`12` stays `12`, `12.1` stays `12.1`), while anything beyond\n * `decimalScale` is still truncated.\n */\n fixedDecimalScale?: boolean;\n placeholder?: string;\n sign?: '+' | '-';\n showArrows?: boolean;\n step?: number;\n readOnly?: boolean;\n onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;\n}\n\nfunction NumberInput(props: NumberInputProps): ReactElement {\n const {\n value,\n onChange,\n formValidator,\n label,\n error,\n className,\n style,\n allowNegative = false,\n decimalSeparator,\n thousandSeparator,\n prefix,\n suffix,\n decimalScale,\n fixedDecimalScale = true,\n placeholder,\n sign,\n showArrows = false,\n step = 1,\n readOnly = false,\n onKeyDown: onKeyDownProp,\n ...rest\n } = useComponentDefaults('NumberInput', props);\n const rawValue = formValidator != null ? formValidator.value as number | string : value;\n // When a sign is forced, display the absolute value — the prefix character carries the sign visually.\n const displayValue = sign != null && rawValue != null ? Math.abs(Number(rawValue)) : rawValue;\n const controlledValue = displayValue != null ? String(displayValue) : '';\n\n function handleValueChange(floatValue: number | undefined) {\n let out = floatValue;\n if (out !== undefined) {\n if (sign === '-') out = -Math.abs(out);\n if (sign === '+') out = Math.abs(out);\n }\n if (formValidator != null) formValidator.set(out ?? null);\n onChange?.(out);\n }\n\n function handleStep(delta: number) {\n if (readOnly) return;\n const current = rawValue != null && rawValue !== '' ? Number(rawValue) : 0;\n let next = current + delta;\n if (!allowNegative && sign !== '-') next = Math.max(0, next);\n if (sign === '-') next = Math.min(0, next);\n handleValueChange(next);\n }\n\n function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n if (readOnly) { onKeyDownProp?.(e); return; }\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n handleStep(e.shiftKey ? step * 10 : step);\n return;\n }\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n handleStep(e.shiftKey ? -step * 10 : -step);\n return;\n }\n onKeyDownProp?.(e);\n }\n\n const resolvedPrefix = sign === '-' ? '-' : sign === '+' ? '+' : prefix;\n\n const arrowSuffix = showArrows && !readOnly ? (\n <div className={styles.arrows}>\n <InteractableDiv\n className={styles.arrowBtn}\n tabIndex={-1}\n onMouseDown={(e) => { e.preventDefault(); handleStep(e.shiftKey ? step * 10 : step); }}\n >\n <FontAwesomeIcon icon={faChevronUp} />\n </InteractableDiv>\n <InteractableDiv\n className={styles.arrowBtn}\n tabIndex={-1}\n onMouseDown={(e) => { e.preventDefault(); handleStep(e.shiftKey ? -step * 10 : -step); }}\n >\n <FontAwesomeIcon icon={faChevronDown} />\n </InteractableDiv>\n </div>\n ) : null;\n\n return (\n <Input\n label={label}\n className={cx(styles.numberInput, className)}\n style={style}\n value={controlledValue}\n onChange={() => {}}\n formValidator={null}\n isValid={formValidator ? (formValidator.touched ? !formValidator.hasError() : true) : !error}\n errorMessage={formValidator ? (formValidator.getCurrentErrorMessage() ?? '') : (error ?? '')}\n placeholder={placeholder}\n readOnly={readOnly}\n suffix={arrowSuffix}\n inputMode={decimalScale === 0 ? 'numeric' : 'decimal'}\n customInput={\n <NumericFormat\n onValueChange={(vals) => handleValueChange(vals.floatValue)}\n allowNegative={sign != null ? false : allowNegative}\n decimalSeparator={decimalSeparator}\n thousandSeparator={thousandSeparator}\n decimalScale={decimalScale}\n fixedDecimalScale={fixedDecimalScale}\n prefix={resolvedPrefix}\n suffix={suffix}\n onKeyDown={showArrows ? handleKeyDown : onKeyDownProp}\n {...rest}\n />\n }\n />\n );\n}\n\nexport default NumberInput;\n"],"mappings":"0eA2CA,SAAS,EAAY,EAAuC,CAC1D,GAAM,CACN,QACA,WACA,gBACA,QACA,QACA,YACA,QACA,gBAAgB,GAChB,mBACA,oBACA,SACA,SACA,eACA,oBAAoB,GACpB,cACA,OACA,aAAa,GACb,OAAO,EACP,WAAW,GACX,UAAW,EACX,GAAG,GACC,EAAqB,cAAe,CAAK,EACvC,EAAW,GAAiB,KAAgD,EAAzC,EAAc,MAEjD,EAAe,GAAQ,MAAQ,GAAY,KAAO,KAAK,IAAI,OAAO,CAAQ,CAAC,EAAI,EAC/E,EAAkB,GAAgB,KAA8B,GAAvB,OAAO,CAAY,EAElE,SAAS,EAAkB,EAAgC,CACzD,IAAI,EAAM,EACN,IAAQ,IAAA,KACN,IAAS,MAAK,EAAM,CAAC,KAAK,IAAI,CAAG,GACjC,IAAS,MAAK,EAAO,KAAK,IAAI,CAAG,IAEnC,GAAqC,IAAI,GAAO,IAAI,EACxD,IAAW,CAAG,CAChB,CAEA,SAAS,EAAW,EAAe,CACjC,GAAI,EAAU,OAEd,IAAI,GADY,GAAY,MAAQ,IAAa,GAAK,OAAO,CAAQ,EAAI,GACpD,EACjB,CAAC,GAAiB,IAAS,MAAK,EAAO,KAAK,IAAI,EAAG,CAAI,GACvD,IAAS,MAAK,EAAO,KAAK,IAAI,EAAG,CAAI,GACzC,EAAkB,CAAI,CACxB,CAEA,SAAS,EAAc,EAA0C,CAC/D,GAAI,EAAU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AAgB,EACxC,GAAI,CACL,CAAA,CAEJ,CAAA,CAEL"}
@@ -0,0 +1,2 @@
1
+ import e from"../interactableDiv/index.mjs";import t from"./timeline.module.mjs";import{TimelineAlignment as n,TimelineItemStatus as r}from"./timeline.types.mjs";import"react";import i from"classnames";import{FontAwesomeIcon as a}from"@fortawesome/react-fontawesome";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l={[r.Primary]:t.timelineDotPrimary,[r.Success]:t.timelineDotSuccess,[r.Warn]:t.timelineDotWarn,[r.Error]:t.timelineDotError};function u({items:u=[],alignment:d=n.Left,className:f,style:p,classNames:m,styles:h,...g}){return s(`div`,{...g,className:i(t.timeline,{[t.timelineRight]:d===n.Right,[t.timelineAlternate]:d===n.Alternate},m?.root,f),style:{...h?.root,...p},children:u.map((f,p)=>{let g=f.id??p,_=p===u.length-1,v=d===n.Alternate&&p%2==1,y=!!f.onClick&&!f.disabled,b=c(o,{children:[c(`div`,{className:i(t.timelineMarker,m?.marker),style:h?.marker,children:[s(`div`,{className:i(t.timelineDot,l[f.status??r.Default],m?.dot),style:h?.dot,children:f.icon&&s(a,{icon:f.icon})}),!_&&s(`div`,{className:i(t.timelineConnector,m?.connector),style:h?.connector})]}),c(`div`,{className:i(t.timelineContent,m?.content),style:h?.content,children:[c(`div`,{className:t.timelineHeader,children:[s(`div`,{className:i(t.timelineTitle,m?.title),style:h?.title,children:f.title}),f.timestamp!=null&&s(`div`,{className:i(t.timelineTimestamp,m?.timestamp),style:h?.timestamp,children:f.timestamp})]}),f.description!=null&&s(`div`,{className:i(t.timelineDescription,m?.description),style:h?.description,children:f.description}),f.content]})]}),x=i(t.timelineItem,{[t.timelineItemRight]:v},{[t.timelineItemClickable]:y},{[t.timelineItemDisabled]:f.disabled},m?.item);return y?s(e,{className:x,style:h?.item,onClick:f.onClick,children:b},g):s(`div`,{className:x,style:h?.item,"aria-disabled":f.disabled||void 0,children:b},g)})})}export{u as default};
2
+ //# sourceMappingURL=timeline.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.mjs","names":[],"sources":["../../../../package/common/timeline/timeline.tsx"],"sourcesContent":["import React from 'react';\nimport cx from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport InteractableDiv from '../interactableDiv';\nimport styles from './timeline.module.pcss';\nimport { TimelineAlignment, TimelineItemStatus, type TimelineProps, type TimelineItem } from './timeline.types';\n\n// TimelineItemStatus.Default is intentionally absent: it uses .timeline-dot's own\n// background-color, so no modifier class is needed for it.\nconst STATUS_CLASS: Partial<Record<TimelineItemStatus, string>> = {\n [TimelineItemStatus.Primary]: styles.timelineDotPrimary,\n [TimelineItemStatus.Success]: styles.timelineDotSuccess,\n [TimelineItemStatus.Warn]: styles.timelineDotWarn,\n [TimelineItemStatus.Error]: styles.timelineDotError,\n};\n\nexport default function Timeline({\n items = [],\n alignment = TimelineAlignment.Left,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n}: TimelineProps) {\n return (\n <div\n {...rest}\n className={cx(\n styles.timeline,\n {\n [styles.timelineRight]: alignment === TimelineAlignment.Right,\n [styles.timelineAlternate]: alignment === TimelineAlignment.Alternate,\n },\n classNames?.root,\n className,\n )}\n style={{ ...slotStyles?.root, ...style }}\n >\n {items.map((item: TimelineItem, index: number) => {\n const key = item.id ?? index;\n const isLast = index === items.length - 1;\n const isAlternateRight = alignment === TimelineAlignment.Alternate && index % 2 === 1;\n const isClickable = !!item.onClick && !item.disabled;\n\n const itemContent = (\n <>\n <div className={cx(styles.timelineMarker, classNames?.marker)} style={slotStyles?.marker}>\n <div\n className={cx(styles.timelineDot, STATUS_CLASS[item.status ?? TimelineItemStatus.Default], classNames?.dot)}\n style={slotStyles?.dot}\n >\n {item.icon && <FontAwesomeIcon icon={item.icon} />}\n </div>\n {!isLast && (\n <div className={cx(styles.timelineConnector, classNames?.connector)} style={slotStyles?.connector} />\n )}\n </div>\n <div className={cx(styles.timelineContent, classNames?.content)} style={slotStyles?.content}>\n <div className={styles.timelineHeader}>\n <div className={cx(styles.timelineTitle, classNames?.title)} style={slotStyles?.title}>\n {item.title}\n </div>\n {item.timestamp != null && (\n <div className={cx(styles.timelineTimestamp, classNames?.timestamp)} style={slotStyles?.timestamp}>\n {item.timestamp}\n </div>\n )}\n </div>\n {item.description != null && (\n <div className={cx(styles.timelineDescription, classNames?.description)} style={slotStyles?.description}>\n {item.description}\n </div>\n )}\n {item.content}\n </div>\n </>\n );\n\n const itemClassName = cx(\n styles.timelineItem,\n { [styles.timelineItemRight]: isAlternateRight },\n { [styles.timelineItemClickable]: isClickable },\n { [styles.timelineItemDisabled]: item.disabled },\n classNames?.item,\n );\n\n if (isClickable) {\n return (\n <InteractableDiv\n key={key}\n className={itemClassName}\n style={slotStyles?.item}\n onClick={item.onClick}\n >\n {itemContent}\n </InteractableDiv>\n );\n }\n\n return (\n <div key={key} className={itemClassName} style={slotStyles?.item} aria-disabled={item.disabled || undefined}>\n {itemContent}\n </div>\n );\n })}\n </div>\n );\n}\n"],"mappings":"2UASA,IAAM,EAA4D,EAC/D,EAAmB,SAAU,EAAO,oBACpC,EAAmB,SAAU,EAAO,oBACpC,EAAmB,MAAO,EAAO,iBACjC,EAAmB,OAAQ,EAAO,gBACrC,EAEA,SAAwB,EAAS,CAC/B,QAAQ,CAAC,EACT,YAAY,EAAkB,KAC9B,YACA,QACA,aACA,OAAQ,EACR,GAAG,GACa,CAChB,OACE,EAAC,MAAD,CACE,GAAI,EACJ,UAAW,EACT,EAAO,SACP,EACG,EAAO,eAAgB,IAAc,EAAkB,OACvD,EAAO,mBAAoB,IAAc,EAAkB,SAC9D,EACA,GAAY,KACZ,CACF,EACA,MAAO,CAAE,GAAG,GAAY,KAAM,GAAG,CAAM,WAEtC,EAAM,KAAK,EAAoB,IAAkB,CAChD,IAAM,EAAM,EAAK,IAAM,EACjB,EAAS,IAAU,EAAM,OAAS,EAClC,EAAmB,IAAc,EAAkB,WAAa,EAAQ,GAAM,EAC9E,EAAc,CA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MAAD,CAAe,UAAW,EAAe,MAAO,GAAY,KAAM,gBAAe,EAAK,UAAY,IAAA,YAC/F,CACE,EAFK,CAEL,CAET,CAAC,CACE,CAAA,CAET"}
@@ -0,0 +1,2 @@
1
+ var e={timeline:`timeline_VtQdt`,"timeline-item":`timeline-item_s8-U2`,timelineItem:`timeline-item_s8-U2`,"timeline-item-connector":`timeline-item-connector_06FQ0`,timelineItemConnector:`timeline-item-connector_06FQ0`,"timeline-item-clickable":`timeline-item-clickable_0w8zK`,timelineItemClickable:`timeline-item-clickable_0w8zK`,"timeline-item-disabled":`timeline-item-disabled_EkWVA`,timelineItemDisabled:`timeline-item-disabled_EkWVA`,"timeline-marker":`timeline-marker_u6jDA`,timelineMarker:`timeline-marker_u6jDA`,"timeline-dot":`timeline-dot_l-s7C`,timelineDot:`timeline-dot_l-s7C`,"timeline-dot-primary":`timeline-dot-primary_5Uk-e`,timelineDotPrimary:`timeline-dot-primary_5Uk-e`,"timeline-dot-success":`timeline-dot-success_iEoLv`,timelineDotSuccess:`timeline-dot-success_iEoLv`,"timeline-dot-warn":`timeline-dot-warn_-6G8K`,timelineDotWarn:`timeline-dot-warn_-6G8K`,"timeline-dot-error":`timeline-dot-error_-10M7`,timelineDotError:`timeline-dot-error_-10M7`,"timeline-connector":`timeline-connector_VuXnH`,timelineConnector:`timeline-connector_VuXnH`,"timeline-content":`timeline-content_K4Ztg`,timelineContent:`timeline-content_K4Ztg`,"timeline-header":`timeline-header_xr4Tw`,timelineHeader:`timeline-header_xr4Tw`,"timeline-title":`timeline-title_MZ26k`,timelineTitle:`timeline-title_MZ26k`,"timeline-timestamp":`timeline-timestamp_-0w-N`,timelineTimestamp:`timeline-timestamp_-0w-N`,"timeline-description":`timeline-description_WcWIu`,timelineDescription:`timeline-description_WcWIu`,"timeline-right":`timeline-right_fZEKn`,timelineRight:`timeline-right_fZEKn`,"timeline-alternate":`timeline-alternate_Kv9LY`,timelineAlternate:`timeline-alternate_Kv9LY`,"timeline-item-right":`timeline-item-right_s5ELB`,timelineItemRight:`timeline-item-right_s5ELB`};export{e as default};
2
+ //# sourceMappingURL=timeline.module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.module.mjs","names":[],"sources":["../../../../package/common/timeline/timeline.module.pcss"],"sourcesContent":[".timeline {\n /* Theme tokens resolved once, each with a built-in fallback. Set any of the\n public `--timeline-*` variables via ThemeProvider (theme-wide) or `style`\n (per instance) to override; unset ones fall back to the values below. */\n --custom-timeline-dot-size: var(--timeline-dot-size, 14px);\n --custom-timeline-dot-color: var(--timeline-dot-color, var(--primary-color));\n --custom-timeline-dot-border: var(--timeline-dot-border, var(--background));\n --custom-timeline-line-color: var(--timeline-line-color, var(--border-color));\n --custom-timeline-line-thickness: var(--timeline-line-thickness, 2px);\n --custom-timeline-gap: var(--timeline-gap, 16px);\n --custom-timeline-item-gap: var(--timeline-item-gap, 20px);\n --custom-timeline-icon-dot-size: var(--timeline-icon-dot-size, 28px);\n\n display: flex;\n flex-direction: column;\n color: var(--text-color);\n\n &-item {\n display: flex;\n gap: var(--custom-timeline-gap);\n border-radius: var(--default-border-radius);\n\n &:last-child &-connector {\n display: none;\n }\n }\n\n &-item-clickable {\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n transition: background-color 0.15s ease;\n margin: 0px -10px;\n padding: 0px 10px;\n\n &:hover {\n background-color: var(--background-accent-light);\n }\n &:focus-visible {\n outline: 2px solid var(--primary-color);\n outline-offset: -2px;\n }\n }\n\n &-item-disabled {\n opacity: 0.5;\n }\n\n &-marker {\n display: flex;\n flex-direction: column;\n align-items: center;\n flex-shrink: 0;\n }\n\n &-dot {\n width: var(--custom-timeline-dot-size);\n height: var(--custom-timeline-dot-size);\n border-radius: 50%;\n background-color: var(--custom-timeline-dot-color);\n box-shadow: 0 0 0 3px var(--custom-timeline-dot-border);\n flex-shrink: 0;\n\n &:has(svg) {\n width: var(--custom-timeline-icon-dot-size);\n height: var(--custom-timeline-icon-dot-size);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--text-on-primary);\n font-size: calc(var(--custom-timeline-icon-dot-size) * 0.5);\n }\n }\n\n &-dot-primary {\n background-color: var(--primary-color);\n }\n &-dot-success {\n background-color: var(--success-color);\n }\n &-dot-warn {\n background-color: var(--warn-color);\n }\n &-dot-error {\n background-color: var(--error-color);\n }\n\n &-connector {\n flex: 1 1 auto;\n width: var(--custom-timeline-line-thickness);\n min-height: 12px;\n background-color: var(--custom-timeline-line-color);\n margin: 4px 0;\n }\n\n &-content {\n flex: 1 1 auto;\n min-width: 0;\n padding-bottom: var(--custom-timeline-item-gap);\n }\n\n &-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 8px;\n }\n\n &-title {\n font-weight: 600;\n color: var(--text-color);\n }\n\n &-timestamp {\n flex-shrink: 0;\n color: var(--text-dark);\n font-size: var(--text-small-font-size, 0.85em);\n white-space: nowrap;\n }\n\n &-description {\n color: var(--text-dark);\n margin-top: 2px;\n }\n\n /* Right: markers + line on the right, content on the left */\n &-right &-item {\n flex-direction: row-reverse;\n text-align: right;\n }\n &-right &-header {\n flex-direction: row-reverse;\n }\n\n /* Alternate: two-column layout, entries alternating left/right of a centered line */\n &-alternate &-item {\n display: grid;\n grid-template-columns: 1fr auto 1fr;\n align-items: start;\n gap: var(--custom-timeline-gap);\n }\n &-alternate &-marker {\n grid-column: 2;\n grid-row: 1;\n }\n &-alternate &-content {\n grid-column: 1;\n grid-row: 1;\n text-align: right;\n }\n &-alternate &-header {\n flex-direction: row-reverse;\n }\n &-alternate &-item-right &-content {\n grid-column: 3;\n text-align: left;\n }\n &-alternate &-item-right &-header {\n flex-direction: row;\n }\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ var e=function(e){return e.Left=`left`,e.Right=`right`,e.Alternate=`alternate`,e}({}),t=function(e){return e.Default=`default`,e.Primary=`primary`,e.Success=`success`,e.Warn=`warn`,e.Error=`error`,e}({});export{e as TimelineAlignment,t as TimelineItemStatus};
2
+ //# sourceMappingURL=timeline.types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.types.mjs","names":[],"sources":["../../../../package/common/timeline/timeline.types.ts"],"sourcesContent":["import type React from 'react';\nimport type { IconDefinition } from '@fortawesome/fontawesome-svg-core';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\n/** Layout of entries relative to the connecting line. */\nexport enum TimelineAlignment {\n /** Line and markers on the left, content to the right (the default). */\n Left = 'left',\n /** Line and markers on the right, content to the left. */\n Right = 'right',\n /** Line down the center, entries alternating left/right. */\n Alternate = 'alternate',\n}\n\n/** Semantic colour for an entry's marker, matching the theme's status colours. */\nexport enum TimelineItemStatus {\n Default = 'default',\n Primary = 'primary',\n Success = 'success',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport type TimelineSlots =\n | 'root'\n | 'item'\n | 'marker'\n | 'dot'\n | 'connector'\n | 'content'\n | 'title'\n | 'description'\n | 'timestamp';\n\nexport interface TimelineItem {\n /** Stable identity for the entry, used as its React key. Falls back to its array index when omitted; pass one whenever `items` can be reordered or have entries prepended (e.g. a live \"newest first\" audit log), so React doesn't misattribute row state across the shift. */\n id?: string | number;\n /** Primary label for the entry. */\n title: React.ReactNode;\n /** Secondary line under the title. */\n description?: React.ReactNode;\n /** Rendered next to the title, e.g. a date or relative time (\"2 hours ago\"). */\n timestamp?: React.ReactNode;\n /** FontAwesome icon shown in the marker instead of a plain dot. */\n icon?: IconDefinition;\n /** Semantic marker colour (default `Default`). */\n status?: TimelineItemStatus;\n /** Extra content rendered under the description, e.g. a diff, an attachment, an actor avatar. */\n content?: React.ReactNode;\n /** Makes the whole entry clickable (e.g. to open the full record), rendering it as an accessible button. */\n onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;\n /** Disables the entry: never clickable, dimmed. Only relevant alongside `onClick`. */\n disabled?: boolean;\n}\n\nexport interface TimelineProps extends HtmlProps {\n /** The entries to render, in display order (typically newest first for an audit log). */\n items?: TimelineItem[];\n /** Layout of entries relative to the connecting line (default `Left`). */\n alignment?: TimelineAlignment;\n className?: string;\n style?: React.CSSProperties;\n classNames?: SlotClassNames<TimelineSlots>;\n styles?: SlotStyles<TimelineSlots>;\n}\n"],"mappings":"AAKA,IAAY,EAAL,SAAA,EAAA,OAEL,GAAA,KAAA,OAEA,EAAA,MAAA,QAEA,EAAA,UAAA,aACF,EAAA,CAAA,CAAA,EAGY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}