@duro-app/ui 5.21.0 → 5.23.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 (110) hide show
  1. package/dist/Table-Cw1B14R3.js.map +1 -1
  2. package/dist/components/AppShell/AppShell.d.ts +10 -1
  3. package/dist/components/AppShell/AppShell.d.ts.map +1 -1
  4. package/dist/components/AppShell/AppShell.stories.d.ts +8 -0
  5. package/dist/components/AppShell/AppShell.stories.d.ts.map +1 -1
  6. package/dist/components/AppShell/styles.css.d.ts +7 -0
  7. package/dist/components/AppShell/styles.css.d.ts.map +1 -1
  8. package/dist/components/CodeBlock/CodeBlock.d.ts +3 -21
  9. package/dist/components/CodeBlock/CodeBlock.d.ts.map +1 -1
  10. package/dist/components/CodeBlock/CodeBlock.stories.d.ts +4 -0
  11. package/dist/components/CodeBlock/CodeBlock.stories.d.ts.map +1 -1
  12. package/dist/components/CodeBlock/DiffLines.d.ts +9 -0
  13. package/dist/components/CodeBlock/DiffLines.d.ts.map +1 -0
  14. package/dist/components/CodeBlock/diffRoles.d.ts +14 -0
  15. package/dist/components/CodeBlock/diffRoles.d.ts.map +1 -0
  16. package/dist/components/CodeBlock/styles.css.d.ts +24 -0
  17. package/dist/components/CodeBlock/styles.css.d.ts.map +1 -1
  18. package/dist/components/CodeBlock/types.d.ts +29 -0
  19. package/dist/components/CodeBlock/types.d.ts.map +1 -0
  20. package/dist/components/Drawer/touchInput.d.ts +5 -1
  21. package/dist/components/Drawer/touchInput.d.ts.map +1 -1
  22. package/dist/components/Prose/Prose.d.ts +1 -1
  23. package/dist/components/SplitPane/SplitPane.d.ts +10 -1
  24. package/dist/components/SplitPane/SplitPane.d.ts.map +1 -1
  25. package/dist/components/SplitPane/SplitPane.stories.d.ts +11 -0
  26. package/dist/components/SplitPane/SplitPane.stories.d.ts.map +1 -1
  27. package/dist/components/SplitPane/styles.css.d.ts +22 -0
  28. package/dist/components/SplitPane/styles.css.d.ts.map +1 -1
  29. package/dist/components/Textarea/Textarea.d.ts +14 -2
  30. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  31. package/dist/components/Textarea/Textarea.meta.d.ts.map +1 -1
  32. package/dist/components/Textarea/Textarea.stories.d.ts +2 -0
  33. package/dist/components/Textarea/Textarea.stories.d.ts.map +1 -1
  34. package/dist/components/Textarea/autoGrow.d.ts +22 -0
  35. package/dist/components/Textarea/autoGrow.d.ts.map +1 -0
  36. package/dist/components/Textarea/grow.css.d.ts +12 -0
  37. package/dist/components/Textarea/grow.css.d.ts.map +1 -0
  38. package/dist/components/Textarea/grow.d.ts +2 -0
  39. package/dist/components/Textarea/grow.d.ts.map +1 -0
  40. package/dist/components/Textarea/native.css.d.ts +8 -0
  41. package/dist/components/Textarea/native.css.d.ts.map +1 -0
  42. package/dist/components/Textarea/useAutoGrowFallback.d.ts +9 -0
  43. package/dist/components/Textarea/useAutoGrowFallback.d.ts.map +1 -0
  44. package/dist/components/Toolbar/Toolbar.d.ts +2 -14
  45. package/dist/components/Toolbar/Toolbar.d.ts.map +1 -1
  46. package/dist/components/Toolbar/types.d.ts +15 -0
  47. package/dist/components/Toolbar/types.d.ts.map +1 -0
  48. package/dist/components/VirtualList/VirtualList.d.ts +5 -26
  49. package/dist/components/VirtualList/VirtualList.d.ts.map +1 -1
  50. package/dist/components/VirtualList/VirtualList.meta.d.ts.map +1 -1
  51. package/dist/components/VirtualList/VirtualList.stories.d.ts +16 -0
  52. package/dist/components/VirtualList/VirtualList.stories.d.ts.map +1 -1
  53. package/dist/components/VirtualList/native.css.d.ts +14 -0
  54. package/dist/components/VirtualList/native.css.d.ts.map +1 -0
  55. package/dist/components/VirtualList/props.d.ts +31 -0
  56. package/dist/components/VirtualList/props.d.ts.map +1 -0
  57. package/dist/components/VirtualList/styles.css.d.ts +4 -0
  58. package/dist/components/VirtualList/styles.css.d.ts.map +1 -1
  59. package/dist/index.css +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +4442 -4215
  63. package/dist/index.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/components/AppShell/AppShell.meta.ts +1 -1
  66. package/src/components/AppShell/AppShell.native.tsx +3 -0
  67. package/src/components/AppShell/AppShell.stories.tsx +68 -0
  68. package/src/components/AppShell/AppShell.tsx +16 -5
  69. package/src/components/AppShell/styles.css.ts +10 -0
  70. package/src/components/CodeBlock/CodeBlock.meta.ts +1 -1
  71. package/src/components/CodeBlock/CodeBlock.native.tsx +33 -0
  72. package/src/components/CodeBlock/CodeBlock.stories.tsx +54 -0
  73. package/src/components/CodeBlock/CodeBlock.tsx +8 -20
  74. package/src/components/CodeBlock/DiffLines.tsx +32 -0
  75. package/src/components/CodeBlock/diffRoles.ts +40 -0
  76. package/src/components/CodeBlock/styles.css.ts +17 -0
  77. package/src/components/CodeBlock/types.ts +29 -0
  78. package/src/components/Drawer/touchInput.ts +16 -2
  79. package/src/components/Prose/Prose.meta.ts +1 -1
  80. package/src/components/Prose/Prose.native.tsx +23 -0
  81. package/src/components/Prose/Prose.tsx +1 -1
  82. package/src/components/Prose/styles.native.css.ts +15 -0
  83. package/src/components/SplitPane/SplitPane.meta.ts +1 -1
  84. package/src/components/SplitPane/SplitPane.native.tsx +4 -0
  85. package/src/components/SplitPane/SplitPane.stories.tsx +207 -1
  86. package/src/components/SplitPane/SplitPane.tsx +50 -7
  87. package/src/components/SplitPane/styles.css.ts +28 -0
  88. package/src/components/Textarea/Textarea.meta.ts +6 -2
  89. package/src/components/Textarea/Textarea.stories.tsx +136 -1
  90. package/src/components/Textarea/Textarea.tsx +50 -3
  91. package/src/components/Textarea/autoGrow.ts +33 -0
  92. package/src/components/Textarea/grow.css.ts +18 -0
  93. package/src/components/Textarea/grow.native.ts +1 -0
  94. package/src/components/Textarea/grow.ts +1 -0
  95. package/src/components/Textarea/native.css.ts +16 -0
  96. package/src/components/Textarea/useAutoGrowFallback.native.ts +5 -0
  97. package/src/components/Textarea/useAutoGrowFallback.ts +35 -0
  98. package/src/components/Toolbar/Toolbar.meta.ts +1 -1
  99. package/src/components/Toolbar/Toolbar.native.tsx +27 -0
  100. package/src/components/Toolbar/Toolbar.tsx +3 -14
  101. package/src/components/Toolbar/types.ts +15 -0
  102. package/src/components/VirtualList/VirtualList.meta.ts +2 -1
  103. package/src/components/VirtualList/VirtualList.native.tsx +80 -0
  104. package/src/components/VirtualList/VirtualList.stories.tsx +171 -1
  105. package/src/components/VirtualList/VirtualList.tsx +118 -27
  106. package/src/components/VirtualList/native.css.ts +14 -0
  107. package/src/components/VirtualList/props.ts +31 -0
  108. package/src/components/VirtualList/styles.css.ts +7 -0
  109. package/src/index.native.ts +8 -0
  110. package/src/index.ts +1 -0
