division-ds 0.3.0 → 0.4.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 (82) hide show
  1. package/AGENTS.md +2 -2
  2. package/package.json +1 -1
  3. package/public/docs/components/accordion.md +1 -1
  4. package/public/docs/components/ai-label.md +1 -1
  5. package/public/docs/components/alert-dialog.md +1 -1
  6. package/public/docs/components/alert.md +1 -1
  7. package/public/docs/components/approval-request.md +1 -1
  8. package/public/docs/components/auth-form.md +1 -1
  9. package/public/docs/components/avatar-group.md +1 -1
  10. package/public/docs/components/avatar.md +1 -1
  11. package/public/docs/components/badge.md +1 -1
  12. package/public/docs/components/breadcrumbs.md +1 -1
  13. package/public/docs/components/button.md +1 -1
  14. package/public/docs/components/card.md +1 -1
  15. package/public/docs/components/carousel.md +1 -1
  16. package/public/docs/components/cart.md +1 -1
  17. package/public/docs/components/chart-panel.md +58 -43
  18. package/public/docs/components/chat-message.md +1 -1
  19. package/public/docs/components/chat-thread.md +1 -1
  20. package/public/docs/components/checkbox.md +1 -1
  21. package/public/docs/components/checkout-form.md +1 -1
  22. package/public/docs/components/code-block.md +106 -0
  23. package/public/docs/components/command-palette.md +1 -1
  24. package/public/docs/components/data-table.md +1 -1
  25. package/public/docs/components/date-picker.md +3 -3
  26. package/public/docs/components/date-presets.md +1 -1
  27. package/public/docs/components/date-range-picker.md +3 -3
  28. package/public/docs/components/description-list.md +1 -1
  29. package/public/docs/components/dialog.md +1 -1
  30. package/public/docs/components/divider.md +1 -1
  31. package/public/docs/components/dropdown-menu.md +2 -1
  32. package/public/docs/components/empty-state.md +1 -1
  33. package/public/docs/components/footer.md +1 -1
  34. package/public/docs/components/form-field.md +2 -2
  35. package/public/docs/components/icon-button.md +1 -1
  36. package/public/docs/components/input.md +1 -1
  37. package/public/docs/components/kanban-board.md +1 -1
  38. package/public/docs/components/kbd.md +25 -4
  39. package/public/docs/components/link.md +1 -1
  40. package/public/docs/components/list-item.md +1 -1
  41. package/public/docs/components/loading-animation.md +1 -1
  42. package/public/docs/components/multi-select.md +5 -5
  43. package/public/docs/components/navbar.md +55 -4
  44. package/public/docs/components/newsletter-form.md +1 -1
  45. package/public/docs/components/page-header.md +1 -1
  46. package/public/docs/components/pagination.md +1 -1
  47. package/public/docs/components/panel.md +139 -0
  48. package/public/docs/components/product-card.md +1 -1
  49. package/public/docs/components/progress.md +2 -2
  50. package/public/docs/components/prompt-input.md +1 -1
  51. package/public/docs/components/quantity-stepper.md +2 -2
  52. package/public/docs/components/radio.md +1 -1
  53. package/public/docs/components/rating.md +1 -1
  54. package/public/docs/components/score-ring.md +1 -1
  55. package/public/docs/components/search.md +1 -1
  56. package/public/docs/components/section-heading.md +1 -1
  57. package/public/docs/components/segmented-control.md +1 -1
  58. package/public/docs/components/select.md +2 -2
  59. package/public/docs/components/sheet.md +1 -1
  60. package/public/docs/components/sidebar.md +1 -1
  61. package/public/docs/components/skeleton.md +1 -1
  62. package/public/docs/components/slider.md +1 -1
  63. package/public/docs/components/sparkline.md +1 -1
  64. package/public/docs/components/spinner.md +1 -1
  65. package/public/docs/components/stat.md +1 -1
  66. package/public/docs/components/status-tracker.md +1 -1
  67. package/public/docs/components/stepper.md +1 -1
  68. package/public/docs/components/switch.md +1 -1
  69. package/public/docs/components/tabs.md +1 -1
  70. package/public/docs/components/tag.md +1 -1
  71. package/public/docs/components/textarea.md +1 -1
  72. package/public/docs/components/time-field.md +5 -5
  73. package/public/docs/components/timeline.md +1 -1
  74. package/public/docs/components/toast.md +1 -1
  75. package/public/docs/components/tool-call.md +1 -1
  76. package/public/docs/components/tooltip.md +1 -1
  77. package/public/manifest/components.json +516 -92
  78. package/public/manifest/tokens.json +10 -7
  79. package/scripts/lib/agent-docs.mjs +1 -1
  80. package/scripts/lib/props-validator.mjs +36 -2
  81. package/skills/division-ds/SKILL.md +1 -1
  82. package/division-ds-0.3.0.tgz +0 -0
