@examplary/ui 0.0.1 → 1.0.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/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # UI components for Examplary
2
2
 
3
- Read more in the [📘 Developer Documentation](https://developers.examplary.ai/question-types).
3
+ Read more in the [📘 Developer Documentation](https://developers.examplary.ai/question-types).
@@ -20,6 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
31
+ };
23
32
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
33
  import { useEffect, useMemo, useState } from "react";
25
34
  import Document from "@tiptap/extension-document";
@@ -43,15 +52,17 @@ export var MinimalRichTextField = function (_a) {
43
52
  var _b = _a.className, className = _b === void 0 ? "" : _b, _c = _a.editorClassName, editorClassName = _c === void 0 ? "" : _c, _d = _a.value, value = _d === void 0 ? "" : _d, _e = _a.placeholder, placeholder = _e === void 0 ? "" : _e, onChange = _a.onChange, slotBefore = _a.slotBefore, _f = _a.singleLine, singleLine = _f === void 0 ? false : _f, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, _h = _a.showFormattingMenu, showFormattingMenu = _h === void 0 ? false : _h, _j = _a.uploadFile, uploadFile = _j === void 0 ? undefined : _j, props = __rest(_a, ["className", "editorClassName", "value", "placeholder", "onChange", "slotBefore", "singleLine", "autoFocus", "showFormattingMenu", "uploadFile"]);
44
53
  var _k = useState(value), content = _k[0], setContent = _k[1];
45
54
  var extensions = useMemo(function () {
46
- return [
47
- StarterKit.configure({
48
- document: singleLine ? false : undefined,
49
- link: false,
50
- }),
51
- singleLine &&
55
+ return __spreadArray(__spreadArray([], (singleLine
56
+ ? [
57
+ StarterKit.configure({
58
+ document: false,
59
+ link: false,
60
+ }),
52
61
  Document.extend({
53
62
  content: "block",
54
63
  }),
64
+ ]
65
+ : [StarterKit.configure({ link: false })]), true), [
55
66
  Link.configure({
56
67
  openOnClick: false,
57
68
  }),
@@ -63,7 +74,7 @@ export var MinimalRichTextField = function (_a) {
63
74
  // Mathematics,
64
75
  Highlight,
65
76
  uploadFile && fileHandler(uploadFile),
66
- ].filter(Boolean);
77
+ ], false).filter(Boolean);
67
78
  }, [singleLine, placeholder, uploadFile]);
68
79
  var editor = useEditor({
69
80
  onUpdate: function (_a) {
@@ -1,4 +1,4 @@
1
1
  import { Editor } from "@tiptap/react";
2
2
  export declare const processFilesAsString: (uploadFile: any, files: any) => Promise<unknown>;
3
3
  export declare const processFiles: (uploadFile: any, currentEditor: Editor, files: any, pos: any) => void;
4
- export declare const fileHandler: (uploadFile: any) => import("@tiptap/core").Extension<Omit<import("@tiptap-pro/extension-file-handler").FileHandlePluginOptions, "key" | "editor">, any>;
4
+ export declare const fileHandler: (uploadFile: any) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "key" | "editor">, any>;
@@ -35,7 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import toast from "react-hot-toast";
38
- import FileHandler from "@tiptap-pro/extension-file-handler";
38
+ import FileHandler from "@tiptap/extension-file-handler";
39
39
  import { getImageSize } from "../tiptap/png-scanner";
40
40
  export var processFilesAsString = function (uploadFile, files) {
41
41
  return new Promise(function (resolve) {
@@ -178,6 +178,8 @@ export var fileHandler = function (uploadFile) {
178
178
  "application/pdf",
179
179
  "text/html",
180
180
  "text/plain",
181
+ "application/msword",
182
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
181
183
  ],
182
184
  onDrop: function (currentEditor, files, pos) {
183
185
  processFiles(uploadFile, currentEditor, files, pos);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
1
  export * from "./utils";
2
- export { Button } from "./components/button";
3
- export { Input } from "./components/input";
4
2
  export * from "./components/rich-text";
5
3
  export * as WebComponents from "./components/web-components";
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
1
  export * from "./utils";
2
- export { Button } from "./components/button";
3
- export { Input } from "./components/input";
4
2
  export * from "./components/rich-text";
5
3
  export * as WebComponents from "./components/web-components";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@examplary/ui",
3
3
  "description": "UI components for the Examplary testing platform.",
4
4
  "packageManager": "yarn@4.5.3",
5
- "version": "0.0.1",
5
+ "version": "1.0.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "files": [
@@ -17,9 +17,8 @@
17
17
  "@floating-ui/dom": "^1.7.2",
18
18
  "@tailwindcss/forms": "^0.5.10",
19
19
  "@tailwindcss/typography": "^0.5.16",
20
- "@tiptap-pro/extension-file-handler": "^2.21.5",
21
- "@tiptap-pro/extension-mathematics": "^2.18.0",
22
20
  "@tiptap/core": "^3.0.7",
21
+ "@tiptap/extension-file-handler": "^3.0.7",
23
22
  "@tiptap/extension-highlight": "^3.0.7",
24
23
  "@tiptap/extension-link": "^3.0.7",
25
24
  "@tiptap/extension-mathematics": "^3.0.7",
@@ -36,5 +35,10 @@
36
35
  },
37
36
  "devDependencies": {
38
37
  "typescript": "^5.8.3"
38
+ },
39
+ "homepage": "https://developers.examplary.ai",
40
+ "author": {
41
+ "name": "Examplary AI",
42
+ "email": "hi@examplary.ai"
39
43
  }
40
44
  }
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
3
- declare const buttonVariants: (props?: {
4
- variant?: "default" | "transparent" | "primary" | "noShadow" | "neutral" | "simple" | "pressed" | "reverse";
5
- size?: "default" | "sm" | "lg" | "icon";
6
- } & import("class-variance-authority/types").ClassProp) => string;
7
- export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
- asChild?: boolean;
9
- }
10
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
- export { Button, buttonVariants };
@@ -1,58 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { jsx as _jsx } from "react/jsx-runtime";
24
- import * as React from "react";
25
- import { Slot } from "@radix-ui/react-slot";
26
- import { cva } from "class-variance-authority";
27
- import { cn } from "../utils";
28
- var buttonVariants = cva("inline-flex font-medium cursor-pointer items-center text-text justify-center whitespace-nowrap rounded-base text-sm font-base ring-offset-white transition-all gap-2 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", {
29
- variants: {
30
- variant: {
31
- default: "bg-white border-2 border-border dark:border-darkBorder shadow-light dark:shadow-dark hover:translate-x-boxShadowX hover:translate-y-boxShadowY hover:shadow-none dark:hover:shadow-none",
32
- transparent: "border-2 border-border dark:border-darkBorder shadow-light dark:shadow-dark hover:translate-x-boxShadowX hover:translate-y-boxShadowY hover:shadow-none dark:hover:shadow-none",
33
- primary: "bg-bright border-2 border-border dark:border-darkBorder shadow-light dark:shadow-dark hover:translate-x-boxShadowX hover:translate-y-boxShadowY hover:shadow-none dark:hover:shadow-none",
34
- noShadow: "bg-white border-2 border-border dark:border-darkBorder",
35
- neutral: "bg-white dark:bg-secondaryBlack dark:text-darkText border-2 border-border dark:border-darkBorder shadow-light dark:shadow-dark hover:translate-x-boxShadowX hover:translate-y-boxShadowY hover:shadow-none dark:hover:shadow-none",
36
- simple: "bg-white border-2 border-border dark:border-darkBorder",
37
- pressed: "bg-white border-2 border-border mt-1 ml-1",
38
- reverse: "bg-white border-2 border-border dark:border-darkBorder hover:translate-x-reverseBoxShadowX hover:translate-y-reverseBoxShadowY hover:shadow-light dark:hover:shadow-dark",
39
- },
40
- size: {
41
- default: "h-10 px-4 py-2",
42
- sm: "h-9 px-3",
43
- lg: "h-11 px-8",
44
- icon: "h-10 w-10",
45
- },
46
- },
47
- defaultVariants: {
48
- variant: "default",
49
- size: "default",
50
- },
51
- });
52
- var Button = React.forwardRef(function (_a, ref) {
53
- var className = _a.className, variant = _a.variant, size = _a.size, _b = _a.asChild, asChild = _b === void 0 ? false : _b, props = __rest(_a, ["className", "variant", "size", "asChild"]);
54
- var Comp = asChild ? Slot : "button";
55
- return (_jsx(Comp, __assign({ className: cn(buttonVariants({ variant: variant, size: size, className: className })), ref: ref }, props)));
56
- });
57
- Button.displayName = "Button";
58
- export { Button, buttonVariants };
@@ -1,4 +0,0 @@
1
- import * as React from "react";
2
- export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
3
- declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
4
- export { Input };
@@ -1,31 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { jsx as _jsx } from "react/jsx-runtime";
24
- import * as React from "react";
25
- import { cn } from "../utils";
26
- var Input = React.forwardRef(function (_a, ref) {
27
- var className = _a.className, type = _a.type, props = __rest(_a, ["className", "type"]);
28
- return (_jsx("input", __assign({ type: type, className: cn("flex h-10 w-full rounded-base border-2 text-text dark:text-darkText font-base selection:bg-main selection:text-text border-border dark:border-darkBorder bg-white dark:bg-secondaryBlack px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-base focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref }, props)));
29
- });
30
- Input.displayName = "Input";
31
- export { Input };