@womp/kookie-ui 0.29.1 → 0.30.0

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 (139) hide show
  1. package/components.css +94 -2
  2. package/dist/cjs/components/_internal/navigator-host.d.ts +21 -0
  3. package/dist/cjs/components/_internal/navigator-host.d.ts.map +1 -0
  4. package/dist/cjs/components/_internal/navigator-host.js +3 -0
  5. package/dist/cjs/components/_internal/navigator-host.js.map +7 -0
  6. package/dist/cjs/components/combobox.js +1 -1
  7. package/dist/cjs/components/combobox.js.map +4 -4
  8. package/dist/cjs/components/dialog.d.ts.map +1 -1
  9. package/dist/cjs/components/dialog.js +1 -1
  10. package/dist/cjs/components/dialog.js.map +4 -4
  11. package/dist/cjs/components/index.d.ts +1 -0
  12. package/dist/cjs/components/index.d.ts.map +1 -1
  13. package/dist/cjs/components/index.js +2 -2
  14. package/dist/cjs/components/index.js.map +4 -4
  15. package/dist/cjs/components/navigator.d.ts +99 -0
  16. package/dist/cjs/components/navigator.d.ts.map +1 -0
  17. package/dist/cjs/components/navigator.js +3 -0
  18. package/dist/cjs/components/navigator.js.map +7 -0
  19. package/dist/cjs/components/popover.d.ts.map +1 -1
  20. package/dist/cjs/components/popover.js +1 -1
  21. package/dist/cjs/components/popover.js.map +4 -4
  22. package/dist/cjs/components/select.d.ts.map +1 -1
  23. package/dist/cjs/components/select.js +1 -1
  24. package/dist/cjs/components/select.js.map +3 -3
  25. package/dist/cjs/components/sheet.d.ts.map +1 -1
  26. package/dist/cjs/components/sheet.js +1 -1
  27. package/dist/cjs/components/sheet.js.map +4 -4
  28. package/dist/cjs/components/sidebar.js +1 -1
  29. package/dist/cjs/components/sidebar.js.map +4 -4
  30. package/dist/cjs/components/text-field.d.ts.map +1 -1
  31. package/dist/cjs/components/text-field.js +2 -2
  32. package/dist/cjs/components/text-field.js.map +3 -3
  33. package/dist/cjs/components/text-field.props.d.ts +4 -1
  34. package/dist/cjs/components/text-field.props.d.ts.map +1 -1
  35. package/dist/cjs/components/text-field.props.js.map +1 -1
  36. package/dist/cjs/index.js +5 -5
  37. package/dist/cjs/index.js.map +4 -4
  38. package/dist/cjs/props/index.js.map +1 -1
  39. package/dist/esm/chunk-4KBKS3ZE.js +3 -0
  40. package/dist/esm/chunk-4KBKS3ZE.js.map +7 -0
  41. package/dist/esm/chunk-5KX3RA3P.js +3 -0
  42. package/dist/esm/chunk-5KX3RA3P.js.map +7 -0
  43. package/dist/esm/chunk-676Y7ZUT.js +3 -0
  44. package/dist/esm/chunk-676Y7ZUT.js.map +7 -0
  45. package/dist/esm/chunk-6UFIS6B2.js +3 -0
  46. package/dist/esm/chunk-6UFIS6B2.js.map +7 -0
  47. package/dist/esm/chunk-CMHKCUHP.js +3 -0
  48. package/dist/esm/chunk-CMHKCUHP.js.map +7 -0
  49. package/dist/esm/{chunk-4LV37PHM.js → chunk-D74WY6UO.js} +2 -2
  50. package/dist/esm/chunk-E4KT72IB.js +2 -0
  51. package/dist/esm/chunk-EQE6QQXM.js +3 -0
  52. package/dist/esm/chunk-EQE6QQXM.js.map +7 -0
  53. package/dist/esm/{chunk-FIMFM25N.js → chunk-EXF5SF27.js} +1 -1
  54. package/dist/esm/{chunk-FIMFM25N.js.map → chunk-EXF5SF27.js.map} +1 -1
  55. package/dist/esm/{chunk-2E57H3NH.js → chunk-FRFVGYGX.js} +2 -2
  56. package/dist/esm/chunk-K5V53KTJ.js +6 -0
  57. package/dist/esm/chunk-K5V53KTJ.js.map +7 -0
  58. package/dist/esm/{chunk-2FYUM6TA.js → chunk-NEKIU24N.js} +2 -2
  59. package/dist/esm/{chunk-WAXRIARV.js → chunk-R4UKO4UK.js} +2 -2
  60. package/dist/esm/{chunk-AS2STDGA.js → chunk-VGJALIJ5.js} +2 -2
  61. package/dist/esm/{chunk-JTMLFTNZ.js → chunk-WAE4MLBN.js} +2 -2
  62. package/dist/esm/{chunk-MJROOEPE.js → chunk-YMRN5ESN.js} +2 -2
  63. package/dist/esm/{chunk-324VC67W.js → chunk-ZYQEFENG.js} +2 -2
  64. package/dist/esm/components/_internal/base-menu.utils.js +1 -1
  65. package/dist/esm/components/_internal/menu-context.js +1 -1
  66. package/dist/esm/components/_internal/navigator-host.d.ts +21 -0
  67. package/dist/esm/components/_internal/navigator-host.d.ts.map +1 -0
  68. package/dist/esm/components/_internal/navigator-host.js +3 -0
  69. package/dist/esm/components/_internal/navigator-host.js.map +7 -0
  70. package/dist/esm/components/_internal/pane-chrome.js +1 -1
  71. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  72. package/dist/esm/components/alert-dialog.js +1 -1
  73. package/dist/esm/components/combobox.js +1 -1
  74. package/dist/esm/components/context-menu.js +1 -1
  75. package/dist/esm/components/dialog.d.ts.map +1 -1
  76. package/dist/esm/components/dialog.js +1 -1
  77. package/dist/esm/components/dropdown-menu.js +1 -1
  78. package/dist/esm/components/index.d.ts +1 -0
  79. package/dist/esm/components/index.d.ts.map +1 -1
  80. package/dist/esm/components/index.js +1 -1
  81. package/dist/esm/components/navigator.d.ts +99 -0
  82. package/dist/esm/components/navigator.d.ts.map +1 -0
  83. package/dist/esm/components/navigator.js +3 -0
  84. package/dist/esm/components/navigator.js.map +7 -0
  85. package/dist/esm/components/popover.d.ts.map +1 -1
  86. package/dist/esm/components/popover.js +1 -1
  87. package/dist/esm/components/schemas/index.js +1 -1
  88. package/dist/esm/components/select.d.ts.map +1 -1
  89. package/dist/esm/components/select.js +1 -1
  90. package/dist/esm/components/separator.js +1 -1
  91. package/dist/esm/components/sheet.d.ts.map +1 -1
  92. package/dist/esm/components/sheet.js +1 -1
  93. package/dist/esm/components/shell.js +1 -1
  94. package/dist/esm/components/sidebar.js +1 -1
  95. package/dist/esm/components/text-field.d.ts.map +1 -1
  96. package/dist/esm/components/text-field.js +1 -1
  97. package/dist/esm/components/text-field.props.d.ts +4 -1
  98. package/dist/esm/components/text-field.props.d.ts.map +1 -1
  99. package/dist/esm/components/text-field.props.js +1 -1
  100. package/dist/esm/components/toolbar.js +1 -1
  101. package/dist/esm/components/virtual-menu.js +1 -1
  102. package/dist/esm/hooks/index.js +1 -1
  103. package/dist/esm/index.js +1 -1
  104. package/dist/esm/props/index.js +1 -1
  105. package/package.json +1 -1
  106. package/src/components/_internal/navigator-host.ts +17 -0
  107. package/src/components/dialog.tsx +8 -0
  108. package/src/components/index.css +1 -0
  109. package/src/components/index.tsx +14 -0
  110. package/src/components/navigator.css +85 -0
  111. package/src/components/navigator.tsx +385 -0
  112. package/src/components/popover.tsx +18 -1
  113. package/src/components/select.css +2 -2
  114. package/src/components/select.tsx +15 -1
  115. package/src/components/sheet.tsx +8 -0
  116. package/src/components/text-field.css +8 -1
  117. package/src/components/text-field.props.tsx +4 -1
  118. package/src/components/text-field.tsx +66 -86
  119. package/styles.css +94 -2
  120. package/dist/esm/chunk-5BX2YZV6.js +0 -3
  121. package/dist/esm/chunk-5BX2YZV6.js.map +0 -7
  122. package/dist/esm/chunk-GPZHRZBE.js +0 -6
  123. package/dist/esm/chunk-GPZHRZBE.js.map +0 -7
  124. package/dist/esm/chunk-HR2VHGJ5.js +0 -3
  125. package/dist/esm/chunk-HR2VHGJ5.js.map +0 -7
  126. package/dist/esm/chunk-MJKVVGGV.js +0 -3
  127. package/dist/esm/chunk-MJKVVGGV.js.map +0 -7
  128. package/dist/esm/chunk-NG54K6FL.js +0 -2
  129. package/dist/esm/chunk-VQDCHBZR.js +0 -3
  130. package/dist/esm/chunk-VQDCHBZR.js.map +0 -7
  131. /package/dist/esm/{chunk-4LV37PHM.js.map → chunk-D74WY6UO.js.map} +0 -0
  132. /package/dist/esm/{chunk-NG54K6FL.js.map → chunk-E4KT72IB.js.map} +0 -0
  133. /package/dist/esm/{chunk-2E57H3NH.js.map → chunk-FRFVGYGX.js.map} +0 -0
  134. /package/dist/esm/{chunk-2FYUM6TA.js.map → chunk-NEKIU24N.js.map} +0 -0
  135. /package/dist/esm/{chunk-WAXRIARV.js.map → chunk-R4UKO4UK.js.map} +0 -0
  136. /package/dist/esm/{chunk-AS2STDGA.js.map → chunk-VGJALIJ5.js.map} +0 -0
  137. /package/dist/esm/{chunk-JTMLFTNZ.js.map → chunk-WAE4MLBN.js.map} +0 -0
  138. /package/dist/esm/{chunk-MJROOEPE.js.map → chunk-YMRN5ESN.js.map} +0 -0
  139. /package/dist/esm/{chunk-324VC67W.js.map → chunk-ZYQEFENG.js.map} +0 -0
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{d as m,i as b,j as C}from"./chunk-WAE4MLBN.js";import{a as O}from"./chunk-JP36JSNP.js";import{a as S}from"./chunk-KVVRFWGQ.js";import{a as R}from"./chunk-4KBKS3ZE.js";import{d as B,i as w,k as H}from"./chunk-YMRN5ESN.js";import{j as L}from"./chunk-GHWEXMF6.js";import*as e from"react";import k from"classnames";var E=e.createContext(null),A=e.createContext(0),G=e.createContext(null);function J(){let t=e.useContext(L),a=e.useContext(B),i=e.useContext(R);return t!==null&&!a&&i===null}var M=e.Activity;function Q({visible:t,children:a}){return M?e.createElement(M,{mode:t?"visible":"hidden"},a):e.createElement("div",{hidden:!t,style:{display:t?"contents":"none"}},a)}function se({path:t,defaultPath:a,onPathChange:i,screen:s,root:c,children:u,className:v,style:p}){let l=J(),[F,$]=e.useState(a??[]),o=t??F,[g,D]=e.useState({path:o,direction:null}),f=g.direction;if(g.path.length!==o.length||g.path.some((n,r)=>!Object.is(n,o[r]))){let n=g.path;f=o.length<n.length?"pop":o.length>n.length||!Object.is(o[o.length-1],n[n.length-1])?"push":g.direction,D({path:o,direction:f})}let T=e.useRef([]),h=e.useRef([]),[I,q]=e.useState(0),N=e.useCallback(n=>{t===void 0&&$(n),i?.(n)},[t,i]),z=e.useMemo(()=>({path:o,canGoBack:o.length>0,push:n=>{h.current[o.length+1]=typeof document>"u"?null:document.activeElement,N([...o,n])},pop:()=>{o.length>0&&N(o.slice(0,-1))},popTo:n=>{n<o.length&&N(o.slice(0,Math.max(0,n)))},titles:T,openers:h,setTitle:(n,r)=>{T.current[n]!==r&&(T.current[n]=r,q(V=>V+1))},direction:f,inPane:l}),[o,N,I,f,l]),x=e.useRef(o.length);e.useEffect(()=>{let n=x.current;if(x.current=o.length,o.length<n){let r=h.current[n];h.current.length=o.length+1,r&&r.isConnected&&r.focus()}},[o.length]);let y=[c,...o.map(n=>s(n))],K=y.length-1,P=e.createElement("div",{className:k("kui-Navigator",v),style:p},y.map((n,r)=>e.createElement(Q,{key:r===0?"root":`${r}:${String(o[r-1])}`,visible:r===K},e.createElement(A.Provider,{value:r},e.createElement("div",{className:"kui-NavigatorLevel"},n)))));return e.createElement(E.Provider,{value:z},e.createElement(G.Provider,{value:P},u??(l?e.createElement(U,null):P)))}function U(){return e.createElement(e.Fragment,null,e.createElement(w,null,e.createElement(C,null,e.createElement(S,{align:"center"},e.createElement(Z,null),e.createElement(_,null)))),e.createElement(H,null,e.createElement(X,null)))}function X(){return e.createElement(e.Fragment,null,e.useContext(G))}function d(){let t=e.useContext(E);if(!t)throw new Error("Kookie: this part must be inside a <Navigator>.");return t}function ce(){return d()}function j(){return e.createElement("svg",{className:"kui-NavigatorBackGlyph",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},e.createElement("path",{d:"m15 18-6-6 6-6",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"}))}function Y(){return e.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},e.createElement("path",{d:"M18 6 6 18M6 6l12 12",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round"}))}function W(t,a){let i=a>0?t.titles.current[a-1]:void 0;return i?`Back to ${i}`:"Back"}function Z(t){let a=d();return a.canGoBack?e.createElement(m,{iconOnly:!0,"aria-label":t["aria-label"]??W(a,a.path.length),onClick:a.pop},e.createElement(j,null)):null}function _(){let t=d();return e.createElement(b,null,t.titles.current[t.path.length])}function le({title:t,children:a,className:i}){let s=d(),c=e.useContext(A),u=e.useContext(R),v=e.useRef(null);if(e.useEffect(()=>{s.setTitle(c,t)},[s,c,t]),e.useEffect(()=>{if(c===0||s.direction!=="push")return;let l=v.current?.querySelector(".kui-NavigatorBar .kui-ToolbarTitle")??v.current;l&&(l.tabIndex=-1,l.focus({preventScroll:!0}))},[]),s.inPane)return e.createElement("div",{ref:v,className:k("kui-NavigatorScreen",i)},a);let p=e.createElement(O,{as:"h2",size:"4",weight:"medium",truncate:!0},t);return e.createElement("div",{ref:v,className:k("kui-NavigatorScreen",i)},e.createElement("div",{className:"kui-NavigatorBar"},e.createElement(C,{"aria-label":"Navigation"},s.canGoBack&&c>0?e.createElement(m,{iconOnly:!0,"aria-label":W(s,c),onClick:s.pop},e.createElement(j,null)):null,e.createElement(b,{className:"kui-NavigatorBarTitle"},u?e.createElement(u.Title,null,p):p),u?e.createElement(u.Close,null,e.createElement(m,{iconOnly:!0,"aria-label":"Close"},e.createElement(Y,null))):null)),e.createElement("div",{className:"kui-NavigatorBody"},a))}function ue({value:t,className:a,children:i,...s}){let c=d();return e.createElement("button",{type:"button",...s,className:k("kui-reset","kui-NavigatorLink",a),onClick:()=>c.push(t)},e.createElement("span",{className:"kui-NavigatorLinkLabel"},i),e.createElement("svg",{className:"kui-NavigatorLinkGlyph",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},e.createElement("path",{d:"m9 18 6-6-6-6",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"})))}export{se as a,X as b,ce as c,Z as d,_ as e,le as f,ue as g};
3
+ //# sourceMappingURL=chunk-5KX3RA3P.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/navigator.tsx"],
4
+ "sourcesContent": ["'use client';\n\n/**\n * Navigator, from v2 (2026-11-03): a stack of screens, any depth. Any screen can open another on\n * top of it, and Back removes the top one. The first screen is the root and never goes.\n *\n * THE PATH IS DATA. The screens above the root are a list of values the app owns, and `screen`\n * turns a value into a screen, so an app can keep the path in its URL, restore it, or open three\n * levels deep from a link.\n *\n * IT HAS NO REGION OF ITS OWN. The host decides how a screen carries its title. In a Shell pane\n * (Sidebar, Panel, Inspector, Bottom), the pane's band holds Back and the title, and the screens\n * go in the pane's scroller. Anywhere else (a card, a Dialog, a Sheet, a Popover, `Shell.Content`)\n * each screen draws its own band: Back, the title, and the overlay's close when it has one.\n *\n * SCREENS UNDER THE TOP STAY MOUNTED, hidden, so a list keeps its scroll and a field its draft.\n *\n * Focus: a pushed screen takes focus at its top; on pop, focus returns to the control that opened\n * the screen. Escape never goes back; it belongs to whatever overlay holds this.\n *\n * Differs from v2 in look only: no motion, since v1 has none. v1 has no Page or Row yet, so a pane\n * screen's title lives in the band from the start, and `NavigatorLink` is its own row.\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\n\nimport { NavigatorHostContext } from './_internal/navigator-host.js';\nimport { PaneHeader, Scroll, ShellContentContext } from './_internal/pane-chrome.js';\nimport { ShellStoreContext } from './_internal/shell-store.js';\nimport { Flex } from './flex.js';\nimport { Heading } from './heading.js';\nimport { Toolbar, ToolbarButton, ToolbarTitle } from './toolbar.js';\n\ntype NavigatorApi<T> = {\n /** The values above the root, bottom first. Empty at the root. */\n path: readonly T[];\n /** Open a screen on top. */\n push: (value: T) => void;\n /** Close the top screen. Does nothing at the root. */\n pop: () => void;\n /** Close every screen above `depth`, where 0 is the root. */\n popTo: (depth: number) => void;\n /** Whether there is a screen to go back to. */\n canGoBack: boolean;\n};\n\ntype NavigatorState = NavigatorApi<unknown> & {\n /** Each level's title, so Back can name the screen it returns to and a pane's band can show it. */\n titles: React.MutableRefObject<(string | undefined)[]>;\n setTitle: (depth: number, title: string) => void;\n /** The control that opened each level, so focus can go back to it. */\n openers: React.MutableRefObject<(HTMLElement | null)[]>;\n direction: 'push' | 'pop' | null;\n inPane: boolean;\n};\n\nconst NavigatorContext = React.createContext<NavigatorState | null>(null);\nconst LevelContext = React.createContext<number>(0);\nconst OutletContext = React.createContext<React.ReactNode>(null);\n\n/**\n * True in a Shell pane, not in `Shell.Content` and not in an overlay opened from the pane: there\n * the pane's band carries the title. Overlays set the host context, which is how they opt out.\n */\nfunction useInPane() {\n const store = React.useContext(ShellStoreContext);\n const inContent = React.useContext(ShellContentContext);\n const host = React.useContext(NavigatorHostContext);\n return store !== null && !inContent && host === null;\n}\n\n// Activity keeps a hidden screen's state and cleans up its effects (React 19.2). On an older\n// React, the screen is kept in a hidden element instead, with its effects still running.\nconst Activity = (React as { Activity?: React.ComponentType<{ mode: 'visible' | 'hidden'; children: React.ReactNode }> }).Activity;\n\nfunction Level({ visible, children }: { visible: boolean; children: React.ReactNode }) {\n if (Activity) return <Activity mode={visible ? 'visible' : 'hidden'}>{children}</Activity>;\n return (\n <div hidden={!visible} style={{ display: visible ? 'contents' : 'none' }}>\n {children}\n </div>\n );\n}\n\ninterface NavigatorProps<T> {\n /** The screens above the root, as values. Use it with `onPathChange` to control the path. */\n path?: readonly T[];\n /** The path to start with when the navigator controls its own path. */\n defaultPath?: readonly T[];\n /** Called with the new path whenever a screen opens or closes. */\n onPathChange?: (path: T[]) => void;\n /** Turns a value from the path into its screen, usually a `NavigatorScreen`. */\n screen: (value: T) => React.ReactNode;\n /** The root screen, usually a `NavigatorScreen`. It is always at the bottom and never closes. */\n root: React.ReactNode;\n /**\n * The frame around the screens, when you need your own: a `Shell.PaneHeader` with actions, and\n * a `Shell.Scroll` holding `NavigatorOutlet`. Leave it out and the navigator draws the frame: in\n * a Shell pane, the pane's band with Back and the title, and its scroller; anywhere else, the\n * screens on their own.\n */\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/**\n * A stack of screens: any screen can open another on top, and Back returns to the one below.\n * `root` is the first screen, `screen` turns each value in the path into its screen, and\n * `children`, when given, is the frame the screens go into through `NavigatorOutlet`.\n */\nfunction Navigator<T>({ path: pathProp, defaultPath, onPathChange, screen, root, children, className, style }: NavigatorProps<T>) {\n const inPane = useInPane();\n const [own, setOwn] = React.useState<readonly T[]>(defaultPath ?? []);\n const path = pathProp ?? own;\n // The direction comes from the path itself, so a path the app sets moves focus the same way as\n // one changed by push and pop. Equal length with a new top value is a new screen arriving.\n const [seen, setSeen] = React.useState<{ path: readonly T[]; direction: 'push' | 'pop' | null }>({ path, direction: null });\n let direction = seen.direction;\n // Compared by content, not identity: a controlled `path` may be a new array every render.\n if (seen.path.length !== path.length || seen.path.some((value, i) => !Object.is(value, path[i]))) {\n const before = seen.path;\n direction = path.length < before.length ? 'pop' : path.length > before.length || !Object.is(path[path.length - 1], before[before.length - 1]) ? 'push' : seen.direction;\n setSeen({ path, direction });\n }\n const titles = React.useRef<(string | undefined)[]>([]);\n const openers = React.useRef<(HTMLElement | null)[]>([]);\n const [version, setVersion] = React.useState(0);\n\n const change = React.useCallback(\n (next: T[]) => {\n if (pathProp === undefined) setOwn(next);\n onPathChange?.(next);\n },\n [pathProp, onPathChange],\n );\n\n const api = React.useMemo<NavigatorState>(\n () => ({\n path,\n canGoBack: path.length > 0,\n push: (value) => {\n openers.current[path.length + 1] = typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null);\n change([...path, value as T]);\n },\n pop: () => {\n if (path.length > 0) change(path.slice(0, -1));\n },\n popTo: (depth) => {\n if (depth < path.length) change(path.slice(0, Math.max(0, depth)));\n },\n titles,\n openers,\n setTitle: (depth, title) => {\n if (titles.current[depth] === title) return;\n titles.current[depth] = title;\n setVersion((v) => v + 1);\n },\n direction,\n inPane,\n }),\n // `version` is read through `titles`; it is here so a new title reaches the band and Back.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [path, change, version, direction, inPane],\n );\n\n // On pop, focus goes back to the control that opened the screen that just closed.\n const previousDepth = React.useRef(path.length);\n React.useEffect(() => {\n const before = previousDepth.current;\n previousDepth.current = path.length;\n if (path.length < before) {\n const opener = openers.current[before];\n openers.current.length = path.length + 1;\n if (opener && opener.isConnected) opener.focus();\n }\n }, [path.length]);\n\n const levels = [root, ...path.map((value) => screen(value))];\n const top = levels.length - 1;\n const outlet = (\n <div className={classNames('kui-Navigator', className)} style={style}>\n {levels.map((level, depth) => (\n // Keyed by depth AND value, so a path that replaces the screen at a depth mounts a new\n // screen instead of handing it the old one's state.\n <Level key={depth === 0 ? 'root' : `${depth}:${String(path[depth - 1])}`} visible={depth === top}>\n <LevelContext.Provider value={depth}>\n <div className=\"kui-NavigatorLevel\">{level}</div>\n </LevelContext.Provider>\n </Level>\n ))}\n </div>\n );\n\n return (\n <NavigatorContext.Provider value={api}>\n <OutletContext.Provider value={outlet}>{children ?? (inPane ? <PaneFrame /> : outlet)}</OutletContext.Provider>\n </NavigatorContext.Provider>\n );\n}\n\n/**\n * The pane's frame: Back and the top screen's title as one cluster at the start of the pane's\n * band, and the screens in the pane's scroller. Pass children to the Navigator instead when the\n * band needs actions of its own, and put `NavigatorBack` and `NavigatorTitle` in it, together in\n * a `Flex`.\n */\nfunction PaneFrame() {\n return (\n <>\n <PaneHeader>\n <Toolbar>\n {/* One cluster: as two loose toolbar children, the band splits them to its two ends. */}\n <Flex align=\"center\">\n <NavigatorBack />\n <NavigatorTitle />\n </Flex>\n </Toolbar>\n </PaneHeader>\n <Scroll>\n <NavigatorOutlet />\n </Scroll>\n </>\n );\n}\n\n/** Where the screens go, inside a frame passed as the navigator's children. */\nfunction NavigatorOutlet() {\n return <>{React.useContext(OutletContext)}</>;\n}\n\nfunction useNavigatorState(): NavigatorState {\n const state = React.useContext(NavigatorContext);\n if (!state) throw new Error('Kookie: this part must be inside a <Navigator>.');\n return state;\n}\n\n/** The navigator around this component: its path, and `push`, `pop` and `popTo`. */\nfunction useNavigator<T = unknown>(): NavigatorApi<T> {\n return useNavigatorState() as NavigatorApi<T>;\n}\n\nfunction BackGlyph() {\n return (\n <svg className=\"kui-NavigatorBackGlyph\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden>\n <path d=\"m15 18-6-6 6-6\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n );\n}\n\nfunction CloseGlyph() {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" />\n </svg>\n );\n}\n\nfunction backLabel(state: NavigatorState, depth: number) {\n const previous = depth > 0 ? state.titles.current[depth - 1] : undefined;\n return previous ? `Back to ${previous}` : 'Back';\n}\n\ninterface NavigatorBackProps {\n /** The accessible name. The default is \"Back to\" and the previous screen's title. */\n 'aria-label'?: string;\n}\n\n/**\n * Back, for a toolbar: a chevron that closes the top screen. It is absent at the root rather than\n * disabled, because there is nowhere to go back to. It names the screen it returns to, so a screen\n * reader hears \"Back to Settings\".\n */\nfunction NavigatorBack(props: NavigatorBackProps) {\n const state = useNavigatorState();\n if (!state.canGoBack) return null;\n return (\n <ToolbarButton iconOnly aria-label={props['aria-label'] ?? backLabel(state, state.path.length)} onClick={state.pop}>\n <BackGlyph />\n </ToolbarButton>\n );\n}\n\n/** The top screen's title, for a toolbar in a frame of your own. */\nfunction NavigatorTitle() {\n const state = useNavigatorState();\n return <ToolbarTitle>{state.titles.current[state.path.length]}</ToolbarTitle>;\n}\n\ninterface NavigatorScreenProps {\n /** The screen's title. In a pane it shows in the pane's band; elsewhere in the screen's own. */\n title: string;\n /** The screen's content, under its title. */\n children?: React.ReactNode;\n className?: string;\n}\n\n/**\n * One screen in a navigator. In a Shell pane the pane's band carries Back and its title, so the\n * screen is only its content. Anywhere else it draws its own band: Back, the title, and the\n * overlay's close when it sits in one. In a Dialog, Sheet or Popover the title names the panel.\n */\nfunction NavigatorScreen({ title, children, className }: NavigatorScreenProps) {\n const state = useNavigatorState();\n const depth = React.useContext(LevelContext);\n const Host = React.useContext(NavigatorHostContext);\n const node = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n state.setTitle(depth, title);\n }, [state, depth, title]);\n\n // A pushed screen takes focus at its top, so a keyboard and a screen reader start there. In a\n // pane the title is in the band, outside the screen, so the screen itself takes it.\n React.useEffect(() => {\n if (depth === 0 || state.direction !== 'push') return;\n const target = node.current?.querySelector<HTMLElement>('.kui-NavigatorBar .kui-ToolbarTitle') ?? node.current;\n if (target) {\n target.tabIndex = -1;\n target.focus({ preventScroll: true });\n }\n // Only on arrival: a later re-render must not pull focus back to the title.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (state.inPane) {\n return (\n <div ref={node} className={classNames('kui-NavigatorScreen', className)}>\n {children}\n </div>\n );\n }\n\n const heading = (\n <Heading as=\"h2\" size=\"4\" weight=\"medium\" truncate>\n {title}\n </Heading>\n );\n return (\n <div ref={node} className={classNames('kui-NavigatorScreen', className)}>\n {/* One row: Back, the title, and the overlay's close. The band sits one step closer to the\n panel's edge than the content does. */}\n <div className=\"kui-NavigatorBar\">\n <Toolbar aria-label=\"Navigation\">\n {state.canGoBack && depth > 0 ? (\n <ToolbarButton iconOnly aria-label={backLabel(state, depth)} onClick={state.pop}>\n <BackGlyph />\n </ToolbarButton>\n ) : null}\n <ToolbarTitle className=\"kui-NavigatorBarTitle\">{Host ? <Host.Title>{heading}</Host.Title> : heading}</ToolbarTitle>\n {Host ? (\n <Host.Close>\n <ToolbarButton iconOnly aria-label=\"Close\">\n <CloseGlyph />\n </ToolbarButton>\n </Host.Close>\n ) : null}\n </Toolbar>\n </div>\n <div className=\"kui-NavigatorBody\">{children}</div>\n </div>\n );\n}\n\ninterface NavigatorLinkProps<T> extends Omit<React.ComponentPropsWithoutRef<'button'>, 'value' | 'onClick'> {\n /** The value pushed onto the path when the row is pressed. */\n value: T;\n}\n\n/** A row that opens the next screen, with the chevron that says so. */\nfunction NavigatorLink<T>({ value, className, children, ...props }: NavigatorLinkProps<T>) {\n const state = useNavigatorState();\n return (\n <button type=\"button\" {...props} className={classNames('kui-reset', 'kui-NavigatorLink', className)} onClick={() => state.push(value)}>\n <span className=\"kui-NavigatorLinkLabel\">{children}</span>\n <svg className=\"kui-NavigatorLinkGlyph\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden>\n <path d=\"m9 18 6-6-6-6\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n );\n}\n\nexport { Navigator, NavigatorOutlet, NavigatorBack, NavigatorTitle, NavigatorScreen, NavigatorLink, useNavigator };\nexport type { NavigatorProps, NavigatorBackProps, NavigatorScreenProps, NavigatorLinkProps, NavigatorApi };\n"],
5
+ "mappings": ";4QAwBA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAgCvB,IAAMC,EAAyB,gBAAqC,IAAI,EAClEC,EAAqB,gBAAsB,CAAC,EAC5CC,EAAsB,gBAA+B,IAAI,EAM/D,SAASC,GAAY,CACnB,IAAMC,EAAc,aAAWC,CAAiB,EAC1CC,EAAkB,aAAWC,CAAmB,EAChDC,EAAa,aAAWC,CAAoB,EAClD,OAAOL,IAAU,MAAQ,CAACE,GAAaE,IAAS,IAClD,CAIA,IAAME,EAAoH,WAE1H,SAASC,EAAM,CAAE,QAAAC,EAAS,SAAAC,CAAS,EAAoD,CACrF,OAAIH,EAAiB,gBAACA,EAAA,CAAS,KAAME,EAAU,UAAY,UAAWC,CAAS,EAE7E,gBAAC,OAAI,OAAQ,CAACD,EAAS,MAAO,CAAE,QAASA,EAAU,WAAa,MAAO,GACpEC,CACH,CAEJ,CA6BA,SAASC,GAAa,CAAE,KAAMC,EAAU,YAAAC,EAAa,aAAAC,EAAc,OAAAC,EAAQ,KAAAC,EAAM,SAAAN,EAAU,UAAAO,EAAW,MAAAC,CAAM,EAAsB,CAChI,IAAMC,EAASnB,EAAU,EACnB,CAACoB,EAAKC,CAAM,EAAU,WAAuBR,GAAe,CAAC,CAAC,EAC9DS,EAAOV,GAAYQ,EAGnB,C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AAS,CAC/C,CAEJ,CAQA,SAAS4D,GAAiB,CAAE,MAAA5C,EAAO,UAAAT,EAAW,SAAAP,EAAU,GAAGmD,CAAM,EAA0B,CACzF,IAAMN,EAAQD,EAAkB,EAChC,OACE,gBAAC,UAAO,KAAK,SAAU,GAAGO,EAAO,UAAWjB,EAAW,YAAa,oBAAqB3B,CAAS,EAAG,QAAS,IAAMsC,EAAM,KAAK7B,CAAK,GAClI,gBAAC,QAAK,UAAU,0BAA0BhB,CAAS,EACnD,gBAAC,OAAI,UAAU,yBAAyB,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAA6B,cAAW,IACpH,gBAAC,QAAK,EAAE,gBAAgB,OAAO,eAAe,YAAa,KAAM,cAAc,QAAQ,eAAe,QAAQ,CAChH,CACF,CAEJ",
6
+ "names": ["React", "classNames", "NavigatorContext", "LevelContext", "OutletContext", "useInPane", "store", "ShellStoreContext", "inContent", "ShellContentContext", "host", "NavigatorHostContext", "Activity", "Level", "visible", "children", "Navigator", "pathProp", "defaultPath", "onPathChange", "screen", "root", "className", "style", "inPane", "own", "setOwn", "path", "seen", "setSeen", "direction", "value", "i", "before", "titles", "openers", "version", "setVersion", "change", "next", "api", "depth", "title", "v", "previousDepth", "opener", "levels", "top", "outlet", "classNames", "level", "PaneFrame", "PaneHeader", "Toolbar", "Flex", "NavigatorBack", "NavigatorTitle", "Scroll", "NavigatorOutlet", "useNavigatorState", "state", "useNavigator", "BackGlyph", "CloseGlyph", "backLabel", "previous", "props", "ToolbarButton", "ToolbarTitle", "NavigatorScreen", "Host", "node", "target", "heading", "Heading", "NavigatorLink"]
7
+ }
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{a as N}from"./chunk-BUXK5VGR.js";import{b as E,c as w}from"./chunk-GKDGNPBD.js";import{a as L}from"./chunk-KOAWATCI.js";import{c as C}from"./chunk-OKQAVYW4.js";import{a as z}from"./chunk-AQKSO3SW.js";import{b as O}from"./chunk-FVRVBB6O.js";import{b as x}from"./chunk-5ON3XLRD.js";import{c as g}from"./chunk-HBWBPBSA.js";import{b as D}from"./chunk-XU74PNM2.js";import{a as _}from"./chunk-VQPANPMI.js";var te={};_(te,{Content:()=>H,Group:()=>K,Item:()=>W,Label:()=>j,Root:()=>B,Separator:()=>F,Trigger:()=>V});import*as e from"react";import u from"classnames";import{Select as r,ScrollArea as y}from"radix-ui";import{useComposedRefs as X,useLayoutEffect as Z}from"radix-ui/internal";var J=["1","2","3","4"],v={size:{type:"enum",className:"kui-r-size",values:J,default:"2",responsive:!0}},Q=["raised","surface","soft","outline","ghost"],G={variant:{type:"enum",className:"kui-variant",values:Q,default:"raised"},error:{type:"boolean"},loading:{type:"boolean"},disabled:{type:"boolean"},readOnly:{type:"boolean"},...g,...D,placeholder:{type:"ReactNode"}},M={...g};var A={size:v.size},$=[" ","Enter","ArrowUp","ArrowDown"],h=e.createContext({}),B=o=>{let{children:t,size:a,open:S,defaultOpen:f,onOpenChange:c,...p}=o,n=x(a,v.size),[l,i]=e.useState(f??!1),m=S??l,P=e.useCallback(d=>{i(d),c?.(d)},[c]);return e.createElement(r.Root,{...p,open:m,onOpenChange:P},e.createElement(h.Provider,{value:e.useMemo(()=>({size:n,open:m}),[n,m])},t))};B.displayName="Select.Root";var V=e.forwardRef((o,t)=>{let a=e.useContext(h),{children:S,className:f,color:c,radius:p,placeholder:n,error:l,loading:i,disabled:m,readOnly:P,...d}=C({size:a?.size,...o},A,G),{"aria-invalid":R,"aria-busy":b,"aria-disabled":T,"aria-readonly":k}=d,I=!!l||R===!0||R==="true",U=e.useMemo(()=>({"aria-invalid":I?!0:R,"aria-busy":i||b,"aria-disabled":m||T,"aria-readonly":P||k}),[I,R,i,b,m,T,P,k]),Y=!!(P||i)?{onPointerDown:s=>s.preventDefault(),onClick:s=>{s.preventDefault(),s.currentTarget.focus()},onKeyDown:s=>{let q=s.ctrlKey||s.altKey||s.metaKey;($.includes(s.key)||!q&&s.key.length===1)&&s.preventDefault()}}:void 0;return e.createElement(r.Trigger,{asChild:!0,disabled:m,...Y},e.createElement("button",{"data-accent-color":c,"data-radius":p,"data-error":l,"data-loading":i,...d,...U,ref:t,className:u("kui-reset","kui-SelectTrigger",f)},e.createElement("span",{className:"kui-SelectTriggerInner"},e.createElement(r.Value,{placeholder:n},S)),e.createElement(r.Icon,{asChild:!0},i?e.createElement("span",{className:"kui-SelectIcon kui-SelectLoadingIcon","aria-hidden":"true"},e.createElement(N,null)):e.createElement(w,{className:"kui-SelectIcon"}))))});V.displayName="Select.Trigger";var H=e.forwardRef((o,t)=>{let a=e.useContext(h),{className:S,children:f,color:c,container:p,...n}=C({size:a?.size,...o},A,M),l=O();if(a.open===!1&&!n.forceMount)return e.createElement(r.Portal,{container:p},e.createElement(r.Content,{...n,asChild:!1,ref:t},f));let i=c||l.accentColor;return e.createElement(r.Portal,{container:p},e.createElement(z,{asChild:!0},e.createElement(r.Content,{"data-accent-color":i,sideOffset:4,...n,asChild:!1,ref:t,className:u("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-SelectContent",S)},e.createElement(ee,null,f))))});H.displayName="Select.Content";function ee({children:o}){let t=L();return e.createElement(y.Root,{type:"auto",className:"kui-ScrollAreaRoot"},e.createElement(r.Viewport,{asChild:!0,className:u("kui-BaseMenuViewport","kui-SelectViewport")},e.createElement(y.Viewport,{ref:t,className:"kui-ScrollAreaViewport",style:{overflowY:void 0}},o)),e.createElement(y.Scrollbar,{className:"kui-ScrollAreaScrollbar",orientation:"vertical"},e.createElement(y.Thumb,{className:"kui-ScrollAreaThumb"})))}var W=e.forwardRef((o,t)=>{let{className:a,children:S,...f}=o,c=typeof S!="string",p=e.useRef(null),n=X(t,p);return Z(()=>{let l=p.current,i=l?.querySelector(":scope > :not(.kui-SelectItemIndicator)");if(!l||!i||!c)return;let m=parseFloat(getComputedStyle(l).lineHeight);l.toggleAttribute("data-multiline",i.getBoundingClientRect().height>m*1.5)}),e.createElement(r.Item,{...f,asChild:!1,ref:n,className:u("kui-reset","kui-BaseMenuItem","kui-SelectItem",{"kui-SelectItemRich":c},a)},e.createElement(r.ItemIndicator,{className:"kui-SelectItemIndicator"},e.createElement(E,{className:"kui-SelectItemIndicatorIcon"})),e.createElement(r.ItemText,null,S))});W.displayName="Select.Item";var K=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Group,{...t,asChild:!1,ref:a,className:u("kui-SelectGroup",o)}));K.displayName="Select.Group";var j=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Label,{...t,asChild:!1,ref:a,className:u("kui-BaseMenuLabel","kui-SelectLabel",o)}));j.displayName="Select.Label";var F=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Separator,{...t,asChild:!1,ref:a,className:u("kui-BaseMenuSeparator","kui-SelectSeparator",o)}));F.displayName="Select.Separator";export{B as a,V as b,H as c,W as d,K as e,j as f,F as g,te as h};
3
+ //# sourceMappingURL=chunk-676Y7ZUT.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/select.tsx", "../../src/components/select.props.tsx"],
4
+ "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Select as SelectPrimitive, ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\nimport { useComposedRefs, useLayoutEffect } from 'radix-ui/internal';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSize } from '../hooks/theme-size.js';\nimport { ChevronDownIcon, ThickCheckIcon } from './icons.js';\nimport { Spinner } from './spinner.js';\nimport {\n selectRootPropDefs,\n selectTriggerPropDefs,\n selectContentPropDefs,\n} from './select.props.js';\nimport { useThemeContext } from './theme.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { useThumbSync } from '../hooks/use-thumb-sync.js';\n\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\ntype SelectRootOwnProps = GetPropDefTypes<typeof selectRootPropDefs>;\n\n// Trigger and Content pass the size prop def as its own record. It is hoisted because\n// extractProps caches its compiled prop defs on the identity of each record it is given:\n// a literal written at the call site would be a new object, and a recompile, every render.\nconst selectSizePropDefs = { size: selectRootPropDefs.size };\n\n// Keys that open the list from the trigger, as in Radix.\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\n\ninterface SelectContextValue extends SelectRootOwnProps {\n /** Whether the list is open. Undefined when Content is rendered outside a Kookie Select.Root. */\n open?: boolean;\n}\nconst SelectContext = React.createContext<SelectContextValue>({});\n\ninterface SelectRootProps extends SelectPrimitive.SelectProps, SelectRootOwnProps {}\nconst SelectRoot: React.FC<SelectRootProps> = (props) => {\n const {\n children,\n size: sizeProp,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...rootProps\n } = props;\n const size = useThemeSize(sizeProp, selectRootPropDefs.size);\n\n // Root owns the open state and hands Radix a controlled `open`, so Content learns of a\n // change in the same render Radix does. Radix's uncontrolled state reports changes from an\n // effect, a render late, which would mount the open list once without its wrappers.\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);\n const open = openProp ?? uncontrolledOpen;\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [onOpenChange],\n );\n\n return (\n <SelectPrimitive.Root {...rootProps} open={open} onOpenChange={handleOpenChange}>\n <SelectContext.Provider value={React.useMemo(() => ({ size, open }), [size, open])}>\n {children}\n </SelectContext.Provider>\n </SelectPrimitive.Root>\n );\n};\nSelectRoot.displayName = 'Select.Root';\n\ntype SelectTriggerElement = React.ElementRef<typeof SelectPrimitive.Trigger>;\ntype SelectTriggerOwnProps = GetPropDefTypes<typeof selectTriggerPropDefs>;\ninterface SelectTriggerProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Trigger, RemovedProps>,\n SelectTriggerOwnProps {}\nconst SelectTrigger = React.forwardRef<SelectTriggerElement, SelectTriggerProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const {\n children,\n className,\n color,\n radius,\n placeholder,\n error,\n loading,\n disabled,\n readOnly,\n ...triggerProps\n } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectTriggerPropDefs,\n );\n\n // The props win when set; otherwise a caller's own aria-* (a form library's aria-invalid)\n // stays, so both paths reach the accessibility tree and the CSS, as on TextField.\n const {\n 'aria-invalid': ariaInvalid,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadOnly,\n } = triggerProps;\n const isInvalid = Boolean(error) || ariaInvalid === true || ariaInvalid === 'true';\n const ariaProps = React.useMemo(\n () => ({\n 'aria-invalid': isInvalid ? true : ariaInvalid,\n 'aria-busy': loading || ariaBusy,\n 'aria-disabled': disabled || ariaDisabled,\n 'aria-readonly': readOnly || ariaReadOnly,\n }),\n [isInvalid, ariaInvalid, loading, ariaBusy, disabled, ariaDisabled, readOnly, ariaReadOnly],\n );\n\n // Read-only and loading triggers stay focusable but do not open or take typeahead,\n // as on Combobox. Radix skips its own handler when the event is default-prevented.\n const isBlocked = Boolean(readOnly || loading);\n const blockedHandlers = isBlocked\n ? {\n onPointerDown: (event: React.PointerEvent<HTMLButtonElement>) => event.preventDefault(),\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.currentTarget.focus();\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => {\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (OPEN_KEYS.includes(event.key) || (!isModifierKey && event.key.length === 1)) {\n event.preventDefault();\n }\n },\n }\n : undefined;\n\n return (\n // `disabled` goes to Radix, which merges it with Root's and sets the native attribute.\n <SelectPrimitive.Trigger asChild disabled={disabled} {...blockedHandlers}>\n <button\n data-accent-color={color}\n data-radius={radius}\n data-error={error}\n data-loading={loading}\n {...triggerProps}\n {...ariaProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-SelectTrigger', className)}\n >\n <span className=\"kui-SelectTriggerInner\">\n <SelectPrimitive.Value placeholder={placeholder}>{children}</SelectPrimitive.Value>\n </span>\n <SelectPrimitive.Icon asChild>\n {loading ? (\n <span className=\"kui-SelectIcon kui-SelectLoadingIcon\" aria-hidden=\"true\">\n <Spinner />\n </span>\n ) : (\n <ChevronDownIcon className=\"kui-SelectIcon\" />\n )}\n </SelectPrimitive.Icon>\n </button>\n </SelectPrimitive.Trigger>\n );\n },\n);\nSelectTrigger.displayName = 'Select.Trigger';\n\ntype SelectContentElement = React.ElementRef<typeof SelectPrimitive.Content>;\ntype SelectContentOwnProps = GetPropDefTypes<typeof selectContentPropDefs>;\ninterface SelectContentProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Content, RemovedProps>,\n SelectContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Portal>['container'];\n}\nconst SelectContent = React.forwardRef<SelectContentElement, SelectContentProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const { className, children, color, container, ...contentProps } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectContentPropDefs,\n );\n const themeContext = useThemeContext();\n\n // While closed, Radix still renders Content's children, into a detached fragment: the\n // items must exist for the trigger's value label, typeahead and the native form select.\n // Nothing in that fragment is ever shown, so the theme wrapper and the scroll area, with\n // its two resize observers, are left out until the list opens.\n if (context.open === false && !contentProps.forceMount) {\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content {...contentProps} asChild={false} ref={forwardedRef}>\n {children}\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n }\n\n const resolvedColor = color || themeContext.accentColor;\n return (\n <SelectPrimitive.Portal container={container}>\n <PortalTheme asChild>\n <SelectPrimitive.Content\n data-accent-color={resolvedColor}\n sideOffset={4}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-SelectContent',\n className,\n )}\n >\n <SelectScrollArea>{children}</SelectScrollArea>\n </SelectPrimitive.Content>\n </PortalTheme>\n </SelectPrimitive.Portal>\n );\n },\n);\nSelectContent.displayName = 'Select.Content';\n\n/** The open list's scroll area. Its own component so the thumb sync hook runs only while open. */\nfunction SelectScrollArea({ children }: { children: React.ReactNode }) {\n const setThumbViewport = useThumbSync<HTMLDivElement>();\n return (\n <ScrollAreaPrimitive.Root type=\"auto\" className=\"kui-ScrollAreaRoot\">\n <SelectPrimitive.Viewport\n asChild\n className={classNames('kui-BaseMenuViewport', 'kui-SelectViewport')}\n >\n <ScrollAreaPrimitive.Viewport\n ref={setThumbViewport}\n className=\"kui-ScrollAreaViewport\"\n style={{ overflowY: undefined }}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n </SelectPrimitive.Viewport>\n <ScrollAreaPrimitive.Scrollbar className=\"kui-ScrollAreaScrollbar\" orientation=\"vertical\">\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n </ScrollAreaPrimitive.Root>\n );\n}\n\ntype SelectItemElement = React.ElementRef<typeof SelectPrimitive.Item>;\ninterface SelectItemProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Item, RemovedProps> {}\nconst SelectItem = React.forwardRef<SelectItemElement, SelectItemProps>((props, forwardedRef) => {\n const { className, children, ...itemProps } = props;\n\n // Detect if this is rich content (not just a string)\n const isRichContent = typeof children !== 'string';\n\n // Rich content is not the same as several lines: an icon and a label is one line, and its mark\n // stays centred. Only content taller than one and a half lines pins the mark to the first line.\n // Written to the DOM, not state, so measuring never re-renders the list.\n const itemRef = React.useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs(forwardedRef, itemRef);\n useLayoutEffect(() => {\n const item = itemRef.current;\n const text = item?.querySelector(':scope > :not(.kui-SelectItemIndicator)');\n if (!item || !text || !isRichContent) return;\n const lineHeight = parseFloat(getComputedStyle(item).lineHeight);\n item.toggleAttribute('data-multiline', text.getBoundingClientRect().height > lineHeight * 1.5);\n });\n\n return (\n <SelectPrimitive.Item\n {...itemProps}\n asChild={false}\n ref={composedRef}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-SelectItem',\n { 'kui-SelectItemRich': isRichContent },\n className,\n )}\n >\n <SelectPrimitive.ItemIndicator className=\"kui-SelectItemIndicator\">\n <ThickCheckIcon className=\"kui-SelectItemIndicatorIcon\" />\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n});\nSelectItem.displayName = 'Select.Item';\n\ntype SelectGroupElement = React.ElementRef<typeof SelectPrimitive.Group>;\ninterface SelectGroupProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Group, RemovedProps> {}\nconst SelectGroup = React.forwardRef<SelectGroupElement, SelectGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-SelectGroup', className)}\n />\n ),\n);\nSelectGroup.displayName = 'Select.Group';\n\ntype SelectLabelElement = React.ElementRef<typeof SelectPrimitive.Label>;\ninterface SelectLabelProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Label, RemovedProps> {}\nconst SelectLabel = React.forwardRef<SelectLabelElement, SelectLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-SelectLabel', className)}\n />\n ),\n);\nSelectLabel.displayName = 'Select.Label';\n\ntype SelectSeparatorElement = React.ElementRef<typeof SelectPrimitive.Separator>;\ninterface SelectSeparatorProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Separator, RemovedProps> {}\nconst SelectSeparator = React.forwardRef<SelectSeparatorElement, SelectSeparatorProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-SelectSeparator', className)}\n />\n ),\n);\nSelectSeparator.displayName = 'Select.Separator';\n\nexport {\n SelectRoot as Root,\n SelectTrigger as Trigger,\n SelectContent as Content,\n SelectItem as Item,\n SelectGroup as Group,\n SelectLabel as Label,\n SelectSeparator as Separator,\n};\n\nexport type {\n SelectRootProps as RootProps,\n SelectTriggerProps as TriggerProps,\n SelectContentProps as ContentProps,\n SelectItemProps as ItemProps,\n SelectGroupProps as GroupProps,\n SelectLabelProps as LabelProps,\n SelectSeparatorProps as SeparatorProps,\n};\n", "import type React from 'react';\n\nimport { colorPropDef } from '../props/color.prop.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\n\nconst selectRootPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n};\n\nconst triggerVariants = ['raised', 'surface', 'soft', 'outline', 'ghost'] as const;\n\nconst selectTriggerPropDefs = {\n variant: { type: 'enum', className: 'kui-variant', values: triggerVariants, default: 'raised' },\n error: { type: 'boolean' },\n loading: { type: 'boolean' },\n disabled: { type: 'boolean' },\n readOnly: { type: 'boolean' },\n ...colorPropDef,\n ...radiusPropDef,\n placeholder: { type: 'ReactNode' },\n} satisfies {\n variant: PropDef<(typeof triggerVariants)[number]>;\n error: PropDef<boolean>;\n loading: PropDef<boolean>;\n disabled: PropDef<boolean>;\n readOnly: PropDef<boolean>;\n placeholder: PropDef<React.ReactNode>;\n};\n\n\nconst selectContentPropDefs = {\n ...colorPropDef,\n} satisfies {\n};\n\nexport { selectRootPropDefs, selectTriggerPropDefs, selectContentPropDefs };\n"],
5
+ "mappings": ";uZAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,aAAAE,EAAA,UAAAC,EAAA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B,IAAMW,EAAoB,aACxB,CAAC,CAAE,UAAA9C,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,MAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWsB,EAAW,kBAAmBpB,CAAS,EACpD,CAEJ,EACA8C,EAAY,YAAc,eAK1B,IAAMC,EAAoB,aACxB,CAAC,CAAE,UAAA/C,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,MAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWsB,EAAW,oBAAqB,kBAAmBpB,CAAS,EACzE,CAEJ,EACA+C,EAAY,YAAc,eAK1B,IAAMC,EAAwB,aAC5B,CAAC,CAAE,UAAAhD,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,UAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWsB,EAAW,wBAAyB,sBAAuBpB,CAAS,EACjF,CAEJ,EACAgD,EAAgB,YAAc",
6
+ "names": ["select_exports", "__export", "SelectContent", "SelectGroup", "SelectItem", "SelectLabel", "SelectRoot", "SelectSeparator", "SelectTrigger", "React", "classNames", "SelectPrimitive", "ScrollAreaPrimitive", "useComposedRefs", "useLayoutEffect", "sizes", "selectRootPropDefs", "triggerVariants", "selectTriggerPropDefs", "colorPropDef", "radiusPropDef", "selectContentPropDefs", "selectSizePropDefs", "selectRootPropDefs", "OPEN_KEYS", "SelectContext", "SelectRoot", "props", "children", "sizeProp", "openProp", "defaultOpen", "onOpenChange", "rootProps", "size", "useThemeSize", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChange", "next", "SelectPrimitive", "SelectTrigger", "forwardedRef", "context", "className", "color", "radius", "placeholder", "error", "loading", "disabled", "readOnly", "triggerProps", "extractProps", "selectTriggerPropDefs", "ariaInvalid", "ariaBusy", "ariaDisabled", "ariaReadOnly", "isInvalid", "ariaProps", "blockedHandlers", "event", "isModifierKey", "classNames", "Spinner", "ChevronDownIcon", "SelectContent", "container", "contentProps", "selectContentPropDefs", "themeContext", "useThemeContext", "resolvedColor", "PortalTheme", "SelectScrollArea", "setThumbViewport", "useThumbSync", "ScrollAreaPrimitive", "SelectItem", "itemProps", "isRichContent", "itemRef", "composedRef", "useComposedRefs", "useLayoutEffect", "item", "text", "lineHeight", "ThickCheckIcon", "SelectGroup", "SelectLabel", "SelectSeparator"]
7
+ }
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{a as m}from"./chunk-FATCGZZE.js";import{a as c}from"./chunk-7VJF6EXN.js";import{a as l}from"./chunk-TGRHRMQI.js";import{a as D}from"./chunk-JP36JSNP.js";import{a as P}from"./chunk-4MNRLB57.js";import{a as p}from"./chunk-4KBKS3ZE.js";import{c as r}from"./chunk-OKQAVYW4.js";import{a as g}from"./chunk-AQKSO3SW.js";import{c as n}from"./chunk-5ON3XLRD.js";import{a as w}from"./chunk-VQPANPMI.js";var z={};w(z,{Close:()=>T,Content:()=>v,Description:()=>y,Root:()=>f,Title:()=>R,Trigger:()=>d});import*as o from"react";import W from"classnames";import{Dialog as i}from"radix-ui";var f=e=>o.createElement(i.Root,{...e,modal:!0});f.displayName="Dialog.Root";var d=o.forwardRef(({children:e,...t},a)=>o.createElement(i.Trigger,{...t,ref:a,asChild:!0},l(e)));d.displayName="Dialog.Trigger";var{align:O,...C}=m,B={align:O},S={Title:({children:e})=>o.createElement(i.Title,{asChild:!0},e),Close:({children:e})=>o.createElement(i.Close,{asChild:!0},e)},v=o.forwardRef(({align:e,...t},a)=>{let u=n(t,C.size),{className:h}=r({align:e},B),{className:N,forceMount:E,container:x,onCloseAutoFocus:H,...s}=r(u,C);return c(),o.createElement(i.Portal,{container:x,forceMount:E},o.createElement(g,{asChild:!0},o.createElement(i.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay"},o.createElement("div",{className:"kui-BaseDialogScroll kui-DialogScroll"},o.createElement("div",{className:`kui-BaseDialogScrollPadding kui-DialogScrollPadding ${h}`},o.createElement(i.Content,{...s,ref:a,className:W("kui-BaseDialogContent","kui-DialogContent",N),children:o.createElement(p.Provider,{value:S},s.children),"aria-modal":"true",onCloseAutoFocus:k=>{H?.(k),document.body.style.pointerEvents=""}}))))))});v.displayName="Dialog.Content";var R=o.forwardRef((e,t)=>o.createElement(i.Title,{asChild:!0},o.createElement(D,{size:"5",trim:"start",...e,asChild:!1,ref:t})));R.displayName="Dialog.Title";var y=o.forwardRef((e,t)=>o.createElement(i.Description,{asChild:!0},o.createElement(P,{as:"p",size:"3",...e,asChild:!1,ref:t})));y.displayName="Dialog.Description";var T=o.forwardRef(({children:e,...t},a)=>o.createElement(i.Close,{...t,ref:a,asChild:!0},l(e)));T.displayName="Dialog.Close";export{f as a,d as b,v as c,R as d,y as e,T as f,z as g};
3
+ //# sourceMappingURL=chunk-6UFIS6B2.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/dialog.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { NavigatorHostContext, type NavigatorHost } from './_internal/navigator-host.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport type { ComponentPropsWithout, RemovedProps, ComponentPropsAs } from '../helpers/component-props.js';\n\ninterface DialogRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst DialogRoot: React.FC<DialogRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nDialogRoot.displayName = 'Dialog.Root';\n\ntype DialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ninterface DialogTriggerProps extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n));\nDialogTrigger.displayName = 'Dialog.Trigger';\n\n// Split once at module scope. `extractProps` memoises on the identity of the\n// prop def objects it is handed, so rebuilding these per render would recompile\n// them on every render.\nconst { align: alignPropDef, ...contentPropDefs } = dialogContentPropDefs;\nconst alignPropDefs = { align: alignPropDef };\n\ntype DialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface DialogContentProps extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>, DialogContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\n/** What a Navigator screen in this panel uses: its title names the panel, its close closes it. */\nconst dialogNavigatorHost: NavigatorHost = {\n Title: ({ children }) => <DialogPrimitive.Title asChild>{children}</DialogPrimitive.Title>,\n Close: ({ children }) => <DialogPrimitive.Close asChild>{children}</DialogPrimitive.Close>,\n};\n\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(({ align, ...ownProps }, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, contentPropDefs.size);\n const { className: alignClassName } = extractProps({ align }, alignPropDefs);\n\n const { className, forceMount, container, onCloseAutoFocus, ...contentProps } = extractProps(props, contentPropDefs);\n\n // Cleanup stuck pointer-events on body\n useBodyPointerEventsCleanup();\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <PortalTheme asChild>\n <DialogPrimitive.Overlay className=\"kui-BaseDialogOverlay kui-DialogOverlay\">\n <div className=\"kui-BaseDialogScroll kui-DialogScroll\">\n <div className={`kui-BaseDialogScrollPadding kui-DialogScrollPadding ${alignClassName}`}>\n <DialogPrimitive.Content\n {...contentProps}\n ref={forwardedRef}\n className={classNames('kui-BaseDialogContent', 'kui-DialogContent', className)}\n children={<NavigatorHostContext.Provider value={dialogNavigatorHost}>{contentProps.children}</NavigatorHostContext.Provider>}\n aria-modal=\"true\"\n onCloseAutoFocus={(event) => {\n // Radix returns focus to the trigger unless the caller prevents it.\n onCloseAutoFocus?.(event);\n // Restore pointer-events to body (Radix UI fix for issue #1241)\n document.body.style.pointerEvents = '';\n }}\n />\n </div>\n </div>\n </DialogPrimitive.Overlay>\n </PortalTheme>\n </DialogPrimitive.Portal>\n );\n});\nDialogContent.displayName = 'Dialog.Content';\n\ntype DialogTitleElement = React.ElementRef<typeof Heading>;\ntype DialogTitleProps = ComponentPropsWithout<typeof Heading, 'asChild'>;\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>((props, forwardedRef) => (\n <DialogPrimitive.Title asChild>\n <Heading size=\"5\" trim=\"start\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Title>\n));\nDialogTitle.displayName = 'Dialog.Title';\n\ntype DialogDescriptionElement = HTMLParagraphElement;\ntype DialogDescriptionProps = ComponentPropsAs<typeof Text, 'p'>;\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>((props, forwardedRef) => (\n <DialogPrimitive.Description asChild>\n <Text as=\"p\" size=\"3\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Description>\n));\nDialogDescription.displayName = 'Dialog.Description';\n\ntype DialogCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface DialogCloseProps extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Close {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n));\nDialogClose.displayName = 'Dialog.Close';\n\nexport { DialogRoot as Root, DialogTrigger as Trigger, DialogContent as Content, DialogTitle as Title, DialogDescription as Description, DialogClose as Close };\n\nexport type {\n DialogRootProps as RootProps,\n DialogTriggerProps as TriggerProps,\n DialogContentProps as ContentProps,\n DialogTitleProps as TitleProps,\n DialogDescriptionProps as DescriptionProps,\n DialogCloseProps as CloseProps,\n};\n"],
5
+ "mappings": ";gZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,YAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,YAAAC,IAAA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,MAAuB,WAgB1C,IAAMC,EAAyCC,GAAU,gBAACC,EAAgB,KAAhB,CAAsB,GAAGD,EAAO,MAAK,GAAC,EAChGD,EAAW,YAAc,cAIzB,IAAMG,EAAsB,aAAqD,CAAC,CAAE,SAAAC,EAAU,GAAGH,CAAM,EAAGI,IACxG,gBAACH,EAAgB,QAAhB,CAAyB,GAAGD,EAAO,IAAKI,EAAc,QAAO,IAC3DC,EAAoBF,CAAQ,CAC/B,CACD,EACDD,EAAc,YAAc,iBAK5B,GAAM,CAAE,MAAOI,EAAc,GAAGC,CAAgB,EAAIC,EAC9CC,EAAgB,CAAE,MAAOH,CAAa,EAOtCI,EAAqC,CACzC,MAAO,CAAC,CAAE,SAAAP,CAAS,IAAM,gBAACF,EAAgB,MAAhB,CAAsB,QAAO,IAAEE,CAAS,EAClE,MAAO,CAAC,CAAE,SAAAA,CAAS,IAAM,gBAACF,EAAgB,MAAhB,CAAsB,QAAO,IAAEE,CAAS,CACpE,EAEMQ,EAAsB,aAAqD,CAAC,CAAE,MAAAC,EAAO,GAAGC,CAAS,EAAGT,IAAiB,CACzH,IAAMJ,EAAQc,EAAkBD,EAAUN,EAAgB,IAAI,EACxD,CAAE,UAAWQ,CAAe,EAAIC,EAAa,CAAE,MAAAJ,CAAM,EAAGH,CAAa,EAErE,CAAE,UAAAQ,EAAW,WAAAC,EAAY,UAAA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"names": ["dialog_exports", "__export", "DialogClose", "DialogContent", "DialogDescription", "DialogRoot", "DialogTitle", "DialogTrigger", "React", "classNames", "DialogPrimitive", "DialogRoot", "props", "DialogPrimitive", "DialogTrigger", "children", "forwardedRef", "requireReactElement", "alignPropDef", "contentPropDefs", "dialogContentPropDefs", "alignPropDefs", "dialogNavigatorHost", "DialogContent", "align", "ownProps", "useThemeSizeProps", "alignClassName", "extractProps", "className", "forceMount", "container", "onCloseAutoFocus", "contentProps", "useBodyPointerEventsCleanup", "PortalTheme", "classNames", "NavigatorHostContext", "event", "DialogTitle", "Heading", "DialogDescription", "Text", "DialogClose"]
7
+ }
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{a as g}from"./chunk-FATCGZZE.js";import{a as C}from"./chunk-7VJF6EXN.js";import{a}from"./chunk-TGRHRMQI.js";import{a as f}from"./chunk-JP36JSNP.js";import{a as d}from"./chunk-4MNRLB57.js";import{a as P}from"./chunk-4KBKS3ZE.js";import{c as m}from"./chunk-OKQAVYW4.js";import{a as h}from"./chunk-AQKSO3SW.js";import{c}from"./chunk-5ON3XLRD.js";import{a as W}from"./chunk-VQPANPMI.js";var j={};W(j,{Close:()=>E,Content:()=>y,Description:()=>T,Root:()=>S,Title:()=>D,Trigger:()=>R});import*as e from"react";import k from"classnames";import{Dialog as i}from"radix-ui";var S=t=>e.createElement(i.Root,{...t,modal:!0});S.displayName="Sheet.Root";var R=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Trigger,{...o,ref:r,asChild:!0},a(t)));R.displayName="Sheet.Trigger";var{align:Y,...w}=g,u=w,B={Title:({children:t})=>e.createElement(i.Title,{asChild:!0},t),Close:({children:t})=>e.createElement(i.Close,{asChild:!0},t)},v=e.createContext(null),y=e.forwardRef((t,o)=>{let{side:r="start",forceMount:s,container:n,className:N,...x}=t,b=c(x,u.size),H={left:"start",right:"end",start:"start",end:"end",top:"top",bottom:"bottom"}[r],{className:O,...l}=m(b,u),z=e.useRef(0),M=e.useCallback(p=>{typeof o=="function"?o(p):o&&(o.current=p)},[o]);return C(),e.createElement(i.Portal,{container:n,forceMount:s},e.createElement(v.Provider,{value:z},e.createElement(h,{asChild:!0},e.createElement(i.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay"},e.createElement(i.Content,{...l,ref:M,className:k("kui-BaseDialogContent","kui-SheetContent",N,O),"data-side":H,"aria-modal":"true",children:e.createElement(P.Provider,{value:B},l.children)})))))});y.displayName="Sheet.Content";var D=e.forwardRef(({size:t="4",weight:o="medium",...r},s)=>{let n=e.useContext(v);return e.useLayoutEffect(()=>{if(n)return n.current+=1,()=>{n.current-=1}},[n]),e.createElement(i.Title,{asChild:!0},e.createElement(f,{ref:s,size:t,weight:o,...r}))});D.displayName="Sheet.Title";var T=e.forwardRef(({size:t="2",emphasis:o="medium",...r},s)=>e.createElement(i.Description,{asChild:!0},e.createElement(d,{ref:s,size:t,emphasis:o,...r})));T.displayName="Sheet.Description";var E=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Close,{...o,ref:r,asChild:!0},a(t)));E.displayName="Sheet.Close";export{S as a,R as b,y as c,D as d,T as e,E as f,j as g};
3
+ //# sourceMappingURL=chunk-CMHKCUHP.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/sheet.tsx"],
4
+ "sourcesContent": ["'use client';\n\n/**\n * Sheet\n *\n * A side-placed overlay built on top of Radix Dialog. It inherits accessibility,\n * focus management, overlay behavior, and sizing scales from the base dialog, and\n * adds side placement and slide motion suited for navigation panels and drawers.\n *\n * Structure mirrors Dialog:\n * - Root, Trigger, Content, Title, Description, Close\n *\n * Notes\n * - Side: set with `side` on `Sheet.Content`. Aliases: `left` \u2192 `start`, `right` \u2192 `end`.\n * - Sizing: reuses Dialog content prop defs (width/min/max/height/size). Size follows the\n * Theme size; start/end sheets cap at the size's overlay width unless maxWidth is set.\n * - A11y: provide an accessible name via `Sheet.Title` or `aria-label` on `Sheet.Content`.\n * Radix owns the focus trap, initial focus and the return of focus to the trigger.\n *\n * Example\n * <Sheet.Root>\n * <Sheet.Trigger>\n * <Button>Open</Button>\n * </Sheet.Trigger>\n * <Sheet.Content side=\"end\" width={{ initial: '280px', md: '360px' }}>\n * <Sheet.Title>Details</Sheet.Title>\n * ...\n * <Sheet.Close>\n * <Button>Close</Button>\n * </Sheet.Close>\n * </Sheet.Content>\n * </Sheet.Root>\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { NavigatorHostContext, type NavigatorHost } from './_internal/navigator-host.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { HeadingProps } from './heading.js';\n\n/**\n * Supported sides for the Sheet.\n * Aliases are normalized RTL-aware: `left` \u2192 `start`, `right` \u2192 `end`.\n */\ntype SheetSide = 'start' | 'end' | 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * Sheet is a side-placed overlay built on the Dialog primitive.\n * It reuses Dialog's accessibility, focus, overlay, and size scales, while adding side placement and slide motion.\n */\n\n// Root\n/**\n * Props for `Sheet.Root` (Radix Dialog root with `modal` forced on).\n */\ninterface SheetRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst Root: React.FC<SheetRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nRoot.displayName = 'Sheet.Root';\n\n// Trigger\n/** Element type for `Sheet.Trigger`. */\ntype SheetTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\n/** Props for `Sheet.Trigger` (expects a single element child). */\ninterface SheetTriggerProps extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst Trigger = React.forwardRef<SheetTriggerElement, SheetTriggerProps>(({ children, ...props }, ref) => (\n <DialogPrimitive.Trigger {...props} ref={ref} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n));\nTrigger.displayName = 'Sheet.Trigger';\n\n// Content\n/** Element type for `Sheet.Content`. */\n// Reuse dialog content prop defs for size/width/height tokens.\n// Built once at module scope: `extractProps` memoises on the identity of the\n// prop def objects it is handed, so rebuilding these per render would recompile\n// them every time a sheet renders.\nconst { align: _alignPropDef, ...dialogPropDefsForSheet } = dialogContentPropDefs;\nconst sheetPropDefs = dialogPropDefsForSheet;\n\n/** What a Navigator screen in this panel uses: its title names the sheet, its close closes it. */\nconst sheetNavigatorHost: NavigatorHost = {\n Title: ({ children }) => <DialogPrimitive.Title asChild>{children}</DialogPrimitive.Title>,\n Close: ({ children }) => <DialogPrimitive.Close asChild>{children}</DialogPrimitive.Close>,\n};\n\n/** Counts the Sheet.Title elements mounted inside a Sheet.Content, for the dev-only name check. */\nconst SheetTitleCountContext = React.createContext<React.MutableRefObject<number> | null>(null);\n\ntype SheetContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface SheetContentProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>,\n Omit<DialogContentOwnProps, 'align'> {\n /** Side where the Sheet should appear. `left`/`right` alias to `start`/`end`. */\n side?: SheetSide;\n /** Optional DOM container to portal into. Defaults to `document.body`. */\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\n\n/**\n * Renders the Sheet panel. Normalizes left/right to logical start/end and\n * forwards dialog sizing props. Provide an accessible name via `Sheet.Title`\n * or `aria-label`.\n */\nconst Content = React.forwardRef<SheetContentElement, SheetContentProps>((allProps, forwardedRef) => {\n const { side = 'start', forceMount, container, className, ...ownProps } = allProps;\n const restProps = useThemeSizeProps(ownProps, sheetPropDefs.size);\n const normalizedSideMap: Record<SheetSide, 'start' | 'end' | 'top' | 'bottom'> = {\n left: 'start',\n right: 'end',\n start: 'start',\n end: 'end',\n top: 'top',\n bottom: 'bottom',\n };\n const normalizedSide = normalizedSideMap[side];\n // Size/width/height class names come from the dialog defs \u2014 see `sheetPropDefs`.\n const { className: extractedClassName, ...contentProps } = extractProps(restProps, sheetPropDefs);\n\n // Dev-only a11y guard: the panel needs a name. A Sheet.Title anywhere inside counts it\n // in a layout effect, which runs before this ref is attached, so nesting doesn't matter.\n const titleCountRef = React.useRef(0);\n const combinedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n if (process.env.NODE_ENV !== 'production' && node) {\n const hasName = titleCountRef.current > 0 || Boolean(node.getAttribute('aria-label')) || Boolean(node.getAttribute('aria-labelledby'));\n if (!hasName) {\n console.warn('Sheet.Content: Missing accessible name. Include Sheet.Title inside it or provide aria-label.');\n }\n }\n },\n [forwardedRef],\n );\n\n useBodyPointerEventsCleanup();\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <SheetTitleCountContext.Provider value={titleCountRef}>\n <PortalTheme asChild>\n <DialogPrimitive.Overlay className=\"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay\">\n <DialogPrimitive.Content\n {...contentProps}\n ref={combinedRef}\n className={classNames('kui-BaseDialogContent', 'kui-SheetContent', className, extractedClassName)}\n data-side={normalizedSide}\n aria-modal=\"true\"\n children={<NavigatorHostContext.Provider value={sheetNavigatorHost}>{contentProps.children}</NavigatorHostContext.Provider>}\n />\n </DialogPrimitive.Overlay>\n </PortalTheme>\n </SheetTitleCountContext.Provider>\n </DialogPrimitive.Portal>\n );\n});\nContent.displayName = 'Sheet.Content';\n\n// Title - renders as Heading with sensible defaults\ntype SheetTitleElement = React.ElementRef<typeof Heading>;\ntype SheetTitleProps = HeadingProps;\n/** Accessible title for the Sheet. Renders as Heading with sensible defaults. */\nconst Title = React.forwardRef<SheetTitleElement, SheetTitleProps>(({ size = '4', weight = 'medium', ...props }, ref) => {\n const titleCountRef = React.useContext(SheetTitleCountContext);\n React.useLayoutEffect(() => {\n if (!titleCountRef) return;\n titleCountRef.current += 1;\n return () => {\n titleCountRef.current -= 1;\n };\n }, [titleCountRef]);\n return (\n <DialogPrimitive.Title asChild>\n <Heading ref={ref} size={size} weight={weight} {...props} />\n </DialogPrimitive.Title>\n );\n});\nTitle.displayName = 'Sheet.Title';\n\n// Description - renders as Text with sensible defaults\ntype SheetDescriptionElement = React.ElementRef<typeof Text>;\ntype SheetDescriptionProps = React.ComponentPropsWithoutRef<typeof Text>;\n/** Supplementary description text for Sheet content. Renders as Text with sensible defaults. */\nconst Description = React.forwardRef<SheetDescriptionElement, SheetDescriptionProps>(({ size = '2', emphasis = 'medium', ...rest }, ref) => (\n <DialogPrimitive.Description asChild>\n <Text ref={ref} size={size} emphasis={emphasis} {...rest} />\n </DialogPrimitive.Description>\n));\nDescription.displayName = 'Sheet.Description';\n\ntype SheetCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface SheetCloseProps extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\n/** Close button for the Sheet. Expects a single element child rendered via `asChild`. */\nconst Close = React.forwardRef<SheetCloseElement, SheetCloseProps>(({ children, ...props }, ref) => (\n <DialogPrimitive.Close {...props} ref={ref} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n));\nClose.displayName = 'Sheet.Close';\n\nexport { Root, Trigger, Content, Title, Description, Close };\nexport type {\n SheetRootProps as RootProps,\n SheetTriggerProps as TriggerProps,\n SheetContentProps as ContentProps,\n SheetTitleProps as TitleProps,\n SheetDescriptionProps as DescriptionProps,\n SheetCloseProps as CloseProps,\n};\n"],
5
+ "mappings": ";sYAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE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GAAGH,CAAM,EAAGI,IAC1F,gBAACH,EAAgB,MAAhB,CAAuB,GAAGD,EAAO,IAAKI,EAAK,QAAO,IAChDC,EAAoBF,CAAQ,CAC/B,CACD,EACDsC,EAAM,YAAc",
6
+ "names": ["sheet_exports", "__export", "Close", "Content", "Description", "Root", "Title", "Trigger", "React", "classNames", "DialogPrimitive", "Root", "props", "DialogPrimitive", "Trigger", "children", "ref", "requireReactElement", "_alignPropDef", "dialogPropDefsForSheet", "dialogContentPropDefs", "sheetPropDefs", "sheetNavigatorHost", "SheetTitleCountContext", "Content", "allProps", "forwardedRef", "side", "forceMount", "container", "className", "ownProps", "restProps", "useThemeSizeProps", "normalizedSide", "extractedClassName", "contentProps", "extractProps", "titleCountRef", "combinedRef", "node", "useBodyPointerEventsCleanup", "PortalTheme", "classNames", "NavigatorHostContext", "Title", "size", "weight", "Heading", "Description", "emphasis", "rest", "Text", "Close"]
7
+ }
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{a as Ge,b as Ye}from"./chunk-4G3FJUER.js";import{a as Xe}from"./chunk-ZG2XQUOH.js";import{a as Ke}from"./chunk-YMUERC2J.js";import{a as je}from"./chunk-AS2STDGA.js";import{c as ue,d as pe,e as we,f as fe,i as Ae,j as Ie,k as Ne}from"./chunk-MJROOEPE.js";import{c as xe,d as ke}from"./chunk-QEDKL23P.js";import{b as Ee}from"./chunk-5ON3XLRD.js";import{a as Le}from"./chunk-ANQLWGFN.js";import{a as $e}from"./chunk-QRV32INS.js";import{a as Fe,b as me}from"./chunk-3QWGSRYC.js";import{a as Pe,b as he,c as ve}from"./chunk-LTUW36HM.js";import{a as De,b as Be,c as Ve}from"./chunk-QKCNGEX4.js";import{a as Oe}from"./chunk-WEBNIUEX.js";import{a as J,b as We,c as _e,d as Ue,g as qe}from"./chunk-XUCR7L4G.js";import{a as ye}from"./chunk-G66WDIIV.js";import{e as ie,f as Te,h as Me,i as ne,j as ze,k as ce,l as de,n as He,o as oe}from"./chunk-GHWEXMF6.js";import{a as st}from"./chunk-VQPANPMI.js";var Pt={};st(Pt,{Bottom:()=>$e,Content:()=>at,Header:()=>nt,Inspector:()=>Ke,Left:()=>ot,PaneFooter:()=>Ie,PaneHeader:()=>Ae,Panel:()=>Ce,Rail:()=>lt,Root:()=>tt,Scroll:()=>Ne,Sidebar:()=>je,Trigger:()=>rt,useResponsivePresentation:()=>Xe,useShell:()=>Ye,useSidebarMode:()=>Ge});import*as e from"react";import $ from"classnames";import{Slot as it}from"radix-ui";import{useComposedRefs as be,useLayoutEffect as ct}from"radix-ui/internal";var Re=0;function Je(a){Re=Math.max(0,Re+a);let r=document.documentElement;Re>0?r.setAttribute("data-kui-shell-lock",""):r.removeAttribute("data-kui-shell-lock")}var Se="data-kui-shell-inert",dt=30;function Q(a,r){return r===null||r===a||r===a.body||r===a.documentElement}function Qe(a,r,s){for(let u of a.querySelectorAll("[data-shell-trigger][aria-controls]"))if(!(u.getAttribute("aria-controls")!==r||u.closest("[inert]"))&&!(s&&!s.some(R=>R.contains(u))))return u;return null}var ut={values:["1","2","3"]},et=e.createContext(null),Ze=64;function ge(a){return a.querySelector(":scope > .kui-ShellContent > .kui-ShellScroll > .kui-ScrollAreaViewport")??a.querySelector(":scope > .kui-ShellContent")}var tt=e.forwardRef(({className:a,children:r,height:s="full",contained:u,size:R,style:g,onKeyDown:F,onFocus:x,...k},T)=>{let P=Ee(R,ut),[i]=e.useState(Te),C=e.useCallback(t=>Me(i,t),[i]);e.useSyncExternalStore(C,()=>i.version,()=>0);let S=e.useRef(null),D=be(T,S),[E,w]=e.useState(()=>new Set),A=e.useCallback(t=>{w(n=>n.has(t)?n:new Set(n).add(t))},[]),f=e.useCallback(t=>{w(n=>{if(!n.has(t))return n;let o=new Set(n);return o.delete(t),o})},[]),m=e.useMemo(()=>({registerInset:A,unregisterInset:f}),[A,f]),I=e.useCallback(()=>{for(let t of i.entries.values())t.overlayLive&&t.setValue("closed","dismiss")},[i]),M=e.useCallback(()=>[...i.entries.values()].filter(t=>t.overlayLive&&t.el).map(t=>({name:t.name,id:t.id,el:t.el})),[i]),y=[...i.entries.values()].filter(t=>t.overlayLive&&t.el).length,N=u===!0||s!=="full"&&s!=="auto",V=!N&&s==="full",[Z,le]=e.useState(void 0);e.useEffect(()=>{if(!V)return;let t=S.current,n=t?.ownerDocument.defaultView;if(!t||!n||typeof n.matchMedia!="function")return;let o=xe(),c=o?n.scrollY:ge(t)?.scrollTop??0,h=0,v=0,L=()=>{v&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=0})},U=()=>{o&&!v&&(c=n.scrollY)},q=l=>{!o&&!v&&l.target instanceof HTMLElement&&l.target===ge(t)&&(c=l.target.scrollTop)};n.addEventListener("resize",L),n.addEventListener("scroll",U,{passive:!0}),t.addEventListener("scroll",q,{passive:!0,capture:!0});let se=ke(l=>{o=l;let d=c;h&&cancelAnimationFrame(h),h=requestAnimationFrame(()=>{if(h=0,l)n.scrollTo(0,d);else{let p=ge(t);p&&(p.scrollTop=d)}})});return()=>{h&&cancelAnimationFrame(h),v&&cancelAnimationFrame(v),n.removeEventListener("resize",L),n.removeEventListener("scroll",U),t.removeEventListener("scroll",q,{capture:!0}),se()}},[V]);let K=e.useCallback(()=>{let t=S.current;if(!t)return;let n=M().map(o=>o.el);for(let o of t.children){if(!(o instanceof HTMLElement)||o.classList.contains("kui-ShellScrim"))continue;let c=n.some(h=>o===h||o.contains(h));n.length===0||c?o.hasAttribute(Se)&&(o.removeAttribute(Se),o.inert=!1):o.inert||(o.setAttribute(Se,""),o.inert=!0)}},[M]),j=e.useRef(null),G=e.useRef([]),ee=e.useRef(null),O=e.useRef(!1),z=e.useRef(0),W=e.useCallback(()=>{z.current&&cancelAnimationFrame(z.current),z.current=0},[]),_=e.useCallback((t,n)=>{W();let o=0,c=()=>{if(z.current=0,!!t.isConnected){if(n(t.ownerDocument.activeElement)){t.focus({preventScroll:!0});return}o+=1,o<dt&&(z.current=requestAnimationFrame(c))}};z.current=requestAnimationFrame(c)},[W]);e.useEffect(()=>()=>{W(),O.current&&(O.current=!1,Je(-1))},[W]),e.useEffect(()=>{let t=S.current;if(!t)return;let n=t.ownerDocument,o=M(),c=o.map(l=>l.el),h=!N&&o.length>0;h!==O.current&&(O.current=h,Je(h?1:-1));let v=G.current;G.current=o;let L=v.filter(l=>{if(c.includes(l.el))return!1;let d=i.entries.get(l.name);return!l.el.isConnected||!d||d.el!==l.el||d.value==="closed"}),U=l=>l!==null&&L.some(d=>d.el.contains(l));if(v.length===0&&o.length>0){let l=n.activeElement,d=l instanceof HTMLElement&&!Q(n,l)&&!c.some(p=>p.contains(l))?l:null;if(d&&!t.contains(d)){let p=ee.current;p&&p.isConnected&&!c.some(te=>te.contains(p))&&(d=p)}j.current=d}if(K(),o.length===0){let l=j.current;if(j.current=null,L.length===0)return;let p=(H=>H!==null&&H.isConnected&&!H.closest("[inert]")&&!U(H))(l)?l:null;for(let H of L)p??(p=Qe(n,H.id));if(!p)return;let te=H=>Q(n,H)||U(H);te(n.activeElement)?p.focus({preventScroll:!0}):_(p,te);return}if(L.length>0){let l=n.activeElement;if(Q(n,l)||U(l)){let d=null;for(let p of L)d??(d=Qe(n,p.id,c));(d??c[c.length-1]).focus({preventScroll:!0})}}let q=c.filter(l=>!v.some(d=>d.el===l)),se=n.activeElement;q.length>0&&!c.some(l=>l.contains(se))&&(q[0].focus({preventScroll:!0}),_(q[0],l=>Q(n,l)||l instanceof Element&&l.closest("[inert]")!==null))}),e.useEffect(()=>{let t=S.current;if(!t||y===0||typeof MutationObserver>"u")return;let n=new MutationObserver(K);return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["inert"]}),()=>n.disconnect()},[y,K]);let Y=t=>{F?.(t),!(t.key!=="Escape"||t.defaultPrevented||y===0)&&(I(),t.stopPropagation())};e.useEffect(()=>{let t=S.current;if(!t||y===0)return;let n=t.ownerDocument,o=c=>{c.key!=="Escape"||c.defaultPrevented||!Q(n,c.target)||I()};return n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)},[y,I]);let ae=t=>{x?.(t),t.target instanceof HTMLElement&&S.current?.contains(t.target)&&(ee.current=t.target)},B=i.entries.get("rail"),X=B!==void 0&&B.value!==void 0&&B.value!=="closed"?E.has("rail")?`calc(${B.size}px + 2 * var(--shell-inset-gap))`:`${B.size}px`:void 0,re=s==="full"?{}:s==="auto"?{height:"auto"}:typeof s=="number"?{height:`${s}px`}:{height:s};return e.createElement(ze.Provider,{value:i},e.createElement(ue.Provider,{value:P},e.createElement(pe.Provider,{value:!1},e.createElement(we.Provider,{value:V},e.createElement(et.Provider,{value:le},e.createElement(He.Provider,{value:m},e.createElement(Le.Provider,{value:void 0},e.createElement("div",{...k,ref:D,className:$("kui-ShellRoot",a),"data-height":s==="auto"&&!N?"auto":void 0,"data-contained":N||void 0,"data-window":V||void 0,"data-has-inset":E.size>0||void 0,"data-overlay-live":y>0||void 0,onKeyDown:Y,onFocus:ae,style:{...re,...X?{"--shell-rail-offset":X}:{},...Z!==void 0?{"--kui-shell-header-h":`${Z}px`}:{},...g}},r,e.createElement("div",{className:"kui-ShellScrim","aria-hidden":!0,onClick:I})))))))))});tt.displayName="Shell.Root";var nt=e.forwardRef(({className:a,height:r=Ze,style:s,...u},R)=>{let g=e.useContext(et);return ct(()=>{if(g)return g(r===Ze?void 0:r),()=>g(void 0)},[g,r]),e.createElement("header",{...u,ref:R,className:$("kui-ShellHeader",a),style:{...s,"--shell-header-height":`${r}px`}})});nt.displayName="Shell.Header";var ot=e.forwardRef(({children:a},r)=>(e.useEffect(()=>{},[]),e.createElement(e.Fragment,null,a)));ot.displayName="Shell.Left";var pt={controlled:"open",default:"defaultOpen"},lt=e.forwardRef((a,r)=>{let{className:s,presentation:u,expandedSize:R=64,collapsible:g,onExpand:F,onCollapse:x,children:k,style:T,open:P,defaultOpen:i,onOpenChange:C,inset:S,id:D,...E}=a,{table:w,attributes:A}=ve(u,"fixed"),f=Pe({name:"rail",label:"Rail",propNames:pt,id:D,controlled:J(P),defaultValue:J(i),presentationTable:w,builtIn:We,onChange:(I,M)=>C?.(I!=="closed",{reason:M}),onExpand:F,onCollapse:x,size:R});oe("rail",S);let m=be(r,f.setElement);return e.createElement("div",{...E,role:E.role??"navigation",id:f.id,ref:m,className:$("kui-ShellPane","kui-ShellRail",s),...he(f,A),"data-inset":S||void 0,tabIndex:f.overlaying?-1:E.tabIndex,style:{...T,"--rail-size":`${R}px`}},e.createElement(ft,null,k))});lt.displayName="Shell.Rail";function ft({children:a}){let r=e.useContext(ue);return e.createElement("div",{className:$("kui-ShellRailContent",`kui-r-size-${r}`)},e.createElement(fe,{presentation:"thin"},a))}var mt={controlled:"open",default:"defaultOpen"},Ce=e.forwardRef((a,r)=>{let{className:s,presentation:u,defaultOpen:R,open:g,onOpenChange:F,size:x,defaultSize:k,expandedSize:T=288,minSize:P=100,maxSize:i=800,resizable:C=!1,collapsible:S=!0,onExpand:D,onCollapse:E,onResize:w,onResizeStart:A,onResizeEnd:f,snapPoints:m,snapTolerance:I,collapseThreshold:M,paneId:y,persistence:N,children:V,style:Z,onSizeChange:le,sizeUpdate:K,sizeUpdateMs:j=50,inset:G,id:ee,...O}=a,z=ce("Shell.Panel"),W=de(z,"rail"),_=ve(u,"fixed"),Y=u===void 0,ae=Y?W?.presentationTable??ie:_.table,B=Y?{"data-presentation-follows":""}:_.attributes,b=Pe({name:"panel",label:"Panel",propNames:mt,id:ee,controlled:J(g),defaultValue:J(R),presentationTable:ae,builtIn:_e,onChange:(v,L)=>F?.(v!=="closed",{reason:L}),onExpand:D,onCollapse:E,size:T});oe("panel",G),e.useEffect(()=>{(m!==void 0||M!==void 0||y!==void 0||N!==void 0)&&void 0},[m,M,y,N]);let X=e.useRef(null),re=be(r,b.setElement,X),t=Be({name:"panel",elementId:b.id,elementRef:X,cssVarName:"--panel-size",orientation:"vertical",edge:"end",growth:Ue,expandedSize:T,minSize:P,maxSize:i,resizable:C,collapsible:S,size:x,defaultSize:k,onSizeChange:le,sizeUpdate:K,sizeUpdateMs:j,onResize:w,onResizeStart:A,onResizeEnd:f,snapPoints:m,snapTolerance:I,collapseThreshold:M,paneId:y,persistence:N,overlaying:b.overlaying,overlayingNow:()=>(Y?z.entries.get("rail")?.presentationTable??ie:_.table)[ye()]==="overlay",requestCollapse:()=>b.setValue("closed","toggle"),requestToggle:()=>b.toggle("toggle")}),n=De(x,k,P,i),{handles:o,content:c}=Ve(V,me),h=C&&b.shown!==!1&&!b.overlaying?e.createElement(Oe.Provider,{value:t},o.length>0?o:e.createElement(Fe,null)):null;return e.createElement("div",{...qe(O),role:O.role??"navigation",id:b.id,ref:re,className:$("kui-ShellPane","kui-ShellPanel",s),...he(b,B),"data-inset":G||void 0,tabIndex:b.overlaying?-1:O.tabIndex,style:{...Z,"--panel-expanded-size":`${T}px`,...n?{"--panel-size":n}:{}}},e.createElement("div",{className:"kui-ShellPanelContent"},e.createElement(fe,null,c)),h)});Ce.displayName="Shell.Panel";Ce.Handle=me;var at=e.forwardRef(({className:a,inset:r,children:s,...u},R)=>(oe("content",r),e.createElement("main",{...u,ref:R,className:$("kui-ShellContent",a),"data-inset":r||void 0},e.createElement(pe.Provider,{value:!0},s))));at.displayName="Shell.Content";var rt=e.forwardRef(({target:a,action:r="toggle",peekOnHover:s,asChild:u=!1,onClick:R,onMouseEnter:g,onMouseLeave:F,children:x,...k},T)=>{let P=ce("Shell.Trigger");e.useEffect(()=>{a==="left"&&void 0,s&&void 0},[a,s]);let i=a==="left"?"rail":a,C=de(P,i),S=C?.value===void 0?void 0:C.value!=="closed",D=f=>{if(R?.(f),f.defaultPrevented)return;let m=P.entries.get(i);m&&(P.peek===i&&ne(P,null),r==="toggle"?m.toggle("toggle"):r==="expand"?m.setValue("open","toggle"):m.setValue("closed","toggle"))},E=f=>{if(g?.(f),!s)return;let m=P.entries.get(i);m&&m.value==="closed"&&m.presentation!=="overlay"&&ne(P,i)},w=f=>{F?.(f),s&&P.peek===i&&ne(P,null)},A=u?it.Root:"button";return e.createElement(A,{...!u&&{type:"button"},"aria-controls":C?.id,"aria-expanded":S,...k,ref:T,onClick:D,onMouseEnter:E,onMouseLeave:w,"data-shell-trigger":a,"data-shell-action":r},x)});rt.displayName="Shell.Trigger";export{tt as a,nt as b,ot as c,lt as d,Ce as e,at as f,rt as g,Pt as h};
3
- //# sourceMappingURL=chunk-4LV37PHM.js.map
2
+ import{a as Ge,b as Ye}from"./chunk-4G3FJUER.js";import{a as Xe}from"./chunk-ZG2XQUOH.js";import{a as je}from"./chunk-VGJALIJ5.js";import{a as $e}from"./chunk-QRV32INS.js";import{a as Ke}from"./chunk-YMUERC2J.js";import{a as Fe,b as me}from"./chunk-3QWGSRYC.js";import{a as Pe,b as he,c as ve}from"./chunk-LTUW36HM.js";import{a as De,b as Be,c as Ve}from"./chunk-QKCNGEX4.js";import{a as Oe}from"./chunk-WEBNIUEX.js";import{a as J,b as We,c as _e,d as Ue,g as qe}from"./chunk-XUCR7L4G.js";import{a as ye}from"./chunk-G66WDIIV.js";import{c as ue,d as pe,e as we,f as fe,i as Ae,j as Ie,k as Ne}from"./chunk-YMRN5ESN.js";import{c as xe,d as ke}from"./chunk-QEDKL23P.js";import{e as ie,f as Te,h as Me,i as ne,j as ze,k as ce,l as de,n as He,o as oe}from"./chunk-GHWEXMF6.js";import{b as Ee}from"./chunk-5ON3XLRD.js";import{a as Le}from"./chunk-ANQLWGFN.js";import{a as st}from"./chunk-VQPANPMI.js";var Pt={};st(Pt,{Bottom:()=>$e,Content:()=>at,Header:()=>nt,Inspector:()=>Ke,Left:()=>ot,PaneFooter:()=>Ie,PaneHeader:()=>Ae,Panel:()=>Ce,Rail:()=>lt,Root:()=>tt,Scroll:()=>Ne,Sidebar:()=>je,Trigger:()=>rt,useResponsivePresentation:()=>Xe,useShell:()=>Ye,useSidebarMode:()=>Ge});import*as e from"react";import $ from"classnames";import{Slot as it}from"radix-ui";import{useComposedRefs as be,useLayoutEffect as ct}from"radix-ui/internal";var Re=0;function Je(a){Re=Math.max(0,Re+a);let r=document.documentElement;Re>0?r.setAttribute("data-kui-shell-lock",""):r.removeAttribute("data-kui-shell-lock")}var Se="data-kui-shell-inert",dt=30;function Q(a,r){return r===null||r===a||r===a.body||r===a.documentElement}function Qe(a,r,s){for(let u of a.querySelectorAll("[data-shell-trigger][aria-controls]"))if(!(u.getAttribute("aria-controls")!==r||u.closest("[inert]"))&&!(s&&!s.some(R=>R.contains(u))))return u;return null}var ut={values:["1","2","3"]},et=e.createContext(null),Ze=64;function ge(a){return a.querySelector(":scope > .kui-ShellContent > .kui-ShellScroll > .kui-ScrollAreaViewport")??a.querySelector(":scope > .kui-ShellContent")}var tt=e.forwardRef(({className:a,children:r,height:s="full",contained:u,size:R,style:g,onKeyDown:F,onFocus:x,...k},T)=>{let P=Ee(R,ut),[i]=e.useState(Te),C=e.useCallback(t=>Me(i,t),[i]);e.useSyncExternalStore(C,()=>i.version,()=>0);let S=e.useRef(null),D=be(T,S),[E,w]=e.useState(()=>new Set),A=e.useCallback(t=>{w(n=>n.has(t)?n:new Set(n).add(t))},[]),f=e.useCallback(t=>{w(n=>{if(!n.has(t))return n;let o=new Set(n);return o.delete(t),o})},[]),m=e.useMemo(()=>({registerInset:A,unregisterInset:f}),[A,f]),I=e.useCallback(()=>{for(let t of i.entries.values())t.overlayLive&&t.setValue("closed","dismiss")},[i]),M=e.useCallback(()=>[...i.entries.values()].filter(t=>t.overlayLive&&t.el).map(t=>({name:t.name,id:t.id,el:t.el})),[i]),y=[...i.entries.values()].filter(t=>t.overlayLive&&t.el).length,N=u===!0||s!=="full"&&s!=="auto",V=!N&&s==="full",[Z,le]=e.useState(void 0);e.useEffect(()=>{if(!V)return;let t=S.current,n=t?.ownerDocument.defaultView;if(!t||!n||typeof n.matchMedia!="function")return;let o=xe(),c=o?n.scrollY:ge(t)?.scrollTop??0,h=0,v=0,L=()=>{v&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=0})},U=()=>{o&&!v&&(c=n.scrollY)},q=l=>{!o&&!v&&l.target instanceof HTMLElement&&l.target===ge(t)&&(c=l.target.scrollTop)};n.addEventListener("resize",L),n.addEventListener("scroll",U,{passive:!0}),t.addEventListener("scroll",q,{passive:!0,capture:!0});let se=ke(l=>{o=l;let d=c;h&&cancelAnimationFrame(h),h=requestAnimationFrame(()=>{if(h=0,l)n.scrollTo(0,d);else{let p=ge(t);p&&(p.scrollTop=d)}})});return()=>{h&&cancelAnimationFrame(h),v&&cancelAnimationFrame(v),n.removeEventListener("resize",L),n.removeEventListener("scroll",U),t.removeEventListener("scroll",q,{capture:!0}),se()}},[V]);let K=e.useCallback(()=>{let t=S.current;if(!t)return;let n=M().map(o=>o.el);for(let o of t.children){if(!(o instanceof HTMLElement)||o.classList.contains("kui-ShellScrim"))continue;let c=n.some(h=>o===h||o.contains(h));n.length===0||c?o.hasAttribute(Se)&&(o.removeAttribute(Se),o.inert=!1):o.inert||(o.setAttribute(Se,""),o.inert=!0)}},[M]),j=e.useRef(null),G=e.useRef([]),ee=e.useRef(null),O=e.useRef(!1),z=e.useRef(0),W=e.useCallback(()=>{z.current&&cancelAnimationFrame(z.current),z.current=0},[]),_=e.useCallback((t,n)=>{W();let o=0,c=()=>{if(z.current=0,!!t.isConnected){if(n(t.ownerDocument.activeElement)){t.focus({preventScroll:!0});return}o+=1,o<dt&&(z.current=requestAnimationFrame(c))}};z.current=requestAnimationFrame(c)},[W]);e.useEffect(()=>()=>{W(),O.current&&(O.current=!1,Je(-1))},[W]),e.useEffect(()=>{let t=S.current;if(!t)return;let n=t.ownerDocument,o=M(),c=o.map(l=>l.el),h=!N&&o.length>0;h!==O.current&&(O.current=h,Je(h?1:-1));let v=G.current;G.current=o;let L=v.filter(l=>{if(c.includes(l.el))return!1;let d=i.entries.get(l.name);return!l.el.isConnected||!d||d.el!==l.el||d.value==="closed"}),U=l=>l!==null&&L.some(d=>d.el.contains(l));if(v.length===0&&o.length>0){let l=n.activeElement,d=l instanceof HTMLElement&&!Q(n,l)&&!c.some(p=>p.contains(l))?l:null;if(d&&!t.contains(d)){let p=ee.current;p&&p.isConnected&&!c.some(te=>te.contains(p))&&(d=p)}j.current=d}if(K(),o.length===0){let l=j.current;if(j.current=null,L.length===0)return;let p=(H=>H!==null&&H.isConnected&&!H.closest("[inert]")&&!U(H))(l)?l:null;for(let H of L)p??(p=Qe(n,H.id));if(!p)return;let te=H=>Q(n,H)||U(H);te(n.activeElement)?p.focus({preventScroll:!0}):_(p,te);return}if(L.length>0){let l=n.activeElement;if(Q(n,l)||U(l)){let d=null;for(let p of L)d??(d=Qe(n,p.id,c));(d??c[c.length-1]).focus({preventScroll:!0})}}let q=c.filter(l=>!v.some(d=>d.el===l)),se=n.activeElement;q.length>0&&!c.some(l=>l.contains(se))&&(q[0].focus({preventScroll:!0}),_(q[0],l=>Q(n,l)||l instanceof Element&&l.closest("[inert]")!==null))}),e.useEffect(()=>{let t=S.current;if(!t||y===0||typeof MutationObserver>"u")return;let n=new MutationObserver(K);return n.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["inert"]}),()=>n.disconnect()},[y,K]);let Y=t=>{F?.(t),!(t.key!=="Escape"||t.defaultPrevented||y===0)&&(I(),t.stopPropagation())};e.useEffect(()=>{let t=S.current;if(!t||y===0)return;let n=t.ownerDocument,o=c=>{c.key!=="Escape"||c.defaultPrevented||!Q(n,c.target)||I()};return n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)},[y,I]);let ae=t=>{x?.(t),t.target instanceof HTMLElement&&S.current?.contains(t.target)&&(ee.current=t.target)},B=i.entries.get("rail"),X=B!==void 0&&B.value!==void 0&&B.value!=="closed"?E.has("rail")?`calc(${B.size}px + 2 * var(--shell-inset-gap))`:`${B.size}px`:void 0,re=s==="full"?{}:s==="auto"?{height:"auto"}:typeof s=="number"?{height:`${s}px`}:{height:s};return e.createElement(ze.Provider,{value:i},e.createElement(ue.Provider,{value:P},e.createElement(pe.Provider,{value:!1},e.createElement(we.Provider,{value:V},e.createElement(et.Provider,{value:le},e.createElement(He.Provider,{value:m},e.createElement(Le.Provider,{value:void 0},e.createElement("div",{...k,ref:D,className:$("kui-ShellRoot",a),"data-height":s==="auto"&&!N?"auto":void 0,"data-contained":N||void 0,"data-window":V||void 0,"data-has-inset":E.size>0||void 0,"data-overlay-live":y>0||void 0,onKeyDown:Y,onFocus:ae,style:{...re,...X?{"--shell-rail-offset":X}:{},...Z!==void 0?{"--kui-shell-header-h":`${Z}px`}:{},...g}},r,e.createElement("div",{className:"kui-ShellScrim","aria-hidden":!0,onClick:I})))))))))});tt.displayName="Shell.Root";var nt=e.forwardRef(({className:a,height:r=Ze,style:s,...u},R)=>{let g=e.useContext(et);return ct(()=>{if(g)return g(r===Ze?void 0:r),()=>g(void 0)},[g,r]),e.createElement("header",{...u,ref:R,className:$("kui-ShellHeader",a),style:{...s,"--shell-header-height":`${r}px`}})});nt.displayName="Shell.Header";var ot=e.forwardRef(({children:a},r)=>(e.useEffect(()=>{},[]),e.createElement(e.Fragment,null,a)));ot.displayName="Shell.Left";var pt={controlled:"open",default:"defaultOpen"},lt=e.forwardRef((a,r)=>{let{className:s,presentation:u,expandedSize:R=64,collapsible:g,onExpand:F,onCollapse:x,children:k,style:T,open:P,defaultOpen:i,onOpenChange:C,inset:S,id:D,...E}=a,{table:w,attributes:A}=ve(u,"fixed"),f=Pe({name:"rail",label:"Rail",propNames:pt,id:D,controlled:J(P),defaultValue:J(i),presentationTable:w,builtIn:We,onChange:(I,M)=>C?.(I!=="closed",{reason:M}),onExpand:F,onCollapse:x,size:R});oe("rail",S);let m=be(r,f.setElement);return e.createElement("div",{...E,role:E.role??"navigation",id:f.id,ref:m,className:$("kui-ShellPane","kui-ShellRail",s),...he(f,A),"data-inset":S||void 0,tabIndex:f.overlaying?-1:E.tabIndex,style:{...T,"--rail-size":`${R}px`}},e.createElement(ft,null,k))});lt.displayName="Shell.Rail";function ft({children:a}){let r=e.useContext(ue);return e.createElement("div",{className:$("kui-ShellRailContent",`kui-r-size-${r}`)},e.createElement(fe,{presentation:"thin"},a))}var mt={controlled:"open",default:"defaultOpen"},Ce=e.forwardRef((a,r)=>{let{className:s,presentation:u,defaultOpen:R,open:g,onOpenChange:F,size:x,defaultSize:k,expandedSize:T=288,minSize:P=100,maxSize:i=800,resizable:C=!1,collapsible:S=!0,onExpand:D,onCollapse:E,onResize:w,onResizeStart:A,onResizeEnd:f,snapPoints:m,snapTolerance:I,collapseThreshold:M,paneId:y,persistence:N,children:V,style:Z,onSizeChange:le,sizeUpdate:K,sizeUpdateMs:j=50,inset:G,id:ee,...O}=a,z=ce("Shell.Panel"),W=de(z,"rail"),_=ve(u,"fixed"),Y=u===void 0,ae=Y?W?.presentationTable??ie:_.table,B=Y?{"data-presentation-follows":""}:_.attributes,b=Pe({name:"panel",label:"Panel",propNames:mt,id:ee,controlled:J(g),defaultValue:J(R),presentationTable:ae,builtIn:_e,onChange:(v,L)=>F?.(v!=="closed",{reason:L}),onExpand:D,onCollapse:E,size:T});oe("panel",G),e.useEffect(()=>{(m!==void 0||M!==void 0||y!==void 0||N!==void 0)&&void 0},[m,M,y,N]);let X=e.useRef(null),re=be(r,b.setElement,X),t=Be({name:"panel",elementId:b.id,elementRef:X,cssVarName:"--panel-size",orientation:"vertical",edge:"end",growth:Ue,expandedSize:T,minSize:P,maxSize:i,resizable:C,collapsible:S,size:x,defaultSize:k,onSizeChange:le,sizeUpdate:K,sizeUpdateMs:j,onResize:w,onResizeStart:A,onResizeEnd:f,snapPoints:m,snapTolerance:I,collapseThreshold:M,paneId:y,persistence:N,overlaying:b.overlaying,overlayingNow:()=>(Y?z.entries.get("rail")?.presentationTable??ie:_.table)[ye()]==="overlay",requestCollapse:()=>b.setValue("closed","toggle"),requestToggle:()=>b.toggle("toggle")}),n=De(x,k,P,i),{handles:o,content:c}=Ve(V,me),h=C&&b.shown!==!1&&!b.overlaying?e.createElement(Oe.Provider,{value:t},o.length>0?o:e.createElement(Fe,null)):null;return e.createElement("div",{...qe(O),role:O.role??"navigation",id:b.id,ref:re,className:$("kui-ShellPane","kui-ShellPanel",s),...he(b,B),"data-inset":G||void 0,tabIndex:b.overlaying?-1:O.tabIndex,style:{...Z,"--panel-expanded-size":`${T}px`,...n?{"--panel-size":n}:{}}},e.createElement("div",{className:"kui-ShellPanelContent"},e.createElement(fe,null,c)),h)});Ce.displayName="Shell.Panel";Ce.Handle=me;var at=e.forwardRef(({className:a,inset:r,children:s,...u},R)=>(oe("content",r),e.createElement("main",{...u,ref:R,className:$("kui-ShellContent",a),"data-inset":r||void 0},e.createElement(pe.Provider,{value:!0},s))));at.displayName="Shell.Content";var rt=e.forwardRef(({target:a,action:r="toggle",peekOnHover:s,asChild:u=!1,onClick:R,onMouseEnter:g,onMouseLeave:F,children:x,...k},T)=>{let P=ce("Shell.Trigger");e.useEffect(()=>{a==="left"&&void 0,s&&void 0},[a,s]);let i=a==="left"?"rail":a,C=de(P,i),S=C?.value===void 0?void 0:C.value!=="closed",D=f=>{if(R?.(f),f.defaultPrevented)return;let m=P.entries.get(i);m&&(P.peek===i&&ne(P,null),r==="toggle"?m.toggle("toggle"):r==="expand"?m.setValue("open","toggle"):m.setValue("closed","toggle"))},E=f=>{if(g?.(f),!s)return;let m=P.entries.get(i);m&&m.value==="closed"&&m.presentation!=="overlay"&&ne(P,i)},w=f=>{F?.(f),s&&P.peek===i&&ne(P,null)},A=u?it.Root:"button";return e.createElement(A,{...!u&&{type:"button"},"aria-controls":C?.id,"aria-expanded":S,...k,ref:T,onClick:D,onMouseEnter:E,onMouseLeave:w,"data-shell-trigger":a,"data-shell-action":r},x)});rt.displayName="Shell.Trigger";export{tt as a,nt as b,ot as c,lt as d,Ce as e,at as f,rt as g,Pt as h};
3
+ //# sourceMappingURL=chunk-D74WY6UO.js.map
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ //# sourceMappingURL=chunk-E4KT72IB.js.map
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{a as v}from"./chunk-TGRHRMQI.js";import{a as R}from"./chunk-4KBKS3ZE.js";import{a as T}from"./chunk-LPLW7OWA.js";import{a as P}from"./chunk-L54FWKJE.js";import{c as d}from"./chunk-OKQAVYW4.js";import{a as u}from"./chunk-AQKSO3SW.js";import{c as C}from"./chunk-5ON3XLRD.js";import{a as m}from"./chunk-CLJ6SEGP.js";import{a as H}from"./chunk-VQPANPMI.js";var j={};H(j,{Anchor:()=>N,Close:()=>E,Content:()=>y,Root:()=>h,Toolbar:()=>O,Trigger:()=>g});import*as o from"react";import i from"classnames";import{Popover as p}from"radix-ui";var I=["1","2","3","4"],c={...m,size:{type:"enum",className:"kui-r-size",values:I,default:"2",responsive:!0},width:P.width,minWidth:P.minWidth,maxWidth:{...P.maxWidth,default:"480px"},...T};var b=o.createContext(null),f=e=>{let r=o.useContext(b);return r};function M({children:e}){let r=f("Navigator")?.setLabelId,t=o.useId();return o.useEffect(()=>(r?.(t),()=>r?.(void 0)),[t,r]),o.cloneElement(e,{id:t})}var z={Title:M,Close:({children:e})=>o.createElement(p.Close,{asChild:!0},e)},h=e=>o.createElement(p.Root,{...e});h.displayName="Popover.Root";var g=o.forwardRef(({children:e,...r},t)=>o.createElement(p.Trigger,{...r,ref:t,asChild:!0},v(e)));g.displayName="Popover.Trigger";var y=o.forwardRef((e,r)=>{let t=C(e,c.size),{className:s,forceMount:a,container:l,...n}=d(t,c),[A,S]=o.useState(void 0),k=o.useMemo(()=>({setLabelId:S}),[]);return o.createElement(p.Portal,{container:l,forceMount:a},o.createElement(u,{asChild:!0},o.createElement(p.Content,{align:"start",sideOffset:8,collisionPadding:10,...n,ref:r,"aria-labelledby":A??n["aria-labelledby"],className:i("kui-PopperContent","kui-PopoverContent",s)},o.createElement(b.Provider,{value:k},o.createElement(R.Provider,{value:z},t.children)))))});y.displayName="Popover.Content";var E=o.forwardRef(({children:e,...r},t)=>o.createElement(p.Close,{...r,ref:t,asChild:!0},v(e)));E.displayName="Popover.Close";var N=o.forwardRef((e,r)=>o.createElement(p.Anchor,{...e,ref:r}));N.displayName="Popover.Anchor";var x=o.forwardRef(({className:e,children:r,...t},s)=>(f("Popover.Toolbar"),o.createElement("div",{...t,ref:s,className:i("kui-PopoverToolbar",e)},r)));x.displayName="Popover.Toolbar";var w=o.forwardRef(({className:e,...r},t)=>o.createElement("div",{...r,ref:t,className:i("kui-PopoverToolbarSection","kui-PopoverToolbarLeft",e)}));w.displayName="Popover.Toolbar.Left";var D=o.forwardRef(({className:e,...r},t)=>o.createElement("div",{...r,ref:t,className:i("kui-PopoverToolbarSection","kui-PopoverToolbarCenter",e)}));D.displayName="Popover.Toolbar.Center";var L=o.forwardRef(({className:e,...r},t)=>o.createElement("div",{...r,ref:t,className:i("kui-PopoverToolbarSection","kui-PopoverToolbarRight",e)}));L.displayName="Popover.Toolbar.Right";var W=o.forwardRef(({className:e,id:r,...t},s)=>{let a=f("Popover.Toolbar.Title"),l=o.useId(),n=r??`kui-popover-toolbar-title-${l}`;return o.useEffect(()=>(a?.setLabelId(n),()=>a?.setLabelId(void 0)),[a,n]),o.createElement("span",{...t,id:n,ref:s,className:i("kui-PopoverToolbarTitle",e)})});W.displayName="Popover.Toolbar.Title";var O=Object.assign(x,{Left:w,Center:D,Right:L,Title:W});export{h as a,g as b,y as c,E as d,N as e,O as f,j as g};
3
+ //# sourceMappingURL=chunk-EQE6QQXM.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/popover.tsx", "../../src/components/popover.props.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Popover as PopoverPrimitive } from 'radix-ui';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { popoverContentPropDefs } from './popover.props.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { NavigatorHostContext, type NavigatorHost } from './_internal/navigator-host.js';\n\nimport type { PopoverContentOwnProps } from './popover.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\n// ---------------------------------------------\n// Popover Content Context\n// ---------------------------------------------\ntype PopoverContentContextValue = {\n /** Wire up aria-labelledby for toolbar title */\n setLabelId: (id: string | undefined) => void;\n};\n\nconst PopoverContentContext = React.createContext<PopoverContentContextValue | null>(null);\nconst usePopoverContentContext = (caller: string) => {\n const ctx = React.useContext(PopoverContentContext);\n if (!ctx) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`${caller} must be used within Popover.Content`);\n }\n }\n return ctx;\n};\n\ninterface PopoverRootProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\n/** A Navigator screen's title names the popover through the content's label. */\nfunction PopoverNavigatorTitle({ children }: { children: React.ReactElement<{ id?: string }> }) {\n const setLabelId = usePopoverContentContext('Navigator')?.setLabelId;\n const id = React.useId();\n React.useEffect(() => {\n setLabelId?.(id);\n return () => setLabelId?.(undefined);\n }, [id, setLabelId]);\n return React.cloneElement(children, { id });\n}\n\nconst popoverNavigatorHost: NavigatorHost = {\n Title: PopoverNavigatorTitle,\n Close: ({ children }) => <PopoverPrimitive.Close asChild>{children}</PopoverPrimitive.Close>,\n};\n\nconst PopoverRoot: React.FC<PopoverRootProps> = (props: PopoverRootProps) => (\n <PopoverPrimitive.Root {...props} />\n);\nPopoverRoot.displayName = 'Popover.Root';\n\ntype PopoverTriggerElement = React.ElementRef<typeof PopoverPrimitive.Trigger>;\ninterface PopoverTriggerProps\n extends ComponentPropsWithout<typeof PopoverPrimitive.Trigger, RemovedProps> {}\nconst PopoverTrigger = React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <PopoverPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </PopoverPrimitive.Trigger>\n ),\n);\nPopoverTrigger.displayName = 'Popover.Trigger';\n\ntype PopoverContentElement = React.ElementRef<typeof PopoverPrimitive.Content>;\ninterface PopoverContentProps\n extends ComponentPropsWithout<typeof PopoverPrimitive.Content, RemovedProps>,\n PopoverContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>['container'];\n}\nconst PopoverContent = React.forwardRef<PopoverContentElement, PopoverContentProps>(\n (ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, popoverContentPropDefs.size);\n const {\n className,\n forceMount,\n container,\n ...contentProps\n } = extractProps(props, popoverContentPropDefs);\n\n const [labelId, setLabelId] = React.useState<string | undefined>(undefined);\n const contextValue = React.useMemo(() => ({ setLabelId }), []);\n\n return (\n <PopoverPrimitive.Portal container={container} forceMount={forceMount}>\n <PortalTheme asChild>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={8}\n collisionPadding={10}\n {...contentProps}\n ref={forwardedRef}\n // A Toolbar.Title names the panel; without one, the caller's own value stands.\n aria-labelledby={labelId ?? contentProps['aria-labelledby']}\n className={classNames('kui-PopperContent', 'kui-PopoverContent', className)}\n >\n <PopoverContentContext.Provider value={contextValue}>\n <NavigatorHostContext.Provider value={popoverNavigatorHost}>{props.children}</NavigatorHostContext.Provider>\n </PopoverContentContext.Provider>\n </PopoverPrimitive.Content>\n </PortalTheme>\n </PopoverPrimitive.Portal>\n );\n },\n);\nPopoverContent.displayName = 'Popover.Content';\n\ntype PopoverCloseElement = React.ElementRef<typeof PopoverPrimitive.Close>;\ninterface PopoverCloseProps\n extends ComponentPropsWithout<typeof PopoverPrimitive.Close, RemovedProps> {}\nconst PopoverClose = React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n ({ children, ...props }, forwardedRef) => (\n <PopoverPrimitive.Close {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </PopoverPrimitive.Close>\n ),\n);\nPopoverClose.displayName = 'Popover.Close';\n\ntype PopoverAnchorElement = React.ElementRef<typeof PopoverPrimitive.Anchor>;\ninterface PopoverAnchorProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Anchor> {}\nconst PopoverAnchor = React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n (props, forwardedRef) => <PopoverPrimitive.Anchor {...props} ref={forwardedRef} />,\n);\n\nPopoverAnchor.displayName = 'Popover.Anchor';\n\n// ---------------------------------------------\n// Toolbar (Popover-only)\n// ---------------------------------------------\n\ntype PopoverToolbarElement = HTMLDivElement;\ntype PopoverToolbarProps = React.ComponentPropsWithoutRef<'div'>;\n\nconst PopoverToolbarBase = React.forwardRef<PopoverToolbarElement, PopoverToolbarProps>(\n ({ className, children, ...props }, forwardedRef) => {\n // The toolbar is sticky in the content's own CSS, so it needs no measuring; this only warns\n // when it is used outside Popover.Content.\n usePopoverContentContext('Popover.Toolbar');\n\n return (\n <div {...props} ref={forwardedRef} className={classNames('kui-PopoverToolbar', className)}>\n {children}\n </div>\n );\n },\n);\nPopoverToolbarBase.displayName = 'Popover.Toolbar';\n\ntype PopoverToolbarSectionProps = React.ComponentPropsWithoutRef<'div'>;\n\nconst PopoverToolbarLeft = React.forwardRef<HTMLDivElement, PopoverToolbarSectionProps>(\n ({ className, ...props }, ref) => (\n <div\n {...props}\n ref={ref}\n className={classNames('kui-PopoverToolbarSection', 'kui-PopoverToolbarLeft', className)}\n />\n ),\n);\nPopoverToolbarLeft.displayName = 'Popover.Toolbar.Left';\n\nconst PopoverToolbarCenter = React.forwardRef<HTMLDivElement, PopoverToolbarSectionProps>(\n ({ className, ...props }, ref) => (\n <div\n {...props}\n ref={ref}\n className={classNames('kui-PopoverToolbarSection', 'kui-PopoverToolbarCenter', className)}\n />\n ),\n);\nPopoverToolbarCenter.displayName = 'Popover.Toolbar.Center';\n\nconst PopoverToolbarRight = React.forwardRef<HTMLDivElement, PopoverToolbarSectionProps>(\n ({ className, ...props }, ref) => (\n <div\n {...props}\n ref={ref}\n className={classNames('kui-PopoverToolbarSection', 'kui-PopoverToolbarRight', className)}\n />\n ),\n);\nPopoverToolbarRight.displayName = 'Popover.Toolbar.Right';\n\ntype PopoverToolbarTitleProps = React.ComponentPropsWithoutRef<'span'>;\nconst PopoverToolbarTitle = React.forwardRef<HTMLSpanElement, PopoverToolbarTitleProps>(\n ({ className, id: idProp, ...props }, ref) => {\n const ctx = usePopoverContentContext('Popover.Toolbar.Title');\n const reactId = React.useId();\n const id = idProp ?? `kui-popover-toolbar-title-${reactId}`;\n React.useEffect(() => {\n ctx?.setLabelId(id);\n return () => ctx?.setLabelId(undefined);\n }, [ctx, id]);\n return (\n <span\n {...props}\n id={id}\n ref={ref}\n className={classNames('kui-PopoverToolbarTitle', className)}\n />\n );\n },\n);\nPopoverToolbarTitle.displayName = 'Popover.Toolbar.Title';\n\ntype PopoverToolbarComponent = React.ForwardRefExoticComponent<\n React.PropsWithoutRef<PopoverToolbarProps> & React.RefAttributes<HTMLDivElement>\n> & {\n Left: typeof PopoverToolbarLeft;\n Center: typeof PopoverToolbarCenter;\n Right: typeof PopoverToolbarRight;\n Title: typeof PopoverToolbarTitle;\n};\n\nconst PopoverToolbar = Object.assign(PopoverToolbarBase, {\n Left: PopoverToolbarLeft,\n Center: PopoverToolbarCenter,\n Right: PopoverToolbarRight,\n Title: PopoverToolbarTitle,\n}) as PopoverToolbarComponent;\n\nexport {\n PopoverRoot as Root,\n PopoverContent as Content,\n PopoverTrigger as Trigger,\n PopoverClose as Close,\n PopoverAnchor as Anchor,\n PopoverToolbar as Toolbar,\n};\nexport type {\n PopoverRootProps as RootProps,\n PopoverContentProps as ContentProps,\n PopoverTriggerProps as TriggerProps,\n PopoverCloseProps as CloseProps,\n PopoverAnchorProps as AnchorProps,\n PopoverToolbarProps as ToolbarProps,\n PopoverToolbarSectionProps as ToolbarSectionProps,\n PopoverToolbarTitleProps as ToolbarTitleProps,\n};\n", "import { asChildPropDef } from '../props/as-child.prop.js';\nimport { heightPropDefs } from '../props/height.props.js';\nimport { widthPropDefs } from '../props/width.props.js';\n\nimport type { PropDef, GetPropDefTypes } from '../props/prop-def.js';\n\nconst contentSizes = ['1', '2', '3', '4'] as const;\n\nconst popoverContentPropDefs = {\n ...asChildPropDef,\n size: {\n type: 'enum',\n className: 'kui-r-size',\n values: contentSizes,\n default: '2',\n responsive: true,\n },\n width: widthPropDefs.width,\n minWidth: widthPropDefs.minWidth,\n maxWidth: { ...widthPropDefs.maxWidth, default: '480px' },\n ...heightPropDefs,\n} satisfies {\n width: PropDef<string>;\n minWidth: PropDef<string>;\n maxWidth: PropDef<string>;\n size: PropDef<(typeof contentSizes)[number]>;\n};\n\ntype PopoverContentOwnProps = GetPropDefTypes<\n typeof popoverContentPropDefs &\n typeof asChildPropDef &\n typeof widthPropDefs &\n typeof heightPropDefs\n>;\n\nexport { popoverContentPropDefs };\nexport type { PopoverContentOwnProps };\n"],
5
+ "mappings": ";wWAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,UAAAC,EAAA,YAAAC,EAAA,SAAAC,EAAA,YAAAC,EAAA,YAAAC,IAAA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,WAAWC,MAAwB,WCI5C,IAAMC,EAAe,CAAC,IAAK,IAAK,IAAK,GAAG,EAElCC,EAAyB,CAC7B,GAAGC,EACH,KAAM,CACJ,KAAM,OACN,UAAW,aACX,OAAQF,EACR,QAAS,IACT,WAAY,EACd,EACA,MAAOG,EAAc,MACrB,SAAUA,EAAc,SACxB,SAAU,CAAE,GAAGA,EAAc,SAAU,QAAS,OAAQ,EACxD,GAAGC,CACL,EDCA,IAAMC,EAA8B,gBAAiD,IAAI,EACnFC,EAA4BC,GAAmB,CACnD,IAAMC,EAAY,aAAWH,CAAqB,EAMlD,OAAOG,CACT,EAIA,SAASC,EAAsB,CAAE,SAAAC,CAAS,EAAsD,CAC9F,IAAMC,EAAaL,EAAyB,WAAW,GAAG,WACpDM,EAAW,QAAM,EACvB,OAAM,YAAU,KACdD,IAAaC,CAAE,EACR,IAAMD,IAAa,MAAS,GAClC,CAACC,EAAID,CAAU,CAAC,EACN,eAAaD,EAAU,CAAE,GAAAE,CAAG,CAAC,CAC5C,CAEA,IAAMC,EAAsC,CAC1C,MAAOJ,E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AM,YAAU,KACdnC,GAAK,WAAWI,CAAE,EACX,IAAMJ,GAAK,WAAW,MAAS,GACrC,CAACA,EAAKI,CAAE,CAAC,EAEV,gBAAC,QACE,GAAGI,EACJ,GAAIJ,EACJ,IAAK0B,EACL,UAAWN,EAAW,0BAA2BR,CAAS,EAC5D,CAEJ,CACF,EACAiB,EAAoB,YAAc,wBAWlC,IAAMG,EAAiB,OAAO,OAAOR,EAAoB,CACvD,KAAMC,EACN,OAAQE,EACR,MAAOC,EACP,MAAOC,CACT,CAAC",
6
+ "names": ["popover_exports", "__export", "PopoverAnchor", "PopoverClose", "PopoverContent", "PopoverRoot", "PopoverToolbar", "PopoverTrigger", "React", "classNames", "PopoverPrimitive", "contentSizes", "popoverContentPropDefs", "asChildPropDef", "widthPropDefs", "heightPropDefs", "PopoverContentContext", "usePopoverContentContext", "caller", "ctx", "PopoverNavigatorTitle", "children", "setLabelId", "id", "popoverNavigatorHost", "PopoverPrimitive", "PopoverRoot", "props", "PopoverTrigger", "forwardedRef", "requireReactElement", "PopoverContent", "ownProps", "useThemeSizeProps", "popoverContentPropDefs", "className", "forceMount", "container", "contentProps", "extractProps", "labelId", "contextValue", "PortalTheme", "classNames", "NavigatorHostContext", "PopoverClose", "PopoverAnchor", "PopoverToolbarBase", "PopoverToolbarLeft", "ref", "PopoverToolbarCenter", "PopoverToolbarRight", "PopoverToolbarTitle", "idProp", "reactId", "PopoverToolbar"]
7
+ }
@@ -1,2 +1,2 @@
1
1
  import{a as r}from"./chunk-P7VSZYG3.js";import{a as t}from"./chunk-UMYPLUG3.js";import{b as s}from"./chunk-KRJTW535.js";import{c as e}from"./chunk-CUNKWFKA.js";var o=["1","2","3","4"],a=["raised","surface","soft","ghost","outline"],d={size:{type:"enum",className:"kui-r-size",values:o,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:a,default:"raised"},error:{type:"boolean",default:!1},errorMessage:{type:"string",default:void 0},required:{type:"boolean",default:!1},"aria-describedby":{type:"string",default:void 0},"aria-labelledby":{type:"string",default:void 0},...e,...s},i=["raised","surface","soft","outline","ghost"],b={size:{type:"enum",className:"kui-r-size",values:o,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:i,default:"raised"},disabled:{type:"boolean",default:!1},...e,...s},p=["left","right"],c={side:{type:"enum",values:p},...e,gap:t.gap,px:r.px,pl:r.pl,pr:r.pr};export{d as a,b,c};
