next-helios-fe 1.8.92 → 1.8.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-helios-fe",
3
- "version": "1.8.92",
3
+ "version": "1.8.94",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,13 +2,13 @@
2
2
  import React from "react";
3
3
  import Cl from "react-calendar";
4
4
  import "../../../styles";
5
- import dayjs from "dayjs";
5
+ import dayjs, { Dayjs } from "dayjs";
6
6
 
7
7
  interface CalendarProps {
8
8
  options?: {
9
9
  enableSelectRange?: boolean;
10
- disablePast?: boolean;
11
- disableFuture?: boolean;
10
+ minDate?: Dayjs;
11
+ maxDate?: Dayjs;
12
12
  };
13
13
  value?: any;
14
14
  onChange?: (date: any) => void;
@@ -23,10 +23,14 @@ export const Calendar: React.FC<CalendarProps> = ({
23
23
  <Cl
24
24
  selectRange={options?.enableSelectRange ?? false}
25
25
  minDate={
26
- options?.disablePast ? dayjs().startOf("day").toDate() : undefined
26
+ options?.minDate
27
+ ? dayjs(options?.minDate).startOf("day").toDate()
28
+ : undefined
27
29
  }
28
30
  maxDate={
29
- options?.disableFuture ? dayjs().endOf("day").toDate() : undefined
31
+ options?.maxDate
32
+ ? dayjs(options?.maxDate).startOf("day").toDate()
33
+ : undefined
30
34
  }
31
35
  value={value}
32
36
  onChange={onChange}
@@ -84,17 +84,25 @@ export const Dialog: React.FC<DialogProps> = ({
84
84
  <div className="flex justify-end gap-4">
85
85
  <button
86
86
  type="button"
87
- className={`disabled:text-disabled disabled:pointer-events-none ${actionVariant}`}
87
+ className={`flex gap-1 items-center disabled:text-disabled disabled:pointer-events-none ${actionVariant}`}
88
88
  disabled={loading}
89
89
  onClick={() => {
90
90
  action.onClick && action.onClick();
91
91
  }}
92
92
  >
93
- {action.label}
93
+ {loading ? (
94
+ <Icon
95
+ icon="mingcute:loading-fill"
96
+ className="animate-spin text-lg"
97
+ />
98
+ ) : (
99
+ action.label
100
+ )}
94
101
  </button>
95
102
  <button
96
103
  type="button"
97
- className="text-secondary hover:text-secondary-dark hover:underline"
104
+ className="text-secondary hover:text-secondary-dark hover:underline disabled:text-disabled disabled:pointer-events-none"
105
+ disabled={loading}
98
106
  onClick={() => {
99
107
  onClose && onClose();
100
108
  }}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React from "react";
2
+ import React, { useEffect, useRef } from "react";
3
3
  import { Tooltip } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
5
 
@@ -11,6 +11,7 @@ export interface CheckboxProps
11
11
  };
12
12
  label?: string;
13
13
  description?: string;
14
+ indeterminate?: boolean;
14
15
  theme?: string;
15
16
  }
16
17
 
@@ -19,8 +20,15 @@ export const Checkbox: React.FC<CheckboxProps> = ({
19
20
  label,
20
21
  description,
21
22
  theme,
23
+ indeterminate,
22
24
  ...rest
23
25
  }) => {
26
+ const inputRef = useRef<HTMLInputElement>(null);
27
+
28
+ useEffect(() => {
29
+ inputRef.current!.indeterminate = indeterminate ?? false;
30
+ }, [inputRef, indeterminate]);
31
+
24
32
  return (
25
33
  <label
26
34
  className={`group/checkbox flex items-center ${
@@ -36,8 +44,9 @@ export const Checkbox: React.FC<CheckboxProps> = ({
36
44
  } ${options?.variant === "switch" && "hidden"}`}
37
45
  >
38
46
  <input
47
+ ref={inputRef}
39
48
  type="checkbox"
40
- className={`border-default border rounded bg-secondary-bg cursor-pointer checked:bg-primary focus:outline-none focus:ring-0 focus:ring-offset-0 disabled:bg-secondary-light disabled:checked:bg-secondary-dark disabled:cursor-default ${
49
+ className={`border-default border rounded bg-secondary-bg cursor-pointer indeterminate:bg-primary indeterminate:hover:bg-primary checked:bg-primary focus:outline-none focus:ring-0 focus:ring-offset-0 disabled:bg-secondary-light disabled:checked:bg-secondary-dark disabled:cursor-default ${
41
50
  theme && "border-0"
42
51
  }`}
43
52
  style={{ backgroundColor: theme }}
@@ -2,7 +2,7 @@
2
2
  import React, { useState, useEffect, useRef } from "react";
3
3
  import { Tooltip, Dropdown, Calendar } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
- import dayjs from "dayjs";
5
+ import dayjs, { Dayjs } from "dayjs";
6
6
 
7
7
  export interface DateProps extends React.InputHTMLAttributes<HTMLInputElement> {
8
8
  label?: string;
@@ -10,6 +10,8 @@ export interface DateProps extends React.InputHTMLAttributes<HTMLInputElement> {
10
10
  options?: {
11
11
  buttonOnly?: boolean;
12
12
  enableSelectRange?: boolean;
13
+ minDate?: Dayjs;
14
+ maxDate?: Dayjs;
13
15
  disablePast?: boolean;
14
16
  disableFuture?: boolean;
15
17
  width?: "full" | "fit";
@@ -284,8 +286,14 @@ export const Date: React.FC<DateProps> = ({
284
286
  <Calendar
285
287
  options={{
286
288
  enableSelectRange: options?.enableSelectRange ?? false,
287
- disablePast: options?.disablePast ?? false,
288
- disableFuture: options?.disableFuture ?? false,
289
+ minDate:
290
+ options?.minDate ?? options?.disablePast
291
+ ? dayjs()
292
+ : undefined,
293
+ maxDate:
294
+ options?.maxDate ?? options?.disableFuture
295
+ ? dayjs()
296
+ : undefined,
289
297
  }}
290
298
  value={options?.enableSelectRange ? tempValue : tempValue[0]}
291
299
  onChange={(value) => {