@react-fabric/date 1.0.0-beta.61 → 1.0.0-beta.63

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.
@@ -53,7 +53,7 @@ var TimeSlider = function TimeSlider(_ref) {
53
53
  });
54
54
  }, [onTimeChange]);
55
55
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
56
- className: classNames("area-[time] flex flex-col flex-nowrap border-s border-s-tint-50 overflow-hidden bg-base"),
56
+ className: classNames("area-[time] flex flex-col flex-nowrap border-s border-s-tint-50 overflow-hidden bg-default"),
57
57
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
58
58
  className: "flex",
59
59
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -18,7 +18,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
18
18
  * If `children` are provided, it wraps the date in a dropdown.
19
19
  *
20
20
  * @param {Object} props - The component props.
21
- * @returns {JSX.Element} - The rendered component.
21
+ * @returns {React.ReactElement} - The rendered component.
22
22
  *
23
23
  * @example
24
24
  * ```jsx
@@ -35,9 +35,9 @@ var DateDisplay = function DateDisplay(_ref) {
35
35
  children = _ref.children,
36
36
  showAlternateDate = _ref.showAlternateDate,
37
37
  aria = _objectWithoutProperties(_ref, _excluded);
38
- var _useGlobals = core.useGlobals(),
39
- currentCalendar = _useGlobals.currentCalendar,
40
- currentLocale = _useGlobals.currentLocale;
38
+ var _useApplicationContex = core.useApplicationContext(),
39
+ currentCalendar = _useApplicationContex.currentCalendar,
40
+ currentLocale = _useApplicationContex.currentLocale;
41
41
  var dtLabel = /*#__PURE__*/jsxRuntime.jsx(core.Tooltip, {
42
42
  disabled: !showAlternateDate,
43
43
  content: dateUtil.DateUtil.format(date, format, currentLocale, currentCalendar !== "hijri"),
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
5
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
6
  var core = require('@react-fabric/core');
6
7
  var utilities = require('@react-fabric/utilities');
@@ -21,7 +22,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
21
22
  * It uses the current locale for translations.
22
23
  *
23
24
  * @param {Props} props - The properties for the component.
24
- * @returns {JSX.Element} The rendered component.
25
+ * @returns {React.ReactElement} The rendered component.
25
26
  *
26
27
  * @example
27
28
  * ```jsx
