@cloudflare/kumo 1.2.0 → 1.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 (148) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/ai/USAGE.md +193 -0
  3. package/ai/component-registry.json +1492 -215
  4. package/ai/component-registry.md +524 -66
  5. package/ai/schemas.ts +366 -107
  6. package/dist/.build-complete +1 -1
  7. package/dist/badge-Dc99vsfo.js.map +1 -1
  8. package/dist/banner-4fkH6Sbt.js.map +1 -1
  9. package/dist/breadcrumbs-DyKi7BcP.js.map +1 -1
  10. package/dist/button-Bh96oxRL.js.map +1 -1
  11. package/dist/catalog.js +1 -1
  12. package/dist/checkbox-C1LPq8eL.js.map +1 -1
  13. package/dist/clipboard-text-CJSI9X2m.js.map +1 -1
  14. package/dist/cloudflare-logo-Dqd1VD9z.js +166 -0
  15. package/dist/cloudflare-logo-Dqd1VD9z.js.map +1 -0
  16. package/dist/code-T2wPDiM0.js.map +1 -1
  17. package/dist/collapsible-OBNkTO48.js.map +1 -1
  18. package/dist/combobox-CWxn5aHA.js.map +1 -1
  19. package/dist/command-line/cli.js +43 -18
  20. package/dist/command-line/commands/ai.js +23 -0
  21. package/dist/command-line/commands/blocks.js +2 -2
  22. package/dist/command-line/commands/ls.js +2 -2
  23. package/dist/{command-palette-BxmGYxBv.js → command-palette-J50WKjS7.js} +14 -8
  24. package/dist/command-palette-J50WKjS7.js.map +1 -0
  25. package/dist/components/cloudflare-logo.js +10 -0
  26. package/dist/components/cloudflare-logo.js.map +1 -0
  27. package/dist/components/command-palette.js +1 -1
  28. package/dist/components/dialog.js +1 -1
  29. package/dist/components/popover.js +1 -1
  30. package/dist/date-range-picker-CbKEQ9pi.js.map +1 -1
  31. package/dist/{dialog-BxXPA2vI.js → dialog-x9n9wI13.js} +18 -18
  32. package/dist/dialog-x9n9wI13.js.map +1 -0
  33. package/dist/dropdown-BAyk1knz.js.map +1 -1
  34. package/dist/empty-D03cbzRS.js.map +1 -1
  35. package/dist/field-B7ORz5ej.js.map +1 -1
  36. package/dist/grid-DKajRHh8.js.map +1 -1
  37. package/dist/index.js +274 -122
  38. package/dist/index.js.map +1 -1
  39. package/dist/input-D6YgDfDG.js.map +1 -1
  40. package/dist/label-B4FY8MX_.js.map +1 -1
  41. package/dist/layer-card-C8j5Hkkj.js.map +1 -1
  42. package/dist/link-CcuZKqob.js.map +1 -1
  43. package/dist/loader-DHGMYlC6.js.map +1 -1
  44. package/dist/menubar-CzimiryS.js.map +1 -1
  45. package/dist/meter-BrJnHJ3Q.js.map +1 -1
  46. package/dist/pagination-D0x9KQSk.js.map +1 -1
  47. package/dist/{popover-BfGLC2s6.js → popover-CtKDH8Yc.js} +8 -8
  48. package/dist/popover-CtKDH8Yc.js.map +1 -0
  49. package/dist/radio-CYejLANA.js.map +1 -1
  50. package/dist/schemas-DCw6TIy0.js +3859 -0
  51. package/dist/{schemas-C2YJKpDC.js.map → schemas-DCw6TIy0.js.map} +1 -1
  52. package/dist/select-D4rKQAax.js.map +1 -1
  53. package/dist/sensitive-input-DYvAmxkN.js.map +1 -1
  54. package/dist/src/blocks/delete-resource/delete-resource.d.ts +46 -0
  55. package/dist/src/blocks/delete-resource/delete-resource.d.ts.map +1 -0
  56. package/dist/src/blocks/delete-resource/index.d.ts +2 -0
  57. package/dist/src/blocks/delete-resource/index.d.ts.map +1 -0
  58. package/dist/src/command-line/commands/ai.d.ts +10 -0
  59. package/dist/src/command-line/commands/ai.d.ts.map +1 -0
  60. package/dist/src/components/badge/badge.d.ts +31 -4
  61. package/dist/src/components/badge/badge.d.ts.map +1 -1
  62. package/dist/src/components/banner/banner.d.ts +39 -4
  63. package/dist/src/components/banner/banner.d.ts.map +1 -1
  64. package/dist/src/components/breadcrumbs/breadcrumbs.d.ts +35 -0
  65. package/dist/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
  66. package/dist/src/components/button/button.d.ts +86 -0
  67. package/dist/src/components/button/button.d.ts.map +1 -1
  68. package/dist/src/components/checkbox/checkbox.d.ts +7 -0
  69. package/dist/src/components/checkbox/checkbox.d.ts.map +1 -1
  70. package/dist/src/components/clipboard-text/clipboard-text.d.ts +28 -3
  71. package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +1 -1
  72. package/dist/src/components/cloudflare-logo/cloudflare-logo.d.ts +133 -0
  73. package/dist/src/components/cloudflare-logo/cloudflare-logo.d.ts.map +1 -0
  74. package/dist/src/components/cloudflare-logo/index.d.ts +2 -0
  75. package/dist/src/components/cloudflare-logo/index.d.ts.map +1 -0
  76. package/dist/src/components/code/code.d.ts +38 -6
  77. package/dist/src/components/code/code.d.ts.map +1 -1
  78. package/dist/src/components/collapsible/collapsible.d.ts +10 -0
  79. package/dist/src/components/collapsible/collapsible.d.ts.map +1 -1
  80. package/dist/src/components/combobox/combobox.d.ts +61 -0
  81. package/dist/src/components/combobox/combobox.d.ts.map +1 -1
  82. package/dist/src/components/command-palette/command-palette.d.ts +41 -6
  83. package/dist/src/components/command-palette/command-palette.d.ts.map +1 -1
  84. package/dist/src/components/date-range-picker/date-range-picker.d.ts +57 -4
  85. package/dist/src/components/date-range-picker/date-range-picker.d.ts.map +1 -1
  86. package/dist/src/components/dialog/dialog.d.ts +28 -1
  87. package/dist/src/components/dialog/dialog.d.ts.map +1 -1
  88. package/dist/src/components/dropdown/dropdown.d.ts +33 -0
  89. package/dist/src/components/dropdown/dropdown.d.ts.map +1 -1
  90. package/dist/src/components/empty/empty.d.ts +35 -0
  91. package/dist/src/components/empty/empty.d.ts.map +1 -1
  92. package/dist/src/components/field/field.d.ts +34 -4
  93. package/dist/src/components/field/field.d.ts.map +1 -1
  94. package/dist/src/components/grid/grid.d.ts +45 -17
  95. package/dist/src/components/grid/grid.d.ts.map +1 -1
  96. package/dist/src/components/input/input.d.ts +15 -0
  97. package/dist/src/components/input/input.d.ts.map +1 -1
  98. package/dist/src/components/label/label.d.ts +16 -5
  99. package/dist/src/components/label/label.d.ts.map +1 -1
  100. package/dist/src/components/layer-card/layer-card.d.ts +13 -0
  101. package/dist/src/components/layer-card/layer-card.d.ts.map +1 -1
  102. package/dist/src/components/link/link.d.ts +20 -0
  103. package/dist/src/components/link/link.d.ts.map +1 -1
  104. package/dist/src/components/loader/loader.d.ts +34 -0
  105. package/dist/src/components/loader/loader.d.ts.map +1 -1
  106. package/dist/src/components/menubar/menubar.d.ts +44 -0
  107. package/dist/src/components/menubar/menubar.d.ts.map +1 -1
  108. package/dist/src/components/meter/meter.d.ts +26 -0
  109. package/dist/src/components/meter/meter.d.ts.map +1 -1
  110. package/dist/src/components/pagination/pagination.d.ts +25 -0
  111. package/dist/src/components/pagination/pagination.d.ts.map +1 -1
  112. package/dist/src/components/popover/popover.d.ts +33 -5
  113. package/dist/src/components/popover/popover.d.ts.map +1 -1
  114. package/dist/src/components/radio/radio.d.ts +22 -0
  115. package/dist/src/components/radio/radio.d.ts.map +1 -1
  116. package/dist/src/components/select/select.d.ts +42 -20
  117. package/dist/src/components/select/select.d.ts.map +1 -1
  118. package/dist/src/components/sensitive-input/sensitive-input.d.ts +30 -6
  119. package/dist/src/components/sensitive-input/sensitive-input.d.ts.map +1 -1
  120. package/dist/src/components/surface/surface.d.ts +18 -6
  121. package/dist/src/components/surface/surface.d.ts.map +1 -1
  122. package/dist/src/components/switch/switch.d.ts +14 -0
  123. package/dist/src/components/switch/switch.d.ts.map +1 -1
  124. package/dist/src/components/table/table.d.ts +33 -0
  125. package/dist/src/components/table/table.d.ts.map +1 -1
  126. package/dist/src/components/tabs/tabs.d.ts +48 -9
  127. package/dist/src/components/tabs/tabs.d.ts.map +1 -1
  128. package/dist/src/components/text/text.d.ts +35 -7
  129. package/dist/src/components/text/text.d.ts.map +1 -1
  130. package/dist/src/components/toast/toast.d.ts +34 -0
  131. package/dist/src/components/toast/toast.d.ts.map +1 -1
  132. package/dist/src/components/tooltip/tooltip.d.ts +41 -0
  133. package/dist/src/components/tooltip/tooltip.d.ts.map +1 -1
  134. package/dist/src/index.d.ts +31 -0
  135. package/dist/src/index.d.ts.map +1 -1
  136. package/dist/styles/kumo-standalone.css +1 -1
  137. package/dist/surface-BIC6CXiz.js.map +1 -1
  138. package/dist/switch-z7FE1nQE.js.map +1 -1
  139. package/dist/table-Sd2Etb1N.js.map +1 -1
  140. package/dist/tabs-DAEeuQLd.js.map +1 -1
  141. package/dist/text-BEhqwMfe.js.map +1 -1
  142. package/dist/toast-B8ebpHaU.js.map +1 -1
  143. package/dist/tooltip-C4DRhJi1.js.map +1 -1
  144. package/package.json +6 -2
  145. package/dist/command-palette-BxmGYxBv.js.map +0 -1
  146. package/dist/dialog-BxXPA2vI.js.map +0 -1
  147. package/dist/popover-BfGLC2s6.js.map +0 -1
  148. package/dist/schemas-C2YJKpDC.js +0 -3543
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @cloudflare/kumo
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 71d667b: Add CloudflareLogo component with glyph and full logo variants, color schemes (brand/black/white), and exported SVG path data for custom implementations
8
+
9
+ ### Patch Changes
10
+
11
+ - 262e0e6: Replace `.toSorted()` with `.sort()` on spread copies to fix TypeError on Chrome <110
12
+
13
+ ## 1.3.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 6a40edf: add 'Delete Resource' block
18
+
3
19
  ## 1.2.0
