@discuss-ds/ui 0.6.3 → 0.7.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 +6 -0
- package/dist/index.cjs +12 -2
- 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 +15 -5
- 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
|
@@ -2790,7 +2790,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
|
|
|
2790
2790
|
// src/components/Question Types/QuestionOption.tsx
|
|
2791
2791
|
import * as React44 from "react";
|
|
2792
2792
|
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";
|
|
2793
|
+
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2794
2794
|
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
2795
|
function QuestionOption(props) {
|
|
2796
2796
|
const id = React44.useId();
|
|
@@ -2844,7 +2844,7 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
2844
2844
|
}
|
|
2845
2845
|
);
|
|
2846
2846
|
QuestionOtherOption.displayName = "QuestionOtherOption";
|
|
2847
|
-
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }) {
|
|
2847
|
+
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind, rank }) {
|
|
2848
2848
|
const reveal = kind !== void 0;
|
|
2849
2849
|
return /* @__PURE__ */ jsxs31("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
2850
2850
|
/* @__PURE__ */ jsxs31(
|
|
@@ -2858,7 +2858,17 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
|
|
|
2858
2858
|
) : "border-border hover:border-input hover:shadow-md"
|
|
2859
2859
|
),
|
|
2860
2860
|
children: [
|
|
2861
|
-
|
|
2861
|
+
kind === "rank" ? /* @__PURE__ */ jsxs31(Fragment8, { children: [
|
|
2862
|
+
/* @__PURE__ */ jsx45(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
2863
|
+
/* @__PURE__ */ jsx45(
|
|
2864
|
+
"span",
|
|
2865
|
+
{
|
|
2866
|
+
"aria-hidden": "true",
|
|
2867
|
+
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",
|
|
2868
|
+
children: rank
|
|
2869
|
+
}
|
|
2870
|
+
)
|
|
2871
|
+
] }) : reveal ? /* @__PURE__ */ jsxs31("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
|
|
2862
2872
|
/* @__PURE__ */ jsx45(
|
|
2863
2873
|
"span",
|
|
2864
2874
|
{
|
|
@@ -2907,7 +2917,7 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
|
|
|
2907
2917
|
// src/components/Question Types/RankList.tsx
|
|
2908
2918
|
import * as React45 from "react";
|
|
2909
2919
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
2910
|
-
import { Fragment as
|
|
2920
|
+
import { Fragment as Fragment9, jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2911
2921
|
function move(list, from, to) {
|
|
2912
2922
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
2913
2923
|
const next = list.slice();
|
|
@@ -2934,7 +2944,7 @@ var RankList = React45.forwardRef(
|
|
|
2934
2944
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
2935
2945
|
onItemsChange(next);
|
|
2936
2946
|
};
|
|
2937
|
-
return /* @__PURE__ */ jsxs32(
|
|
2947
|
+
return /* @__PURE__ */ jsxs32(Fragment9, { children: [
|
|
2938
2948
|
/* @__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
2949
|
"li",
|
|
2940
2950
|
{
|