@@ -39,11 +40,25 @@ var DateDuration = function DateDuration(_ref) {
39
40
  props = _objectWithoutProperties(_ref, _excluded);
40
41
  var _useTranslation = reactI18next.useTranslation("date"),
41
42
  t = _useTranslation.t;
42
- var interval = react.useMemo(function () {
43
- return dateFns.intervalToDuration({
43
+ var _useState = react.useState({}),
44
+ _useState2 = _slicedToArray(_useState, 2),
45
+ interval = _useState2[0],
46
+ setDateInterval = _useState2[1];
47
+ react.useEffect(function () {
48
+ setDateInterval(dateFns.intervalToDuration({
44
49
  start: new Date(date),
45
50
  end: new Date()
46
- });
51
+ }));
52
+ // update interval every minute
53
+ var tmr = setInterval(function () {
54
+ setDateInterval(dateFns.intervalToDuration({
55
+ start: new Date(date),
56
+ end: new Date()
57
+ }));
58
+ }, 60 * 1000);
59
+ return function () {
60
+ return clearInterval(tmr);
61
+ };
47
62
  }, [date]);
48
63
  var label = react.useMemo(function () {
49
64
  var before = dateFns.isBefore(dateUtil.DateUtil.parseDate(date), new Date());
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@react-fabric/core');
4
- var ar = require('./ar.json.js');
5
- var en = require('./en.json.js');
4
+ var date$1 = require('./ar/date.json.js');
5
+ var date = require('./en/date.json.js');
6
6
 
7
7
  /*
8
8
  * React Fabric
@@ -28,6 +28,6 @@ var en = require('./en.json.js');
28
28
  */
29
29
 
30
30
  core.addTranslationBundle("date", {
31
- en: en.default,
32
- ar: ar.default
31
+ en: date.default,
32
+ ar: date$1.default
33
33
  });
@@ -25,7 +25,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
25
25
  * It also supports disabling specific dates and setting minimum and maximum date limits.
26
26
  *
27
27
  * @param {DateProps} props - The properties for the DatePanel component.
28
- * @return {JSX.Element} The rendered DatePanel component.
28
+ * @return {React.ReactElement} The rendered DatePanel component.
29
29
  *
30
30
  * @example
31
31
  * ```jsx
@@ -55,8 +55,8 @@ var DatePanel = function DatePanel(_ref) {
55
55
  rest = _objectWithoutProperties(_ref, _excluded);
56
56
  var _useTranslation = reactI18next.useTranslation("date"),
57
57
  t = _useTranslation.t;
58
- var _useGlobals = core.useGlobals(),
59
- currentCalendar = _useGlobals.currentCalendar;
58
+ var _useApplicationContex = core.useApplicationContext(),
59
+ currentCalendar = _useApplicationContex.currentCalendar;
60
60
  var _useState = react.useState(currentCalendar === "hijri"),
61
61
  _useState2 = _slicedToArray(_useState, 2),
62
62
  isHijri = _useState2[0],
@@ -168,7 +168,7 @@ var DatePanel = function DatePanel(_ref) {
168
168
  });
169
169
  }, []);
170
170
  return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
171
- className: classNames("block overflow-hidden bg-base rounded-capped", className)
171
+ className: classNames("block overflow-hidden bg-default rounded-capped", className)
172
172
  }, rest), {}, {
173
173
  children: [/*#__PURE__*/jsxRuntime.jsx(BasePanel.BasePanel, _objectSpread(_objectSpread({}, state), {}, {
174
174
  max: max,
@@ -25,7 +25,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
25
25
  * It also supports disabling specific dates and setting minimum and maximum date limits.
26
26
  *
27
27
  * @param {RangeProps} props - The properties for the RangePanel component.
28
- * @return {JSX.Element} The rendered RangePanel component.
28
+ * @return {React.ReactElement} The rendered RangePanel component.
29
29
  *
30
30
  * @example
31
31
  * ```jsx
@@ -53,8 +53,8 @@ var RangePanel = function RangePanel(_ref) {
53
53
  rest = _objectWithoutProperties(_ref, _excluded);
54
54
  var _useTranslation = reactI18next.useTranslation("date"),
55
55
  t = _useTranslation.t;
56
- var _useGlobals = core.useGlobals(),
57
- currentCalendar = _useGlobals.currentCalendar;
56
+ var _useApplicationContex = core.useApplicationContext(),
57
+ currentCalendar = _useApplicationContex.currentCalendar;
58
58
  var _useState = react.useState(currentCalendar === "hijri"),
59
59
  _useState2 = _slicedToArray(_useState, 2),
60
60
  isHijri = _useState2[0],
@@ -226,7 +226,7 @@ var RangePanel = function RangePanel(_ref) {
226
226
  });
227
227
  }, []);
228
228
  return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
229
- className: classNames("block overflow-hidden bg-base rounded-capped", className)
229
+ className: classNames("block overflow-hidden bg-default rounded-capped", className)
230
230
  }, rest), {}, {
231
231
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
232
232
  className: "flex flex-nowrap",
@@ -53,7 +53,7 @@ var TimeSlider = function TimeSlider(_ref) {
53
53
  });
54
54
  }, [onTimeChange]);
