@discuss-ds/ui 0.16.0 → 0.18.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 +12 -0
- package/dist/index.cjs +18 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +18 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -453,11 +453,11 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
|
453
453
|
}
|
|
454
454
|
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
455
455
|
|
|
456
|
-
/** `filter` is the pill-shaped table filter; `toggle` is the icon-only mode switch. */
|
|
457
|
-
type TabNavigationVariant = 'filter' | 'toggle';
|
|
456
|
+
/** `filter` is the pill-shaped table filter; `toggle` is the icon-only mode switch; `underline` is the page-level tab bar (give it the height of its bar, e.g. `h-16`; the active tab gets an accent underline). */
|
|
457
|
+
type TabNavigationVariant = 'filter' | 'toggle' | 'underline';
|
|
458
458
|
declare const TabNavigationContext: React.Context<TabNavigationVariant>;
|
|
459
459
|
declare const tabNavigationVariants: (props?: ({
|
|
460
|
-
variant?: "filter" | "toggle" | null | undefined;
|
|
460
|
+
variant?: "filter" | "toggle" | "underline" | null | undefined;
|
|
461
461
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
462
462
|
/** Radix `Tabs.Root` — owns the selected value; pair with `TabNavigation` + `TabItem` + `TabsContent`. */
|
|
463
463
|
declare const Tabs: React.ForwardRefExoticComponent<Tabs$1.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -663,6 +663,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
663
663
|
note?: React.ReactNode;
|
|
664
664
|
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
665
665
|
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
666
|
+
/** Whether the grip icon shows in the "Question N" tag on hover. Defaults to true; set false when the card can't be moved. See `QuestionHeader`. */
|
|
667
|
+
showDragHandle?: boolean;
|
|
666
668
|
}
|
|
667
669
|
declare const QuestionEditorCard: React.ForwardRefExoticComponent<QuestionEditorCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
668
670
|
|
|
@@ -696,6 +698,11 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
696
698
|
* pass your own `aria-label`. Omit it for the plain tag.
|
|
697
699
|
*/
|
|
698
700
|
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
701
|
+
/**
|
|
702
|
+
* Whether the grip icon appears in the "Question N" tag on hover or focus. Defaults to true. Set it to false when the question
|
|
703
|
+
* can't be moved (for example while a translation is being edited), so the tag doesn't suggest dragging.
|
|
704
|
+
*/
|
|
705
|
+
showDragHandle?: boolean;
|
|
699
706
|
}
|
|
700
707
|
declare const QuestionHeader: React.ForwardRefExoticComponent<QuestionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
701
708
|
|
|
@@ -714,6 +721,11 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
714
721
|
error?: boolean;
|
|
715
722
|
/** Render the child element instead of a `<button>` (e.g. a router link). */
|
|
716
723
|
asChild?: boolean;
|
|
724
|
+
/**
|
|
725
|
+
* Whether hovering swaps the type icon for the drag grip. Defaults to true. Set it to false when the row can't be moved (for
|
|
726
|
+
* example while a translation is being edited), so the icon stays and the row doesn't suggest dragging.
|
|
727
|
+
*/
|
|
728
|
+
showDragHandle?: boolean;
|
|
717
729
|
}
|
|
718
730
|
declare const QuestionNavItem: React.ForwardRefExoticComponent<QuestionNavItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
719
731
|
|
|
@@ -894,7 +906,7 @@ interface TableCellTwoLinesProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
894
906
|
declare function TableCellTwoLines({ primary, secondary, avatar, className, ...props }: TableCellTwoLinesProps): React.JSX.Element;
|
|
895
907
|
|
|
896
908
|
declare const statCardVariants: (props?: ({
|
|
897
|
-
variant?: "default" | "warning" | null | undefined;
|
|
909
|
+
variant?: "default" | "subtle" | "warning" | null | undefined;
|
|
898
910
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
899
911
|
interface StatCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof statCardVariants> {
|
|
900
912
|
label: React.ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -453,11 +453,11 @@ interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
|
453
453
|
}
|
|
454
454
|
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
455
455
|
|
|
456
|
-
/** `filter` is the pill-shaped table filter; `toggle` is the icon-only mode switch. */
|
|
457
|
-
type TabNavigationVariant = 'filter' | 'toggle';
|
|
456
|
+
/** `filter` is the pill-shaped table filter; `toggle` is the icon-only mode switch; `underline` is the page-level tab bar (give it the height of its bar, e.g. `h-16`; the active tab gets an accent underline). */
|
|
457
|
+
type TabNavigationVariant = 'filter' | 'toggle' | 'underline';
|
|
458
458
|
declare const TabNavigationContext: React.Context<TabNavigationVariant>;
|
|
459
459
|
declare const tabNavigationVariants: (props?: ({
|
|
460
|
-
variant?: "filter" | "toggle" | null | undefined;
|
|
460
|
+
variant?: "filter" | "toggle" | "underline" | null | undefined;
|
|
461
461
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
462
462
|
/** Radix `Tabs.Root` — owns the selected value; pair with `TabNavigation` + `TabItem` + `TabsContent`. */
|
|
463
463
|
declare const Tabs: React.ForwardRefExoticComponent<Tabs$1.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -663,6 +663,8 @@ interface QuestionEditorCardProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
663
663
|
note?: React.ReactNode;
|
|
664
664
|
/** Makes the "Question N" tag a drag handle for reordering. See `QuestionHeader`'s `dragHandleProps`. */
|
|
665
665
|
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
666
|
+
/** Whether the grip icon shows in the "Question N" tag on hover. Defaults to true; set false when the card can't be moved. See `QuestionHeader`. */
|
|
667
|
+
showDragHandle?: boolean;
|
|
666
668
|
}
|
|
667
669
|
declare const QuestionEditorCard: React.ForwardRefExoticComponent<QuestionEditorCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
668
670
|
|
|
@@ -696,6 +698,11 @@ interface QuestionHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
696
698
|
* pass your own `aria-label`. Omit it for the plain tag.
|
|
697
699
|
*/
|
|
698
700
|
dragHandleProps?: React.ComponentPropsWithRef<'span'>;
|
|
701
|
+
/**
|
|
702
|
+
* Whether the grip icon appears in the "Question N" tag on hover or focus. Defaults to true. Set it to false when the question
|
|
703
|
+
* can't be moved (for example while a translation is being edited), so the tag doesn't suggest dragging.
|
|
704
|
+
*/
|
|
705
|
+
showDragHandle?: boolean;
|
|
699
706
|
}
|
|
700
707
|
declare const QuestionHeader: React.ForwardRefExoticComponent<QuestionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
701
708
|
|
|
@@ -714,6 +721,11 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
714
721
|
error?: boolean;
|
|
715
722
|
/** Render the child element instead of a `<button>` (e.g. a router link). */
|
|
716
723
|
asChild?: boolean;
|
|
724
|
+
/**
|
|
725
|
+
* Whether hovering swaps the type icon for the drag grip. Defaults to true. Set it to false when the row can't be moved (for
|
|
726
|
+
* example while a translation is being edited), so the icon stays and the row doesn't suggest dragging.
|
|
727
|
+
*/
|
|
728
|
+
showDragHandle?: boolean;
|
|
717
729
|
}
|
|
718
730
|
declare const QuestionNavItem: React.ForwardRefExoticComponent<QuestionNavItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
719
731
|
|
|
@@ -894,7 +906,7 @@ interface TableCellTwoLinesProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
894
906
|
declare function TableCellTwoLines({ primary, secondary, avatar, className, ...props }: TableCellTwoLinesProps): React.JSX.Element;
|
|
895
907
|
|
|
896
908
|
declare const statCardVariants: (props?: ({
|
|
897
|
-
variant?: "default" | "warning" | null | undefined;
|
|
909
|
+
variant?: "default" | "subtle" | "warning" | null | undefined;
|
|
898
910
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
899
911
|
interface StatCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof statCardVariants> {
|
|
900
912
|
label: React.ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -1052,7 +1052,8 @@ var tabNavigationVariants = cva3("inline-flex items-start gap-1 p-0.5", {
|
|
|
1052
1052
|
variants: {
|
|
1053
1053
|
variant: {
|
|
1054
1054
|
filter: "rounded-full border border-border bg-surface",
|
|
1055
|
-
toggle: "rounded-md bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5"
|
|
1055
|
+
toggle: "rounded-md bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
|
|
1056
|
+
underline: "items-stretch p-0"
|
|
1056
1057
|
}
|
|
1057
1058
|
},
|
|
1058
1059
|
defaultVariants: { variant: "filter" }
|
|
@@ -1069,6 +1070,7 @@ import { jsx as jsx21 } from "react/jsx-runtime";
|
|
|
1069
1070
|
var base = "inline-flex h-7 items-center justify-center gap-1 whitespace-nowrap px-2.5 py-1 text-ui-label transition-colors disabled:pointer-events-none disabled:opacity-50";
|
|
1070
1071
|
var filter = "rounded-full text-surface-foreground hover:text-accent data-[state=active]:bg-secondary data-[state=active]:bg-linear-to-r data-[state=active]:from-overlay-dark-5 data-[state=active]:to-overlay-dark-5 data-[state=active]:hover:bg-accent-soft data-[state=active]:hover:bg-none data-[state=active]:hover:text-accent-soft-foreground disabled:text-muted-foreground";
|
|
1071
1072
|
var toggle = "rounded-sm text-secondary-muted-foreground hover:text-surface-foreground data-[state=active]:bg-surface data-[state=active]:text-surface-foreground";
|
|
1073
|
+
var underline = "relative h-full rounded-none px-4 py-3 font-medium text-secondary-muted-foreground hover:text-surface-foreground data-[state=active]:font-semibold data-[state=active]:text-surface-foreground after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 data-[state=active]:after:bg-accent";
|
|
1072
1074
|
var TabItem = React20.forwardRef(
|
|
1073
1075
|
({ className, ...props }, ref) => {
|
|
1074
1076
|
const variant = React20.useContext(TabNavigationContext);
|
|
@@ -1076,7 +1078,7 @@ var TabItem = React20.forwardRef(
|
|
|
1076
1078
|
TabsPrimitive2.Trigger,
|
|
1077
1079
|
{
|
|
1078
1080
|
ref,
|
|
1079
|
-
className: cn(base, variant === "toggle" ? toggle : filter, className),
|
|
1081
|
+
className: cn(base, variant === "toggle" ? toggle : variant === "underline" ? underline : filter, className),
|
|
1080
1082
|
...props
|
|
1081
1083
|
}
|
|
1082
1084
|
);
|
|
@@ -2532,7 +2534,7 @@ import { DotsSixVertical } from "@phosphor-icons/react";
|
|
|
2532
2534
|
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2533
2535
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2534
2536
|
var QuestionHeader = React40.forwardRef(
|
|
2535
|
-
({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
|
|
2537
|
+
({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, ...props }, ref) => {
|
|
2536
2538
|
const [draft, setDraft] = React40.useState(null);
|
|
2537
2539
|
const label = String(number).padStart(2, "0");
|
|
2538
2540
|
const showError = error !== void 0 && error !== false;
|
|
@@ -2548,15 +2550,16 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2548
2550
|
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
2549
2551
|
...dragHandleProps,
|
|
2550
2552
|
className: cn(
|
|
2551
|
-
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption
|
|
2552
|
-
//
|
|
2553
|
-
"group-hover/editor:pl-1",
|
|
2553
|
+
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
2554
|
+
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered.
|
|
2555
|
+
showDragHandle && "hover:pl-1 group-hover/editor:pl-1",
|
|
2554
2556
|
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",
|
|
2555
|
-
dragHandleProps && "cursor-grab touch-none select-none
|
|
2557
|
+
dragHandleProps && "cursor-grab touch-none select-none",
|
|
2558
|
+
dragHandleProps && showDragHandle && "focus-visible:pl-1",
|
|
2556
2559
|
dragHandleProps?.className
|
|
2557
2560
|
),
|
|
2558
2561
|
children: [
|
|
2559
|
-
/* @__PURE__ */ jsx41(
|
|
2562
|
+
showDragHandle && /* @__PURE__ */ jsx41(
|
|
2560
2563
|
DotsSixVertical,
|
|
2561
2564
|
{
|
|
2562
2565
|
size: 16,
|
|
@@ -2642,6 +2645,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2642
2645
|
error,
|
|
2643
2646
|
meta,
|
|
2644
2647
|
dragHandleProps,
|
|
2648
|
+
showDragHandle,
|
|
2645
2649
|
children,
|
|
2646
2650
|
...props
|
|
2647
2651
|
}, ref) => {
|
|
@@ -2673,6 +2677,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2673
2677
|
active,
|
|
2674
2678
|
showCounter: !!active,
|
|
2675
2679
|
dragHandleProps,
|
|
2680
|
+
showDragHandle,
|
|
2676
2681
|
meta,
|
|
2677
2682
|
maxLength,
|
|
2678
2683
|
actions: actions ?? /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
@@ -2788,7 +2793,7 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
|
2788
2793
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2789
2794
|
import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2790
2795
|
var QuestionNavItem = React43.forwardRef(
|
|
2791
|
-
({ className, questionType = "select-one", selected, error, asChild, children, ...props }, ref) => {
|
|
2796
|
+
({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, children, ...props }, ref) => {
|
|
2792
2797
|
const Comp = asChild ? Slot3.Root : "button";
|
|
2793
2798
|
return /* @__PURE__ */ jsxs30(
|
|
2794
2799
|
Comp,
|
|
@@ -2808,8 +2813,8 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2808
2813
|
...props,
|
|
2809
2814
|
children: [
|
|
2810
2815
|
/* @__PURE__ */ jsxs30("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
2811
|
-
/* @__PURE__ */ jsx44(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block" }),
|
|
2812
|
-
/* @__PURE__ */ jsx44("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ jsx44(Warning3, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ jsx44(
|
|
2816
|
+
showDragHandle && /* @__PURE__ */ jsx44(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block" }),
|
|
2817
|
+
/* @__PURE__ */ jsx44("span", { className: showDragHandle ? "group-hover/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx44(Warning3, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ jsx44(
|
|
2813
2818
|
QuestionTypeIcon,
|
|
2814
2819
|
{
|
|
2815
2820
|
type: questionType,
|
|
@@ -3352,6 +3357,8 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
3352
3357
|
variants: {
|
|
3353
3358
|
variant: {
|
|
3354
3359
|
default: "border-border bg-transparent",
|
|
3360
|
+
// A tinted card with no border, for stats on a white panel.
|
|
3361
|
+
subtle: "border-transparent bg-background",
|
|
3355
3362
|
warning: "border-warning-soft-border bg-warning-soft"
|
|
3356
3363
|
}
|
|
3357
3364
|
},
|