@discuss-ds/ui 0.3.4 → 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 +14 -0
- package/dist/index.cjs +62 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +62 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @discuss-ds/ui
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#21](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/21) [`a7ebe02`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/a7ebe02f16a57fd1e40115e9a949484f23e1103a) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionOptionEditor` gets an optional `kind` (`radio` | `checkbox`). With it the row is quiet at rest (no border, the radio or checkbox indicator in front of the label) and turns into the editor on hover or keyboard focus: border and shadow, the drag handle replaces the indicator, and the remove and add buttons appear. The buttons keep their space while hidden, so the row is the same width in every state. Without `kind` the row is the same always-on editor as before.
|
|
8
|
+
|
|
9
|
+
## 0.3.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#19](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/19) [`1c64708`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/1c647085c1f97bce822f81975a7e5a100b6250e1) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionOption` (radio and checkbox answer cards): hovering now changes only the fill and shadow. The border changes only when the option is selected (accent). `RadioGroupItem` is now 16px (was 20px, matching the checkbox) with a proportionally smaller centre dot.
|
|
14
|
+
|
|
15
|
+
`ActivityStructure`: section text is rendered in a `div` instead of a `p`, so it can hold block-level content such as an `InlineEdit` without invalid HTML nesting.
|
|
16
|
+
|
|
3
17
|
## 0.3.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -526,14 +526,14 @@ var RadioGroupItem = React9.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
526
526
|
{
|
|
527
527
|
ref,
|
|
528
528
|
className: cn(
|
|
529
|
-
"peer inline-flex size-
|
|
529
|
+
"peer inline-flex size-4 shrink-0 items-center justify-center rounded-full border-2 border-input bg-surface transition-colors",
|
|
530
530
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
531
531
|
// Brand override: selected controls use `ring`, not `primary`/`accent`.
|
|
532
532
|
"data-[state=checked]:border-ring",
|
|
533
533
|
className
|
|
534
534
|
),
|
|
535
535
|
...props,
|
|
536
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui7.RadioGroup.Indicator, { className: "size-2
|
|
536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui7.RadioGroup.Indicator, { className: "size-2 rounded-full bg-ring" })
|
|
537
537
|
}
|
|
538
538
|
));
|
|
539
539
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
@@ -2925,7 +2925,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
|
|
|
2925
2925
|
var React44 = __toESM(require("react"), 1);
|
|
2926
2926
|
var import_react23 = require("@phosphor-icons/react");
|
|
2927
2927
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2928
|
-
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:
|
|
2928
|
+
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";
|
|
2929
2929
|
function QuestionOption(props) {
|
|
2930
2930
|
const id = React44.useId();
|
|
2931
2931
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
@@ -2978,22 +2978,64 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
2978
2978
|
}
|
|
2979
2979
|
);
|
|
2980
2980
|
QuestionOtherOption.displayName = "QuestionOtherOption";
|
|
2981
|
-
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className }) {
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
"
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2981
|
+
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className, kind }) {
|
|
2982
|
+
const reveal = kind !== void 0;
|
|
2983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
2985
|
+
"div",
|
|
2986
|
+
{
|
|
2987
|
+
className: cn(
|
|
2988
|
+
"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",
|
|
2989
|
+
reveal ? [
|
|
2990
|
+
// Hover or focus anywhere in the row shows the border; the field being edited keeps the accent.
|
|
2991
|
+
"border-transparent group-hover/option:not-focus-within:border-border group-focus-within/option:not-focus-within:border-border",
|
|
2992
|
+
"group-hover/option:shadow-md group-focus-within/option:shadow-md"
|
|
2993
|
+
] : "border-border hover:border-input hover:shadow-md"
|
|
2994
|
+
),
|
|
2995
|
+
children: [
|
|
2996
|
+
reveal ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
|
|
2997
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2998
|
+
"span",
|
|
2999
|
+
{
|
|
3000
|
+
className: cn(
|
|
3001
|
+
"inline-flex size-4 border-2 border-input bg-surface group-hover/option:hidden group-focus-within/option:hidden",
|
|
3002
|
+
kind === "radio" ? "rounded-full" : "rounded-xxs"
|
|
3003
|
+
)
|
|
3004
|
+
}
|
|
3005
|
+
),
|
|
3006
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3007
|
+
import_react23.DotsSixVertical,
|
|
3008
|
+
{
|
|
3009
|
+
size: 20,
|
|
3010
|
+
className: "hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block"
|
|
3011
|
+
}
|
|
3012
|
+
)
|
|
3013
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
3014
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3015
|
+
"input",
|
|
3016
|
+
{
|
|
3017
|
+
"aria-label": "Option label",
|
|
3018
|
+
value: label,
|
|
3019
|
+
onChange: (event) => onLabelChange?.(event.target.value),
|
|
3020
|
+
className: "min-w-0 flex-1 bg-transparent text-body-base text-surface-foreground outline-none"
|
|
3021
|
+
}
|
|
3022
|
+
)
|
|
3023
|
+
]
|
|
3024
|
+
}
|
|
3025
|
+
),
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3027
|
+
"div",
|
|
3028
|
+
{
|
|
3029
|
+
className: cn(
|
|
3030
|
+
"flex items-center gap-2",
|
|
3031
|
+
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3032
|
+
),
|
|
3033
|
+
children: [
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Trash, { size: 16, "aria-hidden": true }) }),
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", onClick: onAdd, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Plus, { size: 16, "aria-hidden": true }) })
|
|
3036
|
+
]
|
|
3037
|
+
}
|
|
3038
|
+
)
|
|
2997
3039
|
] });
|
|
2998
3040
|
}
|
|
2999
3041
|
|
|
@@ -3364,7 +3406,7 @@ var ActivityStructure = React51.forwardRef(
|
|
|
3364
3406
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StatCard, { ...stat }, id)) }),
|
|
3365
3407
|
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
3366
3408
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
3367
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
3368
3410
|
(tags?.length || onAddTag) && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3369
3411
|
tags?.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
3370
3412
|
onAddTag && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|