@adea-ai/ui 0.82.2 → 0.83.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
  2. package/dist/components/composites/action-button/action-button.js +55 -24
  3. package/dist/components/composites/action-button/action-button.js.map +1 -1
  4. package/dist/components/layout/orbit-layout/index.d.ts +3 -0
  5. package/dist/components/layout/orbit-layout/index.d.ts.map +1 -0
  6. package/dist/components/layout/orbit-layout/index.js +2 -0
  7. package/dist/components/layout/orbit-layout/orbit-layout.d.ts +38 -0
  8. package/dist/components/layout/orbit-layout/orbit-layout.d.ts.map +1 -0
  9. package/dist/components/layout/orbit-layout/orbit-layout.js +83 -0
  10. package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -0
  11. package/dist/components/layout/virtual-window/index.d.ts +3 -0
  12. package/dist/components/layout/virtual-window/index.d.ts.map +1 -0
  13. package/dist/components/layout/virtual-window/index.js +2 -0
  14. package/dist/components/layout/virtual-window/virtual-window.d.ts +22 -0
  15. package/dist/components/layout/virtual-window/virtual-window.d.ts.map +1 -0
  16. package/dist/components/layout/virtual-window/virtual-window.js +45 -0
  17. package/dist/components/layout/virtual-window/virtual-window.js.map +1 -0
  18. package/dist/components/ui/command/command.d.ts.map +1 -1
  19. package/dist/components/ui/command/command.js +1 -0
  20. package/dist/components/ui/command/command.js.map +1 -1
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +3 -1
  24. package/dist/r/orbit-layout.json +22 -0
  25. package/dist/r/registry.json +44 -0
  26. package/dist/r/src/components/composites/action-button/action-button.tsx +52 -11
  27. package/dist/r/src/components/layout/orbit-layout/index.ts +8 -0
  28. package/dist/r/src/components/layout/orbit-layout/orbit-layout.tsx +112 -0
  29. package/dist/r/src/components/layout/virtual-window/index.ts +2 -0
  30. package/dist/r/src/components/layout/virtual-window/virtual-window.tsx +55 -0
  31. package/dist/r/src/components/ui/command/command.tsx +1 -0
  32. package/dist/r/virtual-window.json +22 -0
  33. package/package.json +1 -1
  34. package/registry.json +44 -0
  35. package/src/components/composites/action-button/action-button.tsx +52 -11
  36. package/src/components/layout/orbit-layout/index.ts +8 -0
  37. package/src/components/layout/orbit-layout/orbit-layout.tsx +112 -0
  38. package/src/components/layout/virtual-window/index.ts +2 -0
  39. package/src/components/layout/virtual-window/virtual-window.tsx +55 -0
  40. package/src/components/ui/command/command.tsx +1 -0
  41. package/src/index.ts +2 -0
