@adea-ai/ui 0.81.0 → 0.82.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 (69) hide show
  1. package/README.md +41 -8
  2. package/dist/components/composites/account-menu/account-menu.d.ts +5 -0
  3. package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
  4. package/dist/components/composites/account-menu/account-menu.js +122 -70
  5. package/dist/components/composites/account-menu/account-menu.js.map +1 -1
  6. package/dist/components/composites/action-button/action-button.d.ts +27 -0
  7. package/dist/components/composites/action-button/action-button.d.ts.map +1 -0
  8. package/dist/components/composites/action-button/action-button.js +121 -0
  9. package/dist/components/composites/action-button/action-button.js.map +1 -0
  10. package/dist/components/composites/action-button/index.d.ts +3 -0
  11. package/dist/components/composites/action-button/index.d.ts.map +1 -0
  12. package/dist/components/composites/action-button/index.js +2 -0
  13. package/dist/components/conversation/thread-panel.d.ts +2 -0
  14. package/dist/components/conversation/thread-panel.d.ts.map +1 -1
  15. package/dist/components/conversation/thread-panel.js +36 -31
  16. package/dist/components/conversation/thread-panel.js.map +1 -1
  17. package/dist/components/layout/sidebar-nav/index.d.ts +1 -1
  18. package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
  19. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +6 -1
  20. package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
  21. package/dist/components/layout/sidebar-nav/sidebar-nav.js +66 -62
  22. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  23. package/dist/components/ui/board/board.d.ts.map +1 -1
  24. package/dist/components/ui/board/board.js +54 -7
  25. package/dist/components/ui/board/board.js.map +1 -1
  26. package/dist/components/ui/command/command.d.ts +5 -1
  27. package/dist/components/ui/command/command.d.ts.map +1 -1
  28. package/dist/components/ui/command/command.js +8 -3
  29. package/dist/components/ui/command/command.js.map +1 -1
  30. package/dist/components/ui/input/index.d.ts +1 -1
  31. package/dist/components/ui/input/index.d.ts.map +1 -1
  32. package/dist/components/ui/input/input.d.ts +5 -1
  33. package/dist/components/ui/input/input.d.ts.map +1 -1
  34. package/dist/components/ui/input/input.js +36 -17
  35. package/dist/components/ui/input/input.js.map +1 -1
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +2 -1
  39. package/dist/lint/index.d.ts.map +1 -1
  40. package/dist/lint.js +47 -7
  41. package/dist/lint.js.map +1 -1
  42. package/dist/r/account-menu.json +1 -0
  43. package/dist/r/action-button.json +24 -0
  44. package/dist/r/conversation.json +1 -0
  45. package/dist/r/registry.json +26 -0
  46. package/dist/r/src/components/composites/account-menu/account-menu.tsx +100 -44
  47. package/dist/r/src/components/composites/action-button/action-button.tsx +139 -0
  48. package/dist/r/src/components/composites/action-button/index.ts +2 -0
  49. package/dist/r/src/components/conversation/thread-panel.tsx +22 -12
  50. package/dist/r/src/components/layout/sidebar-nav/index.ts +1 -0
  51. package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +29 -21
  52. package/dist/r/src/components/ui/board/board.tsx +74 -6
  53. package/dist/r/src/components/ui/command/command.tsx +15 -4
  54. package/dist/r/src/components/ui/input/index.ts +1 -1
  55. package/dist/r/src/components/ui/input/input.tsx +38 -21
  56. package/package.json +1 -1
  57. package/registry.json +26 -0
  58. package/src/components/composites/account-menu/account-menu.tsx +100 -44
  59. package/src/components/composites/action-button/action-button.tsx +139 -0
  60. package/src/components/composites/action-button/index.ts +2 -0
  61. package/src/components/conversation/thread-panel.tsx +22 -12
  62. package/src/components/layout/sidebar-nav/index.ts +1 -0
  63. package/src/components/layout/sidebar-nav/sidebar-nav.tsx +29 -21
  64. package/src/components/ui/board/board.tsx +74 -6
  65. package/src/components/ui/command/command.tsx +15 -4
  66. package/src/components/ui/input/index.ts +1 -1
  67. package/src/components/ui/input/input.tsx +38 -21
  68. package/src/index.ts +1 -0
  69. package/src/lint/index.ts +71 -7