@@ -430,9 +430,12 @@
430
430
  "layer": "semantic",
431
431
  "value": {
432
432
  "dark": "#0d1016",
433
- "light": "#c2cddc"
433
+ "light": "#e3e8ef"
434
434
  },
435
- "use": "The opaque fill of a control you type or pick in (Input, Textarea, Select), and of small opaque surfaces: Kbd, Tag, Tooltip, menus, toasts. Not a card."
435
+ "use": "The opaque fill of a control you type or pick in (Input, Textarea, Select), and of small opaque surfaces: Kbd, Tag, Tooltip, menus, toasts. Not a card.",
436
+ "measured": {
437
+ "light": "neutral.50 mixed 31% of the way to neutral.100 in OKLab (#e3e8ef with the default preset), so the base-to-sunken step is OKLCH ΔL 0.038, the same step as the dark theme (#07080b to #0d1016, ΔL 0.038). neutral.100 alone sat ΔL 0.122 below base and made every field a heavy grey slab; the ramp has no stop in between. A mix of two ramp stops, not a literal, so a Theme Builder preset re-tints it."
438
+ }
436
439
  },
437
440
  {
438
441
  "name": "--color-surface-raised",
@@ -488,7 +491,7 @@
488
491
  "use": "The boundary of an interactive control at rest (Input, Select, secondary Button). The one border that has to be seen to find the control.",
489
492
  "measured": {
490
493
  "dark": "3.53:1 on surface.sunken (the control fill it is painted on) and 3.71:1 on surface.base — the INFORMATIONAL hairline, the one SC 1.4.11 governs. Opaque rather than alpha so the boundary holds whatever surface it lands on.",
491
- "light": "3.49:1 on surface.sunken (the control fill it is painted on) and 5.10:1 on surface.base — the INFORMATIONAL hairline, the one SC 1.4.11 governs. Opaque rather than alpha so the boundary holds whatever surface it lands on."
494
+ "light": "4.56:1 on surface.sunken (the control fill it is painted on) and 5.10:1 on surface.base — the INFORMATIONAL hairline, the one SC 1.4.11 governs. Opaque rather than alpha so the boundary holds whatever surface it lands on."
492
495
  }
493
496
  },
494
497
  {
@@ -501,7 +504,7 @@
501
504
  "use": "The boundary of the small selection controls at rest: Checkbox, Radio, Switch track.",
502
505
  "measured": {
503
506
  "dark": "The boundary of the small selection controls (Checkbox, Radio, Switch track) at rest. 6.12:1 on surface.sunken. Brighter than border.control (3.53:1) on purpose: a 20px box drawn with the same hairline as a 320px input carries a fraction of the edge length, and at 3.53:1 an unchecked checkbox all but vanished on the dark page. border.control stays the hairline for the large fields.",
504
- "light": "The boundary of the small selection controls (Checkbox, Radio, Switch track) at rest. Same value as border.control in this theme (3.49:1 on surface.sunken), which reads clearly on a light page; the token exists in both themes because dark needed its own brighter step."
507
+ "light": "The boundary of the small selection controls (Checkbox, Radio, Switch track) at rest. Same value as border.control in this theme (4.56:1 on surface.sunken), which reads clearly on a light page; the token exists in both themes because dark needed its own brighter step."
505
508
  }
506
509
  },
