@discuss-ds/ui 0.3.5 → 0.4.1
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 +57 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +57 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @discuss-ds/ui
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#23](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/23) [`36eb4b6`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/36eb4b6aada7d998f5715cd1b9a79aa873365823) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionOptionEditor` with `kind`: the row now keeps its normal border at rest (0.4.0 removed it). Hovering or focusing the row still swaps the indicator for the drag handle and reveals the remove and add buttons, and lifts the row with a shadow, but the border colour does not change. The row is the same width in every state.
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#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.
|
|
14
|
+
|
|
3
15
|
## 0.3.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -2978,22 +2978,63 @@ 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
|
+
// The border is always visible and does not change on hover; only the shadow lifts the row. The field being edited keeps the accent.
|
|
2991
|
+
"border-border group-hover/option:shadow-md group-focus-within/option:shadow-md"
|
|
2992
|
+
) : "border-border hover:border-input hover:shadow-md"
|
|
2993
|
+
),
|
|
2994
|
+
children: [
|
|
2995
|
+
reveal ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: [
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2997
|
+
"span",
|
|
2998
|
+
{
|
|
2999
|
+
className: cn(
|
|
3000
|
+
"inline-flex size-4 border-2 border-input bg-surface group-hover/option:hidden group-focus-within/option:hidden",
|
|
3001
|
+
kind === "radio" ? "rounded-full" : "rounded-xxs"
|
|
3002
|
+
)
|
|
3003
|
+
}
|
|
3004
|
+
),
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3006
|
+
import_react23.DotsSixVertical,
|
|
3007
|
+
{
|
|
3008
|
+
size: 20,
|
|
3009
|
+
className: "hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block"
|
|
3010
|
+
}
|
|
3011
|
+
)
|
|
3012
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
3013
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3014
|
+
"input",
|
|
3015
|
+
{
|
|
3016
|
+
"aria-label": "Option label",
|
|
3017
|
+
value: label,
|
|
3018
|
+
onChange: (event) => onLabelChange?.(event.target.value),
|
|
3019
|
+
className: "min-w-0 flex-1 bg-transparent text-body-base text-surface-foreground outline-none"
|
|
3020
|
+
}
|
|
3021
|
+
)
|
|
3022
|
+
]
|
|
3023
|
+
}
|
|
3024
|
+
),
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3026
|
+
"div",
|
|
3027
|
+
{
|
|
3028
|
+
className: cn(
|
|
3029
|
+
"flex items-center gap-2",
|
|
3030
|
+
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3031
|
+
),
|
|
3032
|
+
children: [
|
|
3033
|
+
/* @__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 }) }),
|
|
3034
|
+
/* @__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 }) })
|
|
3035
|
+
]
|
|
3036
|
+
}
|
|
3037
|
+
)
|
|
2997
3038
|
] });
|
|
2998
3039
|
}
|
|
2999
3040
|
|