@adea-ai/ui 0.162.0 → 0.162.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 (22) hide show
  1. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
  2. package/dist/components/composites/appearance-editor/appearance-choices.js +11 -3
  3. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  4. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
  5. package/dist/components/composites/appearance-editor/appearance-editor.js +1 -4
  6. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  7. package/dist/components/composites/appearance-editor/appearance-rows.d.ts +2 -0
  8. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  9. package/dist/components/composites/appearance-editor/appearance-rows.js +4 -1
  10. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  11. package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
  12. package/dist/components/composites/settings/settings-navigation.js +13 -4
  13. package/dist/components/composites/settings/settings-navigation.js.map +1 -1
  14. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +9 -3
  15. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +3 -7
  16. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +8 -1
  17. package/dist/r/src/components/composites/settings/settings-navigation.tsx +33 -6
  18. package/package.json +1 -1
  19. package/src/components/composites/appearance-editor/appearance-choices.tsx +9 -3
  20. package/src/components/composites/appearance-editor/appearance-editor.tsx +3 -7
  21. package/src/components/composites/appearance-editor/appearance-rows.tsx +8 -1
  22. package/src/components/composites/settings/settings-navigation.tsx +33 -6
@@ -67,8 +67,22 @@ function scrollsOn(value: string): boolean {
67
67
  return value === 'auto' || value === 'scroll'
68
68
  }
69
69
 
