@adea-ai/ui 0.87.0 → 0.89.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 (44) hide show
  1. package/README.md +22 -0
  2. package/dist/components/composites/settings/index.d.ts +2 -0
  3. package/dist/components/composites/settings/index.d.ts.map +1 -1
  4. package/dist/components/composites/settings/index.js +3 -1
  5. package/dist/components/composites/settings/settings-layout.d.ts +28 -0
  6. package/dist/components/composites/settings/settings-layout.d.ts.map +1 -0
  7. package/dist/components/composites/settings/settings-layout.js +62 -0
  8. package/dist/components/composites/settings/settings-layout.js.map +1 -0
  9. package/dist/components/composites/settings/settings-navigation.d.ts +41 -0
  10. package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -0
  11. package/dist/components/composites/settings/settings-navigation.js +102 -0
  12. package/dist/components/composites/settings/settings-navigation.js.map +1 -0
  13. package/dist/components/layout/sidebar-nav/index.d.ts +1 -1
  14. package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
  15. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +18 -2
  16. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
  17. package/dist/components/layout/sidebar-nav/sidebar-nav.js +42 -11
  18. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  19. package/dist/components/layout/top-bar/top-bar.d.ts +3 -1
  20. package/dist/components/layout/top-bar/top-bar.d.ts.map +1 -1
  21. package/dist/components/layout/top-bar/top-bar.js +4 -4
  22. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  23. package/dist/components/ui/tabs/tabs.d.ts.map +1 -1
  24. package/dist/components/ui/tabs/tabs.js +70 -13
  25. package/dist/components/ui/tabs/tabs.js.map +1 -1
  26. package/dist/index.js +3 -1
  27. package/dist/r/registry.json +12 -0
  28. package/dist/r/settings.json +12 -0
  29. package/dist/r/src/components/composites/settings/index.ts +7 -0
  30. package/dist/r/src/components/composites/settings/settings-layout.tsx +65 -0
  31. package/dist/r/src/components/composites/settings/settings-navigation.tsx +135 -0
  32. package/dist/r/src/components/layout/sidebar-nav/index.ts +2 -0
  33. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
  34. package/dist/r/src/components/layout/top-bar/top-bar.tsx +9 -5
  35. package/dist/r/src/components/ui/tabs/tabs.tsx +80 -10
  36. package/package.json +2 -1
  37. package/registry.json +12 -0
  38. package/src/components/composites/settings/index.ts +7 -0
  39. package/src/components/composites/settings/settings-layout.tsx +65 -0
  40. package/src/components/composites/settings/settings-navigation.tsx +135 -0
  41. package/src/components/layout/sidebar-nav/index.ts +2 -0
  42. package/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
  43. package/src/components/layout/top-bar/top-bar.tsx +9 -5
  44. package/src/components/ui/tabs/tabs.tsx +80 -10
