@discuss-ds/ui 0.16.0 → 0.17.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @discuss-ds/ui
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#72](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/72) [`8956850`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/89568503fd76b323d9af660ed59ad1b41f9b3fd1) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - QuestionHeader, QuestionEditorCard and QuestionNavItem: new optional `showDragHandle` prop (default true). Set it to false when the question or row can't be moved, so the grip icon is not shown on hover and the tag or row doesn't shift to make room for it. Nothing changes for existing callers.
8
+
3
9
  ## 0.16.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2678,7 +2678,7 @@ var import_react19 = require("@phosphor-icons/react");
2678
2678
  var import_jsx_runtime41 = require("react/jsx-runtime");
2679
2679
  var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
2680
2680
  var QuestionHeader = React40.forwardRef(
2681
- ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
2681
+ ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, ...props }, ref) => {
2682
2682
  const [draft, setDraft] = React40.useState(null);
2683
2683
  const label = String(number).padStart(2, "0");
2684
2684
  const showError = error !== void 0 && error !== false;
@@ -2694,15 +2694,16 @@ var QuestionHeader = React40.forwardRef(
2694
2694
  "aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
2695
2695
  ...dragHandleProps,
2696
2696
  className: cn(
2697
- "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
2698
- // Inside a QuestionEditorCard the tag takes its hover look whenever the card is hovered.
2699
- "group-hover/editor:pl-1",
2697
+ "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
2698
+ // The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered.
2699
+ showDragHandle && "hover:pl-1 group-hover/editor:pl-1",
2700
2700
  active ? "bg-accent-soft text-accent-soft-foreground" : "bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground",
2701
- dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
2701
+ dragHandleProps && "cursor-grab touch-none select-none",
2702
+ dragHandleProps && showDragHandle && "focus-visible:pl-1",
2702
2703
  dragHandleProps?.className
2703
2704
  ),
2704
2705
  children: [
2705
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2706
+ showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2706
2707
  import_react19.DotsSixVertical,
2707
2708
  {
2708
2709
  size: 16,
@@ -2788,6 +2789,7 @@ var QuestionEditorCard = React41.forwardRef(
2788
2789
  error,
2789
2790
  meta,
2790
2791
  dragHandleProps,
2792
+ showDragHandle,
2791
2793
  children,
2792
2794
  ...props
2793
2795
  }, ref) => {
@@ -2819,6 +2821,7 @@ var QuestionEditorCard = React41.forwardRef(
2819
2821
  active,
2820
2822
  showCounter: !!active,
2821
2823
  dragHandleProps,
2824
+ showDragHandle,
2822
2825
  meta,
2823
2826
  maxLength,
2824
2827
  actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
@@ -2934,7 +2937,7 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
2934
2937
  // src/components/Question Types/QuestionNavItem.tsx
2935
2938
  var import_jsx_runtime44 = require("react/jsx-runtime");
2936
2939
  var QuestionNavItem = React43.forwardRef(
2937
- ({ className, questionType = "select-one", selected, error, asChild, children, ...props }, ref) => {
2940
+ ({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, children, ...props }, ref) => {
2938
2941
  const Comp = asChild ? import_radix_ui21.Slot.Root : "button";
2939
2942
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
2940
2943
  Comp,
@@ -2954,8 +2957,8 @@ var QuestionNavItem = React43.forwardRef(
2954
2957
  ...props,
2955
2958
  children: [
2956
2959
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
2957
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block" }),
2958
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2960
+ showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block" }),
2961
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: showDragHandle ? "group-hover/nav:hidden" : void 0, children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2959
2962
  QuestionTypeIcon,
2960
2963
  {
2961
2964
  type: questionType,