4
20
 
5
21
  ### Minor Changes
package/ai/USAGE.md ADDED
@@ -0,0 +1,193 @@
1
+ # @cloudflare/kumo — AI Usage Guide
2
+
3
+ > Cloudflare's React component library built on [Base UI](https://base-ui.com) + Tailwind CSS v4.
4
+
5
+ ## Quick Start
6
+
7
+ ### CSS setup (required)
8
+
9
+ In your main CSS file (e.g. `global.css`), add **all three lines in this order**:
10
+
11
+ ```css
12
+ @source "path/to/node_modules/@cloudflare/kumo/dist/**/*.{js,jsx,ts,tsx}";
13
+ @import "@cloudflare/kumo/styles";
14
+ @import "tailwindcss";
15
+ ```
16
+
17
+ - **`@source`** — Tells Tailwind to scan kumo's compiled JS for class names. Without this, kumo component internals will be unstyled. Adjust the relative path so it resolves to your project's `node_modules/`.
18
+ - **Import order matters** — `@cloudflare/kumo/styles` must come **before** `@import "tailwindcss"` so kumo's `@theme` tokens are registered first.
19
+
20
+ ### Component usage
21
+
22
+ ```tsx
23
+ import { Button, Input, Dialog } from "@cloudflare/kumo";
24
+ ```
25
+
26
+ ## Critical Rules
27
+
28
+ 1. **Semantic tokens only** — use `bg-kumo-base`, `text-kumo-default`, etc. Never use raw Tailwind colors (`bg-blue-500`).
29
+ 2. **No `dark:` variant** — light/dark mode is handled automatically via CSS `light-dark()`. Never add `dark:` prefixes.
30
+ 3. **Merge classes with `cn()`** — import from `@cloudflare/kumo` and use it to combine class names.
31
+ 4. **Compound components** — many components use a dot-notation API: `<Dialog.Root>`, `<Dialog.Trigger>`, etc.
32
+
33
+ ## Component Quick Reference
34
+
35
+ | Component | Category | Description | Key Props |
36
+ |-----------|----------|-------------|-----------|
37
+ | `Badge` | Display | Status/label indicator | `variant`: primary, secondary, destructive, outline, beta |
38
+ | `Banner` | Feedback | Page-level alert message | `variant`: default, alert, error; `icon`, `onDismiss` |
39
+ | `Breadcrumbs` | Display | Navigation breadcrumb trail | Compound: `.Link` (with `href`), `.Separator`, `.Current`; `size`: sm, base |
40
+ | `Button` | Action | Clickable action trigger | `variant`: primary, secondary, ghost, destructive, secondary-destructive, outline; `size`, `shape`, `icon`, `loading` |
41
+ | `Checkbox` | Input | Toggle or multi-select control | `checked`, `onCheckedChange`, `label`, `indeterminate` |
42
+ | `Checkbox.Group` | Input | Group of checkboxes with fieldset | `legend`, `orientation`, `allValues`, `value`, `onValueChange` |
43
+ | `ClipboardText` | Action | Copy-to-clipboard text display | `value`, `label` |
44
+ | `Code` | Display | Inline code or multi-line code block | `children`; use `CodeBlock` for multi-line with copy |
45
+ | `Collapsible` | Display | Expandable/collapsible section | `title`, `defaultOpen` |
46
+ | `Combobox` | Input | Autocomplete input with dropdown | `items`, `value`, `onValueChange`, `multiple`, `label` |
47
+ | `CommandPalette` | Navigation | Spotlight-style search overlay | `.Root`, `.Input`, `.List`, `.Item`, `.ResultItem` |
48
+ | `DateRangePicker` | Input | Dual-calendar date range selector | `onStartDateChange`, `onEndDateChange`, `size`, `timezone` |
49
+ | `Dialog` | Overlay | Modal dialog with backdrop | `size`: sm, base, lg, xl; uses `.Root`, `.Trigger`, `.Title`, `.Close` |
50
+ | `DropdownMenu` | Overlay | Context/action menu | `.Trigger`, `.Content`, `.Item`; item `variant`: default, danger |
51
+ | `Empty` | Display | Empty state placeholder | `icon`, `title`, `description`, `commandLine`, `contents` |
52
+ | `Field` | Input | Form field wrapper with label/error | `label`, `description`, `error`, `required`, `labelTooltip` |
53
+ | `Grid` | Layout | Responsive CSS grid | `variant`: 2up, side-by-side, 2-1, 1-2, 1-3up, 3up, 4up, 1-2-4up; `gap`: none, sm, base, lg |
54
+ | `Input` | Input | Text input field | `size`: xs, sm, base, lg; `variant`: default, error; `label`, `error` |
55
+ | `Label` | Other | Form label with optional tooltip | `children`, `tooltip`, `required` |
56
+ | `LayerCard` | Display | Card with header and collapsible body | `title`, `tag`, `actions`, `icon` |
57
+ | `Link` | Other | Styled anchor/router link | `variant`: inline, current, plain; `href`, `external` |
58
+ | `Loader` | Feedback | Animated loading spinner | `size`: number (default 16) |
59
+ | `MenuBar` | Navigation | Horizontal icon toolbar | `isActive`, `options: { icon, tooltip, onClick }[]` |
60
+ | `Meter` | Display | Progress/usage meter bar | `value`, `max`, `label`, `size` |
61
+ | `Pagination` | Navigation | Page navigation controls | `page`, `setPage`, `perPage`, `totalCount`; `controls`: full, simple |
62
+ | `Popover` | Overlay | Popup content anchored to trigger | `.Trigger`, `.Content`, `.Title`, `.Description`, `.Close`; `side`, `align` |
63
+ | `Radio` | Input | Single-select radio group | `.Group` with `legend`, `.Item` with `label`, `value` |
64
+ | `Select` | Input | Dropdown select menu | `value`, `onValueChange`, `label`, `hideLabel` (default: true); children: `<Select.Option value="…">` |
65
+ | `SensitiveInput` | Input | Input with show/hide toggle | `label`, `size`, `variant` |
66
+ | `Surface` | Layout | Themed container panel | `variant`: flat, raised; `as` for polymorphic rendering |
67
+ | `Switch` | Input | Toggle switch control | `checked`, `onCheckedChange`, `label`, `size` |
68
+ | `Table` | Display | Data table with selection | `.Header`, `.Head`, `.Body`, `.Row`, `.Cell`, `.Footer`, `.CheckCell`, `.CheckHead`, `.ResizeHandle`; `layout`: auto, fixed |
69
+ | `Tabs` | Navigation | Tabbed navigation | `tabs: { value, label, render? }[]`; `variant`: segmented, underline; `value`, `onValueChange` |
70
+ | `Text` | Display | Themed text with semantic variants | `variant`: heading1, heading2, heading3, body, secondary, success, error, mono, mono-secondary; `size`: xs, sm, base, lg; `as` |
71
+ | `Toast` / `Toasty` | Feedback | Toast notification system | Wrap app with `<Toasty>`, use `Toast.useToastManager().notify()` |
72
+ | `Tooltip` | Overlay | Hover/focus tooltip | `content`, `side`, `align`, `asChild` |
73
+
74
+ ## Semantic Token Reference
75
+
76
+ ### Text Colors
77
+ | Token | Purpose |
78
+ |-------|---------|
79
+ | `text-kumo-default` | Primary text |
80
+ | `text-kumo-inverse` | Inverse text (on dark backgrounds) |
81
+ | `text-kumo-strong` | Secondary/muted-strong text |
82
+ | `text-kumo-subtle` | Muted/placeholder text |
83
+ | `text-kumo-link` | Link text |
84
+ | `text-kumo-danger` | Error/destructive text |
85
+ | `text-kumo-success` | Success text |
86
+ | `text-kumo-warning` | Warning text |
87
+ | `text-kumo-brand` | Brand-colored text |
88
+
89
+ ### Background Colors
90
+ | Token | Purpose |
91
+ |-------|---------|
92
+ | `bg-kumo-base` | Page/card background |
93
+ | `bg-kumo-elevated` | Slightly elevated surface |
94
+ | `bg-kumo-overlay` | Overlay/hover background |
95
+ | `bg-kumo-contrast` | High-contrast background (inverted) |
96
+ | `bg-kumo-control` | Form control background |
97
+ | `bg-kumo-fill` | Muted fill (borders, badges) |
98
+ | `bg-kumo-fill-hover` | Hover state for fills |
99
+ | `bg-kumo-tint` | Subtle tinted background |
100
+ | `bg-kumo-interact` | Interactive element background |
101
+ | `bg-kumo-brand` | Brand primary background |
102
+ | `bg-kumo-brand-hover` | Brand hover background |
103
+ | `bg-kumo-danger` | Error/destructive background |
104
+ | `bg-kumo-success` | Success background |
105
+ | `bg-kumo-warning` | Warning background |
106
+
107
+ ### Border/Ring Colors
108
+ | Token | Purpose |
109
+ |-------|---------|
110
+ | `border-kumo-fill` | Default border |
111
+ | `border-kumo-line` | Subtle separator line |
112
+ | `ring-kumo-line` | Default ring (input borders) |
113
+ | `ring-kumo-ring` | Focus ring |
114
+
115
+ ## Icons
116
+
117
+ Kumo uses **[Phosphor Icons](https://phosphoricons.com/)** via `@phosphor-icons/react`:
118
+
119
+ ```tsx
120
+ import { PlusIcon, TrashIcon, GearIcon } from "@phosphor-icons/react";
121
+
122
+ <Button icon={PlusIcon}>Add Worker</Button>
123
+ <DropdownMenu.Item icon={TrashIcon} variant="danger">Delete</DropdownMenu.Item>
124
+ ```
125
+
126
+ ## Controlled State Reference
127
+
128
+ | Component | Value Prop | Change Callback | Default Prop |
129
+ |-----------|-----------|-----------------|-------------|
130
+ | `Input` | `value` | `onChange` | `defaultValue` |
131
+ | `Select` | `value` | `onValueChange` | `defaultValue` |
132
+ | `Combobox` | `value` | `onValueChange` | `defaultValue` |
133
+ | `Switch` | `checked` | `onCheckedChange` | `defaultChecked` |
134
+ | `Checkbox` | `checked` | `onCheckedChange` | `defaultChecked` |
135
+ | `Checkbox.Group` | `value` | `onValueChange` | `defaultValue` |
136
+ | `Radio.Group` | `value` | `onValueChange` | `defaultValue` |
137
+ | `Tabs` | `value` | `onValueChange` | `selectedValue` |
138
+
139
+ ## Common Patterns
140
+
141
+ ### Field Wrapper (label + description + error)
142
+ Most input components accept `label`, `description`, and `error` props that automatically wrap the input in a `<Field>`:
143
+
144
+ ```tsx
145
+ <Input label="Email" description="We'll never share your email" error="Required" variant="error" />
146
+ <Select label="Region" hideLabel={false} error="Please select a region">
147
+ <Select.Option value="us">US East</Select.Option>
148
+ <Select.Option value="eu">EU West</Select.Option>
149
+ </Select>
150
+ <Combobox label="Tags" items={tags} multiple />
151
+ ```
152
+
153
+ > **Note:** `Select` defaults to `hideLabel={true}` (label is screen-reader only). Pass `hideLabel={false}` for a visible label.
154
+
155
+ ### Compound Components
156
+ Many components use a compound/dot-notation API via `Object.assign`:
157
+
158
+ ```tsx
159
+ <Dialog.Root>
160
+ <Dialog.Trigger render={(p) => <Button {...p}>Open</Button>} />
161
+ <Dialog size="lg" className="p-8">
162
+ <Dialog.Title>Confirm</Dialog.Title>
163
+ <Dialog.Description>Are you sure?</Dialog.Description>
164
+ <Dialog.Close render={(p) => <Button {...p}>Cancel</Button>} />
165
+ </Dialog>
166
+ </Dialog.Root>
167
+ ```
168
+
169
+ ### Loading States
170
+ Buttons support a `loading` prop that shows a spinner and disables interaction:
171
+
172
+ ```tsx
173
+ <Button loading>Saving...</Button>
174
+ ```
175
+
176
+ ### Polymorphic Rendering
177
+ Some components accept an `as` prop or Base UI's `render` prop:
178
+
179
+ ```tsx
180
+ <Surface as="section" variant="raised">Content</Surface>
181
+ <Text variant="heading1" as="h2">Custom heading level</Text>
182
+ <Dialog.Trigger render={(p) => <Button {...p}>Open</Button>} />
183
+ ```
184
+
185
+ ## Full Registry
186
+
187
+ For complete prop details, variant values, Tailwind classes, and code examples for every component, see:
188
+
189
+ ```
190
+ @cloudflare/kumo/ai/component-registry.json
191
+ ```
192
+
193
+ This JSON file contains structured metadata for all components, optimized for AI/agent consumption.