55
55
  return /*#__PURE__*/jsxs("div", {
56
- className: classNames("area-[time] flex flex-col flex-nowrap border-s border-s-tint-50 overflow-hidden bg-base"),
56
+ className: classNames("area-[time] flex flex-col flex-nowrap border-s border-s-tint-50 overflow-hidden bg-default"),
57
57
  children: [/*#__PURE__*/jsxs("div", {
58
58
  className: "flex",
59
59
  children: [/*#__PURE__*/jsx("div", {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
- import { useGlobals, Tooltip, Dropdown } from '@react-fabric/core';
5
+ import { useApplicationContext, Tooltip, Dropdown } from '@react-fabric/core';
6
6
  import { DateUtil } from '../utils/dateUtil.js';
7
7
  import classNames from 'classnames';
8
8
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -18,7 +18,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
18
18
  * If `children` are provided, it wraps the date in a dropdown.
19
19
  *
20
20
  * @param {Object} props - The component props.
21
- * @returns {JSX.Element} - The rendered component.
21
+ * @returns {React.ReactElement} - The rendered component.
22
22
  *
23
23
  * @example
24
24
  * ```jsx
@@ -35,9 +35,9 @@ var DateDisplay = function DateDisplay(_ref) {
35
35
  children = _ref.children,
36
36
  showAlternateDate = _ref.showAlternateDate,
37
37
  aria = _objectWithoutProperties(_ref, _excluded);
38
- var _useGlobals = useGlobals(),
39
- currentCalendar = _useGlobals.currentCalendar,
40
- currentLocale = _useGlobals.currentLocale;
38
+ var _useApplicationContex = useApplicationContext(),
39
+ currentCalendar = _useApplicationContex.currentCalendar,
40
+ currentLocale = _useApplicationContex.currentLocale;
41
41
  var dtLabel = /*#__PURE__*/jsx(Tooltip, {
42
42
  disabled: !showAlternateDate,
43
43
  content: DateUtil.format(date, format, currentLocale, currentCalendar !== "hijri"),
@@ -1,12 +1,13 @@
1
1
  'use client';
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
6
  import { Tooltip, Dropdown } from '@react-fabric/core';
6
7
  import { Format } from '@react-fabric/utilities';
7
8
  import classNames from 'classnames';
8
9
  import { intervalToDuration, isBefore } from 'date-fns';
9
- import { useMemo } from 'react';
10
+ import { useState, useEffect, useMemo } from 'react';
10
11
  import { useTranslation } from 'react-i18next';
11
12
  import { DateUtil } from '../utils/dateUtil.js';
12
13
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -21,7 +22,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
21
22
  * It uses the current locale for translations.
22
23
  *
23
24
  * @param {Props} props - The properties for the component.
24
- * @returns {JSX.Element} The rendered component.
25
+ * @returns {React.ReactElement} The rendered component.
25
26
  *
26
27
  * @example
27
28
  * ```jsx
@@ -39,11 +40,25 @@ var DateDuration = function DateDuration(_ref) {
39
40
  props = _objectWithoutProperties(_ref, _excluded);
40
41
  var _useTranslation = useTranslation("date"),
41
42
  t = _useTranslation.t;
42
- var interval = useMemo(function () {
43
- return intervalToDuration({
43
+ var _useState = useState({}),
44
+ _useState2 = _slicedToArray(_useState, 2),
45
+ interval = _useState2[0],
46
+ setDateInterval = _useState2[1];
47
+ useEffect(function () {
48
+ setDateInterval(intervalToDuration({
44
49
  start: new Date(date),
45
50
  end: new Date()
46
- });
51
+ }));
52
+ // update interval every minute
53
+ var tmr = setInterval(function () {
54
+ setDateInterval(intervalToDuration({
55
+ start: new Date(date),
56
+ end: new Date()
57
+ }));
58
+ }, 60 * 1000);
59
+ return function () {
60
+ return clearInterval(tmr);
61
+ };
47
62
  }, [date]);
48
63
  var label = useMemo(function () {
49
64
  var before = isBefore(DateUtil.parseDate(date), new Date());
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import { addTranslationBundle } from '@react-fabric/core';
4
- import ar from './ar.json.js';
5
- import en from './en.json.js';
4
+ import ar from './ar/date.json.js';
5
+ import en from './en/date.json.js';
6
6
 
7
7
  /*
8
8
  * React Fabric
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import { useGlobals, useDebounce, Button } from '@react-fabric/core';
6
+ import { useApplicationContext, useDebounce, Button } from '@react-fabric/core';
7
7
  import { isEmpty, isArray } from '@react-fabric/utilities';
8
8
  import classNames from 'classnames';
9
9
  import { isBefore, isAfter, isSameDay } from 'date-fns';
@@ -25,7 +25,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
25
25
  * It also supports disabling specific dates and setting minimum and maximum date limits.
26
26
  *
27
27
  * @param {DateProps} props - The properties for the DatePanel component.
28
- * @return {JSX.Element} The rendered DatePanel component.
28
+ * @return {React.ReactElement} The rendered DatePanel component.
29
29
  *
30
30
  * @example
31
31
  * ```jsx
@@ -55,8 +55,8 @@ var DatePanel = function DatePanel(_ref) {
55
55
  rest = _objectWithoutProperties(_ref, _excluded);
56
56
  var _useTranslation = useTranslation("date"),
57
57
  t = _useTranslation.t;
58
- var _useGlobals = useGlobals(),
59
- currentCalendar = _useGlobals.currentCalendar;
58
+ var _useApplicationContex = useApplicationContext(),
59
+ currentCalendar = _useApplicationContex.currentCalendar;
60
60
  var _useState = useState(currentCalendar === "hijri"),
61
61
  _useState2 = _slicedToArray(_useState, 2),
62
62
  isHijri = _useState2[0],
@@ -168,7 +168,7 @@ var DatePanel = function DatePanel(_ref) {
168
168
  });
169
169
  }, []);
170
170
  return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
171
- className: classNames("block overflow-hidden bg-base rounded-capped", className)
171
+ className: classNames("block overflow-hidden bg-default rounded-capped", className)
172
172
  }, rest), {}, {
173
173
  children: [/*#__PURE__*/jsx(BasePanel, _objectSpread(_objectSpread({}, state), {}, {
174
174
  max: max,
@@ -3,7 +3,7 @@
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
6
- import { useGlobals, useDebounce, Button } from '@react-fabric/core';
6
+ import { useApplicationContext, useDebounce, Button } from '@react-fabric/core';
7
7
  import { isEmpty, isArray } from '@react-fabric/utilities';
8
8
  import classNames from 'classnames';
9
9
  import { isAfter, addMonths, isBefore, isSameDay } from 'date-fns';
@@ -25,7 +25,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
25
25
  * It also supports disabling specific dates and setting minimum and maximum date limits.
26
26
  *
27
27
  * @param {RangeProps} props - The properties for the RangePanel component.
28
- * @return {JSX.Element} The rendered RangePanel component.
28
+ * @return {React.ReactElement} The rendered RangePanel component.
29
29
  *
30
30
  * @example
31
31
  * ```jsx
@@ -53,8 +53,8 @@ var RangePanel = function RangePanel(_ref) {
53
53
  rest = _objectWithoutProperties(_ref, _excluded);
54
54
  var _useTranslation = useTranslation("date"),
55
55
  t = _useTranslation.t;
56
- var _useGlobals = useGlobals(),
57
- currentCalendar = _useGlobals.currentCalendar;
56
+ var _useApplicationContex = useApplicationContext(),
57
+ currentCalendar = _useApplicationContex.currentCalendar;
58
58
  var _useState = useState(currentCalendar === "hijri"),
59
59
  _useState2 = _slicedToArray(_useState, 2),
60
60
  isHijri = _useState2[0],
@@ -226,7 +226,7 @@ var RangePanel = function RangePanel(_ref) {
226
226
  });
227
227
  }, []);
228
228
  return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
229
- className: classNames("block overflow-hidden bg-base rounded-capped", className)
229
+ className: classNames("block overflow-hidden bg-default rounded-capped", className)
230
230
  }, rest), {}, {
231
231
  children: [/*#__PURE__*/jsxs("div", {
232
232
  className: "flex flex-nowrap",
@@ -21,7 +21,7 @@ export interface Props extends CssProp, AriaProps, TestProps, Partial<ChildrenPr
21
21
  * If `children` are provided, it wraps the date in a dropdown.
22
22
  *
23
23
  * @param {Object} props - The component props.
24
- * @returns {JSX.Element} - The rendered component.
24
+ * @returns {React.ReactElement} - The rendered component.
25
25
  *
26
26
  * @example
27
27
  * ```jsx
@@ -19,7 +19,7 @@ export interface Props extends CssProp, AriaProps, TestProps, Partial<ChildrenPr
19
19
  * It uses the current locale for translations.
20
20
  *
21
21
  * @param {Props} props - The properties for the component.
22
- * @returns {JSX.Element} The rendered component.
22
+ * @returns {React.ReactElement} The rendered component.
23
23
  *
24
24
  * @example
25
25
  * ```jsx
@@ -7,7 +7,7 @@ import { type DateProps } from "../types";
7
7
  * It also supports disabling specific dates and setting minimum and maximum date limits.
8
8
  *
9
9
  * @param {DateProps} props - The properties for the DatePanel component.
10
- * @return {JSX.Element} The rendered DatePanel component.
10
+ * @return {React.ReactElement} The rendered DatePanel component.
11
11
  *
12
12
  * @example
13
13
  * ```jsx
@@ -7,7 +7,7 @@ import { type RangeProps } from "../types";
7
7
  * It also supports disabling specific dates and setting minimum and maximum date limits.
8
8
  *
9
9
  * @param {RangeProps} props - The properties for the RangePanel component.
10
- * @return {JSX.Element} The rendered RangePanel component.
10
+ * @return {React.ReactElement} The rendered RangePanel component.
11
11
  *
12
12
  * @example
13
13
  * ```jsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/date",
3
- "version": "1.0.0-beta.61",
3
+ "version": "1.0.0-beta.63",
4
4
  "description": "RUF: Date package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -35,21 +35,20 @@
35
35
  "watch": "npm-run-all -p watch:rollup watch:dts"
36
36
  },
37
37
  "dependencies": {
38
- "@react-fabric/core": "^1.0.0-beta.61",
39
- "@react-fabric/utilities": "^1.0.0-beta.61",
38
+ "@react-fabric/core": "^1.0.0-beta.63",
39
+ "@react-fabric/utilities": "^1.0.0-beta.63",
40
40
  "classnames": "~2.5.1",
41
- "date-fns": "~4.1.0",
42
- "resize-observer-polyfill": "~1.5.1"
41
+ "date-fns": "~4.1.0"
43
42
  },
44
43
  "peerDependencies": {
45
- "i18next": "~25.6.0",
46
- "react": "~19.2.0",
47
- "react-dom": "~19.2.0",
48
- "react-i18next": "~16.2.1"
44
+ "i18next": "~25.8.18",
45
+ "react": "~19.2.4",
46
+ "react-dom": "~19.2.4",
47
+ "react-i18next": "~16.5.8"
49
48
  },
50
49
  "engines": {
51
- "node": ">=18.12.0",
52
- "npm": ">=8.19.0"
50
+ "node": ">=22.18.0",
51
+ "npm": ">=10.8.0"
53
52
  },
54
- "gitHead": "a0b0c571bf9c189fa3355bbc3b896ecc4b9d6a04"
53
+ "gitHead": "6e0652b15c6384fbc316842862572e21299a5466"
55
54
  }
@@ -73,7 +73,7 @@ export const TimeSlider = ({ hour = 0, minute = 0, onTimeChange }: Props) => {
73
73
  return (
74
74
  <div
75
75
  className={classNames(
76
- "area-[time] flex flex-col flex-nowrap border-s border-s-tint-50 overflow-hidden bg-base",
76
+ "area-[time] flex flex-col flex-nowrap border-s border-s-tint-50 overflow-hidden bg-default",
77
77
  )}
78
78
  >
79
79
  <div className="flex">
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { Dropdown, Tooltip, useGlobals } from "@react-fabric/core";
24
+ import { Dropdown, Tooltip, useApplicationContext } from "@react-fabric/core";
25
25
  import { type MenuProps } from "@react-fabric/core/dist/types/components/menu/types";
26
26
  import {
27
27
  type AriaProps,
@@ -59,7 +59,7 @@ export interface Props
59
59
  * If `children` are provided, it wraps the date in a dropdown.
60
60
  *
61
61
  * @param {Object} props - The component props.
62
- * @returns {JSX.Element} - The rendered component.
62
+ * @returns {React.ReactElement} - The rendered component.
63
63
  *
64
64
  * @example
65
65
  * ```jsx
@@ -76,7 +76,7 @@ export const DateDisplay = ({
76
76
  showAlternateDate,
77
77
  ...aria
78
78
  }: Props) => {
79
- const { currentCalendar, currentLocale } = useGlobals();
79
+ const { currentCalendar, currentLocale } = useApplicationContext();
80
80
 
81
81
  const dtLabel = (
82
82
  <Tooltip
@@ -32,7 +32,7 @@ import {
32
32
  import { Format } from "@react-fabric/utilities";
33
33
  import classNames from "classnames";
34
34
  import { intervalToDuration, isBefore } from "date-fns";
35
- import { useMemo, type ElementType } from "react";
35
+ import { useEffect, useMemo, useState, type ElementType } from "react";
36
36
  import { useTranslation } from "react-i18next";
37
37
  import { type DateLike } from "../types";
38
38
  import { DateUtil } from "../utils/dateUtil";
@@ -59,7 +59,7 @@ export interface Props
59
59
  * It uses the current locale for translations.
60
60
  *
61
61
  * @param {Props} props - The properties for the component.
62
- * @returns {JSX.Element} The rendered component.
62
+ * @returns {React.ReactElement} The rendered component.
63
63
  *
64
64
  * @example
65
65
  * ```jsx
@@ -76,9 +76,21 @@ export const DateDuration = ({
76
76
  ...props
77
77
  }: Props) => {
78
78
  const { t } = useTranslation("date");
79
+ const [interval, setDateInterval] = useState<
80
+ ReturnType<typeof intervalToDuration>
81
+ >({});
79
82
 
80
- const interval = useMemo(() => {
81
- return intervalToDuration({ start: new Date(date), end: new Date() });
83
+ useEffect(() => {
84
+ setDateInterval(
85
+ intervalToDuration({ start: new Date(date), end: new Date() }),
86
+ );
87
+ // update interval every minute
88
+ const tmr = setInterval(() => {
89
+ setDateInterval(
90
+ intervalToDuration({ start: new Date(date), end: new Date() }),
91
+ );
92
+ }, 60 * 1000);
93
+ return () => clearInterval(tmr);
82
94
  }, [date]);
83
95
 
84
96
  const label = useMemo(() => {
package/src/i18n/index.ts CHANGED
@@ -22,7 +22,7 @@
22
22
  */
23
23
 
24
24
  import { addTranslationBundle } from "@react-fabric/core";
25
- import ar from "./ar.json";
26
- import en from "./en.json";
25
+ import ar from "./ar/date.json";
26
+ import en from "./en/date.json";
27
27
 
28
28
  addTranslationBundle("date", { en, ar });
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { Button, useDebounce, useGlobals } from "@react-fabric/core";
24
+ import { Button, useDebounce, useApplicationContext } from "@react-fabric/core";
25
25
  import { isArray, isEmpty } from "@react-fabric/utilities";
26
26
  import classNames from "classnames";
27
27
  import { isAfter, isBefore, isSameDay } from "date-fns";
@@ -54,7 +54,7 @@ type PanelActions =
54
54
  * It also supports disabling specific dates and setting minimum and maximum date limits.
55
55
  *
56
56
  * @param {DateProps} props - The properties for the DatePanel component.
57
- * @return {JSX.Element} The rendered DatePanel component.
57
+ * @return {React.ReactElement} The rendered DatePanel component.
58
58
  *
59
59
  * @example
60
60
  * ```jsx
@@ -84,7 +84,7 @@ export const DatePanel = ({
84
84
  ...rest
85
85
  }: DateProps) => {
86
86
  const { t } = useTranslation("date");
87
- const { currentCalendar } = useGlobals();
87
+ const { currentCalendar } = useApplicationContext();
88
88
  const [isHijri, setHijri] = useState(currentCalendar === "hijri");
89
89
  const [canSelectToday, setCanSelectToday] = useState(true);
90
90
 
@@ -198,7 +198,7 @@ export const DatePanel = ({
198
198
  return (
199
199
  <div
200
200
  className={classNames(
201
- "block overflow-hidden bg-base rounded-capped",
201
+ "block overflow-hidden bg-default rounded-capped",
202
202
  className,
203
203
  )}
204
204
  {...rest}
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { Button, useDebounce, useGlobals } from "@react-fabric/core";
24
+ import { Button, useDebounce, useApplicationContext } from "@react-fabric/core";
25
25
  import { isArray, isEmpty } from "@react-fabric/utilities";
26
26
  import classNames from "classnames";
27
27
  import { addMonths, isAfter, isBefore, isSameDay } from "date-fns";
@@ -66,7 +66,7 @@ type PanelActions =
66
66
  * It also supports disabling specific dates and setting minimum and maximum date limits.
67
67
  *
68
68
  * @param {RangeProps} props - The properties for the RangePanel component.
69
- * @return {JSX.Element} The rendered RangePanel component.
69
+ * @return {React.ReactElement} The rendered RangePanel component.
70
70
  *
71
71
  * @example
72
72
  * ```jsx
@@ -94,7 +94,7 @@ export const RangePanel = ({
94
94
  ...rest
95
95
  }: RangeProps) => {
96
96
  const { t } = useTranslation("date");
97
- const { currentCalendar } = useGlobals();
97
+ const { currentCalendar } = useApplicationContext();
98
98
  const [isHijri, setHijri] = useState(currentCalendar === "hijri");
99
99
 
100
100
  const fireChange = useDebounce(onChange, [onChange]);
@@ -286,7 +286,7 @@ export const RangePanel = ({
286
286
  return (
287
287
  <div
288
288
  className={classNames(
289
- "block overflow-hidden bg-base rounded-capped",
289
+ "block overflow-hidden bg-default rounded-capped",
290
290
  className,
291
291
  )}
292
292
  {...rest}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes