@cerberus-design/react 0.25.2 → 0.25.3

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.
@@ -4,17 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const parts = require('./parts.cjs');
7
- const CalendarDate = require('../../node_modules/.pnpm/@internationalized_date@3.10.1/node_modules/@internationalized/date/src/CalendarDate.cjs');
8
7
 
9
- const FULL_DATE_REGEX = /^(\d{1,2})[\s/](\d{1,2})[\s/](\d{4})$/;
10
- const PARTIAL_DATE_REGEX = /^(\d{1,2})[\s/](\d{1,2})$/;
11
- const MONTH_REGEX = /^(\d{1,2})$/;
12
8
  function DatePicker(props) {
13
9
  return /* @__PURE__ */ jsxRuntime.jsx(
14
10
  parts.DatePickerParts.Root,
15
11
  {
16
- format: handleFormat,
17
- parse,
18
12
  positioning: {
19
13
  placement: "bottom-start"
20
14
  },
@@ -22,44 +16,5 @@ function DatePicker(props) {
22
16
  }
23
17
  );
24
18
  }
25
- function parse(value) {
26
- const fullMatch = value.match(FULL_DATE_REGEX);
27
- if (fullMatch) {
28
- const [, month, day, year] = fullMatch.map(Number);
29
- try {
30
- return new CalendarDate.CalendarDate(year, month, day);
31
- } catch {
32
- return void 0;
33
- }
34
- }
35
- const partialMatch = value.match(PARTIAL_DATE_REGEX);
36
- if (partialMatch) {
37
- const [, month, day] = partialMatch.map(Number);
38
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
39
- try {
40
- return new CalendarDate.CalendarDate(currentYear, month, day);
41
- } catch {
42
- return void 0;
43
- }
44
- }
45
- const monthMatch = value.match(MONTH_REGEX);
46
- if (monthMatch) {
47
- const [, month] = monthMatch.map(Number);
48
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
49
- try {
50
- if (month < 1 || month > 12) return void 0;
51
- return new CalendarDate.CalendarDate(currentYear, month, 1);
52
- } catch {
53
- return void 0;
54
- }
55
- }
56
- return void 0;
57
- }
58
- function handleFormat(date) {
59
- const day = date.day.toString().padStart(2, "0");
60
- const month = date.month.toString().padStart(2, "0");
61
- const year = date.year.toString();
62
- return `${month} ${day} ${year}`;
63
- }
64
19
 
65
20
  exports.DatePicker = DatePicker;
@@ -1,16 +1,10 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { DatePickerParts } from './parts.js';
3
- import { CalendarDate } from '../../node_modules/.pnpm/@internationalized_date@3.10.1/node_modules/@internationalized/date/src/CalendarDate.js';
4
3
 
5
- const FULL_DATE_REGEX = /^(\d{1,2})[\s/](\d{1,2})[\s/](\d{4})$/;
6
- const PARTIAL_DATE_REGEX = /^(\d{1,2})[\s/](\d{1,2})$/;
7
- const MONTH_REGEX = /^(\d{1,2})$/;
8
4
  function DatePicker(props) {
9
5
  return /* @__PURE__ */ jsx(
10
6
  DatePickerParts.Root,
11
7
  {
12
- format: handleFormat,
13
- parse,
14
8
  positioning: {
15
9
  placement: "bottom-start"
16
10
  },
@@ -18,44 +12,5 @@ function DatePicker(props) {
18
12
  }
19
13
  );
20
14
  }
21
- function parse(value) {
22
- const fullMatch = value.match(FULL_DATE_REGEX);
23
- if (fullMatch) {
24
- const [, month, day, year] = fullMatch.map(Number);
25
- try {
26
- return new CalendarDate(year, month, day);
27
- } catch {
28
- return void 0;
29
- }
30
- }
31
- const partialMatch = value.match(PARTIAL_DATE_REGEX);
32
- if (partialMatch) {
33
- const [, month, day] = partialMatch.map(Number);
34
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
35
- try {
36
- return new CalendarDate(currentYear, month, day);
37
- } catch {
38
- return void 0;
39
- }
40
- }
41
- const monthMatch = value.match(MONTH_REGEX);
42
- if (monthMatch) {
43
- const [, month] = monthMatch.map(Number);
44
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
45
- try {
46
- if (month < 1 || month > 12) return void 0;
47
- return new CalendarDate(currentYear, month, 1);
48
- } catch {
49
- return void 0;
50
- }
51
- }
52
- return void 0;
53
- }
54
- function handleFormat(date) {
55
- const day = date.day.toString().padStart(2, "0");
56
- const month = date.month.toString().padStart(2, "0");
57
- const year = date.year.toString();
58
- return `${month} ${day} ${year}`;
59
- }
60
15
 
61
16
  export { DatePicker };
@@ -15,7 +15,7 @@ function DatePickerInput(props) {
15
15
  {
16
16
  ...props,
17
17
  maxLength: 11,
18
- placeholder: props.placeholder ?? "MM DD YYYY"
18
+ placeholder: props.placeholder ?? "MM/DD/YYYY"
19
19
  }
20
20
  )
21
21
  ] });
@@ -11,7 +11,7 @@ function DatePickerInput(props) {
11
11
  {
12
12
  ...props,
13
13
  maxLength: 11,
14
- placeholder: props.placeholder ?? "MM DD YYYY"
14
+ placeholder: props.placeholder ?? "MM/DD/YYYY"
15
15
  }
16
16
  )
17
17
  ] });
