@discuss-ds/ui 0.38.0 → 0.39.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @discuss-ds/ui
2
2
 
3
+ ## 0.39.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#145](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/145) [`0c94b7e`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/0c94b7e4076177e42ef6c636c1287a0a5bf7f338) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - Checked Checkbox and Radio now use the accent foreground colour (the same purple as the other accent icons and text) for their border and fill, instead of the lighter `ring` colour. Nothing else about them changes.
8
+
9
+ ## 0.39.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#143](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/143) [`338a447`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/338a4477fb9a216c228c493bc3c2814c64038bc1) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - InlineEdit takes an optional `editing` prop that opens the field from outside when it turns true (for example when the row or card it belongs to is selected), focused without scrolling the page. QuestionEditorCard and QuestionHeader pass it through as `titleEditing`, so selecting a question can put its text in edit mode. Existing callers are unchanged.
14
+
3
15
  ## 0.38.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -500,9 +500,9 @@ var Checkbox = React8.forwardRef(
500
500
  className: cn(
501
501
  "peer inline-flex size-4 shrink-0 items-center justify-center rounded-xxs border-2 border-input bg-surface transition-colors",
502
502
  "disabled:cursor-not-allowed disabled:opacity-50",
503
- // Brand override: selected controls use `ring`, not `primary`/`accent`.
504
- "data-[state=checked]:border-ring data-[state=checked]:bg-ring data-[state=checked]:text-label",
505
- "data-[state=indeterminate]:border-ring data-[state=indeterminate]:bg-ring data-[state=indeterminate]:text-label",
503
+ // Selected controls use the accent foreground, the same colour as the other accent icons and text (they used the lighter `ring` before).
504
+ "data-[state=checked]:border-accent-foreground data-[state=checked]:bg-accent-foreground data-[state=checked]:text-label",
505
+ "data-[state=indeterminate]:border-accent-foreground data-[state=indeterminate]:bg-accent-foreground data-[state=indeterminate]:text-label",
506
506
  className
507
507
  ),
508
508
  ...props,
@@ -558,12 +558,12 @@ var RadioGroupItem = React9.forwardRef(({ className, ...props }, ref) => /* @__P
558
558
  className: cn(
559
559
  "peer inline-flex size-4 shrink-0 items-center justify-center rounded-full border-2 border-input bg-surface transition-colors",
560
560
  "disabled:cursor-not-allowed disabled:opacity-50",
561
- // Brand override: selected controls use `ring`, not `primary`/`accent`.
562
- "data-[state=checked]:border-ring",
561
+ // Selected controls use the accent foreground, the same colour as the other accent icons and text (they used the lighter `ring` before).
562
+ "data-[state=checked]:border-accent-foreground",
563
563
  className
564
564
  ),
565
565
  ...props,
566
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui7.RadioGroup.Indicator, { className: "size-2 rounded-full bg-ring" })
566
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_radix_ui7.RadioGroup.Indicator, { className: "size-2 rounded-full bg-accent-foreground" })
567
567
  }
568
568
  ));
569
569
  RadioGroupItem.displayName = "RadioGroupItem";
@@ -1831,6 +1831,7 @@ var InlineEdit = React25.forwardRef(
1831
1831
  showLimits,
1832
1832
  submitOnEnter,
1833
1833
  disabled,
1834
+ editing: openRequested,
1834
1835
  onEditingChange,
1835
1836
  onDraftChange,
1836
1837
  variant = "default",
@@ -1851,9 +1852,11 @@ var InlineEdit = React25.forwardRef(
1851
1852
  const readRef = React25.useRef(null);
1852
1853
  const cancelled = React25.useRef(false);
1853
1854
  const restoreFocus = React25.useRef(false);
1855
+ const openedByProp = React25.useRef(false);
1854
1856
  React25.useEffect(() => {
1855
1857
  if (editing) {
1856
- fieldRef.current?.focus();
1858
+ fieldRef.current?.focus(openedByProp.current ? { preventScroll: true } : void 0);
1859
+ openedByProp.current = false;
1857
1860
  fieldRef.current?.select();
1858
1861
  } else if (restoreFocus.current) {
1859
1862
  restoreFocus.current = false;
@@ -1875,6 +1878,12 @@ var InlineEdit = React25.forwardRef(
1875
1878
  setEditing(true);
1876
1879
  onEditingChange?.(true);
1877
1880
  };
1881
+ React25.useEffect(() => {
1882
+ if (openRequested && !editing && !disabled) {
1883
+ openedByProp.current = true;
1884
+ start();
1885
+ }
1886
+ }, [openRequested]);
1878
1887
  const finish = (commit, refocus) => {
1879
1888
  if (commit && draft !== value) {
1880
1889
  const problem = problemWith(draft);
@@ -3212,7 +3221,7 @@ QuestionNumberTag.displayName = "QuestionNumberTag";
3212
3221
  var import_jsx_runtime45 = require("react/jsx-runtime");
3213
3222
  var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
3214
3223
  var QuestionHeader = React44.forwardRef(
3215
- ({ 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, questionType, titleMarks, onTitleMarkApply, onTitleMarkDismiss, ...props }, ref) => {
3224
+ ({ 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, questionType, titleMarks, onTitleMarkApply, onTitleMarkDismiss, titleEditing, ...props }, ref) => {
3216
3225
  const [draft, setDraft] = React44.useState(null);
3217
3226
  const label = String(number).padStart(2, "0");
3218
3227
  const showError = error !== void 0 && error !== false;
@@ -3238,6 +3247,7 @@ var QuestionHeader = React44.forwardRef(
3238
3247
  variant: "question",
3239
3248
  multiline: true,
3240
3249
  selected: active,
3250
+ editing: titleEditing,
3241
3251
  className: "-mx-3 w-auto",
3242
3252
  "aria-label": "Question title",
3243
3253
  placeholder: titlePlaceholder,
@@ -3315,6 +3325,7 @@ var QuestionEditorCard = React45.forwardRef(
3315
3325
  titleMarks,
3316
3326
  onTitleMarkApply,
3317
3327
  onTitleMarkDismiss,
3328
+ titleEditing,
3318
3329
  children,
3319
3330
  ...props
3320
3331
  }, ref) => {
@@ -3361,6 +3372,7 @@ var QuestionEditorCard = React45.forwardRef(
3361
3372
  titleMarks,
3362
3373
  onTitleMarkApply,
3363
3374
  onTitleMarkDismiss,
3375
+ titleEditing,
3364
3376
  meta,
3365
3377
  maxLength,
3366
3378
  actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [