@cloudflare/kumo 1.5.0 → 1.6.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 +108 -0
- package/ai/component-registry.json +62 -7
- package/ai/component-registry.md +378 -37
- package/ai/schemas.ts +12 -2
- package/bin/kumo.js +23 -19
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +2166 -0
- package/dist/ai/schemas.d.ts.map +1 -0
- package/dist/catalog.js +1 -1
- package/dist/{checkbox-CWANiedi.js → checkbox-Dt8iSNOg.js} +3 -3
- package/dist/{checkbox-CWANiedi.js.map → checkbox-Dt8iSNOg.js.map} +1 -1
- package/dist/clipboard-text-Bw5rKPXz.js +185 -0
- package/dist/clipboard-text-Bw5rKPXz.js.map +1 -0
- package/dist/{combobox-C9koouxM.js → combobox-BIC-YZ2L.js} +41 -41
- package/dist/combobox-BIC-YZ2L.js.map +1 -0
- package/dist/command-line/cli.js +104 -47
- package/dist/command-line/commands/add.js +88 -30
- package/dist/command-line/commands/ai.js +2 -3
- package/dist/{command-palette-TGXgr6Vq.js → command-palette-D3MNR7w9.js} +31 -31
- package/dist/{command-palette-TGXgr6Vq.js.map → command-palette-D3MNR7w9.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/date-picker.js +6 -0
- package/dist/components/date-picker.js.map +1 -0
- 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 +3 -3
- 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 +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/date-picker-M6uNX5Ca.js +2921 -0
- package/dist/date-picker-M6uNX5Ca.js.map +1 -0
- package/dist/{dialog-CpCeOqSZ.js → dialog-toS9krNF.js} +17 -17
- package/dist/dialog-toS9krNF.js.map +1 -0
- package/dist/{dropdown-DFeFcKfn.js → dropdown-BquiYKKC.js} +38 -38
- package/dist/dropdown-BquiYKKC.js.map +1 -0
- package/dist/{field-Dt-XuSaQ.js → field-DCq04TgZ.js} +3 -3
- package/dist/{field-Dt-XuSaQ.js.map → field-DCq04TgZ.js.map} +1 -1
- package/dist/index.js +86 -73
- package/dist/index.js.map +1 -1
- package/dist/{input-GZAWBXYX.js → input-CCR8NGG7.js} +3 -3
- package/dist/{input-GZAWBXYX.js.map → input-CCR8NGG7.js.map} +1 -1
- package/dist/{input-area-CS1-ceY4.js → input-area-DU2Yvp_t.js} +3 -3
- package/dist/{input-area-CS1-ceY4.js.map → input-area-DU2Yvp_t.js.map} +1 -1
- package/dist/{input-group-COo-wz5O.js → input-group-C365-qBq.js} +2 -2
- package/dist/{input-group-COo-wz5O.js.map → input-group-C365-qBq.js.map} +1 -1
- package/dist/{label-ChZ2Pp5p.js → label-zjtV7oXa.js} +2 -2
- package/dist/{label-ChZ2Pp5p.js.map → label-zjtV7oXa.js.map} +1 -1
- package/dist/{link-Mj2WM1AS.js → link-C8pUZ4Q-.js} +8 -8
- package/dist/{link-Mj2WM1AS.js.map → link-C8pUZ4Q-.js.map} +1 -1
- package/dist/{menubar-CbXWXQYR.js → menubar-D7WvAf6x.js} +6 -6
- package/dist/menubar-D7WvAf6x.js.map +1 -0
- package/dist/{meter-Bu5f3mAc.js → meter-jQGKS1z4.js} +4 -4
- package/dist/{meter-Bu5f3mAc.js.map → meter-jQGKS1z4.js.map} +1 -1
- package/dist/{pagination-Bm8eMWpj.js → pagination-BN80iKY6.js} +21 -20
- package/dist/pagination-BN80iKY6.js.map +1 -0
- package/dist/{popover-D7yeRosi.js → popover-syU1104E.js} +4 -4
- package/dist/{popover-D7yeRosi.js.map → popover-syU1104E.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-CKn09bGo.js → radio-CWMtSx65.js} +8 -8
- package/dist/{radio-CKn09bGo.js.map → radio-CWMtSx65.js.map} +1 -1
- package/dist/{schemas-B-D2OT-O.js → schemas-DbIwo0ET.js} +254 -240
- package/dist/{schemas-B-D2OT-O.js.map → schemas-DbIwo0ET.js.map} +1 -1
- package/dist/{select-DvpgiOau.js → select-G6JqBVkg.js} +37 -37
- package/dist/{select-DvpgiOau.js.map → select-G6JqBVkg.js.map} +1 -1
- package/dist/{sensitive-input-BuYT6U6C.js → sensitive-input-DNFpycoy.js} +4 -4
- package/dist/{sensitive-input-BuYT6U6C.js.map → sensitive-input-DNFpycoy.js.map} +1 -1
- package/dist/src/blocks/delete-resource/delete-resource.d.ts.map +1 -1
- package/dist/src/blocks/delete-resource/delete-resource.tsx +213 -0
- package/dist/src/blocks/page-header/page-header.tsx +99 -0
- package/dist/src/blocks/resource-list/resource-list.test.tsx +28 -0
- package/dist/src/blocks/resource-list/resource-list.tsx +69 -0
- package/dist/src/command-line/commands/ai.d.ts.map +1 -1
- package/dist/src/command-line/utils/transformer.d.ts +8 -4
- package/dist/src/command-line/utils/transformer.d.ts.map +1 -1
- package/dist/src/components/clipboard-text/clipboard-text.d.ts +23 -0
- package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +1 -1
- package/dist/src/components/date-picker/date-picker.d.ts +65 -0
- package/dist/src/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/src/components/date-picker/index.d.ts +4 -0
- package/dist/src/components/date-picker/index.d.ts.map +1 -0
- package/dist/src/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/src/components/pagination/pagination.d.ts +8 -1
- package/dist/src/components/pagination/pagination.d.ts.map +1 -1
- package/dist/src/components/table/table.d.ts +2 -0
- package/dist/src/components/table/table.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/styles/kumo-binding.css +0 -4
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/kumo.css +541 -0
- package/dist/{switch-Tu34uFoa.js → switch-CmsZ4z-g.js} +9 -9
- package/dist/{switch-Tu34uFoa.js.map → switch-CmsZ4z-g.js.map} +1 -1
- package/dist/table-Dc0AGcLV.js +149 -0
- package/dist/table-Dc0AGcLV.js.map +1 -0
- package/dist/{tabs-B7THfqHW.js → tabs-BpD1iUiz.js} +2 -2
- package/dist/{tabs-B7THfqHW.js.map → tabs-BpD1iUiz.js.map} +1 -1
- package/dist/{toast-Du4y8qng.js → toast-BrR0pjLE.js} +8 -8
- package/dist/{toast-Du4y8qng.js.map → toast-BrR0pjLE.js.map} +1 -1
- package/dist/{tooltip-BxV1H6AV.js → tooltip-daVJYtXY.js} +2 -2
- package/dist/{tooltip-BxV1H6AV.js.map → tooltip-daVJYtXY.js.map} +1 -1
- package/dist/{vendor-base-ui-CQ6wEonS.js → vendor-base-ui-9w7J6BvW.js} +7246 -7245
- package/dist/{vendor-base-ui-CQ6wEonS.js.map → vendor-base-ui-9w7J6BvW.js.map} +1 -1
- package/package.json +6 -1
- package/scripts/component-registry/discovery.ts +1 -7
- package/scripts/css-build.ts +47 -1
- package/dist/clipboard-text-CqueQiB8.js +0 -108
- package/dist/clipboard-text-CqueQiB8.js.map +0 -1
- package/dist/combobox-C9koouxM.js.map +0 -1
- package/dist/dialog-CpCeOqSZ.js.map +0 -1
- package/dist/dropdown-DFeFcKfn.js.map +0 -1
- package/dist/menubar-CbXWXQYR.js.map +0 -1
- package/dist/pagination-Bm8eMWpj.js.map +0 -1
- package/dist/table-BUmvaBj8.js +0 -153
- package/dist/table-BUmvaBj8.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { B as J } from "./badge-Dc99vsfo.js";
|
|
3
|
-
import { B as
|
|
3
|
+
import { B as h } from "./banner-4fkH6Sbt.js";
|
|
4
4
|
import { a as Y } from "./banner-4fkH6Sbt.js";
|
|
5
5
|
import { B as n } from "./button-Bh96oxRL.js";
|
|
6
6
|
import { L as aa, R as ea, b as oa } from "./button-Bh96oxRL.js";
|
|
7
7
|
import { D as ta } from "./date-range-picker-CbKEQ9pi.js";
|
|
8
|
-
import { C as ia } from "./checkbox-
|
|
9
|
-
import { C as na } from "./clipboard-text-
|
|
8
|
+
import { C as ia } from "./checkbox-Dt8iSNOg.js";
|
|
9
|
+
import { C as na } from "./clipboard-text-Bw5rKPXz.js";
|
|
10
10
|
import { C as pa, a as fa } from "./code-T2wPDiM0.js";
|
|
11
|
-
import { C as ca } from "./combobox-
|
|
12
|
-
import { a as N, D as O, c as U, e as A } from "./dialog-
|
|
13
|
-
import { d as Ta, b as ua } from "./dialog-
|
|
14
|
-
import { D as _a } from "./dropdown-
|
|
11
|
+
import { C as ca } from "./combobox-BIC-YZ2L.js";
|
|
12
|
+
import { a as N, D as O, c as U, e as A } from "./dialog-toS9krNF.js";
|
|
13
|
+
import { d as Ta, b as ua } from "./dialog-toS9krNF.js";
|
|
14
|
+
import { D as _a } from "./dropdown-BquiYKKC.js";
|
|
15
15
|
import { C as Ca } from "./collapsible-OBNkTO48.js";
|
|
16
|
-
import { F as La, a as Ra, K as Ea, f as
|
|
17
|
-
import { b as Na, K as Oa, L as Ua, a as ga, l as Da } from "./label-
|
|
18
|
-
import { I as g } from "./input-
|
|
19
|
-
import { i as Ka } from "./input-
|
|
20
|
-
import { I as
|
|
21
|
-
import { I as
|
|
16
|
+
import { F as La, a as Ra, K as Ea, f as Sa } from "./field-DCq04TgZ.js";
|
|
17
|
+
import { b as Na, K as Oa, L as Ua, a as ga, l as Da } from "./label-zjtV7oXa.js";
|
|
18
|
+
import { I as g } from "./input-CCR8NGG7.js";
|
|
19
|
+
import { i as Ka } from "./input-CCR8NGG7.js";
|
|
20
|
+
import { I as ka, T as va } from "./input-area-DU2Yvp_t.js";
|
|
21
|
+
import { I as ya } from "./input-group-C365-qBq.js";
|
|
22
22
|
import { L as Ba } from "./layer-card-C8j5Hkkj.js";
|
|
23
23
|
import { L as za } from "./loader-DHGMYlC6.js";
|
|
24
24
|
import { S as ja } from "./skeleton-line-CtpS1u1J.js";
|
|
25
|
-
import { M as qa, u as Wa } from "./menubar-
|
|
26
|
-
import { M as Ha } from "./meter-
|
|
27
|
-
import { P as Qa } from "./pagination-
|
|
28
|
-
import { S as Za } from "./select-
|
|
25
|
+
import { M as qa, u as Wa } from "./menubar-D7WvAf6x.js";
|
|
26
|
+
import { M as Ha } from "./meter-jQGKS1z4.js";
|
|
27
|
+
import { P as Qa } from "./pagination-BN80iKY6.js";
|
|
28
|
+
import { S as Za } from "./select-G6JqBVkg.js";
|
|
29
29
|
import { S as ee } from "./surface-BIC6CXiz.js";
|
|
30
|
-
import { S as re } from "./switch-
|
|
31
|
-
import { T as se } from "./tabs-
|
|
32
|
-
import { T as le } from "./table-
|
|
30
|
+
import { S as re } from "./switch-CmsZ4z-g.js";
|
|
31
|
+
import { T as se } from "./tabs-BpD1iUiz.js";
|
|
32
|
+
import { T as le } from "./table-Dc0AGcLV.js";
|
|
33
33
|
import { T as me } from "./text-BEhqwMfe.js";
|
|
34
|
-
import { a as fe, T as de, u as ce } from "./toast-
|
|
35
|
-
import { T as Te, a as ue } from "./tooltip-
|
|
36
|
-
import { g as _e, K as Ie, P as Ce } from "./popover-
|
|
37
|
-
import { a as Le, K as Re, S as Ee } from "./sensitive-input-
|
|
38
|
-
import { b as
|
|
39
|
-
import { C as De, a as Ve, K as Ke } from "./command-palette-
|
|
40
|
-
import { a as
|
|
34
|
+
import { a as fe, T as de, u as ce } from "./toast-BrR0pjLE.js";
|
|
35
|
+
import { T as Te, a as ue } from "./tooltip-daVJYtXY.js";
|
|
36
|
+
import { g as _e, K as Ie, P as Ce } from "./popover-syU1104E.js";
|
|
37
|
+
import { a as Le, K as Re, S as Ee } from "./sensitive-input-DNFpycoy.js";
|
|
38
|
+
import { b as he, K as Ne, R as Oe, a as Ue } from "./radio-CWMtSx65.js";
|
|
39
|
+
import { C as De, a as Ve, K as Ke } from "./command-palette-D3MNR7w9.js";
|
|
40
|
+
import { a as ke, K as ve, L as Pe, l as ye } from "./link-C8pUZ4Q-.js";
|
|
41
41
|
import { B as Be } from "./breadcrumbs-DyKi7BcP.js";
|
|
42
42
|
import { E as ze } from "./empty-D03cbzRS.js";
|
|
43
43
|
import { G as je, a as $e, c as qe, K as We, b as Xe, g as He } from "./grid-DKajRHh8.js";
|
|
44
44
|
import { C as Qe, a as Ye, K as Ze, P as ao, g as eo } from "./cloudflare-logo-Dqd1VD9z.js";
|
|
45
|
+
import { D as ro } from "./date-picker-M6uNX5Ca.js";
|
|
45
46
|
import { c as D } from "./cn-Bhsu1vx2.js";
|
|
46
|
-
import { s as
|
|
47
|
-
import { L as
|
|
47
|
+
import { s as so } from "./cn-Bhsu1vx2.js";
|
|
48
|
+
import { L as lo, u as no } from "./link-provider-DPBGo-0n.js";
|
|
48
49
|
import { jsx as a, jsxs as e } from "react/jsx-runtime";
|
|
49
50
|
import { useState as _, useEffect as V, useCallback as m } from "react";
|
|
50
|
-
import { XIcon as K, WarningCircleIcon as M, CheckIcon as
|
|
51
|
-
import { i as
|
|
51
|
+
import { XIcon as K, WarningCircleIcon as M, CheckIcon as k, CopyIcon as v } from "@phosphor-icons/react";
|
|
52
|
+
import { i as po } from "./vendor-base-ui-9w7J6BvW.js";
|
|
52
53
|
const W = {
|
|
53
54
|
size: {
|
|
54
55
|
sm: {
|
|
@@ -60,19 +61,19 @@ const W = {
|
|
|
60
61
|
description: "Default delete confirmation dialog size"
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
},
|
|
64
|
+
}, P = {
|
|
64
65
|
size: "base"
|
|
65
66
|
};
|
|
66
|
-
function
|
|
67
|
+
function y({
|
|
67
68
|
open: s,
|
|
68
69
|
onOpenChange: I,
|
|
69
70
|
resourceType: p,
|
|
70
71
|
resourceName: o,
|
|
71
72
|
onDelete: f,
|
|
72
|
-
isDeleting:
|
|
73
|
+
isDeleting: t = !1,
|
|
73
74
|
caseSensitive: d = !0,
|
|
74
75
|
deleteButtonText: C,
|
|
75
|
-
size: b =
|
|
76
|
+
size: b = P.size,
|
|
76
77
|
errorMessage: c,
|
|
77
78
|
className: L
|
|
78
79
|
}) {
|
|
@@ -81,11 +82,11 @@ function P({
|
|
|
81
82
|
s || (T(""), i(!1));
|
|
82
83
|
}, [s]);
|
|
83
84
|
const u = m(
|
|
84
|
-
(
|
|
85
|
+
(r) => d ? r : r.toLowerCase(),
|
|
85
86
|
[d]
|
|
86
87
|
), l = u(x) === u(o), E = m(async () => {
|
|
87
|
-
!l ||
|
|
88
|
-
}, [l,
|
|
88
|
+
!l || t || await f();
|
|
89
|
+
}, [l, t, f]), S = m(async () => {
|
|
89
90
|
await navigator.clipboard.writeText(o), i(!0), setTimeout(() => i(!1), 1500);
|
|
90
91
|
}, [o]);
|
|
91
92
|
return /* @__PURE__ */ a(N, { open: s, onOpenChange: I, children: /* @__PURE__ */ e(O, { size: b, className: D("p-0", L), children: [
|
|
@@ -94,21 +95,27 @@ function P({
|
|
|
94
95
|
"Delete ",
|
|
95
96
|
o
|
|
96
97
|
] }),
|
|
97
|
-
/* @__PURE__ */ a(
|
|
98
|
-
|
|
98
|
+
/* @__PURE__ */ a(
|
|
99
|
+
A,
|
|
99
100
|
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
render: (r) => /* @__PURE__ */ a(
|
|
102
|
+
n,
|
|
103
|
+
{
|
|
104
|
+
...r,
|
|
105
|
+
variant: "ghost",
|
|
106
|
+
shape: "square",
|
|
107
|
+
size: "sm",
|
|
108
|
+
"aria-label": "Close",
|
|
109
|
+
disabled: t,
|
|
110
|
+
children: /* @__PURE__ */ a(K, { size: 18 })
|
|
111
|
+
}
|
|
112
|
+
)
|
|
106
113
|
}
|
|
107
|
-
)
|
|
114
|
+
)
|
|
108
115
|
] }),
|
|
109
116
|
/* @__PURE__ */ e("div", { className: "flex flex-col p-6 gap-4", children: [
|
|
110
117
|
/* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: [
|
|
111
|
-
c && /* @__PURE__ */ a(
|
|
118
|
+
c && /* @__PURE__ */ a(h, { icon: /* @__PURE__ */ a(M, {}), variant: "error", children: c }),
|
|
112
119
|
/* @__PURE__ */ e("p", { className: "text-base text-kumo-subtle max-w-prose text-pretty", children: [
|
|
113
120
|
"This action cannot be undone. This will permanently delete the",
|
|
114
121
|
" ",
|
|
@@ -126,19 +133,19 @@ function P({
|
|
|
126
133
|
"button",
|
|
127
134
|
{
|
|
128
135
|
className: "font-mono text-sm inline font-semibold bg-kumo-tint hover:bg-kumo-fill rounded-md px-2 py-1 group hover:cursor-pointer",
|
|
129
|
-
onClick:
|
|
136
|
+
onClick: S,
|
|
130
137
|
"aria-label": `Copy ${o} to clipboard`,
|
|
131
138
|
children: [
|
|
132
139
|
o,
|
|
133
140
|
R ? /* @__PURE__ */ a(
|
|
134
|
-
|
|
141
|
+
k,
|
|
135
142
|
{
|
|
136
143
|
size: 12,
|
|
137
144
|
weight: "bold",
|
|
138
145
|
className: "inline ml-1.5"
|
|
139
146
|
}
|
|
140
147
|
) : /* @__PURE__ */ a(
|
|
141
|
-
|
|
148
|
+
v,
|
|
142
149
|
{
|
|
143
150
|
size: 12,
|
|
144
151
|
weight: "bold",
|
|
@@ -156,8 +163,8 @@ function P({
|
|
|
156
163
|
{
|
|
157
164
|
placeholder: o,
|
|
158
165
|
value: x,
|
|
159
|
-
onChange: (
|
|
160
|
-
disabled:
|
|
166
|
+
onChange: (r) => T(r.target.value),
|
|
167
|
+
disabled: t,
|
|
161
168
|
autoComplete: "off",
|
|
162
169
|
autoCorrect: "off",
|
|
163
170
|
autoCapitalize: "off",
|
|
@@ -169,24 +176,29 @@ function P({
|
|
|
169
176
|
] })
|
|
170
177
|
] }),
|
|
171
178
|
/* @__PURE__ */ e("div", { className: "flex justify-end gap-3 border-t border-kumo-line px-6 py-4", children: [
|
|
172
|
-
/* @__PURE__ */ a(
|
|
179
|
+
/* @__PURE__ */ a(
|
|
180
|
+
A,
|
|
181
|
+
{
|
|
182
|
+
render: (r) => /* @__PURE__ */ a(n, { ...r, variant: "secondary", disabled: t, children: "Cancel" })
|
|
183
|
+
}
|
|
184
|
+
),
|
|
173
185
|
/* @__PURE__ */ a(
|
|
174
186
|
n,
|
|
175
187
|
{
|
|
176
188
|
variant: "destructive",
|
|
177
189
|
onClick: E,
|
|
178
|
-
disabled: !l ||
|
|
179
|
-
loading:
|
|
190
|
+
disabled: !l || t,
|
|
191
|
+
loading: t,
|
|
180
192
|
children: C || `Delete ${p}`
|
|
181
193
|
}
|
|
182
194
|
)
|
|
183
195
|
] })
|
|
184
196
|
] }) });
|
|
185
197
|
}
|
|
186
|
-
|
|
198
|
+
y.displayName = "DeleteResource";
|
|
187
199
|
export {
|
|
188
200
|
J as Badge,
|
|
189
|
-
|
|
201
|
+
h as Banner,
|
|
190
202
|
Y as BannerVariant,
|
|
191
203
|
Be as Breadcrumbs,
|
|
192
204
|
n as Button,
|
|
@@ -198,8 +210,9 @@ export {
|
|
|
198
210
|
Ca as Collapsible,
|
|
199
211
|
ca as Combobox,
|
|
200
212
|
De as CommandPalette,
|
|
213
|
+
ro as DatePicker,
|
|
201
214
|
ta as DateRangePicker,
|
|
202
|
-
|
|
215
|
+
y as DeleteResource,
|
|
203
216
|
O as Dialog,
|
|
204
217
|
A as DialogClose,
|
|
205
218
|
Ta as DialogDescription,
|
|
@@ -212,13 +225,13 @@ export {
|
|
|
212
225
|
je as Grid,
|
|
213
226
|
$e as GridItem,
|
|
214
227
|
g as Input,
|
|
215
|
-
|
|
216
|
-
|
|
228
|
+
ka as InputArea,
|
|
229
|
+
ya as InputGroup,
|
|
217
230
|
Ye as KUMO_CLOUDFLARE_LOGO_DEFAULT_VARIANTS,
|
|
218
231
|
Ze as KUMO_CLOUDFLARE_LOGO_VARIANTS,
|
|
219
232
|
Ve as KUMO_COMMAND_PALETTE_DEFAULT_VARIANTS,
|
|
220
233
|
Ke as KUMO_COMMAND_PALETTE_VARIANTS,
|
|
221
|
-
|
|
234
|
+
P as KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS,
|
|
222
235
|
W as KUMO_DELETE_RESOURCE_VARIANTS,
|
|
223
236
|
Ra as KUMO_FIELD_DEFAULT_VARIANTS,
|
|
224
237
|
Ea as KUMO_FIELD_VARIANTS,
|
|
@@ -226,19 +239,19 @@ export {
|
|
|
226
239
|
We as KUMO_GRID_VARIANTS,
|
|
227
240
|
Na as KUMO_LABEL_DEFAULT_VARIANTS,
|
|
228
241
|
Oa as KUMO_LABEL_VARIANTS,
|
|
229
|
-
|
|
230
|
-
|
|
242
|
+
ke as KUMO_LINK_DEFAULT_VARIANTS,
|
|
243
|
+
ve as KUMO_LINK_VARIANTS,
|
|
231
244
|
_e as KUMO_POPOVER_DEFAULT_VARIANTS,
|
|
232
245
|
Ie as KUMO_POPOVER_VARIANTS,
|
|
233
|
-
|
|
246
|
+
he as KUMO_RADIO_DEFAULT_VARIANTS,
|
|
234
247
|
Ne as KUMO_RADIO_VARIANTS,
|
|
235
248
|
Le as KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS,
|
|
236
249
|
Re as KUMO_SENSITIVE_INPUT_VARIANTS,
|
|
237
250
|
Ua as Label,
|
|
238
251
|
Ba as LayerCard,
|
|
239
|
-
|
|
252
|
+
Pe as Link,
|
|
240
253
|
aa as LinkButton,
|
|
241
|
-
|
|
254
|
+
lo as LinkProvider,
|
|
242
255
|
za as Loader,
|
|
243
256
|
qa as MenuBar,
|
|
244
257
|
Ha as Meter,
|
|
@@ -256,25 +269,25 @@ export {
|
|
|
256
269
|
le as Table,
|
|
257
270
|
se as Tabs,
|
|
258
271
|
me as Text,
|
|
259
|
-
|
|
260
|
-
|
|
272
|
+
va as Textarea,
|
|
273
|
+
po as Toast,
|
|
261
274
|
fe as ToastProvider,
|
|
262
275
|
de as Toasty,
|
|
263
276
|
Te as Tooltip,
|
|
264
277
|
ue as TooltipProvider,
|
|
265
278
|
oa as buttonVariants,
|
|
266
279
|
D as cn,
|
|
267
|
-
|
|
280
|
+
Sa as fieldVariants,
|
|
268
281
|
eo as generateCloudflareLogoSvg,
|
|
269
282
|
Xe as gridItemVariants,
|
|
270
283
|
He as gridVariants,
|
|
271
284
|
Ka as inputVariants,
|
|
272
285
|
ga as labelContentVariants,
|
|
273
286
|
Da as labelVariants,
|
|
274
|
-
|
|
275
|
-
|
|
287
|
+
ye as linkVariants,
|
|
288
|
+
so as safeRandomId,
|
|
276
289
|
ce as useKumoToastManager,
|
|
277
|
-
|
|
290
|
+
no as useLinkComponent,
|
|
278
291
|
Wa as useMenuNavigation
|
|
279
292
|
};
|
|
280
293
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/blocks/delete-resource/delete-resource.tsx"],"sourcesContent":["import { useState, useCallback, useEffect } from \"react\";\nimport {\n Dialog,\n DialogRoot,\n DialogTitle,\n DialogClose,\n} from \"../../components/dialog\";\nimport { Input } from \"../../components/input\";\nimport { Button } from \"../../components/button\";\nimport { cn } from \"../../utils/cn\";\nimport {\n CheckIcon,\n CopyIcon,\n WarningCircleIcon,\n XIcon,\n} from \"@phosphor-icons/react\";\nimport { Banner } from \"../../components/banner\";\n\nexport const KUMO_DELETE_RESOURCE_VARIANTS = {\n size: {\n sm: {\n classes: \"\",\n description: \"Small dialog for simple delete confirmations\",\n },\n base: {\n classes: \"\",\n description: \"Default delete confirmation dialog size\",\n },\n },\n} as const;\n\nexport const KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS = {\n size: \"base\",\n} as const;\n\nexport type KumoDeleteResourceSize =\n keyof typeof KUMO_DELETE_RESOURCE_VARIANTS.size;\n\nexport interface KumoDeleteResourceVariantsProps {\n size?: KumoDeleteResourceSize;\n}\n\nexport interface DeleteResourceProps extends KumoDeleteResourceVariantsProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback when open state changes */\n onOpenChange: (open: boolean) => void;\n /** The type of resource being deleted (e.g., \"Zone\", \"Worker\", \"KV Namespace\") */\n resourceType: string;\n /** The name of the specific resource being deleted */\n resourceName: string;\n /** Callback when delete is confirmed */\n onDelete: () => void | Promise<void>;\n /** Whether the delete action is in progress */\n isDeleting?: boolean;\n /** Whether the confirmation input should be case-sensitive (default: true) */\n caseSensitive?: boolean;\n /** Custom delete button text (defaults to \"Delete {resourceType}\") */\n deleteButtonText?: string;\n /** Additional className for the dialog */\n className?: string;\n /** Error message to display if the delete action fails */\n errorMessage?: string;\n}\n\nexport function DeleteResource({\n open,\n onOpenChange,\n resourceType,\n resourceName,\n onDelete,\n isDeleting = false,\n caseSensitive = true,\n deleteButtonText,\n size = KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS.size,\n errorMessage,\n className,\n}: DeleteResourceProps) {\n const [confirmationInput, setConfirmationInput] = useState(\"\");\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!open) {\n setConfirmationInput(\"\");\n setCopied(false);\n }\n }, [open]);\n\n const normalizeForComparison = useCallback(\n (str: string) => (caseSensitive ? str : str.toLowerCase()),\n [caseSensitive],\n );\n\n const isConfirmed =\n normalizeForComparison(confirmationInput) ===\n normalizeForComparison(resourceName);\n\n const handleDelete = useCallback(async () => {\n if (!isConfirmed || isDeleting) return;\n await onDelete();\n }, [isConfirmed, isDeleting, onDelete]);\n\n const handleCopy = useCallback(async () => {\n await navigator.clipboard.writeText(resourceName);\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n }, [resourceName]);\n\n return (\n <DialogRoot open={open} onOpenChange={onOpenChange}>\n <Dialog size={size} className={cn(\"p-0\", className)}>\n <div className=\"flex items-center justify-between border-b border-kumo-line px-6 py-4\">\n <DialogTitle className=\"text-lg font-semibold\">\n Delete {resourceName}\n </DialogTitle>\n <DialogClose>\n <Button\n variant=\"ghost\"\n shape=\"square\"\n size=\"sm\"\n aria-label=\"Close\"\n disabled={isDeleting}\n >\n <XIcon size={18} />\n </Button>\n </DialogClose>\n </div>\n\n <div className=\"flex flex-col p-6 gap-4\">\n <div className=\"flex flex-col gap-2\">\n {errorMessage && (\n <Banner icon={<WarningCircleIcon />} variant=\"error\">\n {errorMessage}\n </Banner>\n )}\n <p className=\"text-base text-kumo-subtle max-w-prose text-pretty\">\n This action cannot be undone. This will permanently delete the{\" \"}\n <span className=\"font-medium text-kumo-default\">\n {resourceName}\n </span>{\" \"}\n {resourceType.toLowerCase()}.\n </p>\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center gap-1.5 text-base\">\n <span>\n Type{\" \"}\n <button\n className=\"font-mono text-sm inline font-semibold bg-kumo-tint hover:bg-kumo-fill rounded-md px-2 py-1 group hover:cursor-pointer\"\n onClick={handleCopy}\n aria-label={`Copy ${resourceName} to clipboard`}\n >\n {resourceName}\n\n {copied ? (\n <CheckIcon\n size={12}\n weight=\"bold\"\n className=\"inline ml-1.5\"\n />\n ) : (\n <CopyIcon\n size={12}\n weight=\"bold\"\n className=\"inline text-kumo-subtle group-hover:text-kumo-default ml-1.5\"\n />\n )}\n </button>{\" \"}\n to confirm:\n </span>\n </div>\n <Input\n placeholder={resourceName}\n value={confirmationInput}\n onChange={(e) => setConfirmationInput(e.target.value)}\n disabled={isDeleting}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck={false}\n aria-label={`Type ${resourceName} to confirm deletion`}\n className=\"w-full\"\n />\n </div>\n </div>\n\n <div className=\"flex justify-end gap-3 border-t border-kumo-line px-6 py-4\">\n <DialogClose>\n <Button variant=\"secondary\" disabled={isDeleting}>\n Cancel\n </Button>\n </DialogClose>\n <Button\n variant=\"destructive\"\n onClick={handleDelete}\n disabled={!isConfirmed || isDeleting}\n loading={isDeleting}\n >\n {deleteButtonText || `Delete ${resourceType}`}\n </Button>\n </div>\n </Dialog>\n </DialogRoot>\n );\n}\n\nDeleteResource.displayName = \"DeleteResource\";\n"],"names":["KUMO_DELETE_RESOURCE_VARIANTS","KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS","DeleteResource","open","onOpenChange","resourceType","resourceName","onDelete","isDeleting","caseSensitive","deleteButtonText","size","errorMessage","className","confirmationInput","setConfirmationInput","useState","copied","setCopied","useEffect","normalizeForComparison","useCallback","str","isConfirmed","handleDelete","handleCopy","jsx","DialogRoot","jsxs","Dialog","cn","DialogTitle","DialogClose","Button","XIcon","Banner","WarningCircleIcon","CheckIcon","CopyIcon","Input","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAMA,IAAgC;AAAA,EAC3C,MAAM;AAAA,IACJ,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAEaC,IAAwC;AAAA,EACnD,MAAM;AACR;AAgCO,SAASC,EAAe;AAAA,EAC7B,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,eAAAC,IAAgB;AAAA,EAChB,kBAAAC;AAAA,EACA,MAAAC,IAAOV,EAAsC;AAAA,EAC7C,cAAAW;AAAA,EACA,WAAAC;AACF,GAAwB;AACtB,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAS,EAAE,GACvD,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK;AAE1C,EAAAG,EAAU,MAAM;AACd,IAAKhB,MACHY,EAAqB,EAAE,GACvBG,EAAU,EAAK;AAAA,EAEnB,GAAG,CAACf,CAAI,CAAC;AAET,QAAMiB,IAAyBC;AAAA,IAC7B,CAACC,MAAiBb,IAAgBa,IAAMA,EAAI,YAAA;AAAA,IAC5C,CAACb,CAAa;AAAA,EAAA,GAGVc,IACJH,EAAuBN,CAAiB,MACxCM,EAAuBd,CAAY,GAE/BkB,IAAeH,EAAY,YAAY;AAC3C,IAAI,CAACE,KAAef,KACpB,MAAMD,EAAA;AAAA,EACR,GAAG,CAACgB,G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AQ;AAAA,UACR,SAAST;AAAA,UACT,UAAU,CAACD,KAAef;AAAA,UAC1B,SAASA;AAAA,UAER,UAAAE,KAAoB,UAAUL,CAAY;AAAA,QAAA;AAAA,MAAA;AAAA,IAC7C,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;AAEAH,EAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/blocks/delete-resource/delete-resource.tsx"],"sourcesContent":["import { useState, useCallback, useEffect } from \"react\";\nimport {\n Dialog,\n DialogRoot,\n DialogTitle,\n DialogClose,\n} from \"../../components/dialog\";\nimport { Input } from \"../../components/input\";\nimport { Button } from \"../../components/button\";\nimport { cn } from \"../../utils/cn\";\nimport {\n CheckIcon,\n CopyIcon,\n WarningCircleIcon,\n XIcon,\n} from \"@phosphor-icons/react\";\nimport { Banner } from \"../../components/banner\";\n\nexport const KUMO_DELETE_RESOURCE_VARIANTS = {\n size: {\n sm: {\n classes: \"\",\n description: \"Small dialog for simple delete confirmations\",\n },\n base: {\n classes: \"\",\n description: \"Default delete confirmation dialog size\",\n },\n },\n} as const;\n\nexport const KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS = {\n size: \"base\",\n} as const;\n\nexport type KumoDeleteResourceSize =\n keyof typeof KUMO_DELETE_RESOURCE_VARIANTS.size;\n\nexport interface KumoDeleteResourceVariantsProps {\n size?: KumoDeleteResourceSize;\n}\n\nexport interface DeleteResourceProps extends KumoDeleteResourceVariantsProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback when open state changes */\n onOpenChange: (open: boolean) => void;\n /** The type of resource being deleted (e.g., \"Zone\", \"Worker\", \"KV Namespace\") */\n resourceType: string;\n /** The name of the specific resource being deleted */\n resourceName: string;\n /** Callback when delete is confirmed */\n onDelete: () => void | Promise<void>;\n /** Whether the delete action is in progress */\n isDeleting?: boolean;\n /** Whether the confirmation input should be case-sensitive (default: true) */\n caseSensitive?: boolean;\n /** Custom delete button text (defaults to \"Delete {resourceType}\") */\n deleteButtonText?: string;\n /** Additional className for the dialog */\n className?: string;\n /** Error message to display if the delete action fails */\n errorMessage?: string;\n}\n\nexport function DeleteResource({\n open,\n onOpenChange,\n resourceType,\n resourceName,\n onDelete,\n isDeleting = false,\n caseSensitive = true,\n deleteButtonText,\n size = KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS.size,\n errorMessage,\n className,\n}: DeleteResourceProps) {\n const [confirmationInput, setConfirmationInput] = useState(\"\");\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (!open) {\n setConfirmationInput(\"\");\n setCopied(false);\n }\n }, [open]);\n\n const normalizeForComparison = useCallback(\n (str: string) => (caseSensitive ? str : str.toLowerCase()),\n [caseSensitive],\n );\n\n const isConfirmed =\n normalizeForComparison(confirmationInput) ===\n normalizeForComparison(resourceName);\n\n const handleDelete = useCallback(async () => {\n if (!isConfirmed || isDeleting) return;\n await onDelete();\n }, [isConfirmed, isDeleting, onDelete]);\n\n const handleCopy = useCallback(async () => {\n await navigator.clipboard.writeText(resourceName);\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n }, [resourceName]);\n\n return (\n <DialogRoot open={open} onOpenChange={onOpenChange}>\n <Dialog size={size} className={cn(\"p-0\", className)}>\n <div className=\"flex items-center justify-between border-b border-kumo-line px-6 py-4\">\n <DialogTitle className=\"text-lg font-semibold\">\n Delete {resourceName}\n </DialogTitle>\n <DialogClose\n render={(props) => (\n <Button\n {...props}\n variant=\"ghost\"\n shape=\"square\"\n size=\"sm\"\n aria-label=\"Close\"\n disabled={isDeleting}\n >\n <XIcon size={18} />\n </Button>\n )}\n />\n </div>\n\n <div className=\"flex flex-col p-6 gap-4\">\n <div className=\"flex flex-col gap-2\">\n {errorMessage && (\n <Banner icon={<WarningCircleIcon />} variant=\"error\">\n {errorMessage}\n </Banner>\n )}\n <p className=\"text-base text-kumo-subtle max-w-prose text-pretty\">\n This action cannot be undone. This will permanently delete the{\" \"}\n <span className=\"font-medium text-kumo-default\">\n {resourceName}\n </span>{\" \"}\n {resourceType.toLowerCase()}.\n </p>\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center gap-1.5 text-base\">\n <span>\n Type{\" \"}\n <button\n className=\"font-mono text-sm inline font-semibold bg-kumo-tint hover:bg-kumo-fill rounded-md px-2 py-1 group hover:cursor-pointer\"\n onClick={handleCopy}\n aria-label={`Copy ${resourceName} to clipboard`}\n >\n {resourceName}\n\n {copied ? (\n <CheckIcon\n size={12}\n weight=\"bold\"\n className=\"inline ml-1.5\"\n />\n ) : (\n <CopyIcon\n size={12}\n weight=\"bold\"\n className=\"inline text-kumo-subtle group-hover:text-kumo-default ml-1.5\"\n />\n )}\n </button>{\" \"}\n to confirm:\n </span>\n </div>\n <Input\n placeholder={resourceName}\n value={confirmationInput}\n onChange={(e) => setConfirmationInput(e.target.value)}\n disabled={isDeleting}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck={false}\n aria-label={`Type ${resourceName} to confirm deletion`}\n className=\"w-full\"\n />\n </div>\n </div>\n\n <div className=\"flex justify-end gap-3 border-t border-kumo-line px-6 py-4\">\n <DialogClose\n render={(props) => (\n <Button {...props} variant=\"secondary\" disabled={isDeleting}>\n Cancel\n </Button>\n )}\n />\n <Button\n variant=\"destructive\"\n onClick={handleDelete}\n disabled={!isConfirmed || isDeleting}\n loading={isDeleting}\n >\n {deleteButtonText || `Delete ${resourceType}`}\n </Button>\n </div>\n </Dialog>\n </DialogRoot>\n );\n}\n\nDeleteResource.displayName = \"DeleteResource\";\n"],"names":["KUMO_DELETE_RESOURCE_VARIANTS","KUMO_DELETE_RESOURCE_DEFAULT_VARIANTS","DeleteResource","open","onOpenChange","resourceType","resourceName","onDelete","isDeleting","caseSensitive","deleteButtonText","size","errorMessage","className","confirmationInput","setConfirmationInput","useState","copied","setCopied","useEffect","normalizeForComparison","useCallback","str","isConfirmed","handleDelete","handleCopy","jsx","DialogRoot","jsxs","Dialog","cn","DialogTitle","DialogClose","props","Button","XIcon","Banner","WarningCircleIcon","CheckIcon","CopyIcon","Input","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAMA,IAAgC;AAAA,EAC3C,MAAM;AAAA,IACJ,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,IAEf,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAEaC,IAAwC;AAAA,EACnD,MAAM;AACR;AAgCO,SAASC,EAAe;AAAA,EAC7B,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,eAAAC,IAAgB;AAAA,EAChB,kBAAAC;AAAA,EACA,MAAAC,IAAOV,EAAsC;AAAA,EAC7C,cAAAW;AAAA,EACA,WAAAC;AACF,GAAwB;AACtB,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAS,EAAE,GACvD,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK;AAE1C,EAAAG,EAAU,MAAM;AACd,IAAKhB,MACHY,EAAqB,EAAE,GACvBG,EAAU,EAAK;AAAA,EAEnB,GAAG,CAACf,CAAI,CAAC;AAET,QAAMiB,IAAyBC;AAAA,IAC7B,CAACC,MAAiBb,IAAgBa,IAAMA,EAAI,YAAA;AAAA,IAC5C,CAACb,CAAa;AAAA,EAAA,GAGVc,IACJH,EAAuBN,CAAiB,MACxCM,EAAuBd,CAAY,GAE/BkB,IAAeH,EAAY,YAAY;AAC3C,IAAI,CAACE,KAAef,KACpB,MAAMD,EAAA;AAAA,EACR,GAAG,CAACgB,GAAaf,GAAYD,CAAQ,CAAC,GAEhCkB,IAAaJ,EAAY,YAAY;AACzC,UAAM,UAAU,UAAU,UAAUf,CAAY,GAChDY,EAAU,EAAI,GACd,WAAW,MAA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AAA,QAACQ;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAASV;AAAA,UACT,UAAU,CAACD,KAAef;AAAA,UAC1B,SAASA;AAAA,UAER,UAAAE,KAAoB,UAAUL,CAAY;AAAA,QAAA;AAAA,MAAA;AAAA,IAC7C,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;AAEAH,EAAe,cAAc;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as l } from "react/jsx-runtime";
|
|
3
3
|
import { c as p } from "./cn-Bhsu1vx2.js";
|
|
4
4
|
import { forwardRef as I } from "react";
|
|
5
|
-
import { F as k } from "./field-
|
|
6
|
-
import { I as v } from "./vendor-base-ui-
|
|
5
|
+
import { F as k } from "./field-DCq04TgZ.js";
|
|
6
|
+
import { I as v } from "./vendor-base-ui-9w7J6BvW.js";
|
|
7
7
|
const u = {
|
|
8
8
|
size: {
|
|
9
9
|
xs: {
|
|
@@ -106,4 +106,4 @@ export {
|
|
|
106
106
|
u as K,
|
|
107
107
|
N as i
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=input-
|
|
109
|
+
//# sourceMappingURL=input-CCR8NGG7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-
|
|
1
|
+
{"version":3,"file":"input-CCR8NGG7.js","sources":["../src/components/input/input.tsx"],"sourcesContent":["import { cn } from \"../../utils/cn\";\nimport {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from \"react\";\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport { Field, type FieldErrorMatch } from \"../field/field\";\n\n/** Input size and variant definitions mapping names to their Tailwind classes. */\nexport const KUMO_INPUT_VARIANTS = {\n size: {\n xs: {\n classes: \"h-5 gap-1 rounded-sm px-1.5 text-xs\",\n description: \"Extra small input for compact UIs\",\n },\n sm: {\n classes: \"h-6.5 gap-1 rounded-md px-2 text-xs\",\n description: \"Small input for secondary fields\",\n },\n base: {\n classes: \"h-9 gap-1.5 rounded-lg px-3 text-base\",\n description: \"Default input size\",\n },\n lg: {\n classes: \"h-10 gap-2 rounded-lg px-4 text-base\",\n description: \"Large input for prominent fields\",\n },\n },\n variant: {\n default: {\n classes: \"focus:ring-kumo-ring\",\n description: \"Default input appearance\",\n },\n error: {\n classes: \"!ring-kumo-danger focus:ring-kumo-danger\",\n description: \"Error state for validation failures\",\n },\n },\n} as const;\n\nexport const KUMO_INPUT_DEFAULT_VARIANTS = {\n size: \"base\",\n variant: \"default\",\n} as const;\n\nexport const KUMO_INPUT_STYLING = {\n dimensions: {\n xs: { height: 20, paddingX: 6, fontSize: 12, borderRadius: 2, width: 160 },\n sm: { height: 26, paddingX: 8, fontSize: 12, borderRadius: 6, width: 200 },\n base: {\n height: 36,\n paddingX: 12,\n fontSize: 16,\n borderRadius: 8,\n width: 280,\n },\n lg: { height: 40, paddingX: 16, fontSize: 16, borderRadius: 8, width: 320 },\n },\n baseTokens: {\n background: \"color-secondary\",\n text: \"text-color-surface\",\n placeholder: \"text-color-muted\",\n ring: \"color-border\",\n },\n stateTokens: {\n focus: { ring: \"color-active\" },\n error: { ring: \"color-error\" },\n disabled: { opacity: 0.5, text: \"text-color-muted\" },\n },\n} as const;\n\n// Derived types from KUMO_INPUT_VARIANTS\nexport type KumoInputSize = keyof typeof KUMO_INPUT_VARIANTS.size;\nexport type KumoInputVariant = keyof typeof KUMO_INPUT_VARIANTS.variant;\n\nexport interface KumoInputVariantsProps {\n /**\n * Input size.\n * - `\"xs\"` — Extra small for compact UIs\n * - `\"sm\"` — Small for secondary fields\n * - `\"base\"` — Default size\n * - `\"lg\"` — Large for prominent fields\n * @default \"base\"\n */\n size?: KumoInputSize;\n /**\n * Visual variant.\n * - `\"default\"` — Standard input\n * - `\"error\"` — Error state for validation failures\n * @default \"default\"\n */\n variant?: KumoInputVariant;\n parentFocusIndicator?: boolean;\n focusIndicator?: boolean;\n}\n\n// Omit native `size` attribute (number) to avoid conflict with our custom `size` variant\ntype BaseInputProps = Omit<ComponentPropsWithoutRef<typeof BaseInput>, \"size\">;\n\nexport function inputVariants({\n variant = KUMO_INPUT_DEFAULT_VARIANTS.variant,\n size = KUMO_INPUT_DEFAULT_VARIANTS.size,\n parentFocusIndicator = false,\n focusIndicator = false,\n}: KumoInputVariantsProps = {}) {\n return cn(\n // Base styles\n \"border-0 bg-kumo-control text-kumo-default ring ring-kumo-line\",\n // Disabled state and placeholder styles\n \"outline-none placeholder:text-kumo-subtle disabled:text-kumo-subtle\",\n // Apply size styles from KUMO_INPUT_VARIANTS\n KUMO_INPUT_VARIANTS.size[size].classes,\n // Apply variant styles from KUMO_INPUT_VARIANTS\n KUMO_INPUT_VARIANTS.variant[variant].classes,\n // Focus state handling\n parentFocusIndicator && \"[&:has(:focus-within)]:ring-kumo-ring\",\n focusIndicator && \"focus:ring-kumo-ring\",\n );\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>((props, ref) => {\n const {\n className,\n size = \"base\",\n variant = \"default\",\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\n // A11y enforcement: warn in dev if no accessible name provided\n if (process.env.NODE_ENV !== \"production\") {\n const hasLabel = Boolean(label);\n const hasPlaceholderAndAriaLabel = Boolean(\n inputProps.placeholder && inputProps[\"aria-label\"],\n );\n const hasAriaLabelledBy = Boolean(inputProps[\"aria-labelledby\"]);\n\n if (!hasLabel && !hasPlaceholderAndAriaLabel && !hasAriaLabelledBy) {\n console.warn(\n \"[Kumo Input]: Input must have an accessible name. Provide either:\\n\" +\n \" - label prop: <Input label='Email' />\\n\" +\n \" - placeholder + aria-label: <Input placeholder='Email' aria-label='Email address' />\\n\" +\n \" - aria-labelledby for custom label association\",\n );\n }\n }\n\n const input = (\n <BaseInput\n ref={ref}\n className={cn(\n inputVariants({ size, variant, focusIndicator: true }),\n className,\n )}\n {...inputProps}\n />\n );\n\n // Render with Field wrapper if label is provided\n if (label) {\n return (\n <Field\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 {input}\n </Field>\n );\n }\n\n // Render bare input without Field wrapper\n return input;\n});\n\nInput.displayName = \"Input\";\n\n/**\n * Input component props with accessibility guidance.\n *\n * **Accessible Name Required:** Input should have one of:\n * 1. `label` prop (recommended) - enables Field wrapper with label/description/error\n * 2. `placeholder` + `aria-label` - for bare inputs with visual placeholder\n * 3. `aria-labelledby` - for custom label association\n *\n * Missing accessible names will trigger console warnings in development.\n *\n * @example\n * // Recommended: Built-in Field wrapper\n * <Input label=\"Email\" placeholder=\"you@example.com\" />\n *\n * @example\n * // Bare input with placeholder and aria-label\n * <Input placeholder=\"Search...\" aria-label=\"Search products\" />\n *\n * @example\n * // Custom label association\n * <label id=\"email-label\">Email</label>\n * <Input aria-labelledby=\"email-label\" />\n *\n * @example\n * // With description and error\n * <Input\n * label=\"Password\"\n * description=\"Must be at least 8 characters\"\n * error=\"Password is too short\"\n * variant=\"error\"\n * />\n */\nexport type InputProps = Pick<KumoInputVariantsProps, \"size\" | \"variant\"> &\n BaseInputProps & {\n /** Label content for the input (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 input */\n description?: ReactNode;\n /** Error message or validation error object */\n error?: string | { message: ReactNode; match: FieldErrorMatch };\n };\n"],"names":["KUMO_INPUT_VARIANTS","KUMO_INPUT_DEFAULT_VARIANTS","inputVariants","variant","size","parentFocusIndicator","focusIndicator","cn","Input","forwardRef","props","ref","className","label","labelTooltip","description","error","inputProps","required","hasLabel","hasPlaceholderAndAriaLabel","hasAriaLabelledBy","input","jsx","BaseInput","Field"],"mappings":";;;;;;AAUO,MAAMA,IAAsB;AAAA,EACjC,MAAM;AAAA,IACJ,IAAI;AAAA,MACF,SAAS;AAAA,MACT,aAAa;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AACE,KAAY,CAACC,KAA8B,CAACC,KAC/C,QAAQ;AAAA,MACN;AAAA;AAAA;AAAA;AAAA,IAAA;AAAA,EAMN;AAEA,QAAMC,IACJ,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,KAAAb;AAAA,MACA,WAAWJ;AAAA,QACTL,EAAc,EAAE,MAAAE,GAAM,SAAAD,GAAS,gBAAgB,IAAM;AAAA,QACrDS;AAAA,MAAA;AAAA,MAED,GAAGK;AAAA,IAAA;AAAA,EAAA;AAKR,SAAIJ,IAEA,gBAAAU;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,OAAAZ;AAAA,MACA,UAAAK;AAAA,MACA,cAAAJ;AAAA,MACA,aAAAC;AAAA,MACA,OACEC,IACI,OAAOA,KAAU,WACf,EAAE,SAASA,GAAO,OAAO,GAAA,IACzBA,IACF;AAAA,MAGL,UAAAM;AAAA,IAAA;AAAA,EAAA,IAMAA;AACT,CAAC;AAEDd,EAAM,cAAc;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
-
import { i as C } from "./input-
|
|
3
|
+
import { i as C } from "./input-CCR8NGG7.js";
|
|
4
4
|
import { c as b } from "./cn-Bhsu1vx2.js";
|
|
5
5
|
import * as I from "react";
|
|
6
6
|
import { useCallback as y } from "react";
|
|
7
|
-
import { F as N } from "./field-
|
|
7
|
+
import { F as N } from "./field-DCq04TgZ.js";
|
|
8
8
|
const c = I.forwardRef(
|
|
9
9
|
(l, m) => {
|
|
10
10
|
const {
|
|
@@ -56,4 +56,4 @@ export {
|
|
|
56
56
|
c as I,
|
|
57
57
|
j as T
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=input-area-
|
|
59
|
+
//# sourceMappingURL=input-area-DU2Yvp_t.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-area-
|
|
1
|
+
{"version":3,"file":"input-area-DU2Yvp_t.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/** Alias for InputArea — provided for discoverability when migrating from other libraries */\nexport const Textarea = 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","Textarea"],"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;AAGjB,MAAMuB,IAAWvB;"}
|
|
@@ -3,7 +3,7 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
3
3
|
import * as d from "react";
|
|
4
4
|
import { useContext as l } from "react";
|
|
5
5
|
import { c as s } from "./cn-Bhsu1vx2.js";
|
|
6
|
-
import { i as m, I as p } from "./input-
|
|
6
|
+
import { i as m, I as p } from "./input-CCR8NGG7.js";
|
|
7
7
|
import { B as x } from "./button-Bh96oxRL.js";
|
|
8
8
|
const I = {
|
|
9
9
|
focusMode: "container"
|
|
@@ -108,4 +108,4 @@ const U = Object.assign(v, {
|
|
|
108
108
|
export {
|
|
109
109
|
U as I
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=input-group-
|
|
111
|
+
//# sourceMappingURL=input-group-C365-qBq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group-
|
|
1
|
+
{"version":3,"file":"input-group-C365-qBq.js","sources":["../src/components/input/input-group.tsx"],"sourcesContent":["import { type PropsWithChildren, useContext } from \"react\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport {\n Input as InputExternal,\n type InputProps,\n inputVariants,\n} from \"./input\";\nimport { type ButtonProps, Button as ButtonExternal } from \"../button/button\";\n\nexport const KUMO_INPUT_GROUP_VARIANTS = {\n focusMode: {\n container: {\n classes: \"\",\n description: \"Focus indicator on container (default behavior)\",\n },\n individual: {\n classes: \"\",\n description: \"Focus indicators on individual elements\",\n },\n },\n} as const;\n\nexport const KUMO_INPUT_GROUP_DEFAULT_VARIANTS = {\n focusMode: \"container\",\n} as const;\n\nexport type KumoInputGroupFocusMode =\n keyof typeof KUMO_INPUT_GROUP_VARIANTS.focusMode;\n\nexport interface KumoInputGroupVariantsProps {\n focusMode?: KumoInputGroupFocusMode;\n}\n\ninterface InputGroupRootProps extends KumoInputGroupVariantsProps {\n className?: string;\n size?: \"xs\" | \"sm\" | \"base\" | \"lg\" | undefined;\n}\n\ninterface InputGroupContextValue extends InputGroupRootProps {\n inputId: string;\n descriptionId: string;\n}\n\nconst InputGroupContext = React.createContext<InputGroupContextValue | null>(\n null,\n);\n\nfunction Root({\n size,\n children,\n className,\n focusMode = KUMO_INPUT_GROUP_DEFAULT_VARIANTS.focusMode,\n}: PropsWithChildren<InputGroupRootProps>) {\n const inputId = React.useId();\n const descriptionId = React.useId();\n const contextValue = React.useMemo(\n () => ({ size, inputId, descriptionId, focusMode }),\n [size, inputId, descriptionId, focusMode],\n );\n\n const isIndividualFocus = focusMode === \"individual\";\n\n return (\n <InputGroupContext.Provider value={contextValue}>\n <div\n className={cn(\n inputVariants({ size, parentFocusIndicator: !isIndividualFocus }),\n \"flex w-full gap-0 border-0 px-0\",\n isIndividualFocus\n ? \"overflow-visible\"\n : \"overflow-hidden shadow-xs ring ring-kumo-line focus-within:ring-kumo-ring\",\n className,\n )}\n >\n {children}\n </div>\n </InputGroupContext.Provider>\n );\n}\n\nfunction Label({ children }: PropsWithChildren<{}>) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <label\n htmlFor={context?.inputId}\n className={cn(\n \"flex h-full items-center p-0 px-2 text-kumo-subtle\",\n isIndividualFocus &&\n \"first:rounded-l-[inherit] last:rounded-r-[inherit]\",\n )}\n >\n {children}\n </label>\n );\n}\n\nfunction Input(props: InputProps) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <InputExternal\n id={context?.inputId}\n aria-describedby={context?.descriptionId}\n size={context?.size}\n {...props}\n className={cn(\n \"flex h-full items-center rounded-none border-0 bg-kumo-base font-sans\",\n \"grow px-2\",\n isIndividualFocus\n ? \"relative ring ring-kumo-line first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-10 focus:outline\"\n : \"focus:border-kumo-fill\",\n props.className,\n )}\n />\n );\n}\n\nfunction Description({ children }: PropsWithChildren<{}>) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <span\n id={context?.descriptionId}\n className={cn(\n \"flex h-full items-center p-0 px-2 text-kumo-subtle\",\n isIndividualFocus &&\n \"first:rounded-l-[inherit] last:rounded-r-[inherit]\",\n )}\n >\n {children}\n </span>\n );\n}\n\nfunction Button({\n children,\n className,\n ...props\n}: PropsWithChildren<ButtonProps>) {\n const context = useContext(InputGroupContext);\n const isIndividualFocus = context?.focusMode === \"individual\";\n\n return (\n <ButtonExternal\n {...props}\n size={context?.size}\n className={cn(\n \"h-full! rounded-none disabled:bg-kumo-overlay disabled:text-kumo-inactive!\",\n isIndividualFocus &&\n \"relative ring ring-kumo-line first:rounded-l-[inherit] last:rounded-r-[inherit] focus:z-10 focus:outline\",\n className,\n )}\n >\n {children}\n </ButtonExternal>\n );\n}\n\nexport const InputGroup = Object.assign(Root, {\n Label,\n Input,\n Button,\n Description,\n});\n"],"names":["KUMO_INPUT_GROUP_DEFAULT_VARIANTS","InputGroupContext","React","Root","size","children","className","focusMode","inputId","descriptionId","contextValue","isIndividualFocus","jsx","cn","inputVariants","Label","context","useContext","Input","props","InputExternal","Description","Button","ButtonExternal","InputGroup"],"mappings":";;;;;;;AAuBO,MAAMA,IAAoC;AAAA,EAC/C,WAAW;AACb,GAmBMC,IAAoBC,EAAM;AAAA,EAC9B;AACF;AAEA,SAASC,EAAK;AAAA,EACZ,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAYP,EAAkC;AAChD,GAA2C;AACzC,QAAMQ,IAAUN,EAAM,MAAA,GAChBO,IAAgBP,EAAM,MAAA,GACtBQ,IAAeR,EAAM;AAAA,IACzB,OAAO,EAAE,MAAAE,GAAM,SAAAI,GAAS,eAAAC,GAAe,WAAAF,EAAA;AAAA,IACvC,CAACH,GAAMI,GAASC,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,IAAA;AAAA,EAAA;AAGP;AAEA,SAASiB,EAAO;AAAA,EACd,UAAAjB;AAAA,EACA,WAAAC;AAAA,EACA,GAAGa;AACL,GAAmC;AACjC,QAAMH,IAAUC,EAAWhB,CAAiB,GACtCU,IAAoBK,GAAS,cAAc;AAEjD,SACE,gBAAAJ;AAAA,IAACW;AAAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,MAAMH,GAAS;AAAA,MACf,WAAWH;AAAA,QACT;AAAA,QACAF,KACE;AAAA,QACFL;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;AAEO,MAAMmB,IAAa,OAAO,OAAOrB,GAAM;AAAA,EAC5C,OAAAY;AAAA,EACA,OAAAG;AAAA,EACA,QAAAI;AAAA,EACA,aAAAD;AACF,CAAC;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as e, jsxs as m, Fragment as f } from "react/jsx-runtime";
|
|
3
3
|
import { Info as u } from "@phosphor-icons/react";
|
|
4
4
|
import { c as n } from "./cn-Bhsu1vx2.js";
|
|
5
|
-
import { T as p } from "./tooltip-
|
|
5
|
+
import { T as p } from "./tooltip-daVJYtXY.js";
|
|
6
6
|
const N = {
|
|
7
7
|
// Label currently has no variant options but structure is ready for future additions
|
|
8
8
|
}, _ = {};
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
_ as b,
|
|
56
56
|
b as l
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=label-
|
|
58
|
+
//# sourceMappingURL=label-zjtV7oXa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-
|
|
1
|
+
{"version":3,"file":"label-zjtV7oXa.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 /** The id of the form element this label is associated with */\n htmlFor?: string;\n /**\n * When true, only renders the inline content (indicators, tooltip) without\n * the outer label element 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 htmlFor,\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, render as <label> for accessibility\n return (\n <label\n htmlFor={htmlFor}\n className={cn(labelVariants(), labelContentVariants(), className)}\n >\n {content}\n </label>\n );\n}\n\nLabel.displayName = \"Label\";\n"],"names":["KUMO_LABEL_VARIANTS","KUMO_LABEL_DEFAULT_VARIANTS","labelVariants","_props","cn","labelContentVariants","Label","children","showOptional","tooltip","className","htmlFor","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;AAyDO,SAASE,EAAM;AAAA,EACpB,UAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAe;AACb,QAAMC,IACJ,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAR;AAAA,IACAC,KACC,gBAAAQ,EAAC,QAAA,EAAK,WAAU,gCAA+B,UAAA,cAAU;AAAA,IAE1DP,KACC,gBAAAO,EAACC,GAAA,EAAQ,SAASR,GAChB,UAAA,gBAAAO;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,WAAWZ,EAAGC,KAAwBK,CAAS,GAAI,UAAAG,GAAQ,IAMnE,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAAL;AAAA,MACA,WAAWP,EAAGF,EAAA,GAAiBG,EAAA,GAAwBK,CAAS;AAAA,MAE/D,UAAAG;AAAA,IAAA;AAAA,EAAA;AAGP;AAEAP,EAAM,cAAc;"}
|