ajo-ui 0.1.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 (103) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +126 -0
  3. package/dist/accordion.js +130 -0
  4. package/dist/avatar.js +54 -0
  5. package/dist/calendar.js +2 -0
  6. package/dist/carousel.js +239 -0
  7. package/dist/chart.js +790 -0
  8. package/dist/checkbox-group.js +70 -0
  9. package/dist/checkbox.js +77 -0
  10. package/dist/chunks/bar-CVafh6C1.js +99 -0
  11. package/dist/chunks/calendar-q8jZ8Cxr.js +1923 -0
  12. package/dist/chunks/collection-DtRB63U4.js +111 -0
  13. package/dist/chunks/data-table-DpkWv4y4.js +1039 -0
  14. package/dist/chunks/menu-B45IyHHC.js +704 -0
  15. package/dist/chunks/native-BJdhd9XJ.js +20 -0
  16. package/dist/chunks/popup-C8Bb3l_g.js +459 -0
  17. package/dist/chunks/popup-surface-BDCgtVU0.js +18 -0
  18. package/dist/chunks/position-D6_i_SRn.js +434 -0
  19. package/dist/chunks/virtual-list-B7hjGkjk.js +413 -0
  20. package/dist/collapsible.js +106 -0
  21. package/dist/command.js +263 -0
  22. package/dist/context-menu.js +112 -0
  23. package/dist/data-table.js +5 -0
  24. package/dist/dialog.js +207 -0
  25. package/dist/direction.js +22 -0
  26. package/dist/drawer.js +139 -0
  27. package/dist/field.js +26 -0
  28. package/dist/index.js +38 -0
  29. package/dist/input-date.js +994 -0
  30. package/dist/input-group.js +52 -0
  31. package/dist/input-otp.js +179 -0
  32. package/dist/menu.js +2 -0
  33. package/dist/menubar.js +236 -0
  34. package/dist/message-scroller.js +446 -0
  35. package/dist/navigation-menu.js +330 -0
  36. package/dist/popover.js +307 -0
  37. package/dist/progress.js +39 -0
  38. package/dist/radio-group.js +107 -0
  39. package/dist/resizable.js +172 -0
  40. package/dist/select.js +961 -0
  41. package/dist/sidebar.js +343 -0
  42. package/dist/slider.js +259 -0
  43. package/dist/switch.js +53 -0
  44. package/dist/tabs.js +182 -0
  45. package/dist/toast.js +492 -0
  46. package/dist/toggle-group.js +111 -0
  47. package/dist/toggle.js +52 -0
  48. package/dist/toolbar.js +127 -0
  49. package/dist/tooltip.js +196 -0
  50. package/dist/utils.js +104 -0
  51. package/dist/virtual-list.js +2 -0
  52. package/package.json +250 -0
  53. package/src/accordion.tsx +261 -0
  54. package/src/availability.ts +261 -0
  55. package/src/avatar.tsx +99 -0
  56. package/src/bar.ts +156 -0
  57. package/src/calendar.tsx +1441 -0
  58. package/src/carousel.tsx +424 -0
  59. package/src/chart.tsx +1194 -0
  60. package/src/checkbox-group.tsx +132 -0
  61. package/src/checkbox.tsx +130 -0
  62. package/src/collapsible.tsx +188 -0
  63. package/src/collection.ts +154 -0
  64. package/src/command.tsx +511 -0
  65. package/src/context-menu.tsx +233 -0
  66. package/src/data-table-contract.ts +143 -0
  67. package/src/data-table-model.ts +760 -0
  68. package/src/data-table.tsx +475 -0
  69. package/src/dialog.tsx +393 -0
  70. package/src/direction.tsx +45 -0
  71. package/src/drawer.tsx +251 -0
  72. package/src/field.tsx +61 -0
  73. package/src/index.ts +37 -0
  74. package/src/input-date.tsx +1539 -0
  75. package/src/input-group.tsx +142 -0
  76. package/src/input-otp.tsx +324 -0
  77. package/src/menu-cluster.ts +124 -0
  78. package/src/menu.tsx +1095 -0
  79. package/src/menubar.tsx +459 -0
  80. package/src/message-scroller.tsx +732 -0
  81. package/src/native.ts +26 -0
  82. package/src/navigation-menu.tsx +578 -0
  83. package/src/popover.tsx +519 -0
  84. package/src/popup-surface.tsx +31 -0
  85. package/src/popup.ts +569 -0
  86. package/src/position.ts +523 -0
  87. package/src/progress.tsx +70 -0
  88. package/src/radio-group.tsx +186 -0
  89. package/src/resizable.tsx +310 -0
  90. package/src/segments.ts +922 -0
  91. package/src/select.tsx +1501 -0
  92. package/src/sidebar.tsx +683 -0
  93. package/src/slider.tsx +424 -0
  94. package/src/switch.tsx +104 -0
  95. package/src/tabs.tsx +314 -0
  96. package/src/toast.tsx +923 -0
  97. package/src/toggle-group.tsx +249 -0
  98. package/src/toggle.tsx +91 -0
  99. package/src/toolbar.tsx +212 -0
  100. package/src/tooltip.tsx +359 -0
  101. package/src/utils.ts +204 -0
  102. package/src/virtual-list.tsx +205 -0
  103. package/src/virtual.ts +385 -0
