@discuss-ds/ui 0.6.3 → 0.7.1
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 +12 -0
- package/dist/index.cjs +15 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +18 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -749,9 +749,14 @@ interface QuestionOptionEditorProps {
|
|
|
749
749
|
* On hover or keyboard focus it becomes the editor: the shadow lifts, the drag handle replaces the indicator and the
|
|
750
750
|
* buttons appear. The border colour does not change. Omit it for an always-on editor row.
|
|
751
751
|
*/
|
|
752
|
-
kind?: 'radio' | 'checkbox';
|
|
752
|
+
kind?: 'radio' | 'checkbox' | 'rank';
|
|
753
|
+
/**
|
|
754
|
+
* `kind="rank"` only: the position shown in the round number tag, as in `RankList`. For a ranking question the row keeps
|
|
755
|
+
* its drag handle and number at rest and, like the other kinds, becomes the editor on hover or keyboard focus.
|
|
756
|
+
*/
|
|
757
|
+
rank?: number;
|
|
753
758
|
}
|
|
754
|
-
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }: QuestionOptionEditorProps): React.JSX.Element;
|
|
759
|
+
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }: QuestionOptionEditorProps): React.JSX.Element;
|
|
755
760
|
|
|
756
761
|
interface RankItemData {
|
|
757
762
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -749,9 +749,14 @@ interface QuestionOptionEditorProps {
|
|
|
749
749
|
* On hover or keyboard focus it becomes the editor: the shadow lifts, the drag handle replaces the indicator and the
|
|
750
750
|
* buttons appear. The border colour does not change. Omit it for an always-on editor row.
|
|
751
751
|
*/
|
|
752
|
-
kind?: 'radio' | 'checkbox';
|
|
752
|
+
kind?: 'radio' | 'checkbox' | 'rank';
|
|
753
|
+
/**
|
|
754
|
+
* `kind="rank"` only: the position shown in the round number tag, as in `RankList`. For a ranking question the row keeps
|
|
755
|
+
* its drag handle and number at rest and, like the other kinds, becomes the editor on hover or keyboard focus.
|
|
756
|
+
*/
|
|
757
|
+
rank?: number;
|
|
753
758
|
}
|
|
754
|
-
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }: QuestionOptionEditorProps): React.JSX.Element;
|
|
759
|
+
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }: QuestionOptionEditorProps): React.JSX.Element;
|
|
755
760
|
|
|
756
761
|
interface RankItemData {
|
|
757
762
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -2194,16 +2194,14 @@ var FileUploadItem = React36.forwardRef(
|
|
|
2194
2194
|
/* @__PURE__ */ jsx37("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-full bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground", children: icon ?? /* @__PURE__ */ jsx37(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2195
2195
|
/* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2196
2196
|
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
/* @__PURE__ */ jsx37("p", { className: "truncate text-ui-label text-surface-foreground", children: name }),
|
|
2199
|
-
status === "complete" && /* @__PURE__ */ jsx37(Tag, { variant: "success", children: "Complete" }),
|
|
2200
|
-
status === "error" && /* @__PURE__ */ jsx37(Tag, { variant: "destructive", children: "Error" })
|
|
2201
|
-
] }),
|
|
2197
|
+
/* @__PURE__ */ jsx37("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2202
2198
|
onRemove && /* @__PURE__ */ jsx37(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx37(X5, { size: 16, "aria-hidden": true }) })
|
|
2203
2199
|
] }),
|
|
2204
2200
|
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2205
2201
|
/* @__PURE__ */ jsxs26("span", { className: "flex items-center gap-2", children: [
|
|
2206
2202
|
size,
|
|
2203
|
+
status === "complete" && /* @__PURE__ */ jsx37(Tag, { variant: "success", children: "Complete" }),
|
|
2204
|
+
status === "error" && /* @__PURE__ */ jsx37(Tag, { variant: "destructive", children: "Error" }),
|
|
2207
2205
|
uploading && timeLeft && /* @__PURE__ */ jsxs26(Fragment5, { children: [
|
|
2208
2206
|
/* @__PURE__ */ jsx37("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2209
2207
|
timeLeft
|
|
@@ -2790,7 +2788,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
|
|
|
2790
2788
|
// src/components/Question Types/QuestionOption.tsx
|
|
2791
2789
|
import * as React44 from "react";
|
|
2792
2790
|
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash4 } from "@phosphor-icons/react";
|
|
2793
|
-
import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2791
|
+
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2794
2792
|
var optionClasses = "flex w-full max-w-150 cursor-pointer items-center gap-2 rounded-md border border-border bg-surface px-4 py-2 text-body-base text-surface-foreground transition-colors hover:bg-accent-soft hover:shadow-md has-[[data-state=checked]]:border-accent-foreground has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50";
|
|
2795
2793
|
function QuestionOption(props) {
|
|
2796
2794
|
const id = React44.useId();
|
|
@@ -2844,7 +2842,7 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
2844
2842
|
}
|
|
2845
2843
|
);
|
|
2846
2844
|
QuestionOtherOption.displayName = "QuestionOtherOption";
|
|
2847
|
-
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }) {
|
|
2845
|
+
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }) {
|
|
2848
2846
|
const reveal = kind !== void 0;
|
|
2849
2847
|
return /* @__PURE__ */ jsxs31("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
2850
2848
|
/* @__PURE__ */ jsxs31(
|
|
@@ -2858,7 +2856,17 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
|
|
|
2858
2856
|
) : "border-border hover:border-input hover:shadow-md"
|
|
2859
2857
|
),
|
|
2860
2858
|
children: [
|
|
2861
|
-
|
|
2859
|
+
kind === "rank" ? /* @__PURE__ */ jsxs31(Fragment8, { children: [
|
|
2860
|
+
/* @__PURE__ */ jsx45(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
2861
|
+
/* @__PURE__ */ jsx45(
|
|
2862
|
+
"span",
|
|
2863
|
+
{
|
|
2864
|
+
"aria-hidden": "true",
|
|
2865
|
+
className: "flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-ui-caption text-surface-foreground",
|
|
2866
|
+
children: rank
|
|
2867
|
+
}
|
|
2868
|
+
)
|
|
2869
|
+
] }) : reveal ? /* @__PURE__ */ jsxs31("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
|
|
2862
2870
|
/* @__PURE__ */ jsx45(
|
|
2863
2871
|
"span",
|
|
2864
2872
|
{
|
|
@@ -2907,7 +2915,7 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
|
|
|
2907
2915
|
// src/components/Question Types/RankList.tsx
|
|
2908
2916
|
import * as React45 from "react";
|
|
2909
2917
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
2910
|
-
import { Fragment as
|
|
2918
|
+
import { Fragment as Fragment9, jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2911
2919
|
function move(list, from, to) {
|
|
2912
2920
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
2913
2921
|
const next = list.slice();
|
|
@@ -2934,7 +2942,7 @@ var RankList = React45.forwardRef(
|
|
|
2934
2942
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
2935
2943
|
onItemsChange(next);
|
|
2936
2944
|
};
|
|
2937
|
-
return /* @__PURE__ */ jsxs32(
|
|
2945
|
+
return /* @__PURE__ */ jsxs32(Fragment9, { children: [
|
|
2938
2946
|
/* @__PURE__ */ jsx46("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs32(
|
|
2939
2947
|
"li",
|
|
2940
2948
|
{
|