507
510
  {
@@ -544,7 +547,7 @@
544
547
  "use": "Placeholder text inside a control, on surface.sunken. Only there.",
545
548
  "measured": {
546
549
  "dark": "4.68:1 on surface.sunken, which is the control fill placeholder text is actually painted on. text.muted is gated against surface.base and passes there at 4.59:1, but reaches only 4.37:1 on the sunken fill — so placeholder needs its own step.",
547
- "light": "7.83:1 on surface.sunken, the control fill it is painted on. Light theme needs no separate step from text.muted — unlike dark, where muted reaches only 4.37:1 there — but the name exists in both themes so the component layer has one alias to point at."
550
+ "light": "10.23:1 on surface.sunken, the control fill it is painted on. Light theme needs no separate step from text.muted — unlike dark, where muted reaches only 4.37:1 there — but the name exists in both themes so the component layer has one alias to point at."
548
551
  }
549
552
  },
550
553
  {
@@ -775,7 +778,7 @@
775
778
  "use": "Text or an icon that marks something as made by AI: the AiLabel mark, the AI glyph in a field an AI filled. Always beside a word, never colour alone.",
776
779
  "measured": {
777
780
  "dark": "Measured by the gate: 9.55:1 on surface.base, 9.08:1 on surface.sunken, 8.32:1 on surface.raised. One step lighter than accent.info.text (info.500) so AI marks and status text do not read as the same thing.",
778
- "light": "Measured by the gate: 8.39:1 on surface.base, 5.75:1 on surface.sunken, 8.92:1 on surface.raised. info.700 reached only 3.49:1 on surface.sunken, so the light theme takes info.800."
781
+ "light": "Measured by the gate: 8.39:1 on surface.base, 7.50:1 on surface.sunken, 8.92:1 on surface.raised. info.700 reached only 3.49:1 on the earlier, darker surface.sunken (neutral.100), so the light theme takes info.800."
779
782
  }
780
783
  },
781
784
  {
@@ -788,7 +791,7 @@
788
791
  "use": "The boundary of a form field whose value an AI filled and the person has not changed. Input and Textarea paint it from aiValue; do not paint it by hand.",
789
792
  "measured": {
790
793
  "dark": "The edge of a field an AI filled. 7.91:1 on the AI-filled field (ai.wash over the control fill), far above the 3:1 SC 1.4.11 floor. Same stop as ai.text; a separate token because a boundary and text carry different floors.",
791
- "light": "The edge of a field an AI filled. 5.24:1 on the AI-filled field (ai.wash over surface.sunken). Same stop as ai.text; a separate token because a boundary and text carry different floors."
794
+ "light": "The edge of a field an AI filled. 6.72:1 on the AI-filled field (ai.wash over surface.sunken). Same stop as ai.text; a separate token because a boundary and text carry different floors."
792
795
  }
793
796
  },
