@scaleflex/ui-tw 0.0.86 → 0.0.87

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.
@@ -34,8 +34,7 @@ function DatePicker(_ref) {
34
34
  popoverContentProps = _ref.popoverContentProps,
35
35
  onKeyDown = _ref.onKeyDown,
36
36
  onBlur = _ref.onBlur,
37
- _ref$placeholder = _ref.placeholder,
38
- placeholder = _ref$placeholder === void 0 ? 'DD/MM/YYYY' : _ref$placeholder,
37
+ placeholder = _ref.placeholder,
39
38
  _ref$format = _ref.format,
40
39
  dateFormat = _ref$format === void 0 ? 'dd/MM/yyyy' : _ref$format,
41
40
  _ref$locale = _ref.locale,
@@ -122,7 +121,7 @@ function DatePicker(_ref) {
122
121
  onChange === null || onChange === void 0 || onChange(parsed);
123
122
  };
124
123
  var handleKeyDown = function handleKeyDown(event) {
125
- var allowed = '0123456789/';
124
+ var allowed = "0123456789".concat(dateFormat !== null && dateFormat !== void 0 && dateFormat.includes('.') ? '.' : '/');
126
125
  if (event.key.length === 1 && !allowed.includes(event.key)) {
127
126
  event.preventDefault();
128
127
  }
@@ -159,8 +158,8 @@ function DatePicker(_ref) {
159
158
  type: "text",
160
159
  inputMode: "numeric",
161
160
  autoComplete: "off",
162
- pattern: "\\d{2}/\\d{2}/\\d{4}",
163
- placeholder: placeholder || dateFormat,
161
+ pattern: dateFormat ? dateFormat.replace(/[a-z]/gi, '\\d') : '\\d{2}/\\d{2}/\\d{4}',
162
+ placeholder: placeholder || (dateFormat === null || dateFormat === void 0 ? void 0 : dateFormat.toUpperCase()),
164
163
  value: inputValue,
165
164
  disabled: disabled,
166
165
  className: cn.apply(void 0, _toConsumableArray(getBaseSelectClassNames()).concat(_toConsumableArray(getBaseInputClasses()), ['hover:border-secondary-foreground/50', selectTriggerVariants({
@@ -225,6 +224,6 @@ function DatePicker(_ref) {
225
224
  locale: locale
226
225
  }, calendarProps)))))), !isInputValid && /*#__PURE__*/React.createElement("span", {
227
226
  className: "px-1 text-xs text-red-500"
228
- }, invalidDateText !== null && invalidDateText !== void 0 ? invalidDateText : "Invalid date. Use ".concat(placeholder || dateFormat)));
227
+ }, invalidDateText !== null && invalidDateText !== void 0 ? invalidDateText : "Invalid date. Use ".concat(placeholder || (dateFormat === null || dateFormat === void 0 ? void 0 : dateFormat.toUpperCase()))));
229
228
  }
230
229
  export { DatePicker };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleflex/ui-tw",
3
- "version": "0.0.86",
3
+ "version": "0.0.87",
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.86",
26
+ "@scaleflex/icons-tw": "^0.0.87",
27
27
  "@tanstack/react-table": "^8.21.3",
28
28
  "@types/lodash.merge": "^4.6.9",
29
29
  "class-variance-authority": "^0.7.1",