@discuss-ds/ui 0.16.0 → 0.18.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @discuss-ds/ui
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#74](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/74) [`ec31a44`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/ec31a44c4d73c781817c9481837ebed319f07de3) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - TabNavigation and TabItem: new `underline` variant for a page-level tab bar (the active tab is semibold with a 2px accent underline). StatCard: new `subtle` variant, a tinted card with no border for stats on a white panel. Nothing changes for existing callers.
8
+
9
+ ## 0.17.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#72](https://github.com/TamyresLucas/Discuss-UI-Storybook/pull/72) [`8956850`](https://github.com/TamyresLucas/Discuss-UI-Storybook/commit/89568503fd76b323d9af660ed59ad1b41f9b3fd1) Thanks [@TamyresLucas](https://github.com/TamyresLucas)! - QuestionHeader, QuestionEditorCard and QuestionNavItem: new optional `showDragHandle` prop (default true). Set it to false when the question or row can't be moved, so the grip icon is not shown on hover and the tag or row doesn't shift to make room for it. Nothing changes for existing callers.
14
+
3
15
  ## 0.16.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1211,7 +1211,8 @@ var tabNavigationVariants = (0, import_class_variance_authority3.cva)("inline-fl
1211
1211
  variants: {
1212
1212
  variant: {
1213
1213
  filter: "rounded-full border border-border bg-surface",
1214
- toggle: "rounded-md bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5"
1214
+ toggle: "rounded-md bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
1215
+ underline: "items-stretch p-0"
1215
1216
  }
1216
1217
  },
1217
1218
  defaultVariants: { variant: "filter" }
@@ -1228,6 +1229,7 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
1228
1229
  var base = "inline-flex h-7 items-center justify-center gap-1 whitespace-nowrap px-2.5 py-1 text-ui-label transition-colors disabled:pointer-events-none disabled:opacity-50";
1229
1230
  var filter = "rounded-full text-surface-foreground hover:text-accent data-[state=active]:bg-secondary data-[state=active]:bg-linear-to-r data-[state=active]:from-overlay-dark-5 data-[state=active]:to-overlay-dark-5 data-[state=active]:hover:bg-accent-soft data-[state=active]:hover:bg-none data-[state=active]:hover:text-accent-soft-foreground disabled:text-muted-foreground";
1230
1231
  var toggle = "rounded-sm text-secondary-muted-foreground hover:text-surface-foreground data-[state=active]:bg-surface data-[state=active]:text-surface-foreground";
1232
+ var underline = "relative h-full rounded-none px-4 py-3 font-medium text-secondary-muted-foreground hover:text-surface-foreground data-[state=active]:font-semibold data-[state=active]:text-surface-foreground after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 data-[state=active]:after:bg-accent";
1231
1233
  var TabItem = React20.forwardRef(
1232
1234
  ({ className, ...props }, ref) => {
1233
1235
  const variant = React20.useContext(TabNavigationContext);
@@ -1235,7 +1237,7 @@ var TabItem = React20.forwardRef(
1235
1237
  import_radix_ui10.Tabs.Trigger,
1236
1238
  {
1237
1239
  ref,
1238
- className: cn(base, variant === "toggle" ? toggle : filter, className),
1240
+ className: cn(base, variant === "toggle" ? toggle : variant === "underline" ? underline : filter, className),
1239
1241
  ...props
1240
1242
  }
1241
1243
  );
@@ -2678,7 +2680,7 @@ var import_react19 = require("@phosphor-icons/react");
2678
2680
  var import_jsx_runtime41 = require("react/jsx-runtime");
2679
2681
  var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
2680
2682
  var QuestionHeader = React40.forwardRef(
2681
- ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, ...props }, ref) => {
2683
+ ({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, ...props }, ref) => {
2682
2684
  const [draft, setDraft] = React40.useState(null);
2683
2685
  const label = String(number).padStart(2, "0");
2684
2686
  const showError = error !== void 0 && error !== false;
@@ -2694,15 +2696,16 @@ var QuestionHeader = React40.forwardRef(
2694
2696
  "aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
2695
2697
  ...dragHandleProps,
2696
2698
  className: cn(
2697
- "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption hover:pl-1",
2698
- // Inside a QuestionEditorCard the tag takes its hover look whenever the card is hovered.
2699
- "group-hover/editor:pl-1",
2699
+ "group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
2700
+ // The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered.
2701
+ showDragHandle && "hover:pl-1 group-hover/editor:pl-1",
2700
2702
  active ? "bg-accent-soft text-accent-soft-foreground" : "bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground",
2701
- dragHandleProps && "cursor-grab touch-none select-none focus-visible:pl-1",
2703
+ dragHandleProps && "cursor-grab touch-none select-none",
2704
+ dragHandleProps && showDragHandle && "focus-visible:pl-1",
2702
2705
  dragHandleProps?.className
2703
2706
  ),
2704
2707
  children: [
2705
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2708
+ showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2706
2709
  import_react19.DotsSixVertical,
2707
2710
  {
2708
2711
  size: 16,
@@ -2788,6 +2791,7 @@ var QuestionEditorCard = React41.forwardRef(
2788
2791
  error,
2789
2792
  meta,
2790
2793
  dragHandleProps,
2794
+ showDragHandle,
2791
2795
  children,
2792
2796
  ...props
2793
2797
  }, ref) => {
@@ -2819,6 +2823,7 @@ var QuestionEditorCard = React41.forwardRef(
2819
2823
  active,
2820
2824
  showCounter: !!active,
2821
2825
  dragHandleProps,
2826
+ showDragHandle,
2822
2827
  meta,
2823
2828
  maxLength,
2824
2829
  actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
@@ -2934,7 +2939,7 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
2934
2939
  // src/components/Question Types/QuestionNavItem.tsx
2935
2940
  var import_jsx_runtime44 = require("react/jsx-runtime");
2936
2941
  var QuestionNavItem = React43.forwardRef(
2937
- ({ className, questionType = "select-one", selected, error, asChild, children, ...props }, ref) => {
2942
+ ({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, children, ...props }, ref) => {
2938
2943
  const Comp = asChild ? import_radix_ui21.Slot.Root : "button";
2939
2944
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
2940
2945
  Comp,
@@ -2954,8 +2959,8 @@ var QuestionNavItem = React43.forwardRef(
2954
2959
  ...props,
2955
2960
  children: [
2956
2961
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
2957
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block" }),
2958
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2962
+ showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block" }),
2963
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: showDragHandle ? "group-hover/nav:hidden" : void 0, children: error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react22.Warning, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2959
2964
  QuestionTypeIcon,
2960
2965
  {
2961
2966
  type: questionType,
@@ -3498,6 +3503,8 @@ var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 f
3498
3503
  variants: {
3499
3504
  variant: {
3500
3505
  default: "border-border bg-transparent",
3506
+ // A tinted card with no border, for stats on a white panel.
3507
+ subtle: "border-transparent bg-background",
3501
3508
  warning: "border-warning-soft-border bg-warning-soft"
3502
3509
  }
3503
3510
  },