@@ -0,0 +1,31 @@
1
+ import type {ReactNode} from 'react'
2
+ import type {SizeToken} from '@duro-app/tokens/keys'
3
+ import type {Length} from '../../shared/length'
4
+
5
+ export interface VirtualListProps<T> {
6
+ items: readonly T[]
7
+ /** Each row's starting height estimate, a size token; rows are then measured. */
8
+ estimateSize: SizeToken
9
+ renderItem: (item: T, index: number) => ReactNode
10
+ /** A stable key per item (an id), so rows keep their measurement as items change. */
11
+ getKey: (item: T, index: number) => string | number
12
+ /** Rows rendered beyond each edge of the view. Default 5 */
13
+ overscan?: number
14
+ /**
15
+ * `end` starts at the last item and stays pinned to the bottom while new
16
+ * items arrive, as long as the reader is at the bottom (a transcript, a log).
17
+ * Default `start`.
18
+ */
19
+ anchor?: 'start' | 'end'
20
+ /**
21
+ * Called once each time the reader scrolls to within 44px (touchTarget) of the
22
+ * start (load older history). It fires again only after they move away.
23
+ * A list too short to scroll calls it once for each new first item or length, until it fills.
24
+ * Prepending items keeps the first visible row where it was on screen.
25
+ */
26
+ onStartReached?: () => void
27
+ /** Cap the list's height; without it, it fills its parent. */
28
+ maxHeight?: Length
29
+ /** The list's accessible name. */
30
+ 'aria-label': string
31
+ }
@@ -1,4 +1,6 @@
1
1
  import {css} from 'react-strict-dom'