2
- //# sourceMappingURL=chunk-FIMFM25N.js.map
2
+ //# sourceMappingURL=chunk-EXF5SF27.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/text-field.props.tsx"],
4
- "sourcesContent": ["import { colorPropDef } from '../props/color.prop.js';\nimport { paddingPropDefs } from '../props/padding.props.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\nimport { flexPropDefs } from './flex.props.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\nconst variants = ['raised', 'surface', 'soft', 'ghost', 'outline'] as const;\n\nconst textFieldRootPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: variants, default: 'raised' },\n // Error and validation props\n error: { type: 'boolean', default: false },\n errorMessage: { type: 'string', default: undefined },\n required: { type: 'boolean', default: false },\n // Accessibility props\n 'aria-describedby': { type: 'string', default: undefined },\n 'aria-labelledby': { type: 'string', default: undefined },\n ...colorPropDef,\n ...radiusPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n error: PropDef<boolean>;\n errorMessage: PropDef<string | undefined>;\n required: PropDef<boolean>;\n 'aria-describedby': PropDef<string | undefined>;\n 'aria-labelledby': PropDef<string | undefined>;\n};\n\n// Ghost is the dividers alone: no fill, no edge.\nconst groupVariants = ['raised', 'surface', 'soft', 'outline', 'ghost'] as const;\n\nconst textFieldGroupPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: groupVariants, default: 'raised' },\n disabled: { type: 'boolean', default: false },\n ...colorPropDef,\n ...radiusPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof groupVariants)[number]>;\n disabled: PropDef<boolean>;\n};\n\nconst sides = ['left', 'right'] as const;\n\nconst textFieldSlotPropDefs = {\n side: { type: 'enum', values: sides },\n ...colorPropDef,\n gap: flexPropDefs.gap,\n px: paddingPropDefs.px,\n pl: paddingPropDefs.pl,\n pr: paddingPropDefs.pr,\n} satisfies {\n side: PropDef<(typeof sides)[number]>;\n gap: typeof flexPropDefs.gap;\n px: typeof paddingPropDefs.px;\n pl: typeof paddingPropDefs.pl;\n pr: typeof paddingPropDefs.pr;\n};\n\n/** Scrubbing props for TextField.Slot - handled separately from PropDef system */\ninterface TextFieldSlotScrubProps {\n /** Enable scrubbing behavior on this slot */\n scrub?: boolean;\n /** Current value (required for min/max clamping to work correctly) */\n scrubValue?: number;\n /** Base value change per movement unit (default: 1) */\n scrubStep?: number;\n /** Pixels of movement per step - higher = less sensitive (default: 1) */\n scrubSensitivity?: number;\n /** Minimum allowed value */\n scrubMin?: number;\n /** Maximum allowed value */\n scrubMax?: number;\n /** Step multiplier when Shift is held (default: 10) */\n scrubShiftMultiplier?: number;\n /** Step multiplier when Alt/Option is held (default: 0.1) */\n scrubAltMultiplier?: number;\n /**\n * Callback fired during scrubbing with the value delta\n * @param delta - The change in value\n * @param isChanging - true while dragging, false when released\n */\n onScrub?: (delta: number, isChanging: boolean) => void;\n}\n\nexport type { TextFieldSlotScrubProps };\n\nexport { textFieldRootPropDefs, textFieldGroupPropDefs, textFieldSlotPropDefs };\n"],
4
+ "sourcesContent": ["import { colorPropDef } from '../props/color.prop.js';\nimport { paddingPropDefs } from '../props/padding.props.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\nimport { flexPropDefs } from './flex.props.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\nconst variants = ['raised', 'surface', 'soft', 'ghost', 'outline'] as const;\n\nconst textFieldRootPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: variants, default: 'raised' },\n // Error and validation props\n error: { type: 'boolean', default: false },\n errorMessage: { type: 'string', default: undefined },\n required: { type: 'boolean', default: false },\n // Accessibility props\n 'aria-describedby': { type: 'string', default: undefined },\n 'aria-labelledby': { type: 'string', default: undefined },\n ...colorPropDef,\n ...radiusPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n error: PropDef<boolean>;\n errorMessage: PropDef<string | undefined>;\n required: PropDef<boolean>;\n 'aria-describedby': PropDef<string | undefined>;\n 'aria-labelledby': PropDef<string | undefined>;\n};\n\n// Ghost is the dividers alone: no fill, no edge.\nconst groupVariants = ['raised', 'surface', 'soft', 'outline', 'ghost'] as const;\n\nconst textFieldGroupPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: groupVariants, default: 'raised' },\n disabled: { type: 'boolean', default: false },\n ...colorPropDef,\n ...radiusPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof groupVariants)[number]>;\n disabled: PropDef<boolean>;\n};\n\nconst sides = ['left', 'right'] as const;\n\nconst textFieldSlotPropDefs = {\n side: { type: 'enum', values: sides },\n ...colorPropDef,\n gap: flexPropDefs.gap,\n px: paddingPropDefs.px,\n pl: paddingPropDefs.pl,\n pr: paddingPropDefs.pr,\n} satisfies {\n side: PropDef<(typeof sides)[number]>;\n gap: typeof flexPropDefs.gap;\n px: typeof paddingPropDefs.px;\n pl: typeof paddingPropDefs.pl;\n pr: typeof paddingPropDefs.pr;\n};\n\n/** Scrubbing props for TextField.Slot - handled separately from PropDef system */\ninterface TextFieldSlotScrubProps {\n /**\n * Drag the slot to change the value; Up and Down on the input step it once. Ignored while the\n * field is disabled or read-only.\n */\n scrub?: boolean;\n /** Current value (required for min/max clamping to work correctly) */\n scrubValue?: number;\n /** Base value change per movement unit (default: 1) */\n scrubStep?: number;\n /** Pixels of movement per step - higher = less sensitive (default: 1) */\n scrubSensitivity?: number;\n /** Minimum allowed value */\n scrubMin?: number;\n /** Maximum allowed value */\n scrubMax?: number;\n /** Step multiplier when Shift is held (default: 10) */\n scrubShiftMultiplier?: number;\n /** Step multiplier when Alt/Option is held (default: 0.1) */\n scrubAltMultiplier?: number;\n /**\n * Callback fired during scrubbing with the value delta\n * @param delta - The change in value\n * @param isChanging - true while dragging, false when released\n */\n onScrub?: (delta: number, isChanging: boolean) => void;\n}\n\nexport type { TextFieldSlotScrubProps };\n\nexport { textFieldRootPropDefs, textFieldGroupPropDefs, textFieldSlotPropDefs };\n"],
5
5
  "mappings": "gKAOA,IAAMA,EAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,EAC3BC,EAAW,CAAC,SAAU,UAAW,OAAQ,QAAS,SAAS,EAE3DC,EAAwB,CAC5B,KAAM,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQF,EAAO,QAAS,IAAK,WAAY,EAAK,EAC7F,QAAS,CAAE,KAAM,OAAQ,UAAW,cAAe,OAAQC,EAAU,QAAS,QAAS,EAEvF,MAAO,CAAE,KAAM,UAAW,QAAS,EAAM,EACzC,aAAc,CAAE,KAAM,SAAU,QAAS,MAAU,EACnD,SAAU,CAAE,KAAM,UAAW,QAAS,EAAM,EAE5C,mBAAoB,CAAE,KAAM,SAAU,QAAS,MAAU,EACzD,kBAAmB,CAAE,KAAM,SAAU,QAAS,MAAU,EACxD,GAAGE,EACH,GAAGC,CACL,EAWMC,EAAgB,CAAC,SAAU,UAAW,OAAQ,UAAW,OAAO,EAEhEC,EAAyB,CAC7B,KAAM,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQN,EAAO,QAAS,IAAK,WAAY,EAAK,EAC7F,QAAS,CAAE,KAAM,OAAQ,UAAW,cAAe,OAAQK,EAAe,QAAS,QAAS,EAC5F,SAAU,CAAE,KAAM,UAAW,QAAS,EAAM,EAC5C,GAAGF,EACH,GAAGC,CACL,EAMMG,EAAQ,CAAC,OAAQ,OAAO,EAExBC,EAAwB,CAC5B,KAAM,CAAE,KAAM,OAAQ,OAAQD,CAAM,EACpC,GAAGJ,EACH,IAAKM,EAAa,IAClB,GAAIC,EAAgB,GACpB,GAAIA,EAAgB,GACpB,GAAIA,EAAgB,EACtB",
