@rehagro/ui 1.0.56 → 1.0.57

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/dist/index.d.mts CHANGED
@@ -12,8 +12,8 @@ type ToastLink = {
12
12
  type ToastProps = React__default.HTMLAttributes<HTMLDivElement> & {
13
13
  /** Toast title */
14
14
  title: string;
15
- /** Optional description below the title */
16
- description?: string;
15
+ /** Optional description below the title. Accepts a string or any React node (e.g. a list of items). */
16
+ description?: React__default.ReactNode;
17
17
  /** Optional link below the content */
18
18
  link?: ToastLink;
19
19
  /** Visual variant */
@@ -26,8 +26,8 @@ type ToastProps = React__default.HTMLAttributes<HTMLDivElement> & {
26
26
  declare const Toast: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & {
27
27
  /** Toast title */
28
28
  title: string;
29
- /** Optional description below the title */
30
- description?: string;
29
+ /** Optional description below the title. Accepts a string or any React node (e.g. a list of items). */
30
+ description?: React__default.ReactNode;
31
31
  /** Optional link below the content */
32
32
  link?: ToastLink;
33
33
  /** Visual variant */
@@ -42,7 +42,7 @@ type ToastPosition = "top-right" | "top-left" | "top-center" | "bottom-right" |
42
42
  type ToastItem = {
43
43
  id: string;
44
44
  title: string;
45
- description?: string;
45
+ description?: React__default.ReactNode;
46
46
  link?: ToastLink;
47
47
  variant: ToastVariant;
48
48
  appearance: ToastAppearance;
@@ -50,7 +50,7 @@ type ToastItem = {
50
50
  duration: number;
51
51
  };
52
52
  type ToastOptions = {
53
- description?: string;
53
+ description?: React__default.ReactNode;
54
54
  link?: ToastLink;
55
55
  appearance?: ToastAppearance;
56
56
  /** Auto-dismiss duration in ms. 0 = permanent. Default: 5000 */
@@ -547,6 +547,12 @@ type DateSelectBaseProps = {
547
547
  endYear?: number;
548
548
  /** Custom background color for the trigger button */
549
549
  backgroundColor?: string;
550
+ /**
551
+ * Restricts which modes are available in the picker.
552
+ * When a single mode is provided the tab bar is hidden entirely.
553
+ * Defaults to all four modes: ["interval", "day", "month", "year"].
554
+ */
555
+ modes?: DateSelectMode[];
550
556
  };
551
557
  declare const DateSelect: React__default.ForwardRefExoticComponent<DateSelectBaseProps & React__default.RefAttributes<HTMLButtonElement>>;
552
558
 
package/dist/index.d.ts CHANGED
@@ -12,8 +12,8 @@ type ToastLink = {
12
12
  type ToastProps = React__default.HTMLAttributes<HTMLDivElement> & {
13
13
  /** Toast title */
14
14
  title: string;
15
- /** Optional description below the title */
16
- description?: string;
15
+ /** Optional description below the title. Accepts a string or any React node (e.g. a list of items). */
16
+ description?: React__default.ReactNode;
17
17
  /** Optional link below the content */
18
18
  link?: ToastLink;
19
19
  /** Visual variant */
@@ -26,8 +26,8 @@ type ToastProps = React__default.HTMLAttributes<HTMLDivElement> & {
26
26
  declare const Toast: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & {
27
27
  /** Toast title */
28
28
  title: string;
29
- /** Optional description below the title */
30
- description?: string;
29
+ /** Optional description below the title. Accepts a string or any React node (e.g. a list of items). */
30
+ description?: React__default.ReactNode;
31
31
  /** Optional link below the content */
32
32
  link?: ToastLink;
33
33
  /** Visual variant */
@@ -42,7 +42,7 @@ type ToastPosition = "top-right" | "top-left" | "top-center" | "bottom-right" |
42
42
  type ToastItem = {
43
43
  id: string;
44
44
  title: string;
45
- description?: string;
45
+ description?: React__default.ReactNode;
46
46
  link?: ToastLink;
47
47
  variant: ToastVariant;
48
48
  appearance: ToastAppearance;
@@ -50,7 +50,7 @@ type ToastItem = {
50
50
  duration: number;
51
51
  };
52
52
  type ToastOptions = {
53
- description?: string;
53
+ description?: React__default.ReactNode;
54
54
  link?: ToastLink;
55
55
  appearance?: ToastAppearance;
56
56
  /** Auto-dismiss duration in ms. 0 = permanent. Default: 5000 */
@@ -547,6 +547,12 @@ type DateSelectBaseProps = {
547
547
  endYear?: number;
548
548
  /** Custom background color for the trigger button */
549
549
  backgroundColor?: string;
550
+ /**
551
+ * Restricts which modes are available in the picker.
552
+ * When a single mode is provided the tab bar is hidden entirely.
553
+ * Defaults to all four modes: ["interval", "day", "month", "year"].
554
+ */
555
+ modes?: DateSelectMode[];
550
556
  };
551
557
  declare const DateSelect: React__default.ForwardRefExoticComponent<DateSelectBaseProps & React__default.RefAttributes<HTMLButtonElement>>;
552
558
 
package/dist/index.js CHANGED
@@ -2055,7 +2055,8 @@ var DateSelect = React9.forwardRef(
2055
2055
  wrapperClassName = "",
2056
2056
  startYear,
2057
2057
  endYear,
2058
- backgroundColor
2058
+ backgroundColor,
2059
+ modes
2059
2060
  } = props;
2060
2061
  const triggerId = React9__default.default.useId();
2061
2062
  const helperId = React9__default.default.useId();
@@ -2067,7 +2068,14 @@ var DateSelect = React9.forwardRef(
2067
2068
  );
2068
2069
  const isControlled = props.value !== void 0;
2069
2070
  const value = isControlled ? props.value ?? internalValue : internalValue;
2070
- const [activeMode, setActiveMode] = React9.useState(value.mode ?? "day");
2071
+ const availableModes = React9.useMemo(
2072
+ () => modes && modes.length > 0 ? MODE_OPTIONS.filter((o) => modes.includes(o.value)) : MODE_OPTIONS,
2073
+ [modes]
2074
+ );
2075
+ const defaultMode = availableModes[0]?.value ?? "day";
2076
+ const [activeMode, setActiveMode] = React9.useState(
2077
+ availableModes.some((o) => o.value === (value.mode ?? "day")) ? value.mode ?? "day" : defaultMode
2078
+ );
2071
2079
  const [selectedYear, setSelectedYear] = React9.useState((/* @__PURE__ */ new Date()).getFullYear());
2072
2080
  const [selectedMonth, setSelectedMonth] = React9.useState((/* @__PURE__ */ new Date()).getMonth());
2073
2081
  const rightMonth = selectedMonth === 11 ? 0 : selectedMonth + 1;
@@ -2183,19 +2191,22 @@ var DateSelect = React9.forwardRef(
2183
2191
  const [lo, hi] = start <= ref2 ? [start, ref2] : [ref2, start];
2184
2192
  return date > lo && date < hi;
2185
2193
  };
2186
- const renderModeTabs = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-flex rh-border-b rh-border-border rh-bg-transparent", children: MODE_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
2187
- "button",
2188
- {
2189
- onClick: () => setActiveMode(option.value),
2190
- className: [
2191
- "rh-flex-1 rh-py-2 rh-px-4 rh-text-sm rh-transition-colors rh-duration-150 rh-text-text rh-font-bold",
2192
- "rh-border-b-2 -rh-mb-px",
2193
- activeMode === option.value ? "rh-border-primary" : "rh-border-transparent hover:rh-border-border"
2194
- ].join(" "),
2195
- children: option.label
2196
- },
2197
- option.value
2198
- )) });
2194
+ const renderModeTabs = () => {
2195
+ if (availableModes.length <= 1) return null;
2196
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-flex rh-border-b rh-border-border rh-bg-transparent", children: availableModes.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
2197
+ "button",
2198
+ {
2199
+ onClick: () => setActiveMode(option.value),
2200
+ className: [
2201
+ "rh-flex-1 rh-py-2 rh-px-4 rh-text-sm rh-transition-colors rh-duration-150 rh-text-text rh-font-bold",
2202
+ "rh-border-b-2 -rh-mb-px",
2203
+ activeMode === option.value ? "rh-border-primary" : "rh-border-transparent hover:rh-border-border"
2204
+ ].join(" "),
2205
+ children: option.label
2206
+ },
2207
+ option.value
2208
+ )) });
2209
+ };
2199
2210
  const renderYearGrid = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-p-1", children: [
2200
2211
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
2201
2212
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2722,7 +2733,7 @@ var DateSelect = React9.forwardRef(
2722
2733
  },
2723
2734
  children: [
2724
2735
  renderModeTabs(),
2725
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-mt-2", children: renderContent() })
2736
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: availableModes.length > 1 ? "rh-mt-2" : "", children: renderContent() })
2726
2737
  ]
2727
2738
  }
2728
2739
  ),