@charcuterie/ui 2.18.0 → 3.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 (121) hide show
  1. package/README.md +10 -0
  2. package/dist/Badge/Badge.d.ts +33 -3
  3. package/dist/Badge/Badge.d.ts.map +1 -1
  4. package/dist/Badge/Badge.js +20 -2
  5. package/dist/Badge/Badge.js.map +1 -1
  6. package/dist/Board/Board.d.ts +119 -0
  7. package/dist/Board/Board.d.ts.map +1 -0
  8. package/dist/Board/Board.js +165 -0
  9. package/dist/Board/Board.js.map +1 -0
  10. package/dist/Board/BoardCard.d.ts +120 -0
  11. package/dist/Board/BoardCard.d.ts.map +1 -0
  12. package/dist/Board/BoardCard.js +77 -0
  13. package/dist/Board/BoardCard.js.map +1 -0
  14. package/dist/Board/BoardLaneList.d.ts +103 -0
  15. package/dist/Board/BoardLaneList.d.ts.map +1 -0
  16. package/dist/Board/BoardLaneList.js +69 -0
  17. package/dist/Board/BoardLaneList.js.map +1 -0
  18. package/dist/Board/boardMove.d.ts +116 -0
  19. package/dist/Board/boardMove.d.ts.map +1 -0
  20. package/dist/Board/boardMove.js +116 -0
  21. package/dist/Board/boardMove.js.map +1 -0
  22. package/dist/Board/useBoardDrag.d.ts +44 -0
  23. package/dist/Board/useBoardDrag.d.ts.map +1 -0
  24. package/dist/Board/useBoardDrag.js +237 -0
  25. package/dist/Board/useBoardDrag.js.map +1 -0
  26. package/dist/Checkbox/Checkbox.d.ts.map +1 -1
  27. package/dist/Checkbox/Checkbox.js +15 -4
  28. package/dist/Checkbox/Checkbox.js.map +1 -1
  29. package/dist/DataTable/DataTable.d.ts +159 -0
  30. package/dist/DataTable/DataTable.d.ts.map +1 -0
  31. package/dist/DataTable/DataTable.js +197 -0
  32. package/dist/DataTable/DataTable.js.map +1 -0
  33. package/dist/DatePicker/DateGrid.d.ts +79 -0
  34. package/dist/DatePicker/DateGrid.d.ts.map +1 -0
  35. package/dist/DatePicker/DateGrid.js +220 -0
  36. package/dist/DatePicker/DateGrid.js.map +1 -0
  37. package/dist/DatePicker/DatePicker.d.ts +138 -0
  38. package/dist/DatePicker/DatePicker.d.ts.map +1 -0
  39. package/dist/DatePicker/DatePicker.js +384 -0
  40. package/dist/DatePicker/DatePicker.js.map +1 -0
  41. package/dist/DatePicker/datePresets.d.ts +29 -0
  42. package/dist/DatePicker/datePresets.d.ts.map +1 -0
  43. package/dist/DatePicker/datePresets.js +28 -0
  44. package/dist/DatePicker/datePresets.js.map +1 -0
  45. package/dist/DatePicker/parseDateInput.d.ts +106 -0
  46. package/dist/DatePicker/parseDateInput.d.ts.map +1 -0
  47. package/dist/DatePicker/parseDateInput.js +419 -0
  48. package/dist/DatePicker/parseDateInput.js.map +1 -0
  49. package/dist/DatePicker/plainDate.d.ts +167 -0
  50. package/dist/DatePicker/plainDate.d.ts.map +1 -0
  51. package/dist/DatePicker/plainDate.js +272 -0
  52. package/dist/DatePicker/plainDate.js.map +1 -0
  53. package/dist/MarkdownEditor/MarkdownEditor.d.ts +147 -0
  54. package/dist/MarkdownEditor/MarkdownEditor.d.ts.map +1 -0
  55. package/dist/MarkdownEditor/MarkdownEditor.js +492 -0
  56. package/dist/MarkdownEditor/MarkdownEditor.js.map +1 -0
  57. package/dist/MarkdownEditor/markdownCommands.d.ts +202 -0
  58. package/dist/MarkdownEditor/markdownCommands.d.ts.map +1 -0
  59. package/dist/MarkdownEditor/markdownCommands.js +379 -0
  60. package/dist/MarkdownEditor/markdownCommands.js.map +1 -0
  61. package/dist/MarkdownEditor/markdownSpans.d.ts +92 -0
  62. package/dist/MarkdownEditor/markdownSpans.d.ts.map +1 -0
  63. package/dist/MarkdownEditor/markdownSpans.js +303 -0
  64. package/dist/MarkdownEditor/markdownSpans.js.map +1 -0
  65. package/dist/Select/Select.d.ts +36 -1
  66. package/dist/Select/Select.d.ts.map +1 -1
  67. package/dist/Select/Select.js +38 -2
  68. package/dist/Select/Select.js.map +1 -1
  69. package/dist/categoricalStyles.d.ts +53 -0
  70. package/dist/categoricalStyles.d.ts.map +1 -0
  71. package/dist/categoricalStyles.js +195 -0
  72. package/dist/categoricalStyles.js.map +1 -0
  73. package/dist/index.d.ts +22 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +11 -0
  76. package/dist/index.js.map +1 -1
  77. package/package.json +2 -2
  78. package/src/Badge/Badge.mdx +46 -0
  79. package/src/Badge/Badge.stories.tsx +98 -4
  80. package/src/Badge/Badge.test.tsx +157 -2
  81. package/src/Badge/Badge.tsx +49 -3
  82. package/src/Board/Board.mdx +199 -0
  83. package/src/Board/Board.stories.tsx +707 -0
  84. package/src/Board/Board.test.tsx +310 -0
  85. package/src/Board/Board.tsx +333 -0
  86. package/src/Board/BoardCard.tsx +290 -0
  87. package/src/Board/BoardLaneList.tsx +275 -0
  88. package/src/Board/boardMove.test.ts +213 -0
  89. package/src/Board/boardMove.ts +225 -0
  90. package/src/Board/useBoardDrag.ts +413 -0
  91. package/src/Checkbox/Checkbox.tsx +34 -3
  92. package/src/DataTable/DataTable.mdx +123 -0
  93. package/src/DataTable/DataTable.stories.tsx +411 -0
  94. package/src/DataTable/DataTable.test.tsx +386 -0
  95. package/src/DataTable/DataTable.tsx +497 -0
  96. package/src/DatePicker/DateGrid.tsx +467 -0
  97. package/src/DatePicker/DatePicker.mdx +170 -0
  98. package/src/DatePicker/DatePicker.stories.tsx +268 -0
  99. package/src/DatePicker/DatePicker.test.tsx +455 -0
  100. package/src/DatePicker/DatePicker.tsx +852 -0
  101. package/src/DatePicker/datePresets.ts +34 -0
  102. package/src/DatePicker/parseDateInput.test.ts +187 -0
  103. package/src/DatePicker/parseDateInput.ts +629 -0
  104. package/src/DatePicker/plainDate.test.ts +375 -0
  105. package/src/DatePicker/plainDate.ts +465 -0
  106. package/src/MarkdownEditor/MarkdownEditor.mdx +189 -0
  107. package/src/MarkdownEditor/MarkdownEditor.stories.tsx +267 -0
  108. package/src/MarkdownEditor/MarkdownEditor.test.tsx +627 -0
  109. package/src/MarkdownEditor/MarkdownEditor.tsx +862 -0
  110. package/src/MarkdownEditor/markdownCommands.test.ts +384 -0
  111. package/src/MarkdownEditor/markdownCommands.ts +566 -0
  112. package/src/MarkdownEditor/markdownSpans.test.ts +217 -0
  113. package/src/MarkdownEditor/markdownSpans.ts +458 -0
  114. package/src/Select/Select.mdx +44 -0
  115. package/src/Select/Select.stories.tsx +55 -0
  116. package/src/Select/Select.test.tsx +89 -1
  117. package/src/Select/Select.tsx +58 -2
  118. package/src/argTypes.storyHelpers.ts +39 -0
  119. package/src/categoricalStyles.ts +244 -0
  120. package/src/index.ts +89 -0
  121. package/src/sourceRules.test.ts +52 -1