package/src/lint/index.ts CHANGED
@@ -111,11 +111,14 @@ interface PrimitiveImportOptions {
111
111
 
112
112
  const DEFAULT_PRIMITIVE_PACKAGES = Object.freeze([
113
113
  '@kobalte/core',
114
+ '@corvu',
115
+ 'cmdk-solid',
114
116
  '@ark-ui',
115
117
  '@zag-js',
116
118
  '@radix-ui',
117
119
  'radix-ui',
118
120
  '@base-ui-components',
121
+ '@base-ui',
119
122
  ])
120
123
 
121
124
  /**
@@ -166,7 +169,20 @@ const GENERIC_ELEMENTS: ReadonlySet<string> = new Set([
166
169
  'svg',
167
170
  ])
168
171
 
169
- const CLICK_HANDLERS: ReadonlySet<string> = new Set(['onClick', 'onDoubleClick'])
172
+ const CLICK_HANDLERS: ReadonlySet<string> = new Set([
173
+ 'onClick',
174
+ 'onDoubleClick',
175
+ 'onPointerDown',
176
+ 'onPointerUp',
177
+ 'onMouseDown',
178
+ 'onMouseUp',
179
+ 'on:click',
180
+ 'on:dblclick',
181
+ 'on:pointerdown',
182
+ 'on:pointerup',
183
+ 'on:mousedown',
184
+ 'on:mouseup',
185
+ ])
170
186
 
171
187
  interface InteractiveWrapperOptions {
172
188
  /** Element names this rule should not report (rare; prefer fixing the file). */
@@ -175,13 +191,25 @@ interface InteractiveWrapperOptions {
175
191
  message?: string
176
192
  }
177
193
 
178
- /** Reads a static `role` value; a dynamic role is undecidable statically, so it is left to review. */
194
+ /** Only statically knowable branches; unresolved roles remain a review boundary. */
195
+ const staticStrings = (node: any): string[] => {
196
+ if (node?.type === 'Literal' && typeof node.value === 'string') return [node.value]
197
+ if (node?.type === 'JSXExpressionContainer') return staticStrings(node.expression)
198
+ if (node?.type === 'ConditionalExpression')
199
+ return [...staticStrings(node.consequent), ...staticStrings(node.alternate)]
200
+ if (node?.type === 'TemplateLiteral' && node.expressions.length === 0)
201
+ return [node.quasis[0].value.cooked ?? node.quasis[0].value.raw]
202
+ return []
203
+ }
204
+
179
205
  const roleOf = (node: any): string | null => {
180
206
  for (const attribute of node.attributes ?? []) {
181
207
  if (attribute.type !== 'JSXAttribute' || attribute.name?.name !== 'role') continue
182
- if (attribute.value?.type === 'Literal' && typeof attribute.value.value === 'string')
183
- return attribute.value.value
184
- return null
208
+ return (
209
+ staticStrings(attribute.value)
210
+ .flatMap((role) => role.split(/\s+/))
211
+ .find((role) => role in ROLE_PRIMITIVES) ?? null
212
+ )
185
213
  }
186
214
  return null
187
215
  }
@@ -189,9 +217,34 @@ const roleOf = (node: any): string | null => {
189
217
  /** Whether the element carries the attribute, by name. */
190
218
  const has = (node: any, name: string): boolean =>
191
219
  (node.attributes ?? []).some(
192
- (attribute: any) => attribute.type === 'JSXAttribute' && attribute.name?.name === name
220
+ (attribute: any) =>
221
+ attribute.type === 'JSXAttribute' &&
222
+ (attribute.name?.type === 'JSXNamespacedName'
223
+ ? `${attribute.name.namespace.name}:${attribute.name.name.name}`
224
+ : attribute.name?.name) === name
193
225
  )
194
226
 
227
+ const hasTabStop = (node: any): boolean =>
228
+ (node.attributes ?? []).some((attribute: any) => {
229
+ if (
230
+ attribute.type !== 'JSXAttribute' ||
231
+ !['tabIndex', 'tabindex'].includes(attribute.name?.name)
232
+ )
233
+ return false
234
+ const value =
235
+ attribute.value?.type === 'JSXExpressionContainer'
236
+ ? attribute.value.expression
237
+ : attribute.value
238
+ if (value?.type === 'Literal') return !(Number(value.value) < 0)
239
+ if (
240
+ value?.type === 'UnaryExpression' &&
241
+ value.operator === '-' &&
242
+ value.argument?.type === 'Literal'
243
+ )
244
+ return !(Number(value.argument.value) > 0)
245
+ return true
246
+ })
247
+
195
248
  const noInteractiveWrappers: RuleModule = {
196
249
  meta: {
197
250
  type: 'problem',
@@ -255,7 +308,7 @@ const noInteractiveWrappers: RuleModule = {
255
308
  })
256
309
  return
257
310
  }
258
- if (has(node, 'tabIndex') || has(node, 'tabindex')) {
311
+ if (hasTabStop(node)) {
259
312
  context.report({
260
313
  node,
261
314
  messageId: 'tabindexWrapper',
@@ -315,6 +368,17 @@ const noPrimitiveLibraryImports: RuleModule = {
315
368
  if (typeof node.source?.value === 'string' && offender(node.source.value))
316
369
  report(node, node.source.value)
317
370
  },
371
+ ExportNamedDeclaration(node: any) {
372
+ if (offender(node.source?.value)) report(node, node.source.value)
373
+ },
374
+ ExportAllDeclaration(node: any) {
375
+ if (offender(node.source?.value)) report(node, node.source.value)
376
+ },
377
+ CallExpression(node: any) {
378
+ if (node.callee?.type !== 'Identifier' || node.callee.name !== 'require') return
379
+ const source = node.arguments?.[0]?.value
380
+ if (typeof source === 'string' && offender(source)) report(node, source)
381
+ },
318
382
  }
319
383
  },
320
384
  }