package/src/field.tsx ADDED
@@ -0,0 +1,61 @@
1
+ import type { IntrinsicElements, Stateful, Stateless, WithChildren } from 'ajo'
2
+ import type { OmitArg } from './utils'
3
+ import { label, statefulRootAttrs as rootAttrs, type LabelView } from 'ajo-cloves'
4
+ import { context } from 'ajo/context'
5
+
6
+ type FieldBehaviorArgs = {
7
+ /** Marks composed field parts as invalid for ARIA wiring. */
8
+ invalid?: boolean
9
+ /** Stable id prefix for the field wiring. */
10
+ name?: string
11
+ }
12
+
13
+ type FieldRootArgs = WithChildren<FieldBehaviorArgs>
14
+
15
+ /** Arguments for a field host that coordinates labels, descriptions, and errors. */
16
+ export type FieldArgs = WithChildren<OmitArg<IntrinsicElements['div'], 'children'> & FieldBehaviorArgs>
17
+
18
+ /** Label-clove contract exposed to controls composed inside a Field. */
19
+ export type FieldContextValue = Pick<LabelView,
20
+ | 'buttonAttrs'
21
+ | 'controlAttrs'
22
+ | 'describe'
23
+ | 'descriptionAttrs'
24
+ | 'errorAttrs'
25
+ | 'groupAttrs'
26
+ | 'ids'
27
+ | 'labelAttrs'
28
+ >
29
+
30
+ /** Field context carrying label clove wiring to composed field parts. */
31
+ export const FieldContext = context<FieldContextValue | null>(null)
32
+
33
+ /** Unstyled behavior root for one field's label, description, and error wiring. */
34
+ const FieldRoot: Stateful<FieldRootArgs> = function* (args) {
35
+ const view = label(this, { prefix: () => args.name })
36
+
37
+ for (const next of this) {
38
+ view.reset()
39
+ view.sync(Boolean(next.invalid))
40
+ FieldContext(view)
41
+
42
+ yield <>{next.children}</>
43
+ }
44
+ }
45
+
46
+ /** Unstyled field host with label, description, and error wiring. */
47
+ export const Field: Stateless<FieldArgs> = ({
48
+ children,
49
+ invalid,
50
+ name,
51
+ ...attrs
52
+ }) => (
53
+ <FieldRoot
54
+ {...rootAttrs(attrs)}
55
+ invalid={invalid}
56
+ name={name}
57
+ attr:data-slot="field"
58
+ >
59
+ {children}
60
+ </FieldRoot>
61
+ )
package/src/index.ts ADDED
@@ -0,0 +1,37 @@
1
+ export * from './accordion'
2
+ export * from './avatar'
3
+ export * from './calendar'
4
+ export * from './carousel'
5
+ export * from './chart'
6
+ export * from './checkbox'
7
+ export * from './checkbox-group'
8
+ export * from './collapsible'
9
+ export * from './command'
10
+ export * from './context-menu'
11
+ export * from './data-table'
12
+ export * from './dialog'
13
+ export * from './direction'
14
+ export * from './drawer'
15
+ export * from './field'
16
+ export * from './input-date'
17
+ export * from './input-group'
18
+ export * from './input-otp'
19
+ export * from './menu'
20
+ export * from './menubar'
21
+ export * from './message-scroller'
22
+ export * from './navigation-menu'
23
+ export * from './popover'
24
+ export * from './progress'
25
+ export * from './radio-group'
26
+ export * from './resizable'
27
+ export * from './select'
28
+ export * from './sidebar'
29
+ export * from './slider'
30
+ export * from './switch'
31
+ export * from './tabs'
32
+ export * from './toggle'
33
+ export * from './toggle-group'
34
+ export * from './toast'
35
+ export * from './toolbar'
36
+ export * from './tooltip'
37
+ export * from './virtual-list'