@@ -41,7 +41,7 @@ export function TopBar(props: TopBarProps) {
41
41
  <header
42
42
  data-slot="top-bar"
43
43
  class={cn(
44
- 'h-topbar relative z-(--z-sticky) grid shrink-0 grid-cols-[minmax(0,1fr)_clamp(240px,22vw,480px)_minmax(0,1fr)] items-center gap-3 border-b border-border px-3',
44
+ 'h-topbar relative z-(--z-sticky) grid shrink-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 border-b border-border bg-card text-card-foreground px-3 md:grid-cols-[minmax(0,1fr)_clamp(240px,22vw,480px)_minmax(0,1fr)]',
45
45
  local.glass && 'glass-panel',
46
46
  local.draggable && 'window-drag',
47
47
  local.macosInset && 'window-inset-macos',
@@ -61,7 +61,7 @@ export function TopBarSection(props: ComponentProps<'div'> & { align?: 'start' |
61
61
  <div
62
62
  data-slot="top-bar-section"
63
63
  class={cn(
64
- 'flex min-w-0 items-center gap-2 overflow-hidden',
64
+ 'window-no-drag flex min-w-0 items-center gap-2 overflow-x-auto overflow-y-hidden',
65
65
  local.align === 'end' && 'justify-end',
66
66
  local.align !== 'end' && 'justify-start',
67
67
  local.class
@@ -71,12 +71,16 @@ export function TopBarSection(props: ComponentProps<'div'> & { align?: 'start' |
71
71
  )
72
72
  }
73
73
 
74
- export function TopBarTitle(props: ComponentProps<'div'>) {
75
- const [local, rest] = splitProps(props, ['class'])
74
+ export function TopBarTitle(props: ComponentProps<'div'> & { align?: 'start' | 'center' }) {
75
+ const [local, rest] = splitProps(props, ['class', 'align'])
76
76
  return (
77
77
  <div
78
78
  data-slot="top-bar-title"
79
- class={cn('truncate text-sm font-medium', local.class)}
79
+ class={cn(
80
+ 'truncate text-sm font-medium',
81
+ local.align === 'center' && 'text-center',
82
+ local.class
83
+ )}
80
84
  {...rest}
81
85
  />
82
86
  )
@@ -1,8 +1,31 @@
1
1
  import { Tabs as KobalteTabs } from '@kobalte/core/tabs'
2
- import type { ComponentProps } from 'solid-js'
3
- import { splitProps } from 'solid-js'
2
+ import type { Accessor, ComponentProps } from 'solid-js'
3
+ import {
4
+ createContext,
5
+ createRenderEffect,
6
+ createSignal,
7
+ createUniqueId,
8
+ onCleanup,
9
+ splitProps,
10
+ useContext,
11
+ } from 'solid-js'
4
12
  import { cn } from '#lib/utils'
5
13
 
14
+ type TabsIdContextValue = {
15
+ id: Accessor<string>
16
+ triggerIds: Accessor<ReadonlyMap<string, string>>
17
+ registerTriggerId: (value: string, id: string) => void
18
+ unregisterTriggerId: (value: string, id: string) => void
19
+ }
20
+
21
+ const TabsIdContext = createContext<TabsIdContextValue>()
22
+
23
+ function useTabsId() {
24
+ const tabs = useContext(TabsIdContext)
25
+ if (!tabs) throw new Error('[adea-ui]: Tabs parts must be used within Tabs.')
26
+ return tabs
27
+ }
28
+
6
29
  /**
7
30
  * Tabs.
8
31
  *
@@ -14,12 +37,37 @@ import { cn } from '#lib/utils'
14
37
  * where a full-width underline would collide with the panel's own header rule.
15
38
  */
16
39
  export function Tabs(props: ComponentProps<typeof KobalteTabs>) {
17
- const [local, rest] = splitProps(props, ['class'])
40
+ const [local, rest] = splitProps(props, ['class', 'id'])
41
+ const generatedId = `tabs-${createUniqueId()}`
42
+ const id = () => local.id ?? generatedId
43
+ const [triggerIds, setTriggerIds] = createSignal<ReadonlyMap<string, string>>(new Map())
44
+ const tabs: TabsIdContextValue = {
45
+ id,
46
+ triggerIds,
47
+ registerTriggerId: (value, triggerId) => {
48
+ setTriggerIds((current) => new Map(current).set(value, triggerId))
49
+ },
50
+ unregisterTriggerId: (value, triggerId) => {
51
+ setTriggerIds((current) => {
52
+ if (current.get(value) !== triggerId) return current
53
+ const next = new Map(current)
54
+ next.delete(value)
55
+ return next
56
+ })
57
+ },
58
+ }
59
+
18
60
  return (
19
- <KobalteTabs
20
- class={cn('flex flex-col gap-2 data-[orientation=vertical]:flex-row', local.class)}
21
- {...rest}
22
- />
61
+ <TabsIdContext.Provider value={tabs}>
62
+ <KobalteTabs
63
+ id={id()}
64
+ class={cn(
65
+ 'flex min-h-0 min-w-0 flex-col gap-2 data-[orientation=vertical]:flex-row',
66
+ local.class
67
+ )}
68
+ {...rest}
69
+ />
70
+ </TabsIdContext.Provider>
23
71
  )
24
72
  }
25
73
 
@@ -50,10 +98,21 @@ export type TabsTriggerProps = ComponentProps<typeof KobalteTabs.Trigger> & {
50
98
  }
51
99
 
52
100
  export function TabsTrigger(props: TabsTriggerProps) {
53
- const [local, rest] = splitProps(props, ['class', 'appearance'])
101
+ const [local, rest] = splitProps(props, ['class', 'appearance', 'id'])
102
+ const tabs = useTabsId()
103
+ const triggerId = () => local.id ?? `${tabs.id()}-trigger-${rest.value}`
104
+
105
+ // Register before panels render, including SSR where createEffect is skipped.
106
+ createRenderEffect(() => {
107
+ const value = rest.value
108
+ const id = triggerId()
109
+ tabs.registerTriggerId(value, id)
110
+ onCleanup(() => tabs.unregisterTriggerId(value, id))
111
+ })
54
112
 
55
113
  return (
56
114
  <KobalteTabs.Trigger
115
+ id={triggerId()}
57
116
  class={cn(
58
117
  'inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium',
59
118
  'transition-colors ease-out outline-none select-none',
@@ -72,6 +131,17 @@ export function TabsTrigger(props: TabsTriggerProps) {
72
131
  }
73
132
 
74
133
  export function TabsContent(props: ComponentProps<typeof KobalteTabs.Content>) {
75
- const [local, rest] = splitProps(props, ['class'])
76
- return <KobalteTabs.Content class={cn('flex-1 outline-none', local.class)} {...rest} />
134
+ const [local, rest] = splitProps(props, ['class', 'aria-labelledby'])
135
+ const tabs = useTabsId()
136
+ return (
137
+ <KobalteTabs.Content
138
+ aria-labelledby={
139
+ local['aria-labelledby'] ??
140
+ tabs.triggerIds().get(rest.value) ??
141
+ `${tabs.id()}-trigger-${rest.value}`
142
+ }
143
+ class={cn('min-h-0 min-w-0 flex-1 outline-none', local.class)}
144
+ {...rest}
145
+ />
146
+ )
77
147
  }