Skip to content

Commit 6b9f540

Browse files
committed
refactor: prepare for next headless date input
1 parent b7f7463 commit 6b9f540

File tree

11 files changed

+339
-233
lines changed

11 files changed

+339
-233
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## [5.9.0] - 2025-06-05
4+
5+
### new features:
6+
- add jsdoc to some public attribute and properties for more clarity.
7+
### refactor:
8+
- extract the validations and typing logic from component to stateless functions for next release plan of headless date input.
9+
- refactor `beforeinput` events and move logic to the `utils`.
10+
- remove `this` dependency from utils functions and make them stateless.
11+
312
## [5.8.1] - 2025-05-21
413
### fixed:
514
- fix name assignment on react 19

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"nodeModulesDir":"manual",
77

8-
"version": "0.0.4",
8+
"version": "0.0.5",
99
"exports": "./mod.ts",
1010
"imports": {
1111
"jb-calendar": "npm:jb-calendar@4.1.5",

lib/constants.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const emptyInputValueString = ' / / ';
2+
/**
3+
* format of your input date strings. it effects value, min & max or other value that provides in string type to the component.
4+
*/
5+
export const inputFormat = 'YYYY/MM/DD';
6+
export const inputRegex = /^(?<year>[\u06F0-\u06F90-9,\s]{4})\/(?<month>[\u06F0-\u06F90-9,\s]{2})\/(?<day>[\u06F0-\u06F90-9,\s]{2})$/g
7+
8+
export const dictionary = {
9+
errors: {
10+
minRangeViolation: 'تاریخ انتخابی کمتر از بازه مجاز است',
11+
maxRangeViolation: 'تاریخ انتخابی بیشتر از بازه مجاز است',
12+
required:'لطفا مقدار تاریخ را کامل وارد کنید',
13+
}
14+
}

lib/date-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import { InputTypes, JBDateInputValueObject, ValueTypes, ValueType, InputType, InputtedValueInObject, DateValidResult } from './types';
3-
import { getEmptyValueObject } from './helpers';
3+
import { getEmptyValueObject } from './utils';
44
import { getYear, getMonth, getTime as getTimeStamp, isLeapYear, getDate } from 'date-fns';
55
import { newDate, isLeapYear as isJalaliLeapYear, getYear as getJalaliYear, getMonth as getJalaliMonth, getDate as getJalaliDate, getHours, getMinutes, getSeconds, getMilliseconds } from 'date-fns-jalali';
66

lib/helpers.ts

Lines changed: 0 additions & 89 deletions
This file was deleted.

lib/jb-date-input.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
.jb-date-input-web-component {
99
width: 100%;
10-
margin: var(--jb-date-input-margin, 0 0);
10+
margin: var(--margin);
1111
position: relative;
1212

1313
&:focus-visible {
1414
outline: none;
1515
}
1616
.calendar-trigger {
17-
display: var(--jb-date-input-calendar-trigger-display, block);
18-
width: var(--jb-date-input-calendar-trigger-width, 1.5rem);
19-
height: var(--jb-date-input-calendar-trigger-height, 1.5rem);
17+
display: var(--calendar-trigger-display, block);
18+
width: var(--calendar-trigger-width, 1.5rem);
19+
height: var(--calendar-trigger-height, 1.5rem);
2020
cursor: pointer;
2121
object-fit: contain;
2222
&.--active {

0 commit comments

Comments
 (0)