@discuss-ds/ui 0.3.5 → 0.4.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 +58 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +58 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -734,8 +734,15 @@ interface QuestionOptionEditorProps {
|
|
|
734
734
|
/** Called by the add (+) button. */
|
|
735
735
|
onAdd?: () => void;
|
|
736
736
|
className?: string;
|
|
737
|
+
/**
|
|
738
|
+
* Answer type. When set the row is quiet at rest: no border, the radio or checkbox indicator in front of the label,
|
|
739
|
+
* and the remove/add buttons hidden but still taking their space, so the row is the same width in every state.
|
|
740
|
+
* On hover or keyboard focus it becomes the editor: border and shadow, the drag handle replaces the indicator and
|
|
741
|
+
* the buttons appear. Omit it for an always-on editor row.
|
|
742
|
+
*/
|
|
743
|
+
kind?: 'radio' | 'checkbox';
|
|
737
744
|
}
|
|
738
|
-
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className }: QuestionOptionEditorProps): React.JSX.Element;
|
|
745
|
+
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }: QuestionOptionEditorProps): React.JSX.Element;
|
|
739
746
|
|
|
740
747
|
interface RankItemData {
|
|
741
748
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -734,8 +734,15 @@ interface QuestionOptionEditorProps {
|
|
|
734
734
|
/** Called by the add (+) button. */
|
|
735
735
|
onAdd?: () => void;
|
|
736
736
|
className?: string;
|
|
737
|
+
/**
|
|
738
|
+
* Answer type. When set the row is quiet at rest: no border, the radio or checkbox indicator in front of the label,
|
|
739
|
+
* and the remove/add buttons hidden but still taking their space, so the row is the same width in every state.
|
|
740
|
+
* On hover or keyboard focus it becomes the editor: border and shadow, the drag handle replaces the indicator and
|
|
741
|
+
* the buttons appear. Omit it for an always-on editor row.
|
|
742
|
+
*/
|
|
743
|
+
kind?: 'radio' | 'checkbox';
|
|
737
744
|
}
|
|
738
|
-
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className }: QuestionOptionEditorProps): React.JSX.Element;
|
|
745
|
+
declare function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }: QuestionOptionEditorProps): React.JSX.Element;
|
|
739
746
|
|
|
740
747
|
interface RankItemData {
|
|
741
748
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -2832,22 +2832,64 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
2832
2832
|
}
|
|
2833
2833
|
);
|
|
2834
2834
|
QuestionOtherOption.displayName = "QuestionOtherOption";
|
|
2835
|
-
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className }) {
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
"
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2835
|
+
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }) {
|
|
2836
|
+
const reveal = kind !== void 0;
|
|
2837
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
2838
|
+
/* @__PURE__ */ jsxs31(
|
|
2839
|
+
"div",
|
|
2840
|
+
{
|
|
2841
|
+
className: cn(
|
|
2842
|
+
"flex h-11.5 min-w-0 flex-1 items-center gap-2 rounded-md border bg-surface px-4 py-2 focus-within:border-input-accent",
|
|
2843
|
+
reveal ? [
|
|
2844
|
+
// Hover or focus anywhere in the row shows the border; the field being edited keeps the accent.
|
|
2845
|
+
"border-transparent group-hover/option:not-focus-within:border-border group-focus-within/option:not-focus-within:border-border",
|
|
2846
|
+
"group-hover/option:shadow-md group-focus-within/option:shadow-md"
|
|
2847
|
+
] : "border-border hover:border-input hover:shadow-md"
|
|
2848
|
+
),
|
|
2849
|
+
children: [
|
|
2850
|
+
reveal ? /* @__PURE__ */ jsxs31("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
|
|
2851
|
+
/* @__PURE__ */ jsx45(
|
|
2852
|
+
"span",
|
|
2853
|
+
{
|
|
2854
|
+
className: cn(
|
|
2855
|
+
"inline-flex size-4 border-2 border-input bg-surface group-hover/option:hidden group-focus-within/option:hidden",
|
|
2856
|
+
kind === "radio" ? "rounded-full" : "rounded-xxs"
|
|
2857
|
+
)
|
|
2858
|
+
}
|
|
2859
|
+
),
|
|
2860
|
+
/* @__PURE__ */ jsx45(
|
|
2861
|
+
DotsSixVertical3,
|
|
2862
|
+
{
|
|
2863
|
+
size: 20,
|
|
2864
|
+
className: "hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block"
|
|
2865
|
+
}
|
|
2866
|
+
)
|
|
2867
|
+
] }) : /* @__PURE__ */ jsx45(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
2868
|
+
/* @__PURE__ */ jsx45(
|
|
2869
|
+
"input",
|
|
2870
|
+
{
|
|
2871
|
+
"aria-label": "Option label",
|
|
2872
|
+
value: label,
|
|
2873
|
+
onChange: (event) => onLabelChange?.(event.target.value),
|
|
2874
|
+
className: "min-w-0 flex-1 bg-transparent text-body-base text-surface-foreground outline-none"
|
|
2875
|
+
}
|
|
2876
|
+
)
|
|
2877
|
+
]
|
|
2878
|
+
}
|
|
2879
|
+
),
|
|
2880
|
+
/* @__PURE__ */ jsxs31(
|
|
2881
|
+
"div",
|
|
2882
|
+
{
|
|
2883
|
+
className: cn(
|
|
2884
|
+
"flex items-center gap-2",
|
|
2885
|
+
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
2886
|
+
),
|
|
2887
|
+
children: [
|
|
2888
|
+
/* @__PURE__ */ jsx45(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", onClick: onRemove, children: /* @__PURE__ */ jsx45(Trash4, { size: 16, "aria-hidden": true }) }),
|
|
2889
|
+
/* @__PURE__ */ jsx45(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", onClick: onAdd, children: /* @__PURE__ */ jsx45(Plus4, { size: 16, "aria-hidden": true }) })
|
|
2890
|
+
]
|
|
2891
|
+
}
|
|
2892
|
+
)
|
|
2851
2893
|
] });
|
|
2852
2894
|
}
|
|
2853
2895
|
|