@cloudflare/kumo 1.4.0 → 1.5.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.
- package/CHANGELOG.md +19 -0
- package/README.md +15 -7
- package/ai/component-registry.json +45 -127
- package/ai/component-registry.md +95 -100
- package/ai/schemas.ts +5 -4
- package/dist/.build-complete +1 -1
- package/dist/button-Bh96oxRL.js.map +1 -1
- package/dist/catalog.js +1 -1
- package/dist/{checkbox-C1LPq8eL.js → checkbox-CWANiedi.js} +3 -3
- package/dist/{checkbox-C1LPq8eL.js.map → checkbox-CWANiedi.js.map} +1 -1
- package/dist/{clipboard-text-CJSI9X2m.js → clipboard-text-CqueQiB8.js} +2 -2
- package/dist/{clipboard-text-CJSI9X2m.js.map → clipboard-text-CqueQiB8.js.map} +1 -1
- package/dist/{combobox-CWxn5aHA.js → combobox-C9koouxM.js} +4 -4
- package/dist/{combobox-CWxn5aHA.js.map → combobox-C9koouxM.js.map} +1 -1
- package/dist/command-line/cli.js +5 -5
- package/dist/command-line/commands/doc.js +3 -3
- package/dist/command-line/commands/ls.js +2 -2
- package/dist/{command-palette-J50WKjS7.js → command-palette-TGXgr6Vq.js} +2 -2
- package/dist/{command-palette-J50WKjS7.js.map → command-palette-TGXgr6Vq.js.map} +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-palette.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/input.js +8 -7
- package/dist/components/label.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sensitive-input.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/toast.js +5 -4
- package/dist/components/tooltip.js +1 -1
- package/dist/dialog-CpCeOqSZ.js +97 -0
- package/dist/dialog-CpCeOqSZ.js.map +1 -0
- package/dist/{dropdown-BAyk1knz.js → dropdown-DFeFcKfn.js} +3 -3
- package/dist/{dropdown-BAyk1knz.js.map → dropdown-DFeFcKfn.js.map} +1 -1
- package/dist/{field-B7ORz5ej.js → field-Dt-XuSaQ.js} +3 -3
- package/dist/{field-B7ORz5ej.js.map → field-Dt-XuSaQ.js.map} +1 -1
- package/dist/index.js +106 -104
- package/dist/{input-D6YgDfDG.js → input-GZAWBXYX.js} +3 -3
- package/dist/{input-D6YgDfDG.js.map → input-GZAWBXYX.js.map} +1 -1
- package/dist/{input-area-DN_Ncliw.js → input-area-CS1-ceY4.js} +21 -19
- package/dist/input-area-CS1-ceY4.js.map +1 -0
- package/dist/{input-group-BXzBwH4p.js → input-group-COo-wz5O.js} +2 -2
- package/dist/{input-group-BXzBwH4p.js.map → input-group-COo-wz5O.js.map} +1 -1
- package/dist/label-ChZ2Pp5p.js +58 -0
- package/dist/label-ChZ2Pp5p.js.map +1 -0
- package/dist/{link-CcuZKqob.js → link-Mj2WM1AS.js} +2 -2
- package/dist/{link-CcuZKqob.js.map → link-Mj2WM1AS.js.map} +1 -1
- package/dist/{menubar-CzimiryS.js → menubar-CbXWXQYR.js} +2 -2
- package/dist/{menubar-CzimiryS.js.map → menubar-CbXWXQYR.js.map} +1 -1
- package/dist/{meter-BrJnHJ3Q.js → meter-Bu5f3mAc.js} +2 -2
- package/dist/{meter-BrJnHJ3Q.js.map → meter-Bu5f3mAc.js.map} +1 -1
- package/dist/{pagination-D0x9KQSk.js → pagination-Bm8eMWpj.js} +2 -2
- package/dist/{pagination-D0x9KQSk.js.map → pagination-Bm8eMWpj.js.map} +1 -1
- package/dist/{popover-CtKDH8Yc.js → popover-D7yeRosi.js} +2 -2
- package/dist/{popover-CtKDH8Yc.js.map → popover-D7yeRosi.js.map} +1 -1
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +1 -1
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.js +1 -1
- package/dist/{radio-CYejLANA.js → radio-CKn09bGo.js} +2 -2
- package/dist/{radio-CYejLANA.js.map → radio-CKn09bGo.js.map} +1 -1
- package/dist/{schemas-DCw6TIy0.js → schemas-B-D2OT-O.js} +7 -8
- package/dist/{schemas-DCw6TIy0.js.map → schemas-B-D2OT-O.js.map} +1 -1
- package/dist/{select-D4rKQAax.js → select-DvpgiOau.js} +3 -3
- package/dist/{select-D4rKQAax.js.map → select-DvpgiOau.js.map} +1 -1
- package/dist/{sensitive-input-DYvAmxkN.js → sensitive-input-BuYT6U6C.js} +4 -4
- package/dist/{sensitive-input-DYvAmxkN.js.map → sensitive-input-BuYT6U6C.js.map} +1 -1
- package/dist/src/components/button/button.d.ts +20 -12
- package/dist/src/components/button/button.d.ts.map +1 -1
- package/dist/src/components/dialog/dialog.d.ts +54 -13
- package/dist/src/components/dialog/dialog.d.ts.map +1 -1
- package/dist/src/components/dialog/index.d.ts +1 -1
- package/dist/src/components/dialog/index.d.ts.map +1 -1
- package/dist/src/components/input/index.d.ts +1 -1
- package/dist/src/components/input/index.d.ts.map +1 -1
- package/dist/src/components/input/input-area.d.ts +19 -0
- package/dist/src/components/input/input-area.d.ts.map +1 -1
- package/dist/src/components/label/label.d.ts +5 -3
- package/dist/src/components/label/label.d.ts.map +1 -1
- package/dist/src/components/toast/index.d.ts +1 -1
- package/dist/src/components/toast/index.d.ts.map +1 -1
- package/dist/src/components/toast/toast.d.ts +2 -0
- package/dist/src/components/toast/toast.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/{switch-z7FE1nQE.js → switch-Tu34uFoa.js} +3 -3
- package/dist/{switch-z7FE1nQE.js.map → switch-Tu34uFoa.js.map} +1 -1
- package/dist/{table-Sd2Etb1N.js → table-BUmvaBj8.js} +2 -2
- package/dist/{table-Sd2Etb1N.js.map → table-BUmvaBj8.js.map} +1 -1
- package/dist/{tabs-DAEeuQLd.js → tabs-B7THfqHW.js} +2 -2
- package/dist/{tabs-DAEeuQLd.js.map → tabs-B7THfqHW.js.map} +1 -1
- package/dist/{toast-B8ebpHaU.js → toast-Du4y8qng.js} +16 -14
- package/dist/{toast-B8ebpHaU.js.map → toast-Du4y8qng.js.map} +1 -1
- package/dist/{tooltip-C4DRhJi1.js → tooltip-BxV1H6AV.js} +2 -2
- package/dist/{tooltip-C4DRhJi1.js.map → tooltip-BxV1H6AV.js.map} +1 -1
- package/dist/{vendor-base-ui-kX0wjdav.js → vendor-base-ui-CQ6wEonS.js} +5 -5
- package/dist/{vendor-base-ui-kX0wjdav.js.map → vendor-base-ui-CQ6wEonS.js.map} +1 -1
- package/package.json +2 -2
- package/scripts/component-registry/index.ts +68 -12
- package/dist/dialog-x9n9wI13.js +0 -77
- package/dist/dialog-x9n9wI13.js.map +0 -1
- package/dist/input-area-DN_Ncliw.js.map +0 -1
- package/dist/label-B4FY8MX_.js +0 -50
- package/dist/label-B4FY8MX_.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/kumo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Kumo - Cloudflare's component library for building modern web applications",
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
"zod": "^4.0.0"
|
|
420
420
|
},
|
|
421
421
|
"scripts": {
|
|
422
|
-
"prepublish": "pnpm run clean && pnpm run build && pnpm run test:unit",
|
|
422
|
+
"prepublish": "pnpm run clean && pnpm run codegen:registry && pnpm run build && pnpm run test:unit",
|
|
423
423
|
"build": "vite build --mode production && tsx scripts/css-build.ts && tsx src/command-line/build-cli.ts",
|
|
424
424
|
"dev": "vite build --watch --mode development",
|
|
425
425
|
"new:component": "plop component",
|
|
@@ -317,36 +317,92 @@ function generatePropsFromType(
|
|
|
317
317
|
|
|
318
318
|
// Follow $ref chain to get the actual definition
|
|
319
319
|
// This handles cases like: ExpandableProps -> React.PropsWithChildren<...>
|
|
320
|
-
while (
|
|
320
|
+
while (
|
|
321
|
+
mainDef.$ref &&
|
|
322
|
+
!mainDef.properties &&
|
|
323
|
+
!mainDef.allOf &&
|
|
324
|
+
!mainDef.anyOf &&
|
|
325
|
+
!mainDef.oneOf
|
|
326
|
+
) {
|
|
321
327
|
const refName = decodeURIComponent(mainDef.$ref.split("/").pop()!);
|
|
322
328
|
const refDef = schema.definitions?.[refName] as Definition;
|
|
323
329
|
if (!refDef) break;
|
|
324
330
|
mainDef = refDef;
|
|
325
331
|
}
|
|
326
332
|
|
|
327
|
-
//
|
|
333
|
+
// Helper: collect properties and required fields from a schema part
|
|
328
334
|
// biome-ignore lint/suspicious/noExplicitAny: JSON Schema types are complex
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
335
|
+
function collectFromParts(parts: Definition[]): {
|
|
336
|
+
// biome-ignore lint/suspicious/noExplicitAny: JSON Schema types are complex
|
|
337
|
+
properties: Record<string, any>;
|
|
338
|
+
required: string[];
|
|
339
|
+
} {
|
|
340
|
+
// biome-ignore lint/suspicious/noExplicitAny: JSON Schema types are complex
|
|
341
|
+
let properties: Record<string, any> = {};
|
|
342
|
+
let required: string[] = [];
|
|
343
|
+
|
|
344
|
+
for (const part of parts) {
|
|
334
345
|
if (part.$ref) {
|
|
335
|
-
const refName = part.$ref.split("/").pop()
|
|
346
|
+
const refName = decodeURIComponent(part.$ref.split("/").pop()!);
|
|
336
347
|
const refDef = schema.definitions?.[refName] as Definition;
|
|
337
348
|
if (refDef?.properties) {
|
|
338
|
-
|
|
349
|
+
properties = { ...properties, ...refDef.properties };
|
|
339
350
|
}
|
|
340
351
|
if (refDef?.required) {
|
|
341
|
-
|
|
352
|
+
required = [...required, ...(refDef.required as string[])];
|
|
353
|
+
}
|
|
354
|
+
// Recursively handle nested allOf/anyOf in referenced definitions
|
|
355
|
+
if (refDef?.allOf) {
|
|
356
|
+
const nested = collectFromParts(refDef.allOf as Definition[]);
|
|
357
|
+
properties = { ...properties, ...nested.properties };
|
|
358
|
+
required = [...required, ...nested.required];
|
|
342
359
|
}
|
|
343
360
|
} else if (part.properties) {
|
|
344
|
-
|
|
361
|
+
properties = { ...properties, ...part.properties };
|
|
345
362
|
if (part.required) {
|
|
346
|
-
|
|
363
|
+
required = [...required, ...(part.required as string[])];
|
|
347
364
|
}
|
|
348
365
|
}
|
|
349
366
|
}
|
|
367
|
+
return { properties, required };
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Handle intersection types (allOf) - merge all properties
|
|
371
|
+
// biome-ignore lint/suspicious/noExplicitAny: JSON Schema types are complex
|
|
372
|
+
let allProperties: Record<string, any> = {};
|
|
373
|
+
let allRequired: string[] = [];
|
|
374
|
+
|
|
375
|
+
if (mainDef.allOf) {
|
|
376
|
+
const result = collectFromParts(mainDef.allOf as Definition[]);
|
|
377
|
+
allProperties = result.properties;
|
|
378
|
+
allRequired = result.required;
|
|
379
|
+
} else if (mainDef.anyOf || mainDef.oneOf) {
|
|
380
|
+
// Handle union types (anyOf/oneOf) — e.g. discriminated unions like ButtonProps
|
|
381
|
+
// Merge properties from all union members. Properties that only appear in
|
|
382
|
+
// some members are marked as optional.
|
|
383
|
+
const unionMembers = (mainDef.anyOf || mainDef.oneOf) as Definition[];
|
|
384
|
+
// biome-ignore lint/suspicious/noExplicitAny: JSON Schema types are complex
|
|
385
|
+
const memberProps: Array<{
|
|
386
|
+
// biome-ignore lint/suspicious/noExplicitAny: JSON Schema types are complex
|
|
387
|
+
properties: Record<string, any>;
|
|
388
|
+
required: string[];
|
|
389
|
+
}> = [];
|
|
390
|
+
|
|
391
|
+
for (const member of unionMembers) {
|
|
392
|
+
const collected = collectFromParts([member]);
|
|
393
|
+
memberProps.push(collected);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Merge all member properties
|
|
397
|
+
for (const mp of memberProps) {
|
|
398
|
+
allProperties = { ...allProperties, ...mp.properties };
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// A prop is required only if it's required in ALL union members
|
|
402
|
+
const allPropNames = Object.keys(allProperties);
|
|
403
|
+
allRequired = allPropNames.filter((prop) =>
|
|
404
|
+
memberProps.every((mp) => mp.required.includes(prop)),
|
|
405
|
+
);
|
|
350
406
|
} else if (mainDef.properties) {
|
|
351
407
|
allProperties = mainDef.properties;
|
|
352
408
|
allRequired = (mainDef.required as string[]) || [];
|
package/dist/dialog-x9n9wI13.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as r, jsx as s } from "react/jsx-runtime";
|
|
3
|
-
import { S as c } from "./surface-BIC6CXiz.js";
|
|
4
|
-
import { c as o } from "./cn-Bhsu1vx2.js";
|
|
5
|
-
import { a9 as g, aa as d, ab as m, ac as p, ad as D, ae as f, af as u, ag as x } from "./vendor-base-ui-kX0wjdav.js";
|
|
6
|
-
const w = {
|
|
7
|
-
size: {
|
|
8
|
-
base: {
|
|
9
|
-
classes: "sm:min-w-96",
|
|
10
|
-
description: "Default dialog width"
|
|
11
|
-
},
|
|
12
|
-
sm: {
|
|
13
|
-
classes: "min-w-72",
|
|
14
|
-
description: "Small dialog for simple confirmations"
|
|
15
|
-
},
|
|
16
|
-
lg: {
|
|
17
|
-
classes: "min-w-[32rem]",
|
|
18
|
-
description: "Large dialog for complex content"
|
|
19
|
-
},
|
|
20
|
-
xl: {
|
|
21
|
-
classes: "min-w-[48rem]",
|
|
22
|
-
description: "Extra large dialog for detailed views"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}, t = {
|
|
26
|
-
size: "base"
|
|
27
|
-
};
|
|
28
|
-
function y({
|
|
29
|
-
size: i = t.size
|
|
30
|
-
} = {}) {
|
|
31
|
-
return o(
|
|
32
|
-
// Base styles
|
|
33
|
-
"shadow-m z-modal fixed top-1/2 left-1/2 w-full sm:w-auto max-w-[calc(100vw-2rem)] sm:max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-xl bg-kumo-base text-kumo-default duration-150 data-ending-style:scale-90 data-ending-style:opacity-0 data-starting-style:scale-90 data-starting-style:opacity-0",
|
|
34
|
-
// Apply size from KUMO_DIALOG_VARIANTS
|
|
35
|
-
w.size[i].classes
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
function T({
|
|
39
|
-
className: i,
|
|
40
|
-
children: e,
|
|
41
|
-
style: l,
|
|
42
|
-
size: n = t.size
|
|
43
|
-
}) {
|
|
44
|
-
return /* @__PURE__ */ r(f, { children: [
|
|
45
|
-
/* @__PURE__ */ s(u, { className: "z-modal fixed inset-0 bg-kumo-overlay opacity-80 transition-all duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0" }),
|
|
46
|
-
/* @__PURE__ */ s(
|
|
47
|
-
c,
|
|
48
|
-
{
|
|
49
|
-
as: x,
|
|
50
|
-
className: o(y({ size: n }), i),
|
|
51
|
-
style: {
|
|
52
|
-
transitionProperty: "scale, opacity",
|
|
53
|
-
transitionTimingFunction: "var(--default-transition-timing-function)",
|
|
54
|
-
"--tw-shadow": "0 20px 25px -5px rgb(0 0 0 / 0.03), 0 8px 10px -6px rgb(0 0 0 / 0.03)",
|
|
55
|
-
...l
|
|
56
|
-
},
|
|
57
|
-
children: e
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
] });
|
|
61
|
-
}
|
|
62
|
-
const a = Object.assign(T, {
|
|
63
|
-
Root: D,
|
|
64
|
-
Trigger: p,
|
|
65
|
-
Title: m,
|
|
66
|
-
Description: d,
|
|
67
|
-
Close: g
|
|
68
|
-
}), R = a.Root, h = a.Trigger, C = a.Title, O = a.Description, S = a.Close;
|
|
69
|
-
export {
|
|
70
|
-
a as D,
|
|
71
|
-
R as a,
|
|
72
|
-
h as b,
|
|
73
|
-
C as c,
|
|
74
|
-
O as d,
|
|
75
|
-
S as e
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=dialog-x9n9wI13.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-x9n9wI13.js","sources":["../src/components/dialog/dialog.tsx"],"sourcesContent":["import type { CSSProperties, FC, ReactNode } from \"react\";\nimport { Dialog as DialogBase } from \"@base-ui/react/dialog\";\nimport { Surface } from \"../surface\";\nimport { cn } from \"../../utils/cn\";\n\n/** Dialog size variant definitions mapping sizes to their minimum widths. */\nexport const KUMO_DIALOG_VARIANTS = {\n size: {\n base: {\n classes: \"sm:min-w-96\",\n description: \"Default dialog width\",\n },\n sm: {\n classes: \"min-w-72\",\n description: \"Small dialog for simple confirmations\",\n },\n lg: {\n classes: \"min-w-[32rem]\",\n description: \"Large dialog for complex content\",\n },\n xl: {\n classes: \"min-w-[48rem]\",\n description: \"Extra large dialog for detailed views\",\n },\n },\n} as const;\n\nexport const KUMO_DIALOG_DEFAULT_VARIANTS = {\n size: \"base\",\n} as const;\n\nexport const KUMO_DIALOG_STYLING = {\n dimensions: {\n sm: {\n width: 350,\n titleSize: 20,\n descSize: 16,\n padding: 16,\n gap: 8,\n buttonSize: \"sm\",\n },\n base: {\n width: 384,\n titleSize: 20,\n descSize: 16,\n padding: 24,\n gap: 16,\n buttonSize: \"base\",\n },\n lg: {\n width: 512,\n titleSize: 20,\n descSize: 16,\n padding: 24,\n gap: 16,\n buttonSize: \"base\",\n },\n xl: {\n width: 768,\n titleSize: 20,\n descSize: 16,\n padding: 24,\n gap: 16,\n buttonSize: \"base\",\n },\n },\n baseTokens: {\n background: \"color-surface\",\n text: \"text-color-surface\",\n borderRadius: 12,\n shadow: \"shadow-m\",\n },\n backdrop: {\n background: \"color-surface-secondary\",\n opacity: 0.8,\n },\n header: {\n title: { fontWeight: 600, color: \"text-color-surface\" },\n closeIcon: { name: \"ph-x\", size: 20, color: \"text-color-muted\" },\n },\n description: {\n fontWeight: 400,\n color: \"text-color-muted\",\n },\n buttons: {\n primary: { background: \"color-primary\", text: \"white\" },\n secondary: { ring: \"color-border\", text: \"text-color-surface\" },\n },\n} as const;\n\n// Derived types from KUMO_DIALOG_VARIANTS\nexport type KumoDialogSize = keyof typeof KUMO_DIALOG_VARIANTS.size;\n\nexport interface KumoDialogVariantsProps {\n /**\n * Dialog width.\n * - `\"sm\"` — Small (min 288px) for simple confirmations\n * - `\"base\"` — Default (min 384px)\n * - `\"lg\"` — Large (min 512px) for complex content\n * - `\"xl\"` — Extra large (min 768px) for detailed views\n * @default \"base\"\n */\n size?: KumoDialogSize;\n}\n\nexport function dialogVariants({\n size = KUMO_DIALOG_DEFAULT_VARIANTS.size,\n}: KumoDialogVariantsProps = {}) {\n return cn(\n // Base styles\n \"shadow-m z-modal fixed top-1/2 left-1/2 w-full sm:w-auto max-w-[calc(100vw-2rem)] sm:max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-xl bg-kumo-base text-kumo-default duration-150 data-ending-style:scale-90 data-ending-style:opacity-0 data-starting-style:scale-90 data-starting-style:opacity-0\",\n // Apply size from KUMO_DIALOG_VARIANTS\n KUMO_DIALOG_VARIANTS.size[size].classes,\n );\n}\n\n/**\n * Dialog component props — the modal content panel.\n *\n * @example\n * ```tsx\n * <Dialog.Root>\n * <Dialog.Trigger render={(p) => <Button {...p}>Open</Button>} />\n * <Dialog className=\"p-8\">\n * <Dialog.Title>Confirm Action</Dialog.Title>\n * <Dialog.Description>Are you sure?</Dialog.Description>\n * <Dialog.Close render={(p) => <Button {...p}>Cancel</Button>} />\n * </Dialog>\n * </Dialog.Root>\n * ```\n */\nexport type DialogProps = KumoDialogVariantsProps & {\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n /** Dialog content (typically Title, Description, Close, and action buttons). */\n children: ReactNode;\n /** Inline styles. */\n style?: CSSProperties;\n};\n\n/**\n * Modal dialog overlay with backdrop. Compound component with `Dialog.Root`,\n * `Dialog.Trigger`, `Dialog.Title`, `Dialog.Description`, and `Dialog.Close`.\n *\n * @example\n * ```tsx\n * <Dialog.Root>\n * <Dialog.Trigger render={(p) => <Button {...p}>Delete</Button>} />\n * <Dialog className=\"p-8\">\n * <Dialog.Title>Delete Item</Dialog.Title>\n * <Dialog.Description>This action cannot be undone.</Dialog.Description>\n * <Dialog.Close render={(p) => <Button variant=\"destructive\" {...p}>Delete</Button>} />\n * </Dialog>\n * </Dialog.Root>\n * ```\n */\nfunction DialogContent({\n className,\n children,\n style,\n size = KUMO_DIALOG_DEFAULT_VARIANTS.size,\n}: DialogProps) {\n return (\n <DialogBase.Portal>\n <DialogBase.Backdrop className=\"z-modal fixed inset-0 bg-kumo-overlay opacity-80 transition-all duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0\" />\n <Surface\n as={DialogBase.Popup}\n className={cn(dialogVariants({ size }), className)}\n style={\n {\n transitionProperty: \"scale, opacity\",\n transitionTimingFunction:\n \"var(--default-transition-timing-function)\",\n \"--tw-shadow\":\n \"0 20px 25px -5px rgb(0 0 0 / 0.03), 0 8px 10px -6px rgb(0 0 0 / 0.03)\",\n ...style,\n } as CSSProperties\n }\n >\n {children}\n </Surface>\n </DialogBase.Portal>\n );\n}\n\ntype DialogComponent = FC<DialogProps> & {\n Root: typeof DialogBase.Root;\n Trigger: typeof DialogBase.Trigger;\n Title: typeof DialogBase.Title;\n Description: typeof DialogBase.Description;\n Close: typeof DialogBase.Close;\n};\n\nconst Dialog = Object.assign(DialogContent, {\n Root: DialogBase.Root,\n Trigger: DialogBase.Trigger,\n Title: DialogBase.Title,\n Description: DialogBase.Description,\n Close: DialogBase.Close,\n}) as DialogComponent;\n\nconst DialogRoot = Dialog.Root;\nconst DialogTrigger = Dialog.Trigger;\nconst DialogTitle = Dialog.Title;\nconst DialogDescription = Dialog.Description;\nconst DialogClose = Dialog.Close;\n\nexport {\n Dialog,\n DialogRoot,\n DialogTrigger,\n DialogTitle,\n DialogDescription,\n DialogClose,\n};\n"],"names":["KUMO_DIALOG_VARIANTS","KUMO_DIALOG_DEFAULT_VARIANTS","dialogVariants","size","cn","DialogContent","className","children","style","jsxs","DialogBase.Portal","jsx","DialogBase.Backdrop","Surface","DialogBase.Popup","Dialog","DialogBase.Root","DialogBase.Trigger","DialogBase.Title","DialogBase.Description","DialogBase.Close","DialogRoot","DialogTrigger","DialogTitle","DialogDescription","DialogClose"],"mappings":";;;;;AAMO,MAAMA,IAAuB;AAAA,EAClC,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAEaC,IAA+B;AAAA,EAC1C,MAAM;AACR;AA4EO,SAASC,EAAe;AAAA,EAC7B,MAAAC,IAAOF,EAA6B;AACtC,IAA6B,IAAI;AAC/B,SAAOG;AAAA;AAAA,IAEL;AAAA;AAAA,IAEAJ,EAAqB,KAAKG,CAAI,EAAE;AAAA,EAAA;AAEpC;AA0CA,SAASE,EAAc;AAAA,EACrB,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAL,IAAOF,EAA6B;AACtC,GAAgB;AACd,SACE,gBAAAQ,EAACC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAoB,WAAU,yIAAA,CAAyI;AAAA,IACxK,gBAAAD;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,IAAIC;AAAAA,QACJ,WAAWV,EAAGF,EAAe,EAAE,MAAAC,EAAA,CAAM,GAAGG,CAAS;AAAA,QACjD,OACE;AAAA,UACE,oBAAoB;AAAA,UACpB,0BACE;AAAA,UACF,eACE;AAAA,UACF,GAAGE;AAAA,QAAA;AAAA,QAIN,UAAAD;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;AAUA,MAAMQ,IAAS,OAAO,OAAOV,GAAe;AAAA,EAC1C,MAAMW;AAAAA,EACN,SAASC;AAAAA,EACT,OAAOC;AAAAA,EACP,aAAaC;AAAAA,EACb,OAAOC;AACT,CAAC,GAEKC,IAAaN,EAAO,MACpBO,IAAgBP,EAAO,SACvBQ,IAAcR,EAAO,OACrBS,IAAoBT,EAAO,aAC3BU,IAAcV,EAAO;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-area-DN_Ncliw.js","sources":["../src/components/input/input-area.tsx"],"sourcesContent":["import { inputVariants } from \"./input\";\nimport { cn } from \"../../utils/cn\";\nimport { useCallback, type ReactNode } from \"react\";\nimport * as React from \"react\";\nimport { Field as KumoField, type FieldErrorMatch } from \"../field/field\";\n\nexport const InputArea = React.forwardRef<HTMLTextAreaElement, InputAreaProps>(\n (props, ref) => {\n const {\n className,\n onValueChange,\n size = \"base\",\n variant = \"default\",\n onChange,\n label,\n labelTooltip,\n description,\n error,\n ...inputProps\n } = props;\n\n // Extract required from inputProps to pass to Field for label decoration\n const { required } = inputProps;\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n onValueChange?.(event.target.value);\n },\n [onChange, onValueChange],\n );\n\n const textarea = (\n <textarea\n ref={ref}\n className={cn(\n inputVariants({ size, variant, focusIndicator: true }),\n \"h-auto py-2\", // Input variant always come with size, but it does not apply for textarea\n className,\n )}\n onChange={handleChange}\n {...inputProps}\n />\n );\n\n // Render with Field wrapper if label is provided\n if (label) {\n return (\n <KumoField\n label={label}\n required={required}\n labelTooltip={labelTooltip}\n description={description}\n error={\n error\n ? typeof error === \"string\"\n ? { message: error, match: true }\n : error\n : undefined\n }\n >\n {textarea}\n </KumoField>\n );\n }\n\n // Render bare textarea without Field wrapper\n return textarea;\n },\n);\n\nInputArea.displayName = \"InputArea\";\n\n/**\n * InputArea component props\n * @property {ReactNode} [label] - Label content for the textarea (enables Field wrapper)\n * @property {ReactNode} [description] - Helper text displayed below the textarea\n * @property {string | { message: ReactNode, match: FieldErrorMatch }} [error] - Error message or validation error object\n */\nexport type InputAreaProps = {\n onValueChange?: (value: string) => void;\n variant?: \"default\" | \"error\";\n size?: \"xs\" | \"sm\" | \"base\" | \"lg\";\n // Then other custom props\n children?: React.ReactNode;\n className?: string;\n /** Label content for the textarea (enables Field wrapper) - can be a string or any React node */\n label?: ReactNode;\n /** Tooltip content to display next to the label via an info icon */\n labelTooltip?: ReactNode;\n /** Helper text displayed below the textarea */\n description?: ReactNode;\n /** Error message or validation error object */\n error?: string | { message: ReactNode; match: FieldErrorMatch };\n\n // Finally, spread the native input props (least important)\n} & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, \"size\">;\n"],"names":["InputArea","React","props","ref","className","onValueChange","size","variant","onChange","label","labelTooltip","description","error","inputProps","required","handleChange","useCallback","event","textarea","jsx","cn","inputVariants","KumoField"],"mappings":";;;;;;;AAMO,MAAMA,IAAYC,EAAM;AAAA,EAC7B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,eAAAC;AAAA,MACA,MAAAC,IAAO;AAAA,MACP,SAAAC,IAAU;AAAA,MACV,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,OAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,IACDX,GAGE,EAAE,UAAAY,MAAaD,GACfE,IAAeC;AAAA,MACnB,CAACC,MAAkD;AACjD,QAAAT,IAAWS,CAAK,GAChBZ,IAAgBY,EAAM,OAAO,KAAK;AAAA,MACpC;AAAA,MACA,CAACT,GAAUH,CAAa;AAAA,IAAA,GAGpBa,IACJ,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAhB;AAAA,QACA,WAAWiB;AAAA,UACTC,EAAc,EAAE,MAAAf,GAAM,SAAAC,GAAS,gBAAgB,IAAM;AAAA,UACrD;AAAA;AAAA,UACAH;AAAA,QAAA;AAAA,QAEF,UAAUW;AAAA,QACT,GAAGF;AAAA,MAAA;AAAA,IAAA;AAKR,WAAIJ,IAEA,gBAAAU;AAAA,MAACG;AAAAA,MAAA;AAAA,QACC,OAAAb;AAAA,QACA,UAAAK;AAAA,QACA,cAAAJ;AAAA,QACA,aAAAC;AAAA,QACA,OACEC,IACI,OAAOA,KAAU,WACf,EAAE,SAASA,GAAO,OAAO,GAAA,IACzBA,IACF;AAAA,QAGL,UAAAM;AAAA,MAAA;AAAA,IAAA,IAMAA;AAAA,EACT;AACF;AAEAlB,EAAU,cAAc;"}
|
package/dist/label-B4FY8MX_.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as n, jsxs as c, Fragment as m } from "react/jsx-runtime";
|
|
3
|
-
import { Info as f } from "@phosphor-icons/react";
|
|
4
|
-
import { c as e } from "./cn-Bhsu1vx2.js";
|
|
5
|
-
import { T as p } from "./tooltip-C4DRhJi1.js";
|
|
6
|
-
const h = {
|
|
7
|
-
// Label currently has no variant options but structure is ready for future additions
|
|
8
|
-
}, N = {};
|
|
9
|
-
function u(t = {}) {
|
|
10
|
-
return e(
|
|
11
|
-
// Base styles - when used standalone, apply text styling
|
|
12
|
-
// When used inside Field, the parent FieldBase.Label provides these styles
|
|
13
|
-
"text-base font-medium text-kumo-default"
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
function o() {
|
|
17
|
-
return e(
|
|
18
|
-
// Content wrapper styles - always applied
|
|
19
|
-
"inline-flex items-center gap-1"
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function d({
|
|
23
|
-
children: t,
|
|
24
|
-
showOptional: l = !1,
|
|
25
|
-
tooltip: a,
|
|
26
|
-
className: r,
|
|
27
|
-
asContent: i = !1
|
|
28
|
-
}) {
|
|
29
|
-
const s = /* @__PURE__ */ c(m, { children: [
|
|
30
|
-
t,
|
|
31
|
-
l && /* @__PURE__ */ n("span", { className: "font-normal text-kumo-strong", children: "(optional)" }),
|
|
32
|
-
a && /* @__PURE__ */ n(p, { content: a, children: /* @__PURE__ */ n(
|
|
33
|
-
f,
|
|
34
|
-
{
|
|
35
|
-
className: "size-4 cursor-help text-kumo-strong",
|
|
36
|
-
"aria-label": "More information"
|
|
37
|
-
}
|
|
38
|
-
) })
|
|
39
|
-
] });
|
|
40
|
-
return i ? /* @__PURE__ */ n("span", { className: e(o(), r), children: s }) : /* @__PURE__ */ n("span", { className: e(u(), o(), r), children: s });
|
|
41
|
-
}
|
|
42
|
-
d.displayName = "Label";
|
|
43
|
-
export {
|
|
44
|
-
h as K,
|
|
45
|
-
d as L,
|
|
46
|
-
o as a,
|
|
47
|
-
N as b,
|
|
48
|
-
u as l
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=label-B4FY8MX_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"label-B4FY8MX_.js","sources":["../src/components/label/label.tsx"],"sourcesContent":["import { Info } from \"@phosphor-icons/react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Tooltip } from \"../tooltip\";\n\n/** Label variant definitions (currently empty, reserved for future additions). */\nexport const KUMO_LABEL_VARIANTS = {\n // Label currently has no variant options but structure is ready for future additions\n} as const;\n\nexport const KUMO_LABEL_DEFAULT_VARIANTS = {} as const;\n\n// Derived types from KUMO_LABEL_VARIANTS\nexport interface KumoLabelVariantsProps {}\n\nexport function labelVariants(_props: KumoLabelVariantsProps = {}) {\n return cn(\n // Base styles - when used standalone, apply text styling\n // When used inside Field, the parent FieldBase.Label provides these styles\n \"text-base font-medium text-kumo-default\",\n );\n}\n\nexport function labelContentVariants() {\n return cn(\n // Content wrapper styles - always applied\n \"inline-flex items-center gap-1\",\n );\n}\n\n/**\n * Label component props.\n *\n * @example\n * ```tsx\n * <Label>Email</Label>\n * <Label showOptional>Middle Name</Label>\n * <Label tooltip=\"We'll use this to send you updates\">Email</Label>\n * ```\n */\nexport interface LabelProps extends KumoLabelVariantsProps {\n /** The label content — can be a string or any React node. */\n children: ReactNode;\n /** When `true`, shows gray \"(optional)\" text after the label. */\n showOptional?: boolean;\n /** Tooltip content displayed next to the label via an info icon. */\n tooltip?: ReactNode;\n /** Additional CSS classes merged via `cn()`. */\n className?: string;\n /**\n * When `true`, only renders the inline content (indicators, tooltip) without\n * the outer span with font styling. Useful when composed inside another\n * label element that already provides the text styling.\n * @default false\n */\n asContent?: boolean;\n}\n\n/**\n * Label component for form fields.\n *\n * Provides a standardized way to display labels with optional indicators:\n * - Optional indicator: gray \"(optional)\" text when `showOptional={true}`\n * - Tooltip: info icon with hover tooltip for additional context\n *\n * @example\n * // Basic label\n * <Label>Email</Label>\n *\n * @example\n * // Optional field with indicator\n * <Label showOptional>Middle Name</Label>\n *\n * @example\n * // With tooltip\n * <Label tooltip=\"We'll use this to send you updates\">Email</Label>\n *\n * @example\n * // With ReactNode children\n * <Label>\n * <span>Custom label with <strong>bold</strong> text</span>\n * </Label>\n */\nexport function Label({\n children,\n showOptional = false,\n tooltip,\n className,\n asContent = false,\n}: LabelProps) {\n const content = (\n <>\n {children}\n {showOptional && (\n <span className=\"font-normal text-kumo-strong\">(optional)</span>\n )}\n {tooltip && (\n <Tooltip content={tooltip}>\n <Info\n className=\"size-4 cursor-help text-kumo-strong\"\n aria-label=\"More information\"\n />\n </Tooltip>\n )}\n </>\n );\n\n // When used as content inside another styled element, just render inline\n if (asContent) {\n return (\n <span className={cn(labelContentVariants(), className)}>{content}</span>\n );\n }\n\n // When used standalone, apply full label styling\n return (\n <span className={cn(labelVariants(), labelContentVariants(), className)}>\n {content}\n </span>\n );\n}\n\nLabel.displayName = \"Label\";\n"],"names":["KUMO_LABEL_VARIANTS","KUMO_LABEL_DEFAULT_VARIANTS","labelVariants","_props","cn","labelContentVariants","Label","children","showOptional","tooltip","className","asContent","content","jsxs","Fragment","jsx","Tooltip","Info"],"mappings":";;;;;AAMO,MAAMA,IAAsB;AAAA;AAEnC,GAEaC,IAA8B,CAAA;AAKpC,SAASC,EAAcC,IAAiC,IAAI;AACjE,SAAOC;AAAA;AAAA;AAAA,IAGL;AAAA,EAAA;AAEJ;AAEO,SAASC,IAAuB;AACrC,SAAOD;AAAA;AAAA,IAEL;AAAA,EAAA;AAEJ;AAuDO,SAASE,EAAM;AAAA,EACpB,UAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAe;AACb,QAAMC,IACJ,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAP;AAAA,IACAC,KACC,gBAAAO,EAAC,QAAA,EAAK,WAAU,gCAA+B,UAAA,cAAU;AAAA,IAE1DN,KACC,gBAAAM,EAACC,GAAA,EAAQ,SAASP,GAChB,UAAA,gBAAAM;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,cAAW;AAAA,MAAA;AAAA,IAAA,EACb,CACF;AAAA,EAAA,GAEJ;AAIF,SAAIN,IAEA,gBAAAI,EAAC,UAAK,WAAWX,EAAGC,KAAwBK,CAAS,GAAI,UAAAE,GAAQ,IAMnE,gBAAAG,EAAC,QAAA,EAAK,WAAWX,EAAGF,KAAiBG,EAAA,GAAwBK,CAAS,GACnE,UAAAE,EAAA,CACH;AAEJ;AAEAN,EAAM,cAAc;"}
|