@discuss-ds/ui 0.34.0 → 0.36.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 +17 -0
- package/dist/index.cjs +7 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/styles/globals.css +1 -0
- package/src/styles/overlayDestructive.test.ts +16 -0
package/dist/index.d.cts
CHANGED
|
@@ -831,8 +831,10 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
831
831
|
selected?: boolean;
|
|
832
832
|
/** Question type, shown as the leading 16px duotone icon. */
|
|
833
833
|
questionType?: QuestionType;
|
|
834
|
-
/** The question has validation problems — the type icon becomes
|
|
834
|
+
/** The question has validation problems — the type icon becomes the exclamation circle, in the destructive colour. */
|
|
835
835
|
error?: boolean;
|
|
836
|
+
/** The question has recommendations — the type icon becomes the exclamation triangle, in the warning colour. `error` wins when both are set. */
|
|
837
|
+
warning?: boolean;
|
|
836
838
|
/** Render the child element instead of a `<button>` (e.g. a router link). */
|
|
837
839
|
asChild?: boolean;
|
|
838
840
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -831,8 +831,10 @@ interface QuestionNavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
831
831
|
selected?: boolean;
|
|
832
832
|
/** Question type, shown as the leading 16px duotone icon. */
|
|
833
833
|
questionType?: QuestionType;
|
|
834
|
-
/** The question has validation problems — the type icon becomes
|
|
834
|
+
/** The question has validation problems — the type icon becomes the exclamation circle, in the destructive colour. */
|
|
835
835
|
error?: boolean;
|
|
836
|
+
/** The question has recommendations — the type icon becomes the exclamation triangle, in the warning colour. `error` wins when both are set. */
|
|
837
|
+
warning?: boolean;
|
|
836
838
|
/** Render the child element instead of a `<button>` (e.g. a router link). */
|
|
837
839
|
asChild?: boolean;
|
|
838
840
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3221,12 +3221,13 @@ QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
|
3221
3221
|
|
|
3222
3222
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3223
3223
|
import * as React44 from "react";
|
|
3224
|
-
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3 } from "@phosphor-icons/react";
|
|
3224
|
+
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3, WarningCircle as WarningCircle4 } from "@phosphor-icons/react";
|
|
3225
3225
|
import { Slot as Slot3 } from "radix-ui";
|
|
3226
3226
|
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3227
3227
|
var QuestionNavItem = React44.forwardRef(
|
|
3228
|
-
({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3228
|
+
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3229
3229
|
const Comp = asChild ? Slot3.Root : "button";
|
|
3230
|
+
const warn = !error && !!warning;
|
|
3230
3231
|
return /* @__PURE__ */ jsxs32(
|
|
3231
3232
|
Comp,
|
|
3232
3233
|
{
|
|
@@ -3236,19 +3237,19 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3236
3237
|
"data-hovered": hovered ? "" : void 0,
|
|
3237
3238
|
className: cn(
|
|
3238
3239
|
"group/nav flex h-9.5 w-full max-w-106.5 items-center gap-2 rounded-sm border bg-surface p-2 text-left text-body-small text-surface-foreground transition-colors focus-visible:outline-none",
|
|
3239
|
-
error ? ["hover:bg-destructive-soft focus-visible:border-destructive", selected ? "border-destructive" : "border-border"] : [
|
|
3240
|
+
error ? ["hover:bg-destructive-soft focus-visible:border-destructive", selected ? "border-destructive" : "border-border"] : warn ? ["hover:bg-warning-soft focus-visible:border-warning-foreground", selected ? "border-warning-foreground" : "border-border"] : [
|
|
3240
3241
|
// Hover only changes the fill; the border stays as it is (default grey, or accent when selected).
|
|
3241
3242
|
"hover:bg-accent-soft focus-visible:border-input-accent",
|
|
3242
3243
|
selected ? "border-input-accent" : "border-border"
|
|
3243
3244
|
],
|
|
3244
|
-
hovered && (error ? "bg-destructive-soft" : "bg-accent-soft"),
|
|
3245
|
+
hovered && (error ? "bg-destructive-soft" : warn ? "bg-warning-soft" : "bg-accent-soft"),
|
|
3245
3246
|
className
|
|
3246
3247
|
),
|
|
3247
3248
|
...props,
|
|
3248
3249
|
children: [
|
|
3249
3250
|
/* @__PURE__ */ jsxs32("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3250
3251
|
showDragHandle && /* @__PURE__ */ jsx45(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3251
|
-
/* @__PURE__ */ jsx45("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx45(
|
|
3252
|
+
/* @__PURE__ */ jsx45("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx45(WarningCircle4, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ jsx45(Warning3, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ jsx45(
|
|
3252
3253
|
QuestionTypeIcon,
|
|
3253
3254
|
{
|
|
3254
3255
|
type: questionType,
|
|
@@ -3258,7 +3259,8 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3258
3259
|
) })
|
|
3259
3260
|
] }),
|
|
3260
3261
|
/* @__PURE__ */ jsx45("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3261
|
-
error && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has errors" })
|
|
3262
|
+
error && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has errors" }),
|
|
3263
|
+
warn && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has warnings" })
|
|
3262
3264
|
]
|
|
3263
3265
|
}
|
|
3264
3266
|
);
|
|
@@ -3268,7 +3270,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
|
|
|
3268
3270
|
|
|
3269
3271
|
// src/components/Question Types/QuestionOption.tsx
|
|
3270
3272
|
import * as React45 from "react";
|
|
3271
|
-
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as
|
|
3273
|
+
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle5 } from "@phosphor-icons/react";
|
|
3272
3274
|
import { Fragment as Fragment11, jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3273
3275
|
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";
|
|
3274
3276
|
function QuestionOption(props) {
|
|
@@ -3479,7 +3481,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3479
3481
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3480
3482
|
children: [
|
|
3481
3483
|
/* @__PURE__ */ jsxs33("span", { className: "flex items-start gap-2", children: [
|
|
3482
|
-
error && /* @__PURE__ */ jsx46(
|
|
3484
|
+
error && /* @__PURE__ */ jsx46(WarningCircle5, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3483
3485
|
limitsText2(minLength, maxLength),
|
|
3484
3486
|
error && /* @__PURE__ */ jsx46("span", { className: "sr-only", children: error })
|
|
3485
3487
|
] }),
|