@@ -0,0 +1,112 @@
1
+ import type { ComponentProps } from 'solid-js'
2
+ import { createContext, createMemo, splitProps, useContext, type Accessor } from 'solid-js'
3
+ import { cn } from '#lib/utils'
4
+
5
+ /** A CSS length or expression used to place an item away from the orbit center. */
6
+ export type OrbitRadius = number | string
7
+ export type OrbitLayoutMode = 'radial' | 'flow'
8
+
9
+ const DEFAULT_ORBIT_RADIUS = 'calc(50% - 2rem)'
10
+ const OrbitRadiusContext = createContext<Accessor<string>>()
11
+ const OrbitModeContext = createContext<Accessor<OrbitLayoutMode>>()
12
+
13
+ function resolveRadius(radius: OrbitRadius | undefined): string {
14
+ if (typeof radius === 'number') return `${Number.isFinite(radius) ? Math.max(0, radius) : 0}px`
15
+ return radius?.trim() || DEFAULT_ORBIT_RADIUS
16
+ }
17
+
18
+ /**
19
+ * OrbitLayout.
20
+ *
21
+ * Provides a positioned canvas and a shared radius for its OrbitItems. It does
22
+ * not assign list semantics or alter DOM order: callers choose semantics, and
23
+ * keyboard and screen-reader order remain the source order of the children.
24
+ */
25
+ export type OrbitLayoutProps = Omit<ComponentProps<'div'>, 'style'> & {
26
+ /** JSX style props are owned by this geometry primitive. */
27
+ style?: never
28
+ /** Responsive radius used by every OrbitItem unless that item overrides it. */
29
+ radius?: OrbitRadius
30
+ /** `flow` places items in source order; `radial` positions them around the host. */
31
+ mode?: OrbitLayoutMode
32
+ }
33
+
34
+ export function OrbitLayout(props: OrbitLayoutProps) {
35
+ const [local, rest] = splitProps(props, ['class', 'radius', 'mode', 'style', 'children'])
36
+ const radius = createMemo(() => resolveRadius(local.radius))
37
+ const mode = createMemo(() => local.mode ?? 'radial')
38
+
39
+ return (
40
+ <OrbitRadiusContext.Provider value={radius}>
41
+ <OrbitModeContext.Provider value={mode}>
42
+ <div
43
+ {...rest}
44
+ data-slot="orbit-layout"
45
+ class={cn(mode() === 'flow' ? 'grid gap-3' : 'relative size-full', local.class)}
46
+ >
47
+ {local.children}
48
+ </div>
49
+ </OrbitModeContext.Provider>
50
+ </OrbitRadiusContext.Provider>
51
+ )
52
+ }
53
+
54
+ /**
55
+ * OrbitItem.
56
+ *
57
+ * Positions one ordinary child around its OrbitLayout. This is geometry only:
58
+ * the wrapper has no role, tabindex, or interaction of its own.
59
+ */
60
+ export type OrbitItemProps = Omit<ComponentProps<'div'>, 'style'> & {
61
+ /** JSX style props are owned by this geometry primitive. */
62
+ style?: never
63
+ /** Zero-based position in the rendered sequence. */
64
+ index: number
65
+ /** Number of items sharing this orbit. */
66
+ count: number
67
+ /** Per-item override for OrbitLayout's responsive radius. */
68
+ radius?: OrbitRadius
69
+ }
70
+
71
+ export function OrbitItem(props: OrbitItemProps) {
72
+ const [local, rest] = splitProps(props, [
73
+ 'class',
74
+ 'index',
75
+ 'count',
76
+ 'radius',
77
+ 'style',
78
+ 'children',
79
+ ])
80
+ const inheritedRadius = useContext(OrbitRadiusContext)
81
+ const inheritedMode = useContext(OrbitModeContext)
82
+ const mode = () => inheritedMode?.() ?? 'radial'
83
+ const radius = () =>
84
+ local.radius !== undefined
85
+ ? resolveRadius(local.radius)
86
+ : (inheritedRadius?.() ?? DEFAULT_ORBIT_RADIUS)
87
+ const angle = createMemo(() => {
88
+ const count = Number.isFinite(local.count) ? Math.max(1, Math.trunc(local.count)) : 1
89
+ const rawIndex = Number.isFinite(local.index) ? Math.trunc(local.index) : 0
90
+ const index = ((rawIndex % count) + count) % count
91
+ return `${(index / count) * Math.PI * 2}rad`
92
+ })
93
+ const positionStyle = () =>
94
+ mode() === 'flow'
95
+ ? undefined
96
+ : {
97
+ top: `calc(50% + sin(${angle()}) * ${radius()})`,
98
+ left: `calc(50% + cos(${angle()}) * ${radius()})`,
99
+ translate: '-50% -50%',
100
+ }
101
+
102
+ return (
103
+ <div
104
+ {...rest}
105
+ data-slot="orbit-item"
106
+ class={cn(mode() === 'flow' ? undefined : 'absolute', local.class)}
107
+ style={positionStyle()}
108
+ >
109
+ {local.children}
110
+ </div>
111
+ )
112
+ }
@@ -0,0 +1,2 @@
1
+ /** Geometry wrappers for a virtual list; scrolling and range ownership stay with the caller. */
2
+ export { VirtualWindow, type VirtualWindowProps } from './virtual-window'
@@ -0,0 +1,55 @@
1
+ import type { ComponentProps, JSX } from 'solid-js'
2
+ import { splitProps } from 'solid-js'
3
+ import { cn } from '#lib/utils'
4
+
5
+ /**
6
+ * VirtualWindow.
7
+ *
8
+ * Supplies the two geometry wrappers a virtualized viewport needs: a full-height
9
+ * scroll space and a translated window containing the mounted rows. The caller
10
+ * owns the scroll region, its semantics, keyboard model, and range calculation;
11
+ * this component only keeps those rows at their measured position.
12
+ */
13
+ export type VirtualWindowProps = Omit<ComponentProps<'div'>, 'children' | 'style'> & {
14
+ /** JSX style props are owned by this geometry primitive. */
15
+ style?: never
16
+ /** The full scrollable height, in pixels. */
17
+ totalSize: number
18
+ /** The mounted window's top offset from the start of the full list, in pixels. */
19
+ offset?: number
20
+ /** Optional layout classes for the translated row container. */
21
+ contentClass?: string
22
+ children?: JSX.Element
23
+ }
24
+
25
+ function finitePixels(value: number): string {
26
+ return `${Number.isFinite(value) ? value : 0}px`
27
+ }
28
+
29
+ export function VirtualWindow(props: VirtualWindowProps) {
30
+ const [local, rest] = splitProps(props, [
31
+ 'class',
32
+ 'children',
33
+ 'totalSize',
34
+ 'offset',
35
+ 'contentClass',
36
+ 'style',
37
+ ])
38
+
39
+ return (
40
+ <div
41
+ {...rest}
42
+ data-slot="virtual-window-space"
43
+ class={cn('relative', local.class)}
44
+ style={{ height: finitePixels(Math.max(0, local.totalSize)) }}
45
+ >
46
+ <div
47
+ data-slot="virtual-window-content"
48
+ class={local.contentClass}
49
+ style={{ transform: `translateY(${finitePixels(local.offset ?? 0)})` }}
50
+ >
51
+ {local.children}
52
+ </div>
53
+ </div>
54
+ )
55
+ }
@@ -110,6 +110,7 @@ export function CommandDialog(props: CommandDialogProps) {
110
110
  <KobalteDialog.Content
111
111
  aria-label={commandProps.label}
112
112
  cmdk-dialog=""
113
+ role="dialog"
113
114
  class={cn(
114
115
  'bg-popover text-popover-foreground fixed top-1/3 left-1/2 z-(--z-dialog) w-full max-w-lg -translate-x-1/2 -translate-y-1/2',
115
116
  'overflow-hidden rounded-xl border border-border shadow-xl',
package/src/index.ts CHANGED
@@ -79,6 +79,8 @@ export * from './components/motion'
79
79
 
80
80
  /* --- Layout -------------------------------------------------------------- */
81
81
  export * from './components/layout/split-layout'
82
+ export * from './components/layout/orbit-layout'
83
+ export * from './components/layout/virtual-window'
82
84
  export * from './components/layout/app-shell'
83
85
  export * from './components/layout/page'
84
86
  export * from './components/layout/panel'