@scaleflex/ui-tw 0.0.88 → 0.0.90

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.
@@ -58,7 +58,13 @@ var Button = /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
58
58
  className: className
59
59
  }), loading && 'pointer-events-none opacity-30'])),
60
60
  disabled: disabled,
61
- onMouseDown: handleClick
61
+ onMouseDown: handleClick,
62
+ onKeyDown: function onKeyDown(e) {
63
+ if (e.key === 'Enter') {
64
+ e.preventDefault();
65
+ e.currentTarget.click();
66
+ }
67
+ }
62
68
  }, rest), startIcon || endIcon || loading ? /*#__PURE__*/React.createElement("span", {
63
69
  className: "flex items-center"
64
70
  }, startIcon && /*#__PURE__*/React.createElement(StartIcon, {
@@ -2,7 +2,7 @@ import { Button } from '@scaleflex/ui-tw/button';
2
2
  import React from 'react';
3
3
  import { type ComponentProps } from 'react';
4
4
  import { DayButton, DayPicker } from 'react-day-picker';
5
- declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, ...props }: ComponentProps<typeof DayPicker> & {
5
+ declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, startMonth, endMonth, ...props }: ComponentProps<typeof DayPicker> & {
6
6
  buttonVariant?: ComponentProps<typeof Button>['variant'];
7
7
  }): React.JSX.Element;
8
8
  declare function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>): React.JSX.Element;
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
5
  var _templateObject, _templateObject2;
6
- var _excluded = ["className", "classNames", "showOutsideDays", "captionLayout", "buttonVariant", "formatters", "components"],
6
+ var _excluded = ["className", "classNames", "showOutsideDays", "captionLayout", "buttonVariant", "formatters", "components", "startMonth", "endMonth"],
7
7
  _excluded2 = ["className", "rootRef"],
8
8
  _excluded3 = ["className", "orientation"],
9
9
  _excluded4 = ["children"],
@@ -15,6 +15,8 @@ import { cn } from '@scaleflex/ui-tw/utils/cn';
15
15
  import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
16
16
  import React from 'react';
17
17
  import { DayPicker, getDefaultClassNames } from 'react-day-picker';
18
+ var MS_IN_100_YEARS = 100 * 365 * 24 * 60 * 60 * 1000; // 100 years * 365 days * 24 hours * 60 minutes * 60 seconds * 1000 milli-seconds
19
+ var defaultAfterDate = new Date(Date.now() + MS_IN_100_YEARS);
18
20
  function Calendar(_ref) {
19
21
  var className = _ref.className,
20
22
  classNames = _ref.classNames,
@@ -26,10 +28,14 @@ function Calendar(_ref) {
26
28
  buttonVariant = _ref$buttonVariant === void 0 ? 'ghost-secondary' : _ref$buttonVariant,
27
29
  formatters = _ref.formatters,
28
30
  components = _ref.components,
31
+ startMonth = _ref.startMonth,
32
+ endMonth = _ref.endMonth,
29
33
  props = _objectWithoutProperties(_ref, _excluded);
30
34
  var defaultClassNames = getDefaultClassNames();
31
35
  return /*#__PURE__*/React.createElement(DayPicker, _extends({
32
36
  showOutsideDays: showOutsideDays,
37
+ startMonth: startMonth,
38
+ endMonth: endMonth !== null && endMonth !== void 0 ? endMonth : defaultAfterDate,
33
39
  className: cn('bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent', String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["rtl:**:[.rdp-button_next>svg]:rotate-180"], ["rtl:**:[.rdp-button\\_next>svg]:rotate-180"]))), String.raw(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["rtl:**:[.rdp-button_previous>svg]:rotate-180"], ["rtl:**:[.rdp-button\\_previous>svg]:rotate-180"]))), className),
34
40
  captionLayout: captionLayout,
35
41
  formatters: _objectSpread({
@@ -221,7 +221,9 @@ function DatePicker(_ref) {
221
221
  }, maxDate && {
222
222
  after: maxDate
223
223
  }].filter(Boolean),
224
- locale: locale
224
+ locale: locale,
225
+ startMonth: minDate,
226
+ endMonth: maxDate
225
227
  }, calendarProps)))))), !isInputValid && /*#__PURE__*/React.createElement("span", {
226
228
  className: "px-1 text-xs text-red-500"
227
229
  }, invalidDateText !== null && invalidDateText !== void 0 ? invalidDateText : "Invalid date. Use ".concat(placeholder || (dateFormat === null || dateFormat === void 0 ? void 0 : dateFormat.toUpperCase()))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleflex/ui-tw",
3
- "version": "0.0.88",
3
+ "version": "0.0.90",
4
4
  "author": "scaleflex",
5
5
  "repository": "github:scaleflex/ui",
6
6
  "homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
@@ -23,7 +23,7 @@
23
23
  "@radix-ui/react-slot": "^1.1.2",
24
24
  "@radix-ui/react-switch": "^1.0.1",
25
25
  "@radix-ui/react-tooltip": "^1.2.6",
26
- "@scaleflex/icons-tw": "^0.0.88",
26
+ "@scaleflex/icons-tw": "^0.0.90",
27
27
  "@tanstack/react-table": "^8.21.3",
28
28
  "@types/lodash.merge": "^4.6.9",
29
29
  "class-variance-authority": "^0.7.1",