@@ -15,7 +15,7 @@ function RangePickerInput(props) {
15
15
  {
16
16
  ...props,
17
17
  "data-range-input": true,
18
- placeholder: props.placeholder ?? "MM DD YYYY",
18
+ placeholder: props.placeholder ?? "MM/DD/YYYY",
19
19
  maxLength: 11,
20
20
  index: 0
21
21
  }
@@ -26,7 +26,7 @@ function RangePickerInput(props) {
26
26
  ...props,
27
27
  "data-range-input": true,
28
28
  "data-range-end-input": true,
29
- placeholder: props.placeholder ?? "MM DD YYYY",
29
+ placeholder: props.placeholder ?? "MM/DD/YYYY",
30
30
  maxLength: 11,
31
31
  index: 1
32
32
  }
@@ -11,7 +11,7 @@ function RangePickerInput(props) {
11
11
  {
12
12
  ...props,
13
13
  "data-range-input": true,
14
- placeholder: props.placeholder ?? "MM DD YYYY",
14
+ placeholder: props.placeholder ?? "MM/DD/YYYY",
15
15
  maxLength: 11,
16
16
  index: 0
17
17
  }
@@ -22,7 +22,7 @@ function RangePickerInput(props) {
22
22
  ...props,
23
23
  "data-range-input": true,
24
24
  "data-range-end-input": true,
25
- placeholder: props.placeholder ?? "MM DD YYYY",
25
+ placeholder: props.placeholder ?? "MM/DD/YYYY",
26
26
  maxLength: 11,
27
27
  index: 1
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.25.2",
3
+ "version": "0.25.3",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -28,7 +28,7 @@
28
28
  "vite": "^7.3.1",
29
29
  "vite-plugin-dts": "^4.5.4",
30
30
  "@cerberus-design/configs": "0.0.0",
31
- "@cerberus/panda-preset": "0.25.2"
31
+ "@cerberus/panda-preset": "0.25.3"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
@@ -1,13 +1,7 @@
1
1
  'use client'
2
2
 
3
- import { DateValue } from '@ark-ui/react/date-picker'
4
3
  import { DatePickerParts } from './parts'
5
4
  import type { DatePickerRootProps } from './primitives'
6
- import { CalendarDate } from '@internationalized/date'
7
-
8
- const FULL_DATE_REGEX = /^(\d{1,2})[\s/](\d{1,2})[\s/](\d{4})$/
9
- const PARTIAL_DATE_REGEX = /^(\d{1,2})[\s/](\d{1,2})$/
10
- const MONTH_REGEX = /^(\d{1,2})$/
11
5
 
12
6
  /**
13
7
  * DatePicker component is an abstraction of the DatePickerRoot primitive which
@@ -17,8 +11,6 @@ const MONTH_REGEX = /^(\d{1,2})$/
17
11
  export function DatePicker(props: DatePickerRootProps) {
18
12
  return (
19
13
  <DatePickerParts.Root
20
- format={handleFormat}
21
- parse={parse}
22
14
  positioning={{
23
15
  placement: 'bottom-start',
24
16
  }}
@@ -26,47 +18,3 @@ export function DatePicker(props: DatePickerRootProps) {
26
18
  />
27
19
  )
28
20
  }
29
-
30
- function parse(value: string): DateValue | undefined {
31
- const fullMatch = value.match(FULL_DATE_REGEX)
32
- if (fullMatch) {
33
- const [, month, day, year] = fullMatch.map(Number)
34
- try {
35
- return new CalendarDate(year, month, day) as unknown as DateValue
36
- } catch {
37
- return undefined
38
- }
39
- }
40
-
41
- const partialMatch = value.match(PARTIAL_DATE_REGEX)
42
- if (partialMatch) {
43
- const [, month, day] = partialMatch.map(Number)
44
- const currentYear = new Date().getFullYear()
45
- try {
46
- return new CalendarDate(currentYear, month, day) as unknown as DateValue
47
- } catch {
48
- return undefined
49
- }
50
- }
51
-
52
- const monthMatch = value.match(MONTH_REGEX)
53
- if (monthMatch) {
54
- const [, month] = monthMatch.map(Number)
55
- const currentYear = new Date().getFullYear()
56
- try {
57
- if (month < 1 || month > 12) return undefined
58
- return new CalendarDate(currentYear, month, 1) as unknown as DateValue
59
- } catch {
60
- return undefined
61
- }
62
- }
63
-
64
- return undefined
65
- }
66
-
67
- function handleFormat(date: DateValue): string {
68
- const day = date.day.toString().padStart(2, '0')
69
- const month = date.month.toString().padStart(2, '0')
70
- const year = date.year.toString()
71
- return `${month} ${day} ${year}`
72
- }
@@ -19,7 +19,7 @@ export function DatePickerInput(props: DatePickerInputElProps) {
19
19
  <DatePickerParts.Input
20
20
  {...props}
21
21
  maxLength={11}
22
- placeholder={props.placeholder ?? 'MM DD YYYY'}
22
+ placeholder={props.placeholder ?? 'MM/DD/YYYY'}
23
23
  />
24
24
  </DatePickerParts.Control>
25
25
  )
@@ -21,7 +21,7 @@ export function RangePickerInput(props: RangePickerInputProps) {
21
21
  <DatePickerParts.Input
22
22
  {...props}
23
23
  data-range-input
24
- placeholder={props.placeholder ?? 'MM DD YYYY'}
24
+ placeholder={props.placeholder ?? 'MM/DD/YYYY'}
25
25
  maxLength={11}
26
26
  index={0}
27
27
  />
@@ -29,7 +29,7 @@ export function RangePickerInput(props: RangePickerInputProps) {
29
29
  {...props}
30
30
  data-range-input
31
31
  data-range-end-input
32
- placeholder={props.placeholder ?? 'MM DD YYYY'}
32
+ placeholder={props.placeholder ?? 'MM/DD/YYYY'}
33
33
  maxLength={11}
34
34
  index={1}
35
35
  />