@kelet-ai/feedback-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/dist/feedback-ui.es.d.ts +54 -0
- package/dist/dist/feedback-ui.umd.d.ts +1 -0
- package/dist/eslint.config.d.ts +2 -0
- package/dist/feedback-ui.es.js +592 -0
- package/dist/feedback-ui.umd.js +22 -0
- package/dist/index.d.ts +1 -0
- package/dist/src/components/ui/button.d.ts +10 -0
- package/dist/src/components/ui/popover.d.ts +7 -0
- package/dist/src/components/ui/textarea.d.ts +3 -0
- package/dist/src/components/vote-feedback.d.ts +10 -0
- package/dist/src/components/vote-feedback.stories.d.ts +10 -0
- package/dist/src/contexts/kelet.d.ts +16 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/lib/utils.d.ts +2 -0
- package/dist/src/types/index.d.ts +64 -0
- package/dist/src/ui/shadcn/index.d.ts +2 -0
- package/dist/src/ui/shadcn/vote-feedback.d.ts +13 -0
- package/dist/src/ui/shadcn/vote-feedback.stories.d.ts +11 -0
- package/dist/tailwind.config.d.ts +8 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vitest.config.d.ts +2 -0
- package/package.json +95 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Kelet Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Feedback UI
|
|
2
|
+
|
|
3
|
+
A headless React component to collect feedback for product and AI features.
|
|
4
|
+
|
|
5
|
+
## Quick Start with shadcn/ui
|
|
6
|
+
|
|
7
|
+
The easiest way to start is by using the shadcn/ui theme for instant, beautiful results:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx shadcn add https://feedback-ui.kelet.ai/r/vote-feedback.json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import {ShadcnVoteFeedback} from '@/components/ui/vote-feedback';
|
|
15
|
+
|
|
16
|
+
function App() {
|
|
17
|
+
return (
|
|
18
|
+
<ShadcnVoteFeedback
|
|
19
|
+
identifier="my-feature"
|
|
20
|
+
onFeedback={(feedback) => console.log(feedback)}
|
|
21
|
+
variant="outline"
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Why Feedback UI?
|
|
28
|
+
|
|
29
|
+
Perfect for collecting user feedback on:
|
|
30
|
+
|
|
31
|
+
- **Product features** - Get user reactions to new functionality
|
|
32
|
+
- **AI responses** - Improve AI models with user feedback
|
|
33
|
+
- **Documentation** - Learn what content helps users
|
|
34
|
+
- **UI components** - Validate design decisions
|
|
35
|
+
|
|
36
|
+
## Two Ways to Use
|
|
37
|
+
|
|
38
|
+
### 1. Start Fast with shadcn/ui (Recommended)
|
|
39
|
+
|
|
40
|
+
Get beautiful, production-ready components instantly. Perfect for most use cases:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import {ShadcnVoteFeedback} from '@/components/ui/vote-feedback';
|
|
44
|
+
|
|
45
|
+
<ShadcnVoteFeedback
|
|
46
|
+
identifier="my-feature"
|
|
47
|
+
onFeedback={handleFeedback}
|
|
48
|
+
variant="outline"
|
|
49
|
+
/>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. Go Headless for Full Control
|
|
53
|
+
|
|
54
|
+
When you need complete design control, use the headless components:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import {VoteFeedback} from '@kelet-ai/feedback-ui';
|
|
58
|
+
|
|
59
|
+
<VoteFeedback.Root onFeedback={handleFeedback}>
|
|
60
|
+
<VoteFeedback.UpvoteButton className="your-styles">
|
|
61
|
+
👍 Like
|
|
62
|
+
</VoteFeedback.UpvoteButton>
|
|
63
|
+
<VoteFeedback.DownvoteButton className="your-styles">
|
|
64
|
+
👎 Dislike
|
|
65
|
+
</VoteFeedback.DownvoteButton>
|
|
66
|
+
<VoteFeedback.Popover className="your-popover">
|
|
67
|
+
<VoteFeedback.Textarea placeholder="What could be better?"/>
|
|
68
|
+
<VoteFeedback.SubmitButton>Send</VoteFeedback.SubmitButton>
|
|
69
|
+
</VoteFeedback.Popover>
|
|
70
|
+
</VoteFeedback.Root>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
- **Accessible**: Full keyboard navigation and ARIA support
|
|
76
|
+
- **TypeScript**: Complete type safety included
|
|
77
|
+
- **Flexible**: Works with any styling solution
|
|
78
|
+
- **Zero Dependencies**: Just React - no other dependencies
|
|
79
|
+
|
|
80
|
+
## API Reference
|
|
81
|
+
|
|
82
|
+
### VoteFeedback.Root
|
|
83
|
+
|
|
84
|
+
| Prop | Type | Required | Description |
|
|
85
|
+
|------------------|------------|----------|-------------------------------------|
|
|
86
|
+
| `identifier` | `string` | ✓ | Unique identifier for tracking |
|
|
87
|
+
| `onFeedback` | `function` | ✓ | Callback when feedback is submitted |
|
|
88
|
+
| `extra_metadata` | `object` | | Additional metadata to include |
|
|
89
|
+
|
|
90
|
+
### Feedback Object
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
{
|
|
94
|
+
identifier: string;
|
|
95
|
+
type: 'upvote' | 'downvote';
|
|
96
|
+
explanation ? : string;
|
|
97
|
+
extra_metadata ? : object;
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Examples
|
|
102
|
+
|
|
103
|
+
### Basic Usage
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<VoteFeedback.Root onFeedback={(feedback) => console.log(feedback)}>
|
|
107
|
+
<VoteFeedback.UpvoteButton>👍</VoteFeedback.UpvoteButton>
|
|
108
|
+
<VoteFeedback.DownvoteButton>👎</VoteFeedback.DownvoteButton>
|
|
109
|
+
</VoteFeedback.Root>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### With Custom Styling
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
<VoteFeedback.Root onFeedback={handleFeedback}>
|
|
116
|
+
<VoteFeedback.UpvoteButton className="btn btn-success">
|
|
117
|
+
Like
|
|
118
|
+
</VoteFeedback.UpvoteButton>
|
|
119
|
+
<VoteFeedback.DownvoteButton className="btn btn-danger">
|
|
120
|
+
Dislike
|
|
121
|
+
</VoteFeedback.DownvoteButton>
|
|
122
|
+
<VoteFeedback.Popover className="popover">
|
|
123
|
+
<VoteFeedback.Textarea className="textarea"/>
|
|
124
|
+
<VoteFeedback.SubmitButton className="btn btn-primary">
|
|
125
|
+
Submit
|
|
126
|
+
</VoteFeedback.SubmitButton>
|
|
127
|
+
</VoteFeedback.Popover>
|
|
128
|
+
</VoteFeedback.Root>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Using asChild Pattern
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
<VoteFeedback.UpvoteButton asChild>
|
|
135
|
+
<button className="custom-button">
|
|
136
|
+
<Icon name="thumbs-up"/>
|
|
137
|
+
Like
|
|
138
|
+
</button>
|
|
139
|
+
</VoteFeedback.UpvoteButton>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Accessibility
|
|
143
|
+
|
|
144
|
+
- Full keyboard navigation support
|
|
145
|
+
- ARIA labels and roles
|
|
146
|
+
- Focus management
|
|
147
|
+
- Screen reader compatible
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
bun install
|
|
153
|
+
bun dev # Start Storybook
|
|
154
|
+
bun test # Run tests
|
|
155
|
+
bun build # Build library
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { default as be } from 'react';
|
|
2
|
+
declare const L: be.Context<null>;
|
|
3
|
+
declare function _e({ api_key: s, project: o, children: l }: {
|
|
4
|
+
api_key: any;
|
|
5
|
+
project: any;
|
|
6
|
+
children: any;
|
|
7
|
+
}): any;
|
|
8
|
+
declare namespace Se {
|
|
9
|
+
export { ye as Root };
|
|
10
|
+
export { ke as UpvoteButton };
|
|
11
|
+
export { we as DownvoteButton };
|
|
12
|
+
export { Re as Popover };
|
|
13
|
+
export { Te as Textarea };
|
|
14
|
+
export { xe as SubmitButton };
|
|
15
|
+
}
|
|
16
|
+
declare function he(): any;
|
|
17
|
+
declare function Pe(): never;
|
|
18
|
+
declare function ye({ children: s, onFeedback: o, defaultText: l, identifier: t, extra_metadata: r }: {
|
|
19
|
+
children: any;
|
|
20
|
+
onFeedback: any;
|
|
21
|
+
defaultText?: string | undefined;
|
|
22
|
+
identifier: any;
|
|
23
|
+
extra_metadata: any;
|
|
24
|
+
}): any;
|
|
25
|
+
declare function ke({ asChild: s, children: o, onClick: l, ...t }: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
asChild: any;
|
|
28
|
+
children: any;
|
|
29
|
+
onClick: any;
|
|
30
|
+
}): any;
|
|
31
|
+
declare function we({ asChild: s, children: o, onClick: l, ...t }: {
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
asChild: any;
|
|
34
|
+
children: any;
|
|
35
|
+
onClick: any;
|
|
36
|
+
}): any;
|
|
37
|
+
declare function Re({ asChild: s, children: o, ...l }: {
|
|
38
|
+
[x: string]: any;
|
|
39
|
+
asChild: any;
|
|
40
|
+
children: any;
|
|
41
|
+
}): any;
|
|
42
|
+
declare function Te({ asChild: s, value: o, onChange: l, ...t }: {
|
|
43
|
+
[x: string]: any;
|
|
44
|
+
asChild: any;
|
|
45
|
+
value: any;
|
|
46
|
+
onChange: any;
|
|
47
|
+
}): any;
|
|
48
|
+
declare function xe({ asChild: s, children: o, onClick: l, ...t }: {
|
|
49
|
+
[x: string]: any;
|
|
50
|
+
asChild: any;
|
|
51
|
+
children: any;
|
|
52
|
+
onClick: any;
|
|
53
|
+
}): any;
|
|
54
|
+
export { L as KeletContext, _e as KeletProvider, Se as VoteFeedback, he as useDefaultFeedbackHandler, Pe as useKelet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
import be, { createContext as ue, useContext as W, useCallback as P, isValidElement as F, cloneElement as I, useState as K, useRef as ae, useId as se } from "react";
|
|
2
|
+
var U = { exports: {} }, O = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var le;
|
|
13
|
+
function me() {
|
|
14
|
+
if (le) return O;
|
|
15
|
+
le = 1;
|
|
16
|
+
var s = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
|
|
17
|
+
function l(t, r, a) {
|
|
18
|
+
var d = null;
|
|
19
|
+
if (a !== void 0 && (d = "" + a), r.key !== void 0 && (d = "" + r.key), "key" in r) {
|
|
20
|
+
a = {};
|
|
21
|
+
for (var i in r)
|
|
22
|
+
i !== "key" && (a[i] = r[i]);
|
|
23
|
+
} else a = r;
|
|
24
|
+
return r = a.ref, {
|
|
25
|
+
$$typeof: s,
|
|
26
|
+
type: t,
|
|
27
|
+
key: d,
|
|
28
|
+
ref: r !== void 0 ? r : null,
|
|
29
|
+
props: a
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return O.Fragment = o, O.jsx = l, O.jsxs = l, O;
|
|
33
|
+
}
|
|
34
|
+
var N = {};
|
|
35
|
+
/**
|
|
36
|
+
* @license React
|
|
37
|
+
* react-jsx-runtime.development.js
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the MIT license found in the
|
|
42
|
+
* LICENSE file in the root directory of this source tree.
|
|
43
|
+
*/
|
|
44
|
+
var ie;
|
|
45
|
+
function ve() {
|
|
46
|
+
return ie || (ie = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
+
function s(e) {
|
|
48
|
+
if (e == null) return null;
|
|
49
|
+
if (typeof e == "function")
|
|
50
|
+
return e.$$typeof === y ? null : e.displayName || e.name || null;
|
|
51
|
+
if (typeof e == "string") return e;
|
|
52
|
+
switch (e) {
|
|
53
|
+
case _:
|
|
54
|
+
return "Fragment";
|
|
55
|
+
case M:
|
|
56
|
+
return "Profiler";
|
|
57
|
+
case q:
|
|
58
|
+
return "StrictMode";
|
|
59
|
+
case z:
|
|
60
|
+
return "Suspense";
|
|
61
|
+
case A:
|
|
62
|
+
return "SuspenseList";
|
|
63
|
+
case c:
|
|
64
|
+
return "Activity";
|
|
65
|
+
}
|
|
66
|
+
if (typeof e == "object")
|
|
67
|
+
switch (typeof e.tag == "number" && console.error(
|
|
68
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
+
), e.$$typeof) {
|
|
70
|
+
case h:
|
|
71
|
+
return "Portal";
|
|
72
|
+
case B:
|
|
73
|
+
return (e.displayName || "Context") + ".Provider";
|
|
74
|
+
case w:
|
|
75
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case J:
|
|
77
|
+
var n = e.render;
|
|
78
|
+
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
+
case G:
|
|
80
|
+
return n = e.displayName || null, n !== null ? n : s(e.type) || "Memo";
|
|
81
|
+
case Y:
|
|
82
|
+
n = e._payload, e = e._init;
|
|
83
|
+
try {
|
|
84
|
+
return s(e(n));
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function o(e) {
|
|
91
|
+
return "" + e;
|
|
92
|
+
}
|
|
93
|
+
function l(e) {
|
|
94
|
+
try {
|
|
95
|
+
o(e);
|
|
96
|
+
var n = !1;
|
|
97
|
+
} catch {
|
|
98
|
+
n = !0;
|
|
99
|
+
}
|
|
100
|
+
if (n) {
|
|
101
|
+
n = console;
|
|
102
|
+
var f = n.error, m = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
+
return f.call(
|
|
104
|
+
n,
|
|
105
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
+
m
|
|
107
|
+
), o(e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function t(e) {
|
|
111
|
+
if (e === _) return "<>";
|
|
112
|
+
if (typeof e == "object" && e !== null && e.$$typeof === Y)
|
|
113
|
+
return "<...>";
|
|
114
|
+
try {
|
|
115
|
+
var n = s(e);
|
|
116
|
+
return n ? "<" + n + ">" : "<...>";
|
|
117
|
+
} catch {
|
|
118
|
+
return "<...>";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function r() {
|
|
122
|
+
var e = S.A;
|
|
123
|
+
return e === null ? null : e.getOwner();
|
|
124
|
+
}
|
|
125
|
+
function a() {
|
|
126
|
+
return Error("react-stack-top-frame");
|
|
127
|
+
}
|
|
128
|
+
function d(e) {
|
|
129
|
+
if (C.call(e, "key")) {
|
|
130
|
+
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
+
if (n && n.isReactWarning) return !1;
|
|
132
|
+
}
|
|
133
|
+
return e.key !== void 0;
|
|
134
|
+
}
|
|
135
|
+
function i(e, n) {
|
|
136
|
+
function f() {
|
|
137
|
+
ee || (ee = !0, console.error(
|
|
138
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
+
n
|
|
140
|
+
));
|
|
141
|
+
}
|
|
142
|
+
f.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: f,
|
|
144
|
+
configurable: !0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function b() {
|
|
148
|
+
var e = s(this.type);
|
|
149
|
+
return te[e] || (te[e] = !0, console.error(
|
|
150
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
|
+
}
|
|
153
|
+
function p(e, n, f, m, g, R, X, Z) {
|
|
154
|
+
return f = R.ref, e = {
|
|
155
|
+
$$typeof: x,
|
|
156
|
+
type: e,
|
|
157
|
+
key: n,
|
|
158
|
+
props: R,
|
|
159
|
+
_owner: g
|
|
160
|
+
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
|
+
enumerable: !1,
|
|
162
|
+
get: b
|
|
163
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
|
+
configurable: !1,
|
|
165
|
+
enumerable: !1,
|
|
166
|
+
writable: !0,
|
|
167
|
+
value: 0
|
|
168
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
169
|
+
configurable: !1,
|
|
170
|
+
enumerable: !1,
|
|
171
|
+
writable: !0,
|
|
172
|
+
value: null
|
|
173
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
174
|
+
configurable: !1,
|
|
175
|
+
enumerable: !1,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: X
|
|
178
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
179
|
+
configurable: !1,
|
|
180
|
+
enumerable: !1,
|
|
181
|
+
writable: !0,
|
|
182
|
+
value: Z
|
|
183
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
|
+
}
|
|
185
|
+
function u(e, n, f, m, g, R, X, Z) {
|
|
186
|
+
var v = n.children;
|
|
187
|
+
if (v !== void 0)
|
|
188
|
+
if (m)
|
|
189
|
+
if (V(v)) {
|
|
190
|
+
for (m = 0; m < v.length; m++)
|
|
191
|
+
T(v[m]);
|
|
192
|
+
Object.freeze && Object.freeze(v);
|
|
193
|
+
} else
|
|
194
|
+
console.error(
|
|
195
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
|
+
);
|
|
197
|
+
else T(v);
|
|
198
|
+
if (C.call(n, "key")) {
|
|
199
|
+
v = s(e);
|
|
200
|
+
var j = Object.keys(n).filter(function(fe) {
|
|
201
|
+
return fe !== "key";
|
|
202
|
+
});
|
|
203
|
+
m = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", ne[v + m] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
205
|
+
let props = %s;
|
|
206
|
+
<%s {...props} />
|
|
207
|
+
React keys must be passed directly to JSX without using spread:
|
|
208
|
+
let props = %s;
|
|
209
|
+
<%s key={someKey} {...props} />`,
|
|
210
|
+
m,
|
|
211
|
+
v,
|
|
212
|
+
j,
|
|
213
|
+
v
|
|
214
|
+
), ne[v + m] = !0);
|
|
215
|
+
}
|
|
216
|
+
if (v = null, f !== void 0 && (l(f), v = "" + f), d(n) && (l(n.key), v = "" + n.key), "key" in n) {
|
|
217
|
+
f = {};
|
|
218
|
+
for (var Q in n)
|
|
219
|
+
Q !== "key" && (f[Q] = n[Q]);
|
|
220
|
+
} else f = n;
|
|
221
|
+
return v && i(
|
|
222
|
+
f,
|
|
223
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
+
), p(
|
|
225
|
+
e,
|
|
226
|
+
v,
|
|
227
|
+
R,
|
|
228
|
+
g,
|
|
229
|
+
r(),
|
|
230
|
+
f,
|
|
231
|
+
X,
|
|
232
|
+
Z
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function T(e) {
|
|
236
|
+
typeof e == "object" && e !== null && e.$$typeof === x && e._store && (e._store.validated = 1);
|
|
237
|
+
}
|
|
238
|
+
var k = be, x = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), M = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), B = Symbol.for("react.context"), J = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), A = Symbol.for("react.suspense_list"), G = Symbol.for("react.memo"), Y = Symbol.for("react.lazy"), c = Symbol.for("react.activity"), y = Symbol.for("react.client.reference"), S = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, V = Array.isArray, H = console.createTask ? console.createTask : function() {
|
|
239
|
+
return null;
|
|
240
|
+
};
|
|
241
|
+
k = {
|
|
242
|
+
"react-stack-bottom-frame": function(e) {
|
|
243
|
+
return e();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
var ee, te = {}, re = k["react-stack-bottom-frame"].bind(
|
|
247
|
+
k,
|
|
248
|
+
a
|
|
249
|
+
)(), oe = H(t(a)), ne = {};
|
|
250
|
+
N.Fragment = _, N.jsx = function(e, n, f, m, g) {
|
|
251
|
+
var R = 1e4 > S.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return u(
|
|
253
|
+
e,
|
|
254
|
+
n,
|
|
255
|
+
f,
|
|
256
|
+
!1,
|
|
257
|
+
m,
|
|
258
|
+
g,
|
|
259
|
+
R ? Error("react-stack-top-frame") : re,
|
|
260
|
+
R ? H(t(e)) : oe
|
|
261
|
+
);
|
|
262
|
+
}, N.jsxs = function(e, n, f, m, g) {
|
|
263
|
+
var R = 1e4 > S.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return u(
|
|
265
|
+
e,
|
|
266
|
+
n,
|
|
267
|
+
f,
|
|
268
|
+
!0,
|
|
269
|
+
m,
|
|
270
|
+
g,
|
|
271
|
+
R ? Error("react-stack-top-frame") : re,
|
|
272
|
+
R ? H(t(e)) : oe
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
}()), N;
|
|
276
|
+
}
|
|
277
|
+
var ce;
|
|
278
|
+
function pe() {
|
|
279
|
+
return ce || (ce = 1, process.env.NODE_ENV === "production" ? U.exports = me() : U.exports = ve()), U.exports;
|
|
280
|
+
}
|
|
281
|
+
var E = pe();
|
|
282
|
+
const L = ue(null), Ee = "https://api-v0.kelet.ai/", Pe = () => {
|
|
283
|
+
const s = W(L);
|
|
284
|
+
if (!s)
|
|
285
|
+
throw new Error("useKelet must be used within a KeletProvider");
|
|
286
|
+
return s;
|
|
287
|
+
}, he = () => {
|
|
288
|
+
const s = W(L);
|
|
289
|
+
return s ? s.feedback : async () => {
|
|
290
|
+
};
|
|
291
|
+
}, _e = ({ api_key: s, project: o, children: l }) => {
|
|
292
|
+
const t = W(L), r = s || t?.api_key;
|
|
293
|
+
if (!r)
|
|
294
|
+
throw new Error(
|
|
295
|
+
"api_key is required either directly or from a parent KeletProvider"
|
|
296
|
+
);
|
|
297
|
+
const d = {
|
|
298
|
+
api_key: r,
|
|
299
|
+
project: o,
|
|
300
|
+
feedback: async (i) => {
|
|
301
|
+
const b = `${Ee}/projects/${o}/feedback`, p = {
|
|
302
|
+
tx_id: i.identifier,
|
|
303
|
+
source: "EXPLICIT",
|
|
304
|
+
vote: i.vote,
|
|
305
|
+
explanation: i.explanation
|
|
306
|
+
}, u = await fetch(b, {
|
|
307
|
+
method: "POST",
|
|
308
|
+
headers: {
|
|
309
|
+
"Content-Type": "application/json",
|
|
310
|
+
Authorization: `Bearer ${r}`
|
|
311
|
+
},
|
|
312
|
+
body: JSON.stringify(p)
|
|
313
|
+
});
|
|
314
|
+
if (!u.ok)
|
|
315
|
+
throw new Error(`Failed to submit feedback: ${u.statusText}`);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
return /* @__PURE__ */ E.jsx(L.Provider, { value: d, children: l });
|
|
319
|
+
}, D = (s, o) => {
|
|
320
|
+
const l = { ...o };
|
|
321
|
+
for (const t in o) {
|
|
322
|
+
const r = s[t], a = o[t];
|
|
323
|
+
/^on[A-Z]/.test(t) ? r && a ? l[t] = (...i) => {
|
|
324
|
+
a(...i), r(...i);
|
|
325
|
+
} : r && (l[t] = r) : t === "style" ? l[t] = { ...r, ...a } : t === "className" ? l[t] = [r, a].filter(Boolean).join(" ") : l[t] = a !== void 0 ? a : r;
|
|
326
|
+
}
|
|
327
|
+
return { ...s, ...l };
|
|
328
|
+
}, de = ue(
|
|
329
|
+
null
|
|
330
|
+
), $ = () => {
|
|
331
|
+
const s = W(de);
|
|
332
|
+
if (!s)
|
|
333
|
+
throw new Error(
|
|
334
|
+
"VoteFeedback components must be used within VoteFeedback.Root"
|
|
335
|
+
);
|
|
336
|
+
return s;
|
|
337
|
+
}, ye = ({
|
|
338
|
+
children: s,
|
|
339
|
+
onFeedback: o,
|
|
340
|
+
defaultText: l = "",
|
|
341
|
+
identifier: t,
|
|
342
|
+
extra_metadata: r
|
|
343
|
+
}) => {
|
|
344
|
+
const [a, d] = K(!1), [i, b] = K(l), [p, u] = K(!1), [T, k] = K(null), x = ae(null), h = ae(null), _ = se(), q = se(), M = he(), w = o || M, B = P(async () => {
|
|
345
|
+
k("upvote");
|
|
346
|
+
const c = {
|
|
347
|
+
identifier: t,
|
|
348
|
+
vote: "upvote",
|
|
349
|
+
...r && { extra_metadata: r }
|
|
350
|
+
};
|
|
351
|
+
try {
|
|
352
|
+
u(!0), await w(c);
|
|
353
|
+
} finally {
|
|
354
|
+
u(!1);
|
|
355
|
+
}
|
|
356
|
+
}, [w, t, r]), J = P(async () => {
|
|
357
|
+
if (k("downvote"), w) {
|
|
358
|
+
const c = {
|
|
359
|
+
identifier: t,
|
|
360
|
+
vote: "downvote",
|
|
361
|
+
...r && { extra_metadata: r }
|
|
362
|
+
};
|
|
363
|
+
try {
|
|
364
|
+
u(!0), await w(c);
|
|
365
|
+
} finally {
|
|
366
|
+
u(!1);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
d(!0), setTimeout(() => {
|
|
370
|
+
x.current?.focus();
|
|
371
|
+
const c = document.createElement("div");
|
|
372
|
+
c.setAttribute("aria-live", "polite"), c.setAttribute("aria-atomic", "true"), c.className = "sr-only", c.textContent = "Feedback dialog opened. You can provide additional details about your downvote.", document.body.appendChild(c), setTimeout(() => document.body.removeChild(c), 1e3);
|
|
373
|
+
}, 0);
|
|
374
|
+
}, [w, t, r]), z = P(
|
|
375
|
+
(c) => {
|
|
376
|
+
b(c.target.value);
|
|
377
|
+
},
|
|
378
|
+
[]
|
|
379
|
+
), A = P(async () => {
|
|
380
|
+
const c = i.trim().length > 0;
|
|
381
|
+
if (c) {
|
|
382
|
+
const y = {
|
|
383
|
+
identifier: t,
|
|
384
|
+
vote: "downvote",
|
|
385
|
+
explanation: i,
|
|
386
|
+
...r && { extra_metadata: r }
|
|
387
|
+
};
|
|
388
|
+
try {
|
|
389
|
+
u(!0), await w(y);
|
|
390
|
+
} finally {
|
|
391
|
+
u(!1);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (d(!1), b(l), h.current?.focus(), c) {
|
|
395
|
+
const y = document.createElement("div");
|
|
396
|
+
y.setAttribute("aria-live", "polite"), y.className = "sr-only", y.textContent = "Feedback submitted successfully.", document.body.appendChild(y), setTimeout(() => document.body.removeChild(y), 1e3);
|
|
397
|
+
}
|
|
398
|
+
}, [w, i, l, t, r]), G = P(
|
|
399
|
+
(c) => {
|
|
400
|
+
if (c.key === "Escape")
|
|
401
|
+
d(!1), b(l), h.current?.focus();
|
|
402
|
+
else if ((c.metaKey || c.ctrlKey) && c.key === "Enter")
|
|
403
|
+
c.preventDefault(), A().then((y) => {
|
|
404
|
+
});
|
|
405
|
+
else if (c.key === "Tab" && a) {
|
|
406
|
+
const y = document.getElementById(_);
|
|
407
|
+
if (y) {
|
|
408
|
+
const S = y.querySelectorAll(
|
|
409
|
+
'button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'
|
|
410
|
+
), C = S[0], V = S[S.length - 1];
|
|
411
|
+
c.shiftKey && document.activeElement === C ? (c.preventDefault(), V?.focus()) : !c.shiftKey && document.activeElement === V && (c.preventDefault(), C?.focus());
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
[A, a, _, l]
|
|
416
|
+
), Y = {
|
|
417
|
+
onFeedback: w,
|
|
418
|
+
showPopover: a,
|
|
419
|
+
setShowPopover: d,
|
|
420
|
+
feedbackText: i,
|
|
421
|
+
setFeedbackText: b,
|
|
422
|
+
isSubmitting: p,
|
|
423
|
+
setIsSubmitting: u,
|
|
424
|
+
vote: T,
|
|
425
|
+
handleUpvote: B,
|
|
426
|
+
handleDownvote: J,
|
|
427
|
+
handleTextareaChange: z,
|
|
428
|
+
handleSubmit: A,
|
|
429
|
+
handleKeyDown: G,
|
|
430
|
+
textareaRef: x,
|
|
431
|
+
triggerRef: h,
|
|
432
|
+
popoverId: _,
|
|
433
|
+
triggerId: q,
|
|
434
|
+
identifier: t,
|
|
435
|
+
extra_metadata: r
|
|
436
|
+
};
|
|
437
|
+
return /* @__PURE__ */ E.jsx(de.Provider, { value: Y, children: s });
|
|
438
|
+
}, ke = ({
|
|
439
|
+
asChild: s,
|
|
440
|
+
children: o,
|
|
441
|
+
onClick: l,
|
|
442
|
+
...t
|
|
443
|
+
}) => {
|
|
444
|
+
const { handleUpvote: r, isSubmitting: a, vote: d } = $(), i = P(
|
|
445
|
+
(u) => {
|
|
446
|
+
r(), l?.(u);
|
|
447
|
+
},
|
|
448
|
+
[r, l]
|
|
449
|
+
), b = {
|
|
450
|
+
...t,
|
|
451
|
+
onClick: i,
|
|
452
|
+
disabled: a || t.disabled,
|
|
453
|
+
"aria-label": t["aria-label"] || "Upvote feedback",
|
|
454
|
+
type: "button"
|
|
455
|
+
}, p = d === "upvote";
|
|
456
|
+
if (s) {
|
|
457
|
+
const u = typeof o == "function" ? o({ isSelected: p }) : o;
|
|
458
|
+
if (F(u))
|
|
459
|
+
return I(
|
|
460
|
+
u,
|
|
461
|
+
D(b, u.props)
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
return /* @__PURE__ */ E.jsx("button", { ...b, children: typeof o == "function" ? o({ isSelected: p }) : o });
|
|
465
|
+
}, we = ({
|
|
466
|
+
asChild: s,
|
|
467
|
+
children: o,
|
|
468
|
+
onClick: l,
|
|
469
|
+
...t
|
|
470
|
+
}) => {
|
|
471
|
+
const {
|
|
472
|
+
handleDownvote: r,
|
|
473
|
+
showPopover: a,
|
|
474
|
+
isSubmitting: d,
|
|
475
|
+
popoverId: i,
|
|
476
|
+
triggerId: b,
|
|
477
|
+
triggerRef: p,
|
|
478
|
+
vote: u
|
|
479
|
+
} = $(), T = P(
|
|
480
|
+
(h) => {
|
|
481
|
+
r(), l?.(h);
|
|
482
|
+
},
|
|
483
|
+
[r, l]
|
|
484
|
+
), k = {
|
|
485
|
+
...t,
|
|
486
|
+
ref: p,
|
|
487
|
+
onClick: T,
|
|
488
|
+
disabled: d || t.disabled,
|
|
489
|
+
"aria-label": t["aria-label"] || "Downvote feedback",
|
|
490
|
+
"aria-expanded": a,
|
|
491
|
+
"aria-controls": i,
|
|
492
|
+
id: b,
|
|
493
|
+
type: "button"
|
|
494
|
+
}, x = u === "downvote";
|
|
495
|
+
if (s) {
|
|
496
|
+
const h = typeof o == "function" ? o({ isSelected: x }) : o;
|
|
497
|
+
if (F(h))
|
|
498
|
+
return I(h, D(k, h.props));
|
|
499
|
+
if (h)
|
|
500
|
+
return h;
|
|
501
|
+
}
|
|
502
|
+
return /* @__PURE__ */ E.jsx("button", { ...k, children: typeof o == "function" ? o({ isSelected: x }) : o });
|
|
503
|
+
}, Re = ({ asChild: s, children: o, ...l }) => {
|
|
504
|
+
const { showPopover: t, handleKeyDown: r, popoverId: a, triggerId: d } = $();
|
|
505
|
+
if (!t)
|
|
506
|
+
return null;
|
|
507
|
+
const i = {
|
|
508
|
+
...l,
|
|
509
|
+
role: "dialog",
|
|
510
|
+
"aria-labelledby": d,
|
|
511
|
+
"aria-modal": !0,
|
|
512
|
+
"aria-describedby": `${a}-description`,
|
|
513
|
+
id: a,
|
|
514
|
+
onKeyDown: r,
|
|
515
|
+
tabIndex: -1
|
|
516
|
+
};
|
|
517
|
+
return s && F(o) ? /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
|
|
518
|
+
I(
|
|
519
|
+
o,
|
|
520
|
+
D(i, o.props)
|
|
521
|
+
),
|
|
522
|
+
/* @__PURE__ */ E.jsx("div", { id: `${a}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" })
|
|
523
|
+
] }) : /* @__PURE__ */ E.jsxs("div", { ...i, children: [
|
|
524
|
+
/* @__PURE__ */ E.jsx("div", { id: `${a}-description`, className: "sr-only", children: "Provide additional feedback for your downvote" }),
|
|
525
|
+
o
|
|
526
|
+
] });
|
|
527
|
+
}, Te = ({ asChild: s, value: o, onChange: l, ...t }) => {
|
|
528
|
+
const {
|
|
529
|
+
feedbackText: r,
|
|
530
|
+
handleTextareaChange: a,
|
|
531
|
+
textareaRef: d,
|
|
532
|
+
handleKeyDown: i,
|
|
533
|
+
popoverId: b
|
|
534
|
+
} = $(), p = {
|
|
535
|
+
...t,
|
|
536
|
+
ref: d,
|
|
537
|
+
value: o !== void 0 ? o : r,
|
|
538
|
+
onChange: l || a,
|
|
539
|
+
onKeyDown: i,
|
|
540
|
+
placeholder: t.placeholder || "What did we miss?",
|
|
541
|
+
"aria-label": t["aria-label"] || "Additional feedback",
|
|
542
|
+
"aria-describedby": `${b}-help`,
|
|
543
|
+
rows: t.rows || 3
|
|
544
|
+
};
|
|
545
|
+
return s && F(t.children) ? I(
|
|
546
|
+
t.children,
|
|
547
|
+
D(p, t.children.props)
|
|
548
|
+
) : /* @__PURE__ */ E.jsx("textarea", { ...p });
|
|
549
|
+
}, xe = ({
|
|
550
|
+
asChild: s,
|
|
551
|
+
children: o,
|
|
552
|
+
onClick: l,
|
|
553
|
+
...t
|
|
554
|
+
}) => {
|
|
555
|
+
const { handleSubmit: r, isSubmitting: a, feedbackText: d } = $(), i = P(
|
|
556
|
+
(T) => {
|
|
557
|
+
r(), l?.(T);
|
|
558
|
+
},
|
|
559
|
+
[r, l]
|
|
560
|
+
), b = d.trim().length > 0, p = b ? "Submit feedback" : "Close without feedback", u = {
|
|
561
|
+
...t,
|
|
562
|
+
onClick: i,
|
|
563
|
+
disabled: a || t.disabled,
|
|
564
|
+
type: "button",
|
|
565
|
+
"aria-label": t["aria-label"] || p,
|
|
566
|
+
"aria-describedby": b ? void 0 : "submit-help"
|
|
567
|
+
};
|
|
568
|
+
return s && F(o) ? /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
|
|
569
|
+
I(
|
|
570
|
+
o,
|
|
571
|
+
D(u, o.props)
|
|
572
|
+
),
|
|
573
|
+
!b && /* @__PURE__ */ E.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
574
|
+
] }) : /* @__PURE__ */ E.jsxs("button", { ...u, children: [
|
|
575
|
+
o,
|
|
576
|
+
!b && /* @__PURE__ */ E.jsx("span", { id: "submit-help", className: "sr-only", children: "This will close the dialog without submitting feedback" })
|
|
577
|
+
] });
|
|
578
|
+
}, Se = {
|
|
579
|
+
Root: ye,
|
|
580
|
+
UpvoteButton: ke,
|
|
581
|
+
DownvoteButton: we,
|
|
582
|
+
Popover: Re,
|
|
583
|
+
Textarea: Te,
|
|
584
|
+
SubmitButton: xe
|
|
585
|
+
};
|
|
586
|
+
export {
|
|
587
|
+
L as KeletContext,
|
|
588
|
+
_e as KeletProvider,
|
|
589
|
+
Se as VoteFeedback,
|
|
590
|
+
he as useDefaultFeedbackHandler,
|
|
591
|
+
Pe as useKelet
|
|
592
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(function(w,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],a):(w=typeof globalThis<"u"?globalThis:w||self,a(w["@kelet-ai/feedback-ui"]={},w.React))})(this,function(w,a){"use strict";var Y={exports:{}},A={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Q;function le(){if(Q)return A;Q=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(t,n,s){var f=null;if(s!==void 0&&(f=""+s),n.key!==void 0&&(f=""+n.key),"key"in n){s={};for(var i in n)i!=="key"&&(s[i]=n[i])}else s=n;return n=s.ref,{$$typeof:l,type:t,key:f,ref:n!==void 0?n:null,props:s}}return A.Fragment=o,A.jsx=c,A.jsxs=c,A}var O={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var q;function ce(){return q||(q=1,process.env.NODE_ENV!=="production"&&function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===y?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _:return"Fragment";case L:return"Profiler";case B:return"StrictMode";case J:return"Suspense";case D:return"SuspenseList";case u:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case h:return"Portal";case M:return(e.displayName||"Context")+".Provider";case T:return(e._context.displayName||"Context")+".Consumer";case W:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case K:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}function o(e){return""+e}function c(e){try{o(e);var r=!1}catch{r=!0}if(r){r=console;var b=r.error,v=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return b.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",v),o(e)}}function t(e){if(e===_)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===K)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function n(){var e=C.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function f(e){if(V.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function i(e,r){function b(){ne||(ne=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}b.isReactWarning=!0,Object.defineProperty(e,"key",{get:b,configurable:!0})}function m(){var e=l(this.type);return oe[e]||(oe[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function k(e,r,b,v,S,x,G,X){return b=x.ref,e={$$typeof:P,type:e,key:r,props:x,_owner:S},(b!==void 0?b:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:m}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,r,b,v,S,x,G,X){var p=r.children;if(p!==void 0)if(v)if(U(p)){for(v=0;v<p.length;v++)g(p[v]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(p);if(V.call(r,"key")){p=l(e);var j=Object.keys(r).filter(function(me){return me!=="key"});v=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",se[p+v]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,v,p,j,p),se[p+v]=!0)}if(p=null,b!==void 0&&(c(b),p=""+b),f(r)&&(c(r.key),p=""+r.key),"key"in r){b={};for(var Z in r)Z!=="key"&&(b[Z]=r[Z])}else b=r;return p&&i(b,typeof e=="function"?e.displayName||e.name||"Unknown":e),k(e,p,x,S,n(),b,G,X)}function g(e){typeof e=="object"&&e!==null&&e.$$typeof===P&&e._store&&(e._store.validated=1)}var R=a,P=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),M=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),u=Symbol.for("react.activity"),y=Symbol.for("react.client.reference"),C=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,U=Array.isArray,H=console.createTask?console.createTask:function(){return null};R={"react-stack-bottom-frame":function(e){return e()}};var ne,oe={},re=R["react-stack-bottom-frame"].bind(R,s)(),ae=H(t(s)),se={};O.Fragment=_,O.jsx=function(e,r,b,v,S){var x=1e4>C.recentlyCreatedOwnerStacks++;return d(e,r,b,!1,v,S,x?Error("react-stack-top-frame"):re,x?H(t(e)):ae)},O.jsxs=function(e,r,b,v,S){var x=1e4>C.recentlyCreatedOwnerStacks++;return d(e,r,b,!0,v,S,x?Error("react-stack-top-frame"):re,x?H(t(e)):ae)}}()),O}var $;function ie(){return $||($=1,process.env.NODE_ENV==="production"?Y.exports=le():Y.exports=ce()),Y.exports}var E=ie();const N=a.createContext(null),ue="https://api-v0.kelet.ai/",de=()=>{const l=a.useContext(N);if(!l)throw new Error("useKelet must be used within a KeletProvider");return l},ee=()=>{const l=a.useContext(N);return l?l.feedback:async()=>{}},fe=({api_key:l,project:o,children:c})=>{const t=a.useContext(N),n=l||t?.api_key;if(!n)throw new Error("api_key is required either directly or from a parent KeletProvider");const f={api_key:n,project:o,feedback:async i=>{const m=`${ue}/projects/${o}/feedback`,k={tx_id:i.identifier,source:"EXPLICIT",vote:i.vote,explanation:i.explanation},d=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(k)});if(!d.ok)throw new Error(`Failed to submit feedback: ${d.statusText}`)}};return E.jsx(N.Provider,{value:f,children:c})},F=(l,o)=>{const c={...o};for(const t in o){const n=l[t],s=o[t];/^on[A-Z]/.test(t)?n&&s?c[t]=(...i)=>{s(...i),n(...i)}:n&&(c[t]=n):t==="style"?c[t]={...n,...s}:t==="className"?c[t]=[n,s].filter(Boolean).join(" "):c[t]=s!==void 0?s:n}return{...l,...c}},te=a.createContext(null),I=()=>{const l=a.useContext(te);if(!l)throw new Error("VoteFeedback components must be used within VoteFeedback.Root");return l},be={Root:({children:l,onFeedback:o,defaultText:c="",identifier:t,extra_metadata:n})=>{const[s,f]=a.useState(!1),[i,m]=a.useState(c),[k,d]=a.useState(!1),[g,R]=a.useState(null),P=a.useRef(null),h=a.useRef(null),_=a.useId(),B=a.useId(),L=ee(),T=o||L,M=a.useCallback(async()=>{R("upvote");const u={identifier:t,vote:"upvote",...n&&{extra_metadata:n}};try{d(!0),await T(u)}finally{d(!1)}},[T,t,n]),W=a.useCallback(async()=>{if(R("downvote"),T){const u={identifier:t,vote:"downvote",...n&&{extra_metadata:n}};try{d(!0),await T(u)}finally{d(!1)}}f(!0),setTimeout(()=>{P.current?.focus();const u=document.createElement("div");u.setAttribute("aria-live","polite"),u.setAttribute("aria-atomic","true"),u.className="sr-only",u.textContent="Feedback dialog opened. You can provide additional details about your downvote.",document.body.appendChild(u),setTimeout(()=>document.body.removeChild(u),1e3)},0)},[T,t,n]),J=a.useCallback(u=>{m(u.target.value)},[]),D=a.useCallback(async()=>{const u=i.trim().length>0;if(u){const y={identifier:t,vote:"downvote",explanation:i,...n&&{extra_metadata:n}};try{d(!0),await T(y)}finally{d(!1)}}if(f(!1),m(c),h.current?.focus(),u){const y=document.createElement("div");y.setAttribute("aria-live","polite"),y.className="sr-only",y.textContent="Feedback submitted successfully.",document.body.appendChild(y),setTimeout(()=>document.body.removeChild(y),1e3)}},[T,i,c,t,n]),z=a.useCallback(u=>{if(u.key==="Escape")f(!1),m(c),h.current?.focus();else if((u.metaKey||u.ctrlKey)&&u.key==="Enter")u.preventDefault(),D().then(y=>{});else if(u.key==="Tab"&&s){const y=document.getElementById(_);if(y){const C=y.querySelectorAll('button, textarea, input, select, a[href], [tabindex]:not([tabindex="-1"])'),V=C[0],U=C[C.length-1];u.shiftKey&&document.activeElement===V?(u.preventDefault(),U?.focus()):!u.shiftKey&&document.activeElement===U&&(u.preventDefault(),V?.focus())}}},[D,s,_,c]),K={onFeedback:T,showPopover:s,setShowPopover:f,feedbackText:i,setFeedbackText:m,isSubmitting:k,setIsSubmitting:d,vote:g,handleUpvote:M,handleDownvote:W,handleTextareaChange:J,handleSubmit:D,handleKeyDown:z,textareaRef:P,triggerRef:h,popoverId:_,triggerId:B,identifier:t,extra_metadata:n};return E.jsx(te.Provider,{value:K,children:l})},UpvoteButton:({asChild:l,children:o,onClick:c,...t})=>{const{handleUpvote:n,isSubmitting:s,vote:f}=I(),i=a.useCallback(d=>{n(),c?.(d)},[n,c]),m={...t,onClick:i,disabled:s||t.disabled,"aria-label":t["aria-label"]||"Upvote feedback",type:"button"},k=f==="upvote";if(l){const d=typeof o=="function"?o({isSelected:k}):o;if(a.isValidElement(d))return a.cloneElement(d,F(m,d.props))}return E.jsx("button",{...m,children:typeof o=="function"?o({isSelected:k}):o})},DownvoteButton:({asChild:l,children:o,onClick:c,...t})=>{const{handleDownvote:n,showPopover:s,isSubmitting:f,popoverId:i,triggerId:m,triggerRef:k,vote:d}=I(),g=a.useCallback(h=>{n(),c?.(h)},[n,c]),R={...t,ref:k,onClick:g,disabled:f||t.disabled,"aria-label":t["aria-label"]||"Downvote feedback","aria-expanded":s,"aria-controls":i,id:m,type:"button"},P=d==="downvote";if(l){const h=typeof o=="function"?o({isSelected:P}):o;if(a.isValidElement(h))return a.cloneElement(h,F(R,h.props));if(h)return h}return E.jsx("button",{...R,children:typeof o=="function"?o({isSelected:P}):o})},Popover:({asChild:l,children:o,...c})=>{const{showPopover:t,handleKeyDown:n,popoverId:s,triggerId:f}=I();if(!t)return null;const i={...c,role:"dialog","aria-labelledby":f,"aria-modal":!0,"aria-describedby":`${s}-description`,id:s,onKeyDown:n,tabIndex:-1};return l&&a.isValidElement(o)?E.jsxs(E.Fragment,{children:[a.cloneElement(o,F(i,o.props)),E.jsx("div",{id:`${s}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"})]}):E.jsxs("div",{...i,children:[E.jsx("div",{id:`${s}-description`,className:"sr-only",children:"Provide additional feedback for your downvote"}),o]})},Textarea:({asChild:l,value:o,onChange:c,...t})=>{const{feedbackText:n,handleTextareaChange:s,textareaRef:f,handleKeyDown:i,popoverId:m}=I(),k={...t,ref:f,value:o!==void 0?o:n,onChange:c||s,onKeyDown:i,placeholder:t.placeholder||"What did we miss?","aria-label":t["aria-label"]||"Additional feedback","aria-describedby":`${m}-help`,rows:t.rows||3};return l&&a.isValidElement(t.children)?a.cloneElement(t.children,F(k,t.children.props)):E.jsx("textarea",{...k})},SubmitButton:({asChild:l,children:o,onClick:c,...t})=>{const{handleSubmit:n,isSubmitting:s,feedbackText:f}=I(),i=a.useCallback(g=>{n(),c?.(g)},[n,c]),m=f.trim().length>0,k=m?"Submit feedback":"Close without feedback",d={...t,onClick:i,disabled:s||t.disabled,type:"button","aria-label":t["aria-label"]||k,"aria-describedby":m?void 0:"submit-help"};return l&&a.isValidElement(o)?E.jsxs(E.Fragment,{children:[a.cloneElement(o,F(d,o.props)),!m&&E.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]}):E.jsxs("button",{...d,children:[o,!m&&E.jsx("span",{id:"submit-help",className:"sr-only",children:"This will close the dialog without submitting feedback"})]})}};w.KeletContext=N,w.KeletProvider=fe,w.VoteFeedback=be,w.useDefaultFeedbackHandler=ee,w.useKelet=de,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DownvoteButtonProps, PopoverProps, SubmitButtonProps, TextareaProps, UpvoteButtonProps, VoteFeedbackRootProps } from '../types';
|
|
2
|
+
export declare const VoteFeedback: {
|
|
3
|
+
Root: ({ children, onFeedback, defaultText, identifier, extra_metadata, }: VoteFeedbackRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
UpvoteButton: ({ asChild, children, onClick, ...props }: UpvoteButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
DownvoteButton: ({ asChild, children, onClick, ...props }: DownvoteButtonProps) => string | number | bigint | true | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Popover: ({ asChild, children, ...props }: PopoverProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
Textarea: ({ asChild, value, onChange, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
SubmitButton: ({ asChild, children, onClick, ...props }: SubmitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export { VoteFeedback as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { VoteFeedback } from './vote-feedback';
|
|
3
|
+
declare const meta: Meta<typeof VoteFeedback.Root>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const HeadlessBasic: Story;
|
|
7
|
+
export declare const HeadlessCustomStyling: Story;
|
|
8
|
+
export declare const HeadlessMinimal: Story;
|
|
9
|
+
export declare const AsChildPattern: Story;
|
|
10
|
+
export declare const CompleteWorkflow: Story;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FeedbackData } from '../types';
|
|
3
|
+
interface KeletContextValue {
|
|
4
|
+
api_key: string;
|
|
5
|
+
project: string;
|
|
6
|
+
feedback: (data: FeedbackData) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
interface KeletProviderProps {
|
|
9
|
+
api_key?: string;
|
|
10
|
+
project: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const KeletContext: React.Context<KeletContextValue | null>;
|
|
13
|
+
export declare const useKelet: () => KeletContextValue;
|
|
14
|
+
export declare const useDefaultFeedbackHandler: () => ((data: FeedbackData) => Promise<void>);
|
|
15
|
+
export declare const KeletProvider: React.FC<React.PropsWithChildren<KeletProviderProps>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { VoteFeedback } from './components/vote-feedback';
|
|
2
|
+
export type { FeedbackData, VoteFeedbackRootProps, UpvoteButtonProps, DownvoteButtonProps, PopoverProps, TextareaProps, SubmitButtonProps, } from './types';
|
|
3
|
+
export { KeletProvider, KeletContext, useKelet, useDefaultFeedbackHandler } from './contexts/kelet';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLAttributes, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Feedback data structure returned by the component
|
|
4
|
+
*/
|
|
5
|
+
export interface FeedbackData {
|
|
6
|
+
identifier: string;
|
|
7
|
+
extra_metadata?: Record<string, any>;
|
|
8
|
+
vote: 'upvote' | 'downvote';
|
|
9
|
+
explanation?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Props for the root VoteFeedback component
|
|
13
|
+
* This is a headless component - no styling included
|
|
14
|
+
*/
|
|
15
|
+
export interface VoteFeedbackRootProps {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
onFeedback?: (data: FeedbackData) => void | Promise<void>;
|
|
18
|
+
defaultText?: string;
|
|
19
|
+
identifier: string;
|
|
20
|
+
extra_metadata?: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Props for the upvote button
|
|
24
|
+
* Headless - you provide your own styling and content
|
|
25
|
+
*/
|
|
26
|
+
export interface UpvoteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
children: ReactNode | (({ isSelected }: {
|
|
29
|
+
isSelected: boolean;
|
|
30
|
+
}) => ReactNode);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Props for the downvote button
|
|
34
|
+
* Headless - you provide your own styling and content
|
|
35
|
+
*/
|
|
36
|
+
export interface DownvoteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
37
|
+
asChild?: boolean;
|
|
38
|
+
children: ReactNode | (({ isSelected }: {
|
|
39
|
+
isSelected: boolean;
|
|
40
|
+
}) => ReactNode);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Props for the popover container
|
|
44
|
+
* Headless - you control the positioning and styling
|
|
45
|
+
*/
|
|
46
|
+
export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
47
|
+
asChild?: boolean;
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Props for the textarea input
|
|
52
|
+
* Headless - you provide your own styling
|
|
53
|
+
*/
|
|
54
|
+
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
55
|
+
asChild?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Props for the submit button
|
|
59
|
+
* Headless - you provide your own styling and content
|
|
60
|
+
*/
|
|
61
|
+
export interface SubmitButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
62
|
+
asChild?: boolean;
|
|
63
|
+
children: ReactNode;
|
|
64
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VoteFeedbackRootProps } from '../../types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
interface ShadcnVoteFeedbackProps extends VoteFeedbackRootProps {
|
|
4
|
+
variant?: 'default' | 'outline' | 'ghost' | 'secondary';
|
|
5
|
+
size?: 'default' | 'sm' | 'lg' | 'icon';
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const ShadcnVoteFeedback: React.ForwardRefExoticComponent<ShadcnVoteFeedbackProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export { ShadcnVoteFeedback };
|
|
13
|
+
export type { ShadcnVoteFeedbackProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ShadcnVoteFeedback } from './vote-feedback';
|
|
3
|
+
declare const meta: Meta<typeof ShadcnVoteFeedback>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Ghost: Story;
|
|
8
|
+
export declare const Secondary: Story;
|
|
9
|
+
export declare const DefaultFilled: Story;
|
|
10
|
+
export declare const CustomContent: Story;
|
|
11
|
+
export declare const InlineUsage: Story;
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kelet-ai/feedback-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/kelet-ai/feedback-ui.git"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/feedback-ui.umd.js",
|
|
9
|
+
"module": "./dist/feedback-ui.es.js",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@chromatic-com/storybook": "^4.0.1",
|
|
12
|
+
"@radix-ui/react-popover": "^1.1.14",
|
|
13
|
+
"@radix-ui/react-slot": "^1.2.3",
|
|
14
|
+
"@storybook/addon-a11y": "^9.0.17",
|
|
15
|
+
"@storybook/addon-docs": "^9.0.17",
|
|
16
|
+
"@storybook/addon-themes": "^9.0.17",
|
|
17
|
+
"@storybook/addon-vitest": "^9.0.17",
|
|
18
|
+
"@storybook/builder-vite": "^9.0.17",
|
|
19
|
+
"@storybook/react-vite": "^9.0.17",
|
|
20
|
+
"@tailwindcss/forms": "^0.5.10",
|
|
21
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
22
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
23
|
+
"@testing-library/react": "^16.3.0",
|
|
24
|
+
"@testing-library/user-event": "^14.6.1",
|
|
25
|
+
"@types/bun": "latest",
|
|
26
|
+
"@types/node": "^24.0.14",
|
|
27
|
+
"@types/react": "^19.1.8",
|
|
28
|
+
"@types/react-dom": "^19.1.6",
|
|
29
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
30
|
+
"@vitest/browser": "^3.2.4",
|
|
31
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
32
|
+
"ajv": "^8.17.1",
|
|
33
|
+
"class-variance-authority": "^0.7.1",
|
|
34
|
+
"clsx": "^2.1.1",
|
|
35
|
+
"eslint": "^9.31.0",
|
|
36
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
37
|
+
"eslint-plugin-storybook": "9.0.17",
|
|
38
|
+
"jsdom": "^26.1.0",
|
|
39
|
+
"lucide-react": "^0.525.0",
|
|
40
|
+
"playwright": "^1.54.1",
|
|
41
|
+
"prettier": "^3.6.2",
|
|
42
|
+
"react": "^19.1.0",
|
|
43
|
+
"react-dom": "^19.1.0",
|
|
44
|
+
"shadcn": "^2.9.0",
|
|
45
|
+
"storybook": "^9.0.17",
|
|
46
|
+
"tailwind-merge": "^3.3.1",
|
|
47
|
+
"tailwindcss": "^4.1.11",
|
|
48
|
+
"tw-animate-css": "^1.3.5",
|
|
49
|
+
"typescript": "^5.8.3",
|
|
50
|
+
"typescript-eslint": "^8.37.0",
|
|
51
|
+
"vite": "^7.0.4",
|
|
52
|
+
"vite-plugin-dts": "^4.5.4",
|
|
53
|
+
"vitest": "^3.2.4"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": "^19.1.0",
|
|
57
|
+
"react-dom": "^19.1.0"
|
|
58
|
+
},
|
|
59
|
+
"exports": {
|
|
60
|
+
".": {
|
|
61
|
+
"types": "./dist/index.d.ts",
|
|
62
|
+
"import": "./dist/feedback-ui.es.js",
|
|
63
|
+
"require": "./dist/feedback-ui.umd.js"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"description": "A React component library for feedback UI components",
|
|
67
|
+
"files": [
|
|
68
|
+
"dist"
|
|
69
|
+
],
|
|
70
|
+
"keywords": [
|
|
71
|
+
"react",
|
|
72
|
+
"components",
|
|
73
|
+
"feedback",
|
|
74
|
+
"ui",
|
|
75
|
+
"typescript"
|
|
76
|
+
],
|
|
77
|
+
"license": "APACHE-2.0",
|
|
78
|
+
"scripts": {
|
|
79
|
+
"dev": "NODE_NO_WARNINGS=1 storybook dev -p 6006",
|
|
80
|
+
"build": "vite build",
|
|
81
|
+
"build-storybook": "storybook build",
|
|
82
|
+
"test": "vitest",
|
|
83
|
+
"test:storybook": "vitest --project=storybook",
|
|
84
|
+
"test:storybook:coverage": "vitest --project=storybook --coverage",
|
|
85
|
+
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
86
|
+
"format": "prettier --write .",
|
|
87
|
+
"format:check": "prettier --check .",
|
|
88
|
+
"preview": "vite preview",
|
|
89
|
+
"prepublishOnly": "bun run build",
|
|
90
|
+
"storybook": "NODE_NO_WARNINGS=1 storybook dev -p 6006",
|
|
91
|
+
"registry:build": "bun shadcn build"
|
|
92
|
+
},
|
|
93
|
+
"type": "module",
|
|
94
|
+
"types": "./dist/index.d.ts"
|
|
95
|
+
}
|