794
797
  {
@@ -53,7 +53,7 @@ export function searchIndex(entries, tokens) {
53
53
  }
54
54
 
55
55
  /** Said under every Import block: the paths are the repository's, not an installed project's. */
56
- export const INSTALLED_PATHS = 'Paths are from the Division DS repository root. Installed with shadcn they start `src/division-ds/` instead of `src/` (`src/division-ds/components/...`); import them relative to your file.'
56
+ export const INSTALLED_PATHS = 'Paths are from the Division DS repository root. Installed with shadcn they start `src/division-ds/` instead of `src/` (`src/division-ds/components/...`); import them relative to your file. An install has no index barrels: import each component from its own file, never from `components/molecules`.'
57
57
 
58
58
  /** One component as a markdown page. `entry` is a manifest entry (see `manifestEntry`). */
59
59
  export function componentMarkdown(entry) {
@@ -156,7 +156,14 @@ export function buildIndex(manifest) {
156
156
  const single = exportNames.length === 1
157
157
  for (const name of exportNames) {
158
158
  const spec = specs[name]
159
- spec.checkUnknown = single && !unresolved && spec.rest?.open !== 'any'
159
+ // On a page that documents several components, the rows with no part tag are the main
160
+ // component's own. The main one is checked too when nothing passes through undocumented:
161
+ // its type is closed (manifest `closed`), or its only pass-through is native attributes,
162
+ // which the check already allows. Its parts stay unchecked: their rows list only what
163
+ // differs from the main component.
164
+ const main = name === entry.name && (entry.closed === true || spec.rest?.open === 'native')
165
+ spec.checkUnknown = (single || main) && !unresolved && spec.rest?.open !== 'any'
166
+ spec.namedByFormField = (entry.namedByFormField ?? []).includes(name)
160
167
  index.set(name, spec)
161
168
  }
162
169
  }
@@ -228,7 +235,7 @@ export function scriptKind(path) {
228
235
 
229
236
  /**
230
237
  * Every props violation in one file: `{ path, line, column, rule, component, prop, found, fix }`.
231
- * `rule` is 'unknown-prop' or 'invalid-value'. `index` comes from `buildIndex`.
238
+ * `rule` is 'unknown-prop', 'invalid-value' or 'missing-label' (a control FormField names, with no label and no FormField around it). `index` comes from `buildIndex`.
232
239
  */
233
240
  export function findPropViolations(text, path, index) {
234
241
  const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, scriptKind(path))
@@ -254,11 +261,38 @@ export function findPropViolations(text, path, index) {
254
261
  return undefined
255
262
  }
256
263
 
264
+ // Inside a Division FormField, which names the control it holds.
265
+ const insideFormField = element => {
266
+ for (let node = element.parent; node; node = node.parent) {
267
+ const opening = ts.isJsxElement(node) ? node.openingElement : ts.isJsxSelfClosingElement(node) ? node : null
268
+ if (opening && opening !== element && resolve(opening.tagName) === 'FormField') return true
269
+ }
270
+ return false
271
+ }
272
+
257
273
  const check = element => {
258
274
  const exportName = resolve(element.tagName)
259
275
  const spec = exportName && index.get(exportName)
260
276
  if (!spec) return
261
277
  const tag = element.tagName.getText(source)
278
+ const attributes = element.attributes.properties
279
+ if (
280
+ spec.namedByFormField &&
281
+ !attributes.some(a => ts.isJsxSpreadAttribute(a) || a.name.getText(source) === 'label') &&
282
+ !insideFormField(element)
283
+ ) {
284
+ const at = source.getLineAndCharacterOfPosition(element.getStart(source))
285
+ violations.push({
286
+ path,
287
+ line: at.line + 1,
288
+ column: at.character + 1,
289
+ rule: 'missing-label',
290
+ component: tag,
291
+ prop: 'label',
292
+ found: `<${tag}>`,
293
+ fix: `${tag} has no name: give it a label, or put it in a FormField, which names it. See ${spec.docs}.`,
294
+ })
295
+ }
262
296
  const known = [...spec.props.keys()]
263
297
  for (const attribute of element.attributes.properties) {
264
298
  if (!ts.isJsxAttribute(attribute)) continue
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: division-ds
3
- description: Use when building or changing UI with Division DS (React 19, Tailwind 4, Radix; 72 components). Covers which component and token to use, the composition rules prop types cannot express (providers, FormField, button gaps, card borders), planning a screen's states, and how to check the result. Load it before writing any screen or component in a project that has Division DS components.
3
+ description: Use when building or changing UI with Division DS (React 19, Tailwind 4, Radix; 74 components). Covers which component and token to use, the composition rules prop types cannot express (providers, FormField, button gaps, card borders), planning a screen's states, and how to check the result. Load it before writing any screen or component in a project that has Division DS components.
4
4
  ---
5
5
 
6
6
  # Division DS
Binary file