@discuss-ds/ui 0.4.1 → 0.5.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 +14 -0
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -657,6 +657,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
657
657
|
onPaste?: () => void;
|
|
658
658
|
/** Optional strip under the card body, e.g. an "Inferred" assumption note. */
|
|
659
659
|
note?: React.ReactNode;
|
|
660
|
+
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
661
|
+
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
660
662
|
}
|
|
661
663
|
declare const QuestionEditorCard: React.ForwardRefExoticComponent<QuestionEditorCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
662
664
|
|
|
@@ -681,6 +683,13 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
681
683
|
active?: boolean;
|
|
682
684
|
/** Editor mode: show the "n/2000 characters" counter. Defaults to `true`. */
|
|
683
685
|
showCounter?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Editor mode: turns the "Question N" tag into a drag handle. Spread onto the tag, so it takes anything a drag-and-drop
|
|
688
|
+
* library hands out (`ref`, `role`, `tabIndex`, pointer and keyboard listeners, aria attributes). The tag then shows a
|
|
689
|
+
* grab cursor, is focusable and reveals the grip icon on keyboard focus; it is labelled "Reorder question N" unless you
|
|
690
|
+
* pass your own `aria-label`. Omit it for the plain tag.
|
|
691
|
+
*/
|
|
692
|
+
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
684
693
|
}
|
|
685
694
|
declare const QuestionHeader: React.ForwardRefExoticComponent<QuestionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
686
695
|
|
package/dist/index.d.ts
CHANGED
|
@@ -657,6 +657,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
657
657
|
onPaste?: () => void;
|
|
658
658
|
/** Optional strip under the card body, e.g. an "Inferred" assumption note. */
|
|
659
659
|
note?: React.ReactNode;
|
|
660
|
+
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
661
|
+
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
660
662
|
}
|
|
661
663
|
declare const QuestionEditorCard: React.ForwardRefExoticComponent<QuestionEditorCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
662
664
|
|
|
@@ -681,6 +683,13 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
681
683
|
active?: boolean;
|
|
682
684
|
/** Editor mode: show the "n/2000 characters" counter. Defaults to `true`. */
|
|
683
685
|
showCounter?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Editor mode: turns the "Question N" tag into a drag handle. Spread onto the tag, so it takes anything a drag-and-drop
|
|
688
|
+
* library hands out (`ref`, `role`, `tabIndex`, pointer and keyboard listeners, aria attributes). The tag then shows a
|
|
689
|
+
* grab cursor, is focusable and reveals the grip icon on keyboard focus; it is labelled "Reorder question N" unless you
|
|
690
|
+
* pass your own `aria-label`. Omit it for the plain tag.
|
|
691
|
+
*/
|
|
692
|
+
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
684
693
|
}
|
|
685
694
|
declare const QuestionHeader: React.ForwardRefExoticComponent<QuestionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
686
695
|
|
package/dist/index.js
CHANGED
|
@@ -2503,7 +2503,7 @@ import { DotsSixVertical } from "@phosphor-icons/react";
|
|
|
2503
2503
|
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2504
2504
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2505
2505
|
var QuestionHeader = React40.forwardRef(
|
|
2506
|
-
({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, maxLength = 2e3, active, showCounter = true, ...props }, ref) => {
|
|
2506
|
+
({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
|
|
2507
2507
|
const [draft, setDraft] = React40.useState(null);
|
|
2508
2508
|
const label = String(number).padStart(2, "0");
|
|
2509
2509
|
const showError = error !== void 0 && error !== false;
|
|
@@ -2515,12 +2515,23 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2515
2515
|
/* @__PURE__ */ jsxs28(
|
|
2516
2516
|
"span",
|
|
2517
2517
|
{
|
|
2518
|
+
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
2519
|
+
...dragHandleProps,
|
|
2518
2520
|
className: cn(
|
|
2519
2521
|
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
|
|
2520
|
-
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"
|
|
2522
|
+
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",
|
|
2523
|
+
dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
|
|
2524
|
+
dragHandleProps?.className
|
|
2521
2525
|
),
|
|
2522
2526
|
children: [
|
|
2523
|
-
/* @__PURE__ */ jsx41(
|
|
2527
|
+
/* @__PURE__ */ jsx41(
|
|
2528
|
+
DotsSixVertical,
|
|
2529
|
+
{
|
|
2530
|
+
size: 16,
|
|
2531
|
+
"aria-hidden": true,
|
|
2532
|
+
className: "hidden shrink-0 group-hover/handle:block group-focus-visible/handle:block"
|
|
2533
|
+
}
|
|
2534
|
+
),
|
|
2524
2535
|
"Question ",
|
|
2525
2536
|
number
|
|
2526
2537
|
]
|
|
@@ -2590,6 +2601,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2590
2601
|
onAdd,
|
|
2591
2602
|
onPaste,
|
|
2592
2603
|
note,
|
|
2604
|
+
dragHandleProps,
|
|
2593
2605
|
children,
|
|
2594
2606
|
...props
|
|
2595
2607
|
}, ref) => {
|
|
@@ -2620,6 +2632,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2620
2632
|
onTitleChange,
|
|
2621
2633
|
active,
|
|
2622
2634
|
showCounter: !!active,
|
|
2635
|
+
dragHandleProps,
|
|
2623
2636
|
maxLength,
|
|
2624
2637
|
actions: actions ?? /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
2625
2638
|
/* @__PURE__ */ jsx42(
|
|
@@ -3252,10 +3265,10 @@ var ActivityStructure = React51.forwardRef(
|
|
|
3252
3265
|
"section",
|
|
3253
3266
|
{
|
|
3254
3267
|
ref,
|
|
3255
|
-
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-
|
|
3268
|
+
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
3256
3269
|
...props,
|
|
3257
3270
|
children: [
|
|
3258
|
-
/* @__PURE__ */ jsx52("h3", { className: "text-heading-h3 text-
|
|
3271
|
+
/* @__PURE__ */ jsx52("h3", { className: "text-heading-h3 text-primary", children: title }),
|
|
3259
3272
|
/* @__PURE__ */ jsx52("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx52(StatCard, { ...stat }, id)) }),
|
|
3260
3273
|
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-2", children: [
|
|
3261
3274
|
/* @__PURE__ */ jsx52("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|