6
6
  "names": ["sizes", "variants", "textFieldRootPropDefs", "colorPropDef", "radiusPropDef", "groupVariants", "textFieldGroupPropDefs", "sides", "textFieldSlotPropDefs", "flexPropDefs", "paddingPropDefs"]
7
7
  }
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{a as se,b as ie}from"./chunk-MJKVVGGV.js";import{a as ne}from"./chunk-WUCBFB25.js";import{a as ae}from"./chunk-TGRHRMQI.js";import{a as Y}from"./chunk-BUXK5VGR.js";import{b as Z,c as ee}from"./chunk-GKDGNPBD.js";import{c as X}from"./chunk-5KMEUZWN.js";import{a as Q}from"./chunk-LPLW7OWA.js";import{a as I}from"./chunk-L54FWKJE.js";import{c as O}from"./chunk-OKQAVYW4.js";import{a as re}from"./chunk-AQKSO3SW.js";import{b as te}from"./chunk-FVRVBB6O.js";import{b as oe}from"./chunk-5ON3XLRD.js";import{c as W}from"./chunk-HBWBPBSA.js";import{b as J}from"./chunk-XU74PNM2.js";import{a as Le}from"./chunk-VQPANPMI.js";var je={};Le(je,{Content:()=>ye,Empty:()=>Se,Group:()=>Ve,Input:()=>Re,Item:()=>Te,Label:()=>Ee,List:()=>ve,Root:()=>Pe,Separator:()=>ke,Trigger:()=>ge,Value:()=>he});import*as e from"react";import d from"classnames";import{Popover as me}from"radix-ui";import{useCallbackRef as H,useComposedRefs as pe,useControllableState as A,useLayoutEffect as K}from"radix-ui/internal";import{Command as T,useCommandState as ce}from"cmdk";var Oe=["1","2","3","4"],G={size:{type:"enum",className:"kui-r-size",values:Oe,default:"2",responsive:!0}},ze=["raised","surface","soft","outline","ghost"],le={variant:{type:"enum",className:"kui-variant",values:ze,default:"raised"},error:{type:"boolean"},loading:{type:"boolean"},disabled:{type:"boolean"},readOnly:{type:"boolean"},...W,...J,width:I.width,placeholder:{type:"string"}},Me=["1","2","3","4"],z={size:{type:"enum",className:"kui-r-size",values:Me,default:"2",responsive:!0},...W,width:I.width,minWidth:I.minWidth,maxWidth:{...I.maxWidth,default:"480px"},...Q};var Fe={size:G.size},Be={size:z.size},be=new Set;function We(o){be.has(o)||(be.add(o),console.warn(o))}function Ge(o){let r=o,t=new Set;return{get:()=>r,set:a=>{Object.is(a,r)||(r=a,t.forEach(n=>n()))},subscribe:a=>(t.add(a),()=>{t.delete(a)})}}var ue=e.createContext(null),M=o=>{let r=e.useContext(ue);if(!r)throw new Error(`Combobox.${o} must be used within Combobox.Root`);return r},de=e.createContext(null),fe=e.createContext(null),Ce=e.createContext(null),xe=()=>e.useContext(Ce);function Ae(o){let r=o.getAttribute("aria-label")?.trim();if(r)return r;let t=o.getAttribute("aria-labelledby");if(t){let n=t.split(/\s+/).map(s=>o.ownerDocument.getElementById(s)?.textContent?.trim()).filter(Boolean).join(" ");if(n)return n}let a=o.labels;if(a&&a.length>0){let n=Array.from(a).map(s=>s.textContent?.trim()).filter(Boolean).join(" ");if(n)return n}}var Pe=o=>{let{children:r,size:t,value:a,defaultValue:n=null,onValueChange:s,open:m,defaultOpen:f=!1,onOpenChange:l,placeholder:c="Select an option",searchPlaceholder:P="Search...",searchValue:g,defaultSearchValue:h="",onSearchValueChange:y,filter:C,shouldFilter:i=!0,loop:b=!0,disabled:R,resetSearchOnSelect:x=!0,resetSearchOnClose:S=!0,color:V,displayValue:v,...k}=o,u=oe(t,G.size),[E,w]=A({prop:m,defaultProp:f,onChange:l}),[p,we]=A({prop:a,defaultProp:n,onChange:s}),[q,N]=A({prop:g,defaultProp:h,onChange:y}),$=typeof v=="function"?v(p):v,[D]=e.useState(()=>Ge(p));K(()=>{D.set(p)},[D,p]);let F=H(L=>{w(L),!L&&S&&N("")}),_=H(L=>{we(L),w(!1),x&&N("")}),B=e.useRef(null),U=e.useCallback(()=>B.current?Ae(B.current):void 0,[]),Ie=e.useMemo(()=>({value:p,displayValue:$,setOpen:F,size:u,placeholder:c,searchPlaceholder:P,disabled:R,color:V,loop:b,shouldFilter:i,filter:C,triggerRef:B,getTriggerLabel:U}),[p,$,F,u,c,P,R,V,b,i,C,U]),Ne=e.useMemo(()=>({value:q,setValue:N}),[q,N]),De=e.useMemo(()=>({store:D,onSelect:_,disabled:R}),[D,_,R]);return e.createElement(ue.Provider,{value:Ie},e.createElement(de.Provider,{value:Ne},e.createElement(fe.Provider,{value:De},e.createElement(se,{open:E,onOpenChange:F,...k},r))))};Pe.displayName="Combobox.Root";var ge=e.forwardRef((o,r)=>{let t=M("Trigger"),{children:a,className:n,placeholder:s,disabled:m,readOnly:f,error:l,loading:c,color:P,radius:g,onClick:h,onKeyDown:y,type:C,...i}=O({size:t.size,...o},Fe,le),b=m??t.disabled,R=P??t.color,x=!!(f||c),S=t.value==null&&t.displayValue==null,V=pe(r,t.triggerRef),{getTriggerLabel:v}=t;e.useEffect(()=>{},[v]);let k=p=>{h?.(p),x&&p.preventDefault()},u=p=>{y?.(p),!(p.defaultPrevented||x||b)&&(p.key==="ArrowDown"||p.key==="ArrowUp")&&(p.preventDefault(),t.setOpen(!0))},E=e.createElement("span",{className:"kui-SelectIcon kui-SelectLoadingIcon","aria-hidden":"true"},e.createElement(Y,null)),w=e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-SelectTriggerInner"},e.createElement("span",{className:"kui-ComboboxValue"},t.displayValue??t.value??s??t.placeholder)),c?E:e.createElement(ee,{className:"kui-SelectIcon"}));return e.createElement(ie,{disabled:b},e.createElement("button",{"data-accent-color":R,"data-radius":g,"data-error":l,"data-loading":c,"data-disabled":b||void 0,"data-read-only":f||void 0,"data-placeholder":S?"":void 0,...i,role:"combobox","aria-disabled":b||i["aria-disabled"],"aria-readonly":f||i["aria-readonly"],"aria-invalid":l||i["aria-invalid"],"aria-busy":c||i["aria-busy"],type:C??"button",disabled:b,onClick:k,onKeyDown:u,ref:V,className:d("kui-reset","kui-SelectTrigger","kui-ComboboxTrigger",n)},a?e.createElement(e.Fragment,null,ae(a),c?E:null):w))});ge.displayName="Combobox.Trigger";var he=e.forwardRef(({placeholder:o,children:r,className:t,...a},n)=>{let s=M("Value"),m=s.displayValue??s.value??void 0;return e.createElement("span",{...a,ref:n,className:d("kui-ComboboxValue",t)},m??r??o??s.placeholder)});he.displayName="Combobox.Value";function He(){let o=ce(n=>n.filtered.count),r=ce(n=>n.search),[t,a]=e.useState("");return e.useEffect(()=>{let n=r?o===0?"No results":`${o} result${o===1?"":"s"}`:"",s=window.setTimeout(()=>a(n),r?400:0);return()=>window.clearTimeout(s)},[o,r]),e.createElement(ne,{role:"status","aria-live":"polite","aria-atomic":"true"},t)}var ye=e.forwardRef((o,r)=>{let t=M("Content"),a=te(),n=o.size??t.size??z.size.default,{className:s,children:m,color:f,forceMount:l,container:c,onOpenAutoFocus:P,"aria-label":g,"aria-labelledby":h,...y}=O({...o,size:n},z),C=f||t.color||a.accentColor,{getTriggerLabel:i}=t,[b,R]=e.useState(i);K(()=>{if(b!==void 0)return;let u=i();u!==void 0&&R(u)},[i,b]);let x=o["aria-label"]??b,S=e.useMemo(()=>({sizeClassName:O({size:n},Be).className||void 0,color:C,label:x}),[n,C,x]),V=e.useRef(null),v=u=>{if(P?.(u),u.defaultPrevented)return;let E=V.current;if(!E||E.querySelector("[cmdk-input]"))return;u.preventDefault(),(E.querySelector("[cmdk-list]")??E).focus({preventScroll:!0})},k=t.value?.trim()||void 0;return e.createElement(me.Portal,{container:c,forceMount:l?!0:void 0},e.createElement(re,{asChild:!0},e.createElement(me.Content,{"data-accent-color":C,align:"start",sideOffset:4,collisionPadding:10,"aria-label":h?void 0:x,"aria-labelledby":h,...y,forceMount:l?!0:void 0,onOpenAutoFocus:v,ref:r,className:d("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-ComboboxContent",s)},e.createElement(Ce.Provider,{value:S},e.createElement(T,{ref:V,loop:t.loop,shouldFilter:t.shouldFilter,filter:t.filter,label:x,defaultValue:k,className:"kui-ComboboxCommand"},m,e.createElement(He,null))))))});ye.displayName="Combobox.Content";var Re=e.forwardRef(({className:o,startAdornment:r,endAdornment:t,placeholder:a,variant:n,value:s,onValueChange:m,...f},l)=>{let c=M("Input"),P=e.useContext(de),g=xe(),h=n??"soft",y=s??P?.value??"",C=m??P?.setValue,i=e.createElement("div",{className:d("kui-TextFieldRoot","kui-ComboboxInputRoot",g?.sizeClassName,`kui-variant-${h}`),"data-accent-color":g?.color},r?e.createElement("div",{className:"kui-TextFieldSlot"},r):null,e.createElement(T.Input,{...f,ref:l,value:y,onValueChange:C,placeholder:a??c.searchPlaceholder,className:d("kui-reset","kui-TextFieldInput",o)}),t?e.createElement("div",{className:"kui-TextFieldSlot","data-side":"right"},t):null);return g?e.createElement("div",{className:"kui-ComboboxSearch"},i):i});Re.displayName="Combobox.Input";var ve=e.forwardRef(({className:o,children:r,label:t,...a},n)=>{let s=xe();return e.createElement("div",{className:"kui-ComboboxScrollArea"},e.createElement("div",{className:d("kui-BaseMenuViewport","kui-ComboboxViewport")},e.createElement(T.List,{...a,label:t??s?.label,ref:n,className:d("kui-ComboboxList",o)},r)))});ve.displayName="Combobox.List";var Se=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Empty,{...r,ref:t,className:d("kui-ComboboxEmpty",o)}));Se.displayName="Combobox.Empty";var Ve=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Group,{...r,ref:t,className:d("kui-BaseMenuGroup","kui-ComboboxGroup",o)}));Ve.displayName="Combobox.Group";var Ee=e.forwardRef(({className:o,id:r,...t},a)=>{let n=e.useId(),s=r??n,m=e.useRef(null),f=pe(a,m);return K(()=>{let l=m.current?.closest("[cmdk-group-items]");if(!(!l||l.hasAttribute("aria-labelledby")))return l.setAttribute("aria-labelledby",s),()=>{l.getAttribute("aria-labelledby")===s&&l.removeAttribute("aria-labelledby")}},[s]),e.createElement("div",{...t,id:s,ref:f,className:d("kui-BaseMenuLabel","kui-ComboboxLabel",o)})});Ee.displayName="Combobox.Label";var ke=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Separator,{...r,ref:t,className:d("kui-BaseMenuSeparator","kui-ComboboxSeparator",o)}));ke.displayName="Combobox.Separator";function j(o){return o==null||typeof o=="boolean"?"":typeof o=="string"||typeof o=="number"?String(o):Array.isArray(o)?o.map(j).join(""):e.isValidElement(o)?j(o.props.children):""}var Te=e.forwardRef(({className:o,children:r,label:t,value:a,disabled:n,onSelect:s,keywords:m,...f},l)=>{let c=e.useContext(fe);if(!c)throw new Error("Combobox.Item must be used within Combobox.Root");let{store:P,onSelect:g,disabled:h}=c,y=a??(typeof r=="string"?r.trim():void 0),C=()=>y!==void 0&&P.get()===y,i=e.useSyncExternalStore(P.subscribe,C,C),b=H(s),R=e.useCallback(k=>{let u=a??k;g(u),b(u)},[a,g,b]),x=(t??j(r)).replace(/\s+/g," ").trim(),S=x?m?[x,...m]:[x]:m,V=S?S.join("\0"):"",v=n??h??!1;return e.createElement(T.Item,{key:V,...f,value:a,keywords:S,"aria-checked":i,disabled:v||void 0,ref:l,onSelect:R,className:d("kui-reset","kui-BaseMenuItem","kui-ComboboxItem",o)},i?e.createElement("span",{className:d("kui-BaseMenuItemIndicator","kui-ComboboxItemIndicator")},e.createElement(Z,{className:d("kui-BaseMenuItemIndicatorIcon","kui-ComboboxItemIndicatorIcon")})):null,e.createElement(X,null,r))});Te.displayName="Combobox.Item";export{Pe as a,ge as b,he as c,ye as d,Re as e,ve as f,Se as g,Ve as h,Ee as i,ke as j,Te as k,je as l};
3
- //# sourceMappingURL=chunk-2E57H3NH.js.map
2
+ import{a as se,b as ie}from"./chunk-EQE6QQXM.js";import{a as ne}from"./chunk-WUCBFB25.js";import{a as ae}from"./chunk-TGRHRMQI.js";import{a as Y}from"./chunk-BUXK5VGR.js";import{b as Z,c as ee}from"./chunk-GKDGNPBD.js";import{c as X}from"./chunk-5KMEUZWN.js";import{a as Q}from"./chunk-LPLW7OWA.js";import{a as I}from"./chunk-L54FWKJE.js";import{c as O}from"./chunk-OKQAVYW4.js";import{a as re}from"./chunk-AQKSO3SW.js";import{b as te}from"./chunk-FVRVBB6O.js";import{b as oe}from"./chunk-5ON3XLRD.js";import{c as W}from"./chunk-HBWBPBSA.js";import{b as J}from"./chunk-XU74PNM2.js";import{a as Le}from"./chunk-VQPANPMI.js";var je={};Le(je,{Content:()=>ye,Empty:()=>Se,Group:()=>Ve,Input:()=>Re,Item:()=>Te,Label:()=>Ee,List:()=>ve,Root:()=>Pe,Separator:()=>ke,Trigger:()=>ge,Value:()=>he});import*as e from"react";import d from"classnames";import{Popover as me}from"radix-ui";import{useCallbackRef as H,useComposedRefs as pe,useControllableState as A,useLayoutEffect as K}from"radix-ui/internal";import{Command as T,useCommandState as ce}from"cmdk";var Oe=["1","2","3","4"],G={size:{type:"enum",className:"kui-r-size",values:Oe,default:"2",responsive:!0}},ze=["raised","surface","soft","outline","ghost"],le={variant:{type:"enum",className:"kui-variant",values:ze,default:"raised"},error:{type:"boolean"},loading:{type:"boolean"},disabled:{type:"boolean"},readOnly:{type:"boolean"},...W,...J,width:I.width,placeholder:{type:"string"}},Me=["1","2","3","4"],z={size:{type:"enum",className:"kui-r-size",values:Me,default:"2",responsive:!0},...W,width:I.width,minWidth:I.minWidth,maxWidth:{...I.maxWidth,default:"480px"},...Q};var Fe={size:G.size},Be={size:z.size},be=new Set;function We(o){be.has(o)||(be.add(o),console.warn(o))}function Ge(o){let r=o,t=new Set;return{get:()=>r,set:a=>{Object.is(a,r)||(r=a,t.forEach(n=>n()))},subscribe:a=>(t.add(a),()=>{t.delete(a)})}}var ue=e.createContext(null),M=o=>{let r=e.useContext(ue);if(!r)throw new Error(`Combobox.${o} must be used within Combobox.Root`);return r},de=e.createContext(null),fe=e.createContext(null),Ce=e.createContext(null),xe=()=>e.useContext(Ce);function Ae(o){let r=o.getAttribute("aria-label")?.trim();if(r)return r;let t=o.getAttribute("aria-labelledby");if(t){let n=t.split(/\s+/).map(s=>o.ownerDocument.getElementById(s)?.textContent?.trim()).filter(Boolean).join(" ");if(n)return n}let a=o.labels;if(a&&a.length>0){let n=Array.from(a).map(s=>s.textContent?.trim()).filter(Boolean).join(" ");if(n)return n}}var Pe=o=>{let{children:r,size:t,value:a,defaultValue:n=null,onValueChange:s,open:m,defaultOpen:f=!1,onOpenChange:l,placeholder:c="Select an option",searchPlaceholder:P="Search...",searchValue:g,defaultSearchValue:h="",onSearchValueChange:y,filter:C,shouldFilter:i=!0,loop:b=!0,disabled:R,resetSearchOnSelect:x=!0,resetSearchOnClose:S=!0,color:V,displayValue:v,...k}=o,u=oe(t,G.size),[E,w]=A({prop:m,defaultProp:f,onChange:l}),[p,we]=A({prop:a,defaultProp:n,onChange:s}),[q,N]=A({prop:g,defaultProp:h,onChange:y}),$=typeof v=="function"?v(p):v,[D]=e.useState(()=>Ge(p));K(()=>{D.set(p)},[D,p]);let F=H(L=>{w(L),!L&&S&&N("")}),_=H(L=>{we(L),w(!1),x&&N("")}),B=e.useRef(null),U=e.useCallback(()=>B.current?Ae(B.current):void 0,[]),Ie=e.useMemo(()=>({value:p,displayValue:$,setOpen:F,size:u,placeholder:c,searchPlaceholder:P,disabled:R,color:V,loop:b,shouldFilter:i,filter:C,triggerRef:B,getTriggerLabel:U}),[p,$,F,u,c,P,R,V,b,i,C,U]),Ne=e.useMemo(()=>({value:q,setValue:N}),[q,N]),De=e.useMemo(()=>({store:D,onSelect:_,disabled:R}),[D,_,R]);return e.createElement(ue.Provider,{value:Ie},e.createElement(de.Provider,{value:Ne},e.createElement(fe.Provider,{value:De},e.createElement(se,{open:E,onOpenChange:F,...k},r))))};Pe.displayName="Combobox.Root";var ge=e.forwardRef((o,r)=>{let t=M("Trigger"),{children:a,className:n,placeholder:s,disabled:m,readOnly:f,error:l,loading:c,color:P,radius:g,onClick:h,onKeyDown:y,type:C,...i}=O({size:t.size,...o},Fe,le),b=m??t.disabled,R=P??t.color,x=!!(f||c),S=t.value==null&&t.displayValue==null,V=pe(r,t.triggerRef),{getTriggerLabel:v}=t;e.useEffect(()=>{},[v]);let k=p=>{h?.(p),x&&p.preventDefault()},u=p=>{y?.(p),!(p.defaultPrevented||x||b)&&(p.key==="ArrowDown"||p.key==="ArrowUp")&&(p.preventDefault(),t.setOpen(!0))},E=e.createElement("span",{className:"kui-SelectIcon kui-SelectLoadingIcon","aria-hidden":"true"},e.createElement(Y,null)),w=e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-SelectTriggerInner"},e.createElement("span",{className:"kui-ComboboxValue"},t.displayValue??t.value??s??t.placeholder)),c?E:e.createElement(ee,{className:"kui-SelectIcon"}));return e.createElement(ie,{disabled:b},e.createElement("button",{"data-accent-color":R,"data-radius":g,"data-error":l,"data-loading":c,"data-disabled":b||void 0,"data-read-only":f||void 0,"data-placeholder":S?"":void 0,...i,role:"combobox","aria-disabled":b||i["aria-disabled"],"aria-readonly":f||i["aria-readonly"],"aria-invalid":l||i["aria-invalid"],"aria-busy":c||i["aria-busy"],type:C??"button",disabled:b,onClick:k,onKeyDown:u,ref:V,className:d("kui-reset","kui-SelectTrigger","kui-ComboboxTrigger",n)},a?e.createElement(e.Fragment,null,ae(a),c?E:null):w))});ge.displayName="Combobox.Trigger";var he=e.forwardRef(({placeholder:o,children:r,className:t,...a},n)=>{let s=M("Value"),m=s.displayValue??s.value??void 0;return e.createElement("span",{...a,ref:n,className:d("kui-ComboboxValue",t)},m??r??o??s.placeholder)});he.displayName="Combobox.Value";function He(){let o=ce(n=>n.filtered.count),r=ce(n=>n.search),[t,a]=e.useState("");return e.useEffect(()=>{let n=r?o===0?"No results":`${o} result${o===1?"":"s"}`:"",s=window.setTimeout(()=>a(n),r?400:0);return()=>window.clearTimeout(s)},[o,r]),e.createElement(ne,{role:"status","aria-live":"polite","aria-atomic":"true"},t)}var ye=e.forwardRef((o,r)=>{let t=M("Content"),a=te(),n=o.size??t.size??z.size.default,{className:s,children:m,color:f,forceMount:l,container:c,onOpenAutoFocus:P,"aria-label":g,"aria-labelledby":h,...y}=O({...o,size:n},z),C=f||t.color||a.accentColor,{getTriggerLabel:i}=t,[b,R]=e.useState(i);K(()=>{if(b!==void 0)return;let u=i();u!==void 0&&R(u)},[i,b]);let x=o["aria-label"]??b,S=e.useMemo(()=>({sizeClassName:O({size:n},Be).className||void 0,color:C,label:x}),[n,C,x]),V=e.useRef(null),v=u=>{if(P?.(u),u.defaultPrevented)return;let E=V.current;if(!E||E.querySelector("[cmdk-input]"))return;u.preventDefault(),(E.querySelector("[cmdk-list]")??E).focus({preventScroll:!0})},k=t.value?.trim()||void 0;return e.createElement(me.Portal,{container:c,forceMount:l?!0:void 0},e.createElement(re,{asChild:!0},e.createElement(me.Content,{"data-accent-color":C,align:"start",sideOffset:4,collisionPadding:10,"aria-label":h?void 0:x,"aria-labelledby":h,...y,forceMount:l?!0:void 0,onOpenAutoFocus:v,ref:r,className:d("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-ComboboxContent",s)},e.createElement(Ce.Provider,{value:S},e.createElement(T,{ref:V,loop:t.loop,shouldFilter:t.shouldFilter,filter:t.filter,label:x,defaultValue:k,className:"kui-ComboboxCommand"},m,e.createElement(He,null))))))});ye.displayName="Combobox.Content";var Re=e.forwardRef(({className:o,startAdornment:r,endAdornment:t,placeholder:a,variant:n,value:s,onValueChange:m,...f},l)=>{let c=M("Input"),P=e.useContext(de),g=xe(),h=n??"soft",y=s??P?.value??"",C=m??P?.setValue,i=e.createElement("div",{className:d("kui-TextFieldRoot","kui-ComboboxInputRoot",g?.sizeClassName,`kui-variant-${h}`),"data-accent-color":g?.color},r?e.createElement("div",{className:"kui-TextFieldSlot"},r):null,e.createElement(T.Input,{...f,ref:l,value:y,onValueChange:C,placeholder:a??c.searchPlaceholder,className:d("kui-reset","kui-TextFieldInput",o)}),t?e.createElement("div",{className:"kui-TextFieldSlot","data-side":"right"},t):null);return g?e.createElement("div",{className:"kui-ComboboxSearch"},i):i});Re.displayName="Combobox.Input";var ve=e.forwardRef(({className:o,children:r,label:t,...a},n)=>{let s=xe();return e.createElement("div",{className:"kui-ComboboxScrollArea"},e.createElement("div",{className:d("kui-BaseMenuViewport","kui-ComboboxViewport")},e.createElement(T.List,{...a,label:t??s?.label,ref:n,className:d("kui-ComboboxList",o)},r)))});ve.displayName="Combobox.List";var Se=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Empty,{...r,ref:t,className:d("kui-ComboboxEmpty",o)}));Se.displayName="Combobox.Empty";var Ve=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Group,{...r,ref:t,className:d("kui-BaseMenuGroup","kui-ComboboxGroup",o)}));Ve.displayName="Combobox.Group";var Ee=e.forwardRef(({className:o,id:r,...t},a)=>{let n=e.useId(),s=r??n,m=e.useRef(null),f=pe(a,m);return K(()=>{let l=m.current?.closest("[cmdk-group-items]");if(!(!l||l.hasAttribute("aria-labelledby")))return l.setAttribute("aria-labelledby",s),()=>{l.getAttribute("aria-labelledby")===s&&l.removeAttribute("aria-labelledby")}},[s]),e.createElement("div",{...t,id:s,ref:f,className:d("kui-BaseMenuLabel","kui-ComboboxLabel",o)})});Ee.displayName="Combobox.Label";var ke=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Separator,{...r,ref:t,className:d("kui-BaseMenuSeparator","kui-ComboboxSeparator",o)}));ke.displayName="Combobox.Separator";function j(o){return o==null||typeof o=="boolean"?"":typeof o=="string"||typeof o=="number"?String(o):Array.isArray(o)?o.map(j).join(""):e.isValidElement(o)?j(o.props.children):""}var Te=e.forwardRef(({className:o,children:r,label:t,value:a,disabled:n,onSelect:s,keywords:m,...f},l)=>{let c=e.useContext(fe);if(!c)throw new Error("Combobox.Item must be used within Combobox.Root");let{store:P,onSelect:g,disabled:h}=c,y=a??(typeof r=="string"?r.trim():void 0),C=()=>y!==void 0&&P.get()===y,i=e.useSyncExternalStore(P.subscribe,C,C),b=H(s),R=e.useCallback(k=>{let u=a??k;g(u),b(u)},[a,g,b]),x=(t??j(r)).replace(/\s+/g," ").trim(),S=x?m?[x,...m]:[x]:m,V=S?S.join("\0"):"",v=n??h??!1;return e.createElement(T.Item,{key:V,...f,value:a,keywords:S,"aria-checked":i,disabled:v||void 0,ref:l,onSelect:R,className:d("kui-reset","kui-BaseMenuItem","kui-ComboboxItem",o)},i?e.createElement("span",{className:d("kui-BaseMenuItemIndicator","kui-ComboboxItemIndicator")},e.createElement(Z,{className:d("kui-BaseMenuItemIndicatorIcon","kui-ComboboxItemIndicatorIcon")})):null,e.createElement(X,null,r))});Te.displayName="Combobox.Item";export{Pe as a,ge as b,he as c,ye as d,Re as e,ve as f,Se as g,Ve as h,Ee as i,ke as j,Te as k,je as l};
3
+ //# sourceMappingURL=chunk-FRFVGYGX.js.map
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import{a as ye}from"./chunk-YCLPURTD.js";import{a as Z}from"./chunk-OAJ5DARR.js";import{b as xe,c as $}from"./chunk-OKQAVYW4.js";import{c as ue}from"./chunk-5ON3XLRD.js";import{c as Y}from"./chunk-HBWBPBSA.js";import{b as le}from"./chunk-XU74PNM2.js";import{a as Ie}from"./chunk-VQPANPMI.js";var Ve={};Ie(Ve,{Group:()=>Fe,Root:()=>Te,Slot:()=>Me});import*as e from"react";import*as ge from"react-dom";import J from"classnames";import{composeEventHandlers as _,composeRefs as Se,useLayoutEffect as ze}from"radix-ui/internal";var Pe=["1","2","3","4"],Le=["raised","surface","soft","ghost","outline"],ce={size:{type:"enum",className:"kui-r-size",values:Pe,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:Le,default:"raised"},error:{type:"boolean",default:!1},errorMessage:{type:"string",default:void 0},required:{type:"boolean",default:!1},"aria-describedby":{type:"string",default:void 0},"aria-labelledby":{type:"string",default:void 0},...Y,...le},Ne=["raised","surface","soft","outline","ghost"],de={size:{type:"enum",className:"kui-r-size",values:Pe,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:Ne,default:"raised"},disabled:{type:"boolean",default:!1},...Y,...le},Ge=["left","right"],Re={side:{type:"enum",values:Ge},...Y,gap:ye.gap,px:Z.px,pl:Z.pl,pr:Z.pr};var he=e.createContext(null),pe="button, a, input, select, textarea, label, [tabindex], [contenteditable]",ve=e.createContext(null),Te=e.forwardRef((x,z)=>{let l=e.useContext(ve),d=l?{...x,size:l.size,variant:l.variant,radius:l.radius,color:x.color??l.color,disabled:!!(l.disabled||x.disabled)}:x,{className:y,style:p,...P}=ue(d,ce.size),f=e.useRef(null),{children:k,className:E,color:V,radius:U,style:H,...n}=$(P,ce),c=!!n.errorMessage,I=e.useId(),[K,O]=e.useState([]),A=e.useCallback(r=>(O(o=>o.includes(r)?o:[...o,r]),()=>O(o=>o.filter(h=>h!==r))),[]),R=e.useRef(null),j=e.useCallback(r=>(R.current=r,()=>{R.current===r&&(R.current=null)}),[]),F=!!(n.disabled||n.readOnly),B=e.useMemo(()=>({registerSlot:A,registerScrub:j,inert:F}),[A,j,F]),{"aria-describedby":L,"aria-labelledby":N,"aria-invalid":s}=n,g=!!n.error||s===!0||s==="true",W=e.useMemo(()=>{let r=[];return n.errorMessage&&r.push(I),L&&r.push(L),r.push(...K),r.length>0?r.join(" "):void 0},[n.errorMessage,L,I,K]),Q=e.useMemo(()=>({"aria-invalid":g?!0:s,"aria-describedby":W,"aria-labelledby":N}),[g,s,W,N]),{error:b,errorMessage:ee,required:q,"aria-describedby":fe,"aria-labelledby":te,onKeyDown:X,...M}=n,S=r=>{let o=R.current;!o||F||r.key!=="ArrowUp"&&r.key!=="ArrowDown"||(r.preventDefault(),o(r.key==="ArrowUp"?1:-1,r.shiftKey,r.altKey))},u=e.useCallback(r=>{let o=r.target;if(o.closest(pe))return;let h=f.current;if(!h)return;let w=o.closest(`
3
+ .kui-TextFieldSlot[data-side='right'],
4
+ .kui-TextFieldSlot:not([data-side='right']) ~ .kui-TextFieldSlot:not([data-side='left'])
5
+ `)?h.value.length:0;r.preventDefault(),h.focus();try{h.setSelectionRange(w,w)}catch{}},[]),D=e.createElement("div",{"data-accent-color":V,"data-radius":U,style:c?H:xe(H,p),className:J("kui-TextFieldRoot",E,!c&&y,{"kui-error":g}),onMouseDown:u},e.createElement("input",{...M,required:q||void 0,...Q,onKeyDown:_(X,S),ref:Se(f,z),className:"kui-reset kui-TextFieldInput"}),e.createElement(he.Provider,{value:B},k));return e.createElement("div",{className:J("kui-TextFieldWrapper",c&&y),style:c?p:void 0,"data-message":c||void 0},D,c?e.createElement("div",{id:I,className:"kui-TextFieldErrorMessage",role:"alert"},n.errorMessage):null)});Te.displayName="TextField.Root";var Fe=e.forwardRef((x,z)=>{let l=ue(x,de.size),{size:d,variant:y,radius:p,color:P,disabled:f}=l,{className:k,children:E,radius:V,color:U,disabled:H,...n}=$(l,de),c=e.useMemo(()=>({size:d,variant:y,radius:p,color:P,disabled:f}),[d,y,p,P,f]);return e.createElement("div",{role:"group","data-accent-color":P,"data-radius":p,"data-disabled":f||void 0,...n,ref:z,className:J("kui-TextFieldGroup",k)},e.createElement(ve.Provider,{value:c},E))});Fe.displayName="TextField.Group";var Me=e.forwardRef((x,z)=>{let{scrub:l,scrubValue:d,scrubStep:y=1,scrubSensitivity:p=1,scrubMin:P,scrubMax:f,scrubShiftMultiplier:k=10,scrubAltMultiplier:E=.1,onScrub:V,...U}=x,{className:H,color:n,side:c,onPointerDown:I,onPointerMove:K,onPointerUp:O,onLostPointerCapture:A,...R}=$(U,Re),j=e.useId(),F=R.id??j,B=e.useContext(he),L=B?.registerSlot,N=B?.registerScrub,s=!!l&&!B?.inert,g=e.useRef(null),[W,Q]=e.useState(null);ze(()=>{let t=!!g.current?.querySelector(pe);Q(i=>i===t?i:t)}),e.useEffect(()=>W===!1?L?.(F):void 0,[L,F,W]);let[b,ee]=e.useState(!1),[q,fe]=e.useState({x:0,y:0}),te=e.useRef(null),X=e.useRef(0),M=e.useRef(0),S=e.useRef(0),u=e.useRef(0),D=e.useRef(null),r=e.useRef(0),o=e.useRef({scrubValue:d,scrubStep:y,scrubSensitivity:p,scrubMin:P,scrubMax:f,scrubShiftMultiplier:k,scrubAltMultiplier:E,onScrub:V});o.current={scrubValue:d,scrubStep:y,scrubSensitivity:p,scrubMin:P,scrubMax:f,scrubShiftMultiplier:k,scrubAltMultiplier:E,onScrub:V};let h=e.useCallback(t=>{if(!s||t.target.closest(pe))return;t.preventDefault(),M.current=0,S.current=d??0,u.current=t.clientX,X.current=t.clientY,fe({x:t.clientX,y:t.clientY});let G=g.current;G&&(D.current=t.pointerId,r.current=t.clientX,G.setPointerCapture(t.pointerId),ee(!0))},[s,d]),re=e.useCallback((t,i,G,m)=>{let a=o.current,v=window.innerWidth,C=window.innerHeight;u.current+=t,u.current>v?u.current=u.current%v:u.current<0&&(u.current=v+u.current%v);let T=X.current+i;T>C?T=T%C:T<0&&(T=C+T%C),X.current=T;let oe=te.current;oe&&(oe.style.left=`${u.current}px`,oe.style.top=`${T}px`),M.current+=t;let se=M.current/a.scrubSensitivity;if(Math.abs(se)>=1){let ne=1;G?ne=a.scrubShiftMultiplier:m&&(ne=a.scrubAltMultiplier);let be=Math.trunc(se),ie=be*a.scrubStep*ne,ae=ie;if(a.scrubMin!==void 0||a.scrubMax!==void 0){let Ee=S.current+ie,me=Math.max(a.scrubMin??-1/0,Math.min(a.scrubMax??1/0,Ee));ae=me-S.current,S.current=me}else S.current+=ie;ae!==0&&a.onScrub?.(ae,!0),M.current=(se-be)*a.scrubSensitivity}},[]),w=e.useCallback(()=>{o.current.onScrub?.(0,!1),M.current=0,S.current=0,D.current=null,ee(!1)},[]),De=e.useCallback(t=>{if(!b)return;let i=t.clientX-r.current;r.current=t.clientX,re(i,t.movementY,t.shiftKey,t.altKey)},[b,re]),we=e.useCallback(t=>{if(D.current!==t.pointerId)return;let i=g.current;i&&D.current!==null&&i.releasePointerCapture(D.current),w()},[w]),Ce=e.useCallback(()=>{b&&w()},[b,w]);e.useEffect(()=>{if(!b)return;let t=document.createElement("style");return t.textContent="* { cursor: none !important; user-select: none !important; }",document.head.appendChild(t),()=>{document.head.removeChild(t)}},[b]),e.useEffect(()=>{if(!(!s||!N))return N((t,i,G)=>{let m=o.current,a=i?m.scrubShiftMultiplier:G?m.scrubAltMultiplier:1,v=m.scrubValue??0,C=Math.max(m.scrubMin??-1/0,Math.min(m.scrubMax??1/0,v+t*m.scrubStep*a));C!==v&&m.onScrub?.(C-v,!1)})},[s,N]);let ke=b?ge.createPortal(e.createElement("img",{ref:te,className:"kui-TextFieldSlotScrubCursor",src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='black' stroke='white' stroke-width='1' d='M0 12 L5 7 L5 10 L19 10 L19 7 L24 12 L19 17 L19 14 L5 14 L5 17 Z'/%3E%3C/svg%3E",alt:"",style:{position:"fixed",left:q.x,top:q.y,transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:99999,width:24,height:24},"aria-hidden":"true"}),document.body):null;return e.createElement("div",{"data-accent-color":n,"data-side":c,"data-scrub":s||void 0,"data-scrubbing":b||void 0,...R,id:F,ref:Se(g,z),className:J("kui-TextFieldSlot",H),onPointerDown:s?_(I,h):I,onPointerMove:s?_(K,De):K,onPointerUp:s?_(O,we):O,onLostPointerCapture:s?_(A,Ce):A},R.children,ke)});Me.displayName="TextField.Slot";export{Te as a,Fe as b,Me as c,Ve as d};
6
+ //# sourceMappingURL=chunk-K5V53KTJ.js.map