@discuss-ds/ui 0.29.0 → 0.30.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 +66 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +66 -60
- 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.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#107](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/107) [`43f364a`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/43f364a042167fd14b8cd4748e15829f81a90be8) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionEditorCard` and `QuestionHeader` take `titleRecommendedMax` and `titleRecommendedNote`: a title longer than that many characters (counted live while typing) switches from the heading style to the regular 16px body style and shows the note under it. Opt-in; without the props nothing changes.
|
|
8
|
+
|
|
9
|
+
## 0.29.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#104](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/104) [`1918d72`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/1918d72cab1c11e67c889abd7158e3b07aabe365) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionOptionEditor`: the helper line shown while a guarded option is edited lines up with the option text instead of the drag grip.
|
|
14
|
+
|
|
15
|
+
- [#106](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/106) [`3b04f34`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/3b04f34cedb63b5ae41edefedb0ed13de28fc3b8) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - `QuestionOptionEditor`: the grip, indicator or number stays vertically centred with the option text in the default state.
|
|
16
|
+
|
|
3
17
|
## 0.29.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -2809,13 +2809,14 @@ var import_react19 = require("@phosphor-icons/react");
|
|
|
2809
2809
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2810
2810
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2811
2811
|
var QuestionHeader = React40.forwardRef(
|
|
2812
|
-
({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, ...props }, ref) => {
|
|
2812
|
+
({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, titleRecommendedMax, titleRecommendedNote, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, ...props }, ref) => {
|
|
2813
2813
|
const [draft, setDraft] = React40.useState(null);
|
|
2814
2814
|
const label = String(number).padStart(2, "0");
|
|
2815
2815
|
const showError = error !== void 0 && error !== false;
|
|
2816
2816
|
if (editor) {
|
|
2817
2817
|
const text = typeof title === "string" ? title : "";
|
|
2818
2818
|
const count = (draft ?? text).length;
|
|
2819
|
+
const long = titleRecommendedMax !== void 0 && titleRecommendedNote != null && count > titleRecommendedMax;
|
|
2819
2820
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
2820
2821
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
2821
2822
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2874,9 +2875,10 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2874
2875
|
onEditingChange: (editing) => {
|
|
2875
2876
|
if (!editing) setDraft(null);
|
|
2876
2877
|
},
|
|
2877
|
-
textClassName: "text-heading-h4"
|
|
2878
|
+
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
2878
2879
|
}
|
|
2879
2880
|
),
|
|
2881
|
+
long && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
2880
2882
|
showCounter && titleMinLength === void 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
2881
2883
|
count,
|
|
2882
2884
|
"/",
|
|
@@ -2912,6 +2914,8 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2912
2914
|
titlePlaceholder,
|
|
2913
2915
|
titlePlaceholderTone,
|
|
2914
2916
|
titleMinLength,
|
|
2917
|
+
titleRecommendedMax,
|
|
2918
|
+
titleRecommendedNote,
|
|
2915
2919
|
active,
|
|
2916
2920
|
hovered,
|
|
2917
2921
|
maxLength,
|
|
@@ -2960,6 +2964,8 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2960
2964
|
titlePlaceholder,
|
|
2961
2965
|
titlePlaceholderTone,
|
|
2962
2966
|
titleMinLength,
|
|
2967
|
+
titleRecommendedMax,
|
|
2968
|
+
titleRecommendedNote,
|
|
2963
2969
|
active,
|
|
2964
2970
|
showCounter: !!active,
|
|
2965
2971
|
dragHandleProps,
|
|
@@ -3212,7 +3218,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3212
3218
|
} : { "aria-hidden": true };
|
|
3213
3219
|
const grip = dragHandleProps ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3214
3220
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3215
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.
|
|
3221
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3216
3222
|
"div",
|
|
3217
3223
|
{
|
|
3218
3224
|
className: cn(
|
|
@@ -3222,42 +3228,42 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3222
3228
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3223
3229
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3224
3230
|
),
|
|
3225
|
-
children: [
|
|
3226
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3232
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
3233
|
+
!locked && grip,
|
|
3234
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3235
|
+
"span",
|
|
3236
|
+
{
|
|
3237
|
+
"aria-hidden": "true",
|
|
3238
|
+
className: "flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-ui-caption text-surface-foreground",
|
|
3239
|
+
children: rank
|
|
3240
|
+
}
|
|
3241
|
+
)
|
|
3242
|
+
] }) : reveal && locked ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3243
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3244
|
+
"span",
|
|
3245
|
+
{
|
|
3246
|
+
"aria-hidden": "true",
|
|
3247
|
+
className: cn(
|
|
3248
|
+
"inline-flex size-4 border-2 border-input bg-surface group-hover/option:hidden group-focus-within/option:hidden",
|
|
3249
|
+
lifted && "hidden",
|
|
3250
|
+
kind === "radio" ? "rounded-full" : "rounded-xxs"
|
|
3251
|
+
)
|
|
3252
|
+
}
|
|
3253
|
+
),
|
|
3254
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3255
|
+
import_react23.DotsSixVertical,
|
|
3256
|
+
{
|
|
3257
|
+
size: 20,
|
|
3258
|
+
"aria-hidden": true,
|
|
3259
|
+
className: cn(
|
|
3260
|
+
"hidden shrink-0 text-surface-foreground group-hover/option:block group-focus-within/option:block",
|
|
3261
|
+
lifted && "block"
|
|
3262
|
+
)
|
|
3263
|
+
}
|
|
3264
|
+
)
|
|
3265
|
+
] }) : locked ? null : grip }),
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3261
3267
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3262
3268
|
"input",
|
|
3263
3269
|
{
|
|
@@ -3304,28 +3310,28 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3304
3310
|
placeholderTone === "regular" ? "placeholder:text-surface-foreground" : "placeholder:text-muted-foreground"
|
|
3305
3311
|
)
|
|
3306
3312
|
}
|
|
3313
|
+
),
|
|
3314
|
+
guarded && draft !== null && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3315
|
+
"p",
|
|
3316
|
+
{
|
|
3317
|
+
id: helperId,
|
|
3318
|
+
role: error ? "alert" : void 0,
|
|
3319
|
+
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3320
|
+
children: [
|
|
3321
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex items-start gap-2", children: [
|
|
3322
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.WarningCircle, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3323
|
+
limitsText2(minLength, maxLength),
|
|
3324
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "sr-only", children: error })
|
|
3325
|
+
] }),
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3327
|
+
draft.length,
|
|
3328
|
+
maxLength !== void 0 && `/${maxLength}`
|
|
3329
|
+
] })
|
|
3330
|
+
]
|
|
3331
|
+
}
|
|
3307
3332
|
)
|
|
3308
|
-
] })
|
|
3309
|
-
|
|
3310
|
-
"p",
|
|
3311
|
-
{
|
|
3312
|
-
id: helperId,
|
|
3313
|
-
role: error ? "alert" : void 0,
|
|
3314
|
-
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3315
|
-
children: [
|
|
3316
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex items-start gap-2", children: [
|
|
3317
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.WarningCircle, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3318
|
-
limitsText2(minLength, maxLength),
|
|
3319
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "sr-only", children: error })
|
|
3320
|
-
] }),
|
|
3321
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3322
|
-
draft.length,
|
|
3323
|
-
maxLength !== void 0 && `/${maxLength}`
|
|
3324
|
-
] })
|
|
3325
|
-
]
|
|
3326
|
-
}
|
|
3327
|
-
)
|
|
3328
|
-
]
|
|
3333
|
+
] })
|
|
3334
|
+
] })
|
|
3329
3335
|
}
|
|
3330
3336
|
),
|
|
3331
3337
|
!locked && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|