70
- /** The nearest-edge delta that brings `[start, end]` inside `[min, max]`. */
71
- function nearestDelta(start: number, end: number, min: number, max: number): number {
70
+ /**
71
+ * The nearest-edge delta that brings `[start, end]` inside `[min, max]`. A range longer than
72
+ * the viewport cannot fit, so it aligns its leading edge (`leadingEnd` for a right-to-left
73
+ * inline axis), where the label starts. Settling on whichever edge overflows instead flips
74
+ * between the two on every reveal: a row-forced strip's full-width rows are wider than its
75
+ * scroller, so each reveal of the same row moved it the other way and the row's position
76
+ * depended on how many reveals had run, leaving it scrolled out of view half the time.
77
+ */
78
+ function nearestDelta(
79
+ start: number,
80
+ end: number,
81
+ min: number,
82
+ max: number,
83
+ leadingEnd = false
84
+ ): number {
85
+ if (end - start > max - min) return leadingEnd ? end - max : start - min
72
86
  if (start < min) return start - min
73
87
  if (end > max) return end - max
74
88
  return 0
@@ -88,12 +102,25 @@ function nearestDelta(start: number, end: number, min: number, max: number): num
88
102
  * which is exactly where the browser would report it after that write.
89
103
  */
90
104
  function revealNearest(row: HTMLElement): void {
91
- const scrollers: { container: HTMLElement; x: boolean; y: boolean; box: DOMRect }[] = []
105
+ const scrollers: {
106
+ container: HTMLElement
107
+ x: boolean
108
+ y: boolean
109
+ rtl: boolean
110
+ box: DOMRect
111
+ }[] = []
92
112
  for (let container = row.parentElement; container; container = container.parentElement) {
93
113
  const style = window.getComputedStyle(container)
94
114
  const x = scrollsOn(style.overflowX)
95
115
  const y = scrollsOn(style.overflowY)
96
- if (x || y) scrollers.push({ container, x, y, box: container.getBoundingClientRect() })
116
+ if (x || y)
117
+ scrollers.push({
118
+ container,
119
+ x,
120
+ y,
121
+ rtl: style.direction === 'rtl',
122
+ box: container.getBoundingClientRect(),
123
+ })
97
124
  }
98
125
  if (scrollers.length === 0) return
99
126
  const rowBox = row.getBoundingClientRect()
@@ -102,8 +129,8 @@ function revealNearest(row: HTMLElement): void {
102
129
  let top = rowBox.top
103
130
  let bottom = rowBox.bottom
104
131
  const writes: { container: HTMLElement; dx: number; dy: number }[] = []
105
- for (const { container, x, y, box } of scrollers) {
106
- const dx = x ? nearestDelta(left, right, box.left, box.right) : 0
132
+ for (const { container, x, y, rtl, box } of scrollers) {
133
+ const dx = x ? nearestDelta(left, right, box.left, box.right, rtl) : 0
107
134
  const dy = y ? nearestDelta(top, bottom, box.top, box.bottom) : 0
108
135
  if (dx === 0 && dy === 0) continue
109
136
  writes.push({ container, dx, dy })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/ui",
3
- "version": "0.162.0",
3
+ "version": "0.162.1",
4
4
  "description": "The Adea design system: ui-sdk-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
5
5
  "keywords": [
6
6
  "adea",
@@ -46,10 +46,11 @@ const MODES = [
46
46
  { value: 'light', label: 'Light' },
47
47
  { value: 'dark', label: 'Dark' },
48
48
  ] as const
49
+ // Short labels keep the three choices on the Glass row's own line; each says the rest on hover.
49
50
  const SURFACES = [
50
- { value: 'theme', label: 'Theme default' },
51
- { value: 'frosted', label: 'Frosted' },
52
- { value: 'opaque', label: 'Opaque' },
51
+ { value: 'theme', label: 'Theme', hint: "Uses this theme's default surface." },
52
+ { value: 'frosted', label: 'Frosted', hint: 'Theme-colored glass where supported.' },
53
+ { value: 'opaque', label: 'Opaque', hint: 'Solid surfaces for every theme.' },
53
54
  ] as const
54
55
  const MODE_ICONS = { system: Monitor, light: Sun, dark: Moon } as const
55
56
 
@@ -267,6 +268,11 @@ export function GlassChoices(props: AppearanceEditorProps) {
267
268
  <div class="rounded-md focus-within:ring-3 focus-within:ring-ring/50">
268
269
  <SdkRadio
269
270
  value={option.value}
271
+ title={
272
+ option.value === 'theme'
273
+ ? (props.surfaceCapability.themeDefaultDescription ?? option.hint)
274
+ : option.hint
275
+ }
270
276
  disabled={option.value === 'frosted' && !props.surfaceCapability.frosted}
271
277
  class="flex h-7 w-full cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap outline-none data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
272
278
  >
@@ -102,12 +102,6 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
102
102
  ? `Theme ${offered.label.toLowerCase()} · The theme’s own color.`
103
103
  : 'Theme default · This theme has no such accent.'
104
104
  }
105
- const glassDescription = () =>
106
- props.draft.surface === 'opaque'
107
- ? 'Solid surfaces for every theme.'
108
- : props.draft.surface === 'frosted'
109
- ? 'Theme-colored glass where supported.'
110
- : (props.surfaceCapability.themeDefaultDescription ?? "Uses this theme's default surface.")
111
105
  // One list when no section is asked for; otherwise only that section's rows.
112
106
  const shows = (section: AppearanceEditorTab) =>
113
107
  props.section === undefined || props.section === section
@@ -232,7 +226,9 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
232
226
  the closing slot to them for hosts whose order is palette and
233
227
  surface first, text last. */}
234
228
  <Show when={props.fontSettingsPlacement !== 'end'}>{fontRows()}</Show>
235
- <SettingsRow title="Glass" icon={<PanelsTopLeft />} description={glassDescription()}>
229
+ {/* No subtitle: the three choices fit beside the title, and each explains itself on
230
+ hover. */}
231
+ <SettingsRow title="Glass" icon={<PanelsTopLeft />} compact>
236
232
  <GlassChoices {...props} />
237
233
  </SettingsRow>
238
234
  <Show when={!props.surfaceCapability.frosted && props.surfaceCapability.reason}>
@@ -62,6 +62,8 @@ export function SettingsRow(props: {
62
62
  icon: JSX.Element
63
63
  description?: JSX.Element
64
64
  stacked?: boolean
65
+ /** A short title with no subtitle: the control keeps the title's line at a narrow width. */
66
+ compact?: boolean
65
67
  children: JSX.Element
66
68
  }) {
67
69
  return (
@@ -74,7 +76,12 @@ export function SettingsRow(props: {
74
76
  {/* Reserve readable copy before choosing a side-by-side control row.
75
77
  Wrapping follows the actual host width and enlarged text, rather
76
78
  than a viewport breakpoint that also matches a narrow popover. */}
77
- <div class={cn('flex min-w-0 flex-1 items-center gap-3', { 'basis-48': !props.stacked })}>
79
+ <div
80
+ class={cn('flex min-w-0 flex-1 items-center gap-3', {
81
+ 'basis-48': !props.stacked && !props.compact,
82
+ 'basis-24': !props.stacked && props.compact,
83
+ })}
84
+ >
78
85
  <span
79
86
  class="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4"
80
87
  aria-hidden="true"
@@ -67,8 +67,22 @@ function scrollsOn(value: string): boolean {
67
67
  return value === 'auto' || value === 'scroll'
68
68
  }
69
69
 
70
- /** The nearest-edge delta that brings `[start, end]` inside `[min, max]`. */
71
- function nearestDelta(start: number, end: number, min: number, max: number): number {
70
+ /**
71
+ * The nearest-edge delta that brings `[start, end]` inside `[min, max]`. A range longer than
72
+ * the viewport cannot fit, so it aligns its leading edge (`leadingEnd` for a right-to-left
73
+ * inline axis), where the label starts. Settling on whichever edge overflows instead flips
74
+ * between the two on every reveal: a row-forced strip's full-width rows are wider than its
75
+ * scroller, so each reveal of the same row moved it the other way and the row's position
76
+ * depended on how many reveals had run, leaving it scrolled out of view half the time.
77
+ */
78
+ function nearestDelta(
79
+ start: number,
80
+ end: number,
81
+ min: number,
82
+ max: number,
83
+ leadingEnd = false
84
+ ): number {
85
+ if (end - start > max - min) return leadingEnd ? end - max : start - min
72
86
  if (start < min) return start - min
73
87
  if (end > max) return end - max
74
88
  return 0
@@ -88,12 +102,25 @@ function nearestDelta(start: number, end: number, min: number, max: number): num
88
102
  * which is exactly where the browser would report it after that write.
89
103
  */
90
104
  function revealNearest(row: HTMLElement): void {
91
- const scrollers: { container: HTMLElement; x: boolean; y: boolean; box: DOMRect }[] = []
105
+ const scrollers: {
106
+ container: HTMLElement
107
+ x: boolean
108
+ y: boolean
109
+ rtl: boolean
110
+ box: DOMRect
111
+ }[] = []
92
112
  for (let container = row.parentElement; container; container = container.parentElement) {
93
113
  const style = window.getComputedStyle(container)
94
114
  const x = scrollsOn(style.overflowX)
95
115
  const y = scrollsOn(style.overflowY)
96
- if (x || y) scrollers.push({ container, x, y, box: container.getBoundingClientRect() })
116
+ if (x || y)
117
+ scrollers.push({
118
+ container,
119
+ x,
120
+ y,
121
+ rtl: style.direction === 'rtl',
122
+ box: container.getBoundingClientRect(),
123
+ })
97
124
  }
98
125
  if (scrollers.length === 0) return
99
126
  const rowBox = row.getBoundingClientRect()
@@ -102,8 +129,8 @@ function revealNearest(row: HTMLElement): void {
102
129
  let top = rowBox.top
103
130
  let bottom = rowBox.bottom
104
131
  const writes: { container: HTMLElement; dx: number; dy: number }[] = []
105
- for (const { container, x, y, box } of scrollers) {
106
- const dx = x ? nearestDelta(left, right, box.left, box.right) : 0
132
+ for (const { container, x, y, rtl, box } of scrollers) {
133
+ const dx = x ? nearestDelta(left, right, box.left, box.right, rtl) : 0
107
134
  const dy = y ? nearestDelta(top, bottom, box.top, box.bottom) : 0
108
135
  if (dx === 0 && dy === 0) continue
109
136
  writes.push({ container, dx, dy })