package/src/index.ts CHANGED
@@ -65,6 +65,26 @@ export type {
65
65
  export { Alert } from "./Alert/Alert.tsx"
66
66
  export type { BadgeProps } from "./Badge/Badge.tsx"
67
67
  export { Badge } from "./Badge/Badge.tsx"
68
+ export type {
69
+ BoardMove,
70
+ BoardProps,
71
+ } from "./Board/Board.tsx"
72
+ export { Board } from "./Board/Board.tsx"
73
+ export type { BoardItem } from "./Board/BoardCard.tsx"
74
+ export type { BoardLane } from "./Board/BoardLaneList.tsx"
75
+ export type {
76
+ BoardDropLane,
77
+ BoardDropTarget,
78
+ BoardPoint,
79
+ BoardRect,
80
+ } from "./Board/boardMove.ts"
81
+ export {
82
+ chooseDropIndex,
83
+ chooseDropTarget,
84
+ describeMove,
85
+ getIsMoveMeaningful,
86
+ toSettledIndex,
87
+ } from "./Board/boardMove.ts"
68
88
  export type { ButtonProps } from "./Button/Button.tsx"
69
89
  export { Button } from "./Button/Button.tsx"
70
90
  export type { ButtonLinkProps } from "./ButtonLink/ButtonLink.tsx"
@@ -86,6 +106,12 @@ export type {
86
106
  export { ColorSchemeToggle } from "./ColorSchemeToggle/ColorSchemeToggle.tsx"
87
107
  export type { ComboboxProps } from "./Combobox/Combobox.tsx"
88
108
  export { Combobox } from "./Combobox/Combobox.tsx"
109
+ export {
110
+ CATEGORICAL_APPEARANCE_CLASS,
111
+ CATEGORICAL_CONTENT_CLASS,
112
+ CATEGORICAL_HOVER_CLASS,
113
+ CATEGORICAL_SOLID_FILL_CLASS,
114
+ } from "./categoricalStyles.ts"
89
115
  export type { BadgeSize } from "./controlStyles.ts"
90
116
  export {
91
117
  BADGE_SIZE_CLASS,
@@ -97,6 +123,53 @@ export {
97
123
  MIN_TOUCH_TARGET_CLASS,
98
124
  SPINNER_SIZE_CLASS,
99
125
  } from "./controlStyles.ts"
126
+ export type {
127
+ DataTableColumn,
128
+ DataTableProps,
129
+ DataTableSelection,
130
+ DataTableSort,
131
+ } from "./DataTable/DataTable.tsx"
132
+ export { DataTable } from "./DataTable/DataTable.tsx"
133
+ export type { DatePickerProps } from "./DatePicker/DatePicker.tsx"
134
+ export { DatePicker } from "./DatePicker/DatePicker.tsx"
135
+ export type { DatePreset } from "./DatePicker/datePresets.ts"
136
+ export { DEFAULT_DATE_PRESETS } from "./DatePicker/datePresets.ts"
137
+ export type {
138
+ DateInputKeywords,
139
+ DateInputResult,
140
+ ParseDateInputOptions,
141
+ } from "./DatePicker/parseDateInput.ts"
142
+ export {
143
+ DEFAULT_DATE_INPUT_KEYWORDS,
144
+ parseDateInput,
145
+ } from "./DatePicker/parseDateInput.ts"
146
+ export type {
147
+ DateRange,
148
+ PlainDate,
149
+ PlainDateFormatOptions,
150
+ } from "./DatePicker/plainDate.ts"
151
+ export {
152
+ addDays,
153
+ addMonths,
154
+ clampPlainDate,
155
+ comparePlainDates,
156
+ formatPlainDate,
157
+ getDayNumber,
158
+ getDaysBetween,
159
+ getDaysInMonth,
160
+ getFirstDayOfWeek,
161
+ getIsLeapYear,
162
+ getIsSameDay,
163
+ getIsValidPlainDate,
164
+ getIsWithinRange,
165
+ getLocalPlainDate,
166
+ getMonthNames,
167
+ getPlainDateFromDayNumber,
168
+ getWeekday,
169
+ getWeekdayNames,
170
+ parseIsoDate,
171
+ toIsoDate,
172
+ } from "./DatePicker/plainDate.ts"
100
173
  export type {
101
174
  DialogProps,
102
175
  DialogSize,
@@ -146,6 +219,22 @@ export type {
146
219
  export { LogViewer } from "./LogViewer/LogViewer.tsx"
147
220
  export type { MainProps } from "./Main/Main.tsx"
148
221
  export { Main } from "./Main/Main.tsx"
222
+ export type {
223
+ MarkdownEditorProps,
224
+ MarkdownImageUpload,
225
+ } from "./MarkdownEditor/MarkdownEditor.tsx"
226
+ export { MarkdownEditor } from "./MarkdownEditor/MarkdownEditor.tsx"
227
+ export { toMarkdownImage } from "./MarkdownEditor/markdownCommands.ts"
228
+ export type {
229
+ MarkdownLine,
230
+ MarkdownLineKind,
231
+ MarkdownSpan,
232
+ MarkdownSpanKind,
233
+ } from "./MarkdownEditor/markdownSpans.ts"
234
+ export {
235
+ toLineIndex,
236
+ toMarkdownLines,
237
+ } from "./MarkdownEditor/markdownSpans.ts"
149
238
  export type {
150
239
  MediaTileProps,
151
240
  MediaTileRatio,
@@ -211,9 +211,30 @@ test("a container-query component is never storied in a shrink-to-fit cell", ()
211
211
  // inside it.
212
212
  expect(containerComponents).toEqual([
213
213
  "Alert",
214
+ // `Board` declares **two** containers and neither is the element
215
+ // that queries it: the board's own box decides how many lanes are
216
+ // on screen, and each lane's list — in `BoardLaneList.tsx`, which
217
+ // is a member rather than a component by the `<Name>/<Name>.tsx`
218
+ // rule — decides what shape a card is. Only the first of those is
219
+ // in this list, and that is enough: it is `<Board` a story renders,
220
+ // so `<Board` is what a shrink-to-fit `StoryCell` would collapse.
221
+ "Board",
214
222
  "Card",
223
+ // `DataTable` joins them as the first component whose *layout*
224
+ // is the container query rather than its padding: below `--cq-md`
225
+ // a row stops being a row and becomes a labelled block, so the
226
+ // whole point of the component is a query it declares itself.
227
+ "DataTable",
228
+ // `DatePicker`'s panel is the container, and it is the first one
229
+ // here whose container is *not* the element a caller sized. A
230
+ // portalled panel is clamped to the space floating-ui found for
231
+ // it, so the calendar reads that and not the window — which is
232
+ // the case a media query cannot express at all, and the case the
233
+ // owner is in whenever he browses zoomed in.
234
+ "DatePicker",
215
235
  "EmptyState",
216
236
  "Main",
237
+ "MarkdownEditor",
217
238
  "MediaTile",
218
239
  ])
219
240
 
@@ -374,12 +395,42 @@ test("the barrel is the only place components are re-exported", async () => {
374
395
  // the barrel by the `<Name>/<Name>.tsx` rule, exactly as
375
396
  // `SegmentedOption` and `ListboxOption` do.
376
397
  //
398
+ // `MarkdownEditor` — Docket's live hybrid editor, a real
399
+ // `<textarea>` with a painted layer behind it — is +1 -> 46. Its
400
+ // `markdownSpans.ts` and `markdownCommands.ts` are pure modules
401
+ // rather than components and stay out of this count by the
402
+ // `<Name>/<Name>.tsx` rule.
403
+ //
377
404
  // `Picker` — a `Listbox` with its trigger already attached — is +1 ->
378
405
  // 45. It is a component rather than a recipe in the docs because the
379
406
  // fleet wrote it four separate times (plex-channels' `SelectListbox`,
380
407
  // board-games' `SelectMenu`, mux-magic's `ListboxPicker`, and twice
381
408
  // inside this package), each with its own hand-rolled chevron.
382
- expect(componentNames.length).toBe(45)
409
+ // `DatePicker` — a typed date field with a calendar dialog — is +1
410
+ // -> 47. `DateGrid.tsx`, `plainDate.ts` and `parseDateInput.ts` are
411
+ // its members and stay out of this count by the `<Name>/<Name>.tsx`
412
+ // rule, exactly as `SegmentedOption` and `ListboxOption` do. The
413
+ // two `.ts` ones are still exported from the barrel: the calendar
414
+ // arithmetic and the input grammar are the parts a consumer needs
415
+ // *outside* the field (Docket counts staleness in days), and they
416
+ // reach nothing but `Intl`.
417
+ //
418
+ // `DataTable` — the reflowing table Docket's task lists, backlog and
419
+ // search results need — is +1 -> 48. It **composes**
420
+ // `SortableTableHeader` rather than subsuming it: that component is
421
+ // already in a published 1.0.0 with a consumer of its own, so
422
+ // removing it would be a breaking change bought for nothing, and
423
+ // both stay in this count.
424
+ //
425
+ // `Board` — lanes of cards, sized by their container and moved by
426
+ // keyboard or by pointer — is +1 -> 49. It is the library's first
427
+ // component whose own operation is a **write** rather than a
428
+ // selection, and the first to declare two nested containers.
429
+ // `BoardCard.tsx`, `BoardLaneList.tsx`, `boardMove.ts` and
430
+ // `useBoardDrag.ts` are its members and stay out of this count and
431
+ // the barrel by the `<Name>/<Name>.tsx` rule, exactly as
432
+ // `ToolbarSlot` and `QueryBuilderRow` do.
433
+ expect(componentNames.length).toBe(49)
383
434
 
384
435
  for (const name of componentNames) {
385
436
  expect(barrel).toContain(`export { ${name} }`)