2
+ import {colors} from '@duro-app/tokens/tokens/colors.css'
3
+ import {borders} from '@duro-app/tokens/tokens/borders.css'
2
4
 
3
5
  export const styles = css.create({
4
6
  // The scroll container: it fills its parent (a pane, a flex column) by
@@ -10,6 +12,11 @@ export const styles = css.create({
10
12
  minHeight: 0,
11
13
  overflowY: 'auto',
12
14
  overscrollBehavior: 'contain',
15
+ // Focusable so the keyboard can scroll rows that hold no control (WCAG 2.1.1).
16
+ outlineWidth: {default: 0, ':focus-visible': borders.focusRing},
17
+ outlineStyle: {default: 'none', ':focus-visible': 'solid'},
18
+ outlineColor: {default: 'transparent', ':focus-visible': colors.accent},
19
+ outlineOffset: {default: 0, ':focus-visible': `calc(-1 * ${borders.focusRing})`},
13
20
  },
14
21
  scrollMax: (maxHeight: number | string) => ({
15
22
  height: 'auto',
@@ -27,6 +27,11 @@ export {Text, type TextVariant, type TextColor} from './components/Text/Text'
27
27
  export {TextLink, type TextLinkVariant} from './components/TextLink/TextLink'
28
28
  export {Textarea, type TextareaVariant} from './components/Textarea/Textarea'
29
29
 
30
+ // Text and layout
31
+ export {CodeBlock, type CodeBlockProps} from './components/CodeBlock/CodeBlock'
32
+ export {Prose} from './components/Prose/Prose'
33
+ export {Toolbar, type ToolbarProps} from './components/Toolbar/Toolbar'
34
+
30
35
  // Form field wrappers (RN-safe — used by Input/Textarea/Checkbox)
31
36
  export {Field} from './components/Field/Field'
32
37
  export {InputGroup} from './components/InputGroup/InputGroup'
@@ -57,6 +62,8 @@ export {Tree} from './components/Tree/Tree'
57
62
  export {Select} from './components/Select/Select'
58
63
  export {Combobox} from './components/Combobox/Combobox'
59
64
  export {Listbox} from './components/Listbox/Listbox'
65
+ // A FlatList with the web props; prepend keeps position.
66
+ export {VirtualList, type VirtualListProps} from './components/VirtualList/VirtualList'
60
67
  // The platform's own scroll indicator: Scrollbar and Thumb draw nothing.
61
68
  export {ScrollArea} from './components/ScrollArea/ScrollArea'
62
69
  export type {ListboxAnchorProps, ListboxMaxHeight} from './components/Listbox/Listbox'
@@ -66,6 +73,7 @@ export {SplitPane} from './components/SplitPane/SplitPane'
66
73
  export {
67
74
  AppShell,
68
75
  type AppShellCollapse,
76
+ type AppShellScroll,
69
77
  type AppShellRailState,
70
78
  } from './components/AppShell/AppShell'
71
79
 
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export {Alert, type AlertVariant} from './components/Alert/Alert'
13
13
  export {
14
14
  AppShell,
15
15
  type AppShellCollapse,
16
+ type AppShellScroll,
16
17
  type AppShellRailState,
17
18
  } from './components/AppShell/AppShell'
18
19
  export {Aside} from './components/Aside/Aside'