@dreamstack-us/kaal 0.0.1 → 0.0.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.
- package/README.md +165 -0
- package/lib/module/components/CalendarGrid/CalendarGrid.js +125 -29
- package/lib/module/components/CalendarGrid/CalendarGrid.js.map +1 -1
- package/lib/module/components/CalendarGrid/CalendarGrid.styles.js +22 -17
- package/lib/module/components/CalendarGrid/CalendarGrid.styles.js.map +1 -1
- package/lib/module/components/CalendarGrid/CalendarGrid.web.js +265 -0
- package/lib/module/components/CalendarGrid/CalendarGrid.web.js.map +1 -0
- package/lib/module/components/CalendarGrid/DayCell.js +77 -53
- package/lib/module/components/CalendarGrid/DayCell.js.map +1 -1
- package/lib/module/components/CalendarGrid/DayCell.web.js +124 -0
- package/lib/module/components/CalendarGrid/DayCell.web.js.map +1 -0
- package/lib/module/components/CalendarGrid/index.js +1 -1
- package/lib/module/components/CalendarGrid/index.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.android.js +53 -21
- package/lib/module/components/DatePicker/DatePicker.android.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.ios.js +55 -23
- package/lib/module/components/DatePicker/DatePicker.ios.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.styles.js +19 -20
- package/lib/module/components/DatePicker/DatePicker.styles.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.web.js +59 -21
- package/lib/module/components/DatePicker/DatePicker.web.js.map +1 -1
- package/lib/module/components/TimePicker/ClockFace.js +27 -7
- package/lib/module/components/TimePicker/ClockFace.js.map +1 -1
- package/lib/module/components/TimePicker/ClockFace.web.js +253 -0
- package/lib/module/components/TimePicker/ClockFace.web.js.map +1 -0
- package/lib/module/components/TimePicker/MaterialTimePicker.js +68 -16
- package/lib/module/components/TimePicker/MaterialTimePicker.js.map +1 -1
- package/lib/module/components/TimePicker/MaterialTimePicker.web.js +231 -0
- package/lib/module/components/TimePicker/MaterialTimePicker.web.js.map +1 -0
- package/lib/module/components/TimePicker/TimePicker.android.js +13 -6
- package/lib/module/components/TimePicker/TimePicker.android.js.map +1 -1
- package/lib/module/components/TimePicker/TimePicker.ios.js +14 -7
- package/lib/module/components/TimePicker/TimePicker.ios.js.map +1 -1
- package/lib/module/components/TimePicker/TimePicker.styles.js +53 -45
- package/lib/module/components/TimePicker/TimePicker.styles.js.map +1 -1
- package/lib/module/components/TimePicker/TimePicker.web.js +24 -12
- package/lib/module/components/TimePicker/TimePicker.web.js.map +1 -1
- package/lib/module/components/TimePicker/TimeWheelPicker.js +45 -10
- package/lib/module/components/TimePicker/TimeWheelPicker.js.map +1 -1
- package/lib/module/components/TimePicker/TimeWheelPicker.web.js +339 -0
- package/lib/module/components/TimePicker/TimeWheelPicker.web.js.map +1 -0
- package/lib/module/components/TimePicker/index.js +3 -3
- package/lib/module/components/TimePicker/index.js.map +1 -1
- package/lib/module/components/WheelPicker/WheelPicker.js +21 -2
- package/lib/module/components/WheelPicker/WheelPicker.js.map +1 -1
- package/lib/module/components/WheelPicker/WheelPicker.styles.js +13 -8
- package/lib/module/components/WheelPicker/WheelPicker.styles.js.map +1 -1
- package/lib/module/components/WheelPicker/WheelPicker.web.js +146 -57
- package/lib/module/components/WheelPicker/WheelPicker.web.js.map +1 -1
- package/lib/module/context/ThemeOverrideContext.js +34 -0
- package/lib/module/context/ThemeOverrideContext.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/validation.js +74 -34
- package/lib/module/utils/validation.js.map +1 -1
- package/lib/typescript/components/CalendarGrid/CalendarGrid.d.ts +24 -3
- package/lib/typescript/components/CalendarGrid/CalendarGrid.d.ts.map +1 -1
- package/lib/typescript/components/CalendarGrid/CalendarGrid.styles.d.ts +12 -10
- package/lib/typescript/components/CalendarGrid/CalendarGrid.styles.d.ts.map +1 -1
- package/lib/typescript/components/CalendarGrid/CalendarGrid.web.d.ts +33 -0
- package/lib/typescript/components/CalendarGrid/CalendarGrid.web.d.ts.map +1 -0
- package/lib/typescript/components/CalendarGrid/DayCell.d.ts +3 -0
- package/lib/typescript/components/CalendarGrid/DayCell.d.ts.map +1 -1
- package/lib/typescript/components/CalendarGrid/DayCell.web.d.ts +15 -0
- package/lib/typescript/components/CalendarGrid/DayCell.web.d.ts.map +1 -0
- package/lib/typescript/components/DatePicker/DatePicker.android.d.ts.map +1 -1
- package/lib/typescript/components/DatePicker/DatePicker.d.ts +27 -4
- package/lib/typescript/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/components/DatePicker/DatePicker.ios.d.ts.map +1 -1
- package/lib/typescript/components/DatePicker/DatePicker.styles.d.ts +12 -13
- package/lib/typescript/components/DatePicker/DatePicker.styles.d.ts.map +1 -1
- package/lib/typescript/components/DatePicker/DatePicker.web.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/ClockFace.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/ClockFace.web.d.ts +12 -0
- package/lib/typescript/components/TimePicker/ClockFace.web.d.ts.map +1 -0
- package/lib/typescript/components/TimePicker/MaterialTimePicker.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/MaterialTimePicker.web.d.ts +12 -0
- package/lib/typescript/components/TimePicker/MaterialTimePicker.web.d.ts.map +1 -0
- package/lib/typescript/components/TimePicker/TimePicker.android.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/TimePicker.ios.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/TimePicker.styles.d.ts +29 -25
- package/lib/typescript/components/TimePicker/TimePicker.styles.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/TimePicker.web.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/TimeWheelPicker.d.ts.map +1 -1
- package/lib/typescript/components/TimePicker/TimeWheelPicker.web.d.ts +11 -0
- package/lib/typescript/components/TimePicker/TimeWheelPicker.web.d.ts.map +1 -0
- package/lib/typescript/components/WheelPicker/WheelPicker.d.ts +14 -1
- package/lib/typescript/components/WheelPicker/WheelPicker.d.ts.map +1 -1
- package/lib/typescript/components/WheelPicker/WheelPicker.styles.d.ts +9 -7
- package/lib/typescript/components/WheelPicker/WheelPicker.styles.d.ts.map +1 -1
- package/lib/typescript/components/WheelPicker/WheelPicker.web.d.ts.map +1 -1
- package/lib/typescript/context/ThemeOverrideContext.d.ts +23 -0
- package/lib/typescript/context/ThemeOverrideContext.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +4 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types/datepicker.d.ts +78 -3
- package/lib/typescript/types/datepicker.d.ts.map +1 -1
- package/lib/typescript/types/timepicker.d.ts +62 -0
- package/lib/typescript/types/timepicker.d.ts.map +1 -1
- package/lib/typescript/utils/validation.d.ts +47 -27
- package/lib/typescript/utils/validation.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/CalendarGrid/CalendarGrid.styles.ts +21 -17
- package/src/components/CalendarGrid/CalendarGrid.tsx +265 -85
- package/src/components/CalendarGrid/CalendarGrid.web.tsx +396 -0
- package/src/components/CalendarGrid/DayCell.tsx +122 -61
- package/src/components/CalendarGrid/DayCell.web.tsx +171 -0
- package/src/components/DatePicker/DatePicker.android.tsx +48 -24
- package/src/components/DatePicker/DatePicker.ios.tsx +51 -27
- package/src/components/DatePicker/DatePicker.styles.ts +18 -22
- package/src/components/DatePicker/DatePicker.tsx +35 -4
- package/src/components/DatePicker/DatePicker.web.tsx +55 -23
- package/src/components/TimePicker/ClockFace.tsx +34 -8
- package/src/components/TimePicker/ClockFace.web.tsx +303 -0
- package/src/components/TimePicker/MaterialTimePicker.tsx +144 -13
- package/src/components/TimePicker/MaterialTimePicker.web.tsx +271 -0
- package/src/components/TimePicker/TimePicker.android.tsx +9 -1
- package/src/components/TimePicker/TimePicker.ios.tsx +10 -6
- package/src/components/TimePicker/TimePicker.styles.ts +52 -45
- package/src/components/TimePicker/TimePicker.web.tsx +17 -7
- package/src/components/TimePicker/TimeWheelPicker.tsx +60 -6
- package/src/components/TimePicker/TimeWheelPicker.web.tsx +401 -0
- package/src/components/WheelPicker/WheelPicker.styles.ts +12 -8
- package/src/components/WheelPicker/WheelPicker.tsx +24 -2
- package/src/components/WheelPicker/WheelPicker.web.tsx +153 -57
- package/src/context/ThemeOverrideContext.tsx +38 -0
- package/src/index.ts +13 -0
- package/src/types/datepicker.ts +87 -3
- package/src/types/timepicker.ts +74 -0
- package/src/utils/validation.ts +111 -55
- package/lib/module/unistyles.js +0 -9
- package/lib/module/unistyles.js.map +0 -1
- package/lib/typescript/unistyles.d.ts +0 -3
- package/lib/typescript/unistyles.d.ts.map +0 -1
- package/src/unistyles.ts +0 -6
package/src/utils/validation.ts
CHANGED
|
@@ -1,76 +1,132 @@
|
|
|
1
|
-
import * as v from 'valibot';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Simple validation utilities for date/time pickers
|
|
3
|
+
* No external dependencies - just inline checks
|
|
6
4
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
|
|
6
|
+
// ISO date regex pattern
|
|
7
|
+
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
8
|
+
const ISO_DATETIME_PATTERN =
|
|
9
|
+
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|[+-]\d{2}:\d{2})?$/;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Validates an ISO 8601 date string (YYYY-MM-DD)
|
|
14
13
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
14
|
+
export function isValidISODate(value: string): boolean {
|
|
15
|
+
if (!ISO_DATE_PATTERN.test(value)) return false;
|
|
16
|
+
|
|
17
|
+
const [year, month, day] = value.split('-').map(Number) as [
|
|
18
|
+
number,
|
|
19
|
+
number,
|
|
20
|
+
number,
|
|
21
|
+
];
|
|
22
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
date.getUTCFullYear() === year &&
|
|
26
|
+
date.getUTCMonth() === month - 1 &&
|
|
27
|
+
date.getUTCDate() === day
|
|
28
|
+
);
|
|
29
|
+
}
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
|
-
* Validates an ISO 8601 datetime string
|
|
32
|
+
* Validates an ISO 8601 datetime string
|
|
31
33
|
*/
|
|
32
|
-
export
|
|
34
|
+
export function isValidISODateTime(value: string): boolean {
|
|
35
|
+
if (!ISO_DATETIME_PATTERN.test(value)) return false;
|
|
36
|
+
const date = new Date(value);
|
|
37
|
+
return !Number.isNaN(date.getTime());
|
|
38
|
+
}
|
|
33
39
|
|
|
34
40
|
/**
|
|
35
|
-
* Validates a
|
|
41
|
+
* Validates a time value (24-hour format)
|
|
36
42
|
*/
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
43
|
+
export function isValidTime(hours: number, minutes: number): boolean {
|
|
44
|
+
return (
|
|
45
|
+
Number.isInteger(hours) &&
|
|
46
|
+
Number.isInteger(minutes) &&
|
|
47
|
+
hours >= 0 &&
|
|
48
|
+
hours <= 23 &&
|
|
49
|
+
minutes >= 0 &&
|
|
50
|
+
minutes <= 59
|
|
51
|
+
);
|
|
52
|
+
}
|
|
46
53
|
|
|
47
54
|
/**
|
|
48
|
-
* Validates date
|
|
55
|
+
* Validates a date range where start <= end
|
|
49
56
|
*/
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
disabledDates: v.optional(v.array(isoDateSchema)),
|
|
55
|
-
});
|
|
57
|
+
export function isValidDateRange(start: string, end: string): boolean {
|
|
58
|
+
if (!isValidISODate(start) || !isValidISODate(end)) return false;
|
|
59
|
+
return start <= end;
|
|
60
|
+
}
|
|
56
61
|
|
|
57
62
|
/**
|
|
58
63
|
* Parses an ISO date string to a Date object
|
|
59
|
-
*
|
|
64
|
+
* Returns null if invalid
|
|
60
65
|
*/
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
);
|
|
66
|
+
export function parseISODateSafe(value: string): Date | null {
|
|
67
|
+
if (!isValidISODate(value)) return null;
|
|
68
|
+
const [year, month, day] = value.split('-').map(Number) as [
|
|
69
|
+
number,
|
|
70
|
+
number,
|
|
71
|
+
number,
|
|
72
|
+
];
|
|
73
|
+
return new Date(Date.UTC(year, month - 1, day));
|
|
74
|
+
}
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
// Types for date picker values
|
|
77
|
+
export interface DatePickerValue {
|
|
78
|
+
selectedDate: string;
|
|
79
|
+
minDate?: string;
|
|
80
|
+
maxDate?: string;
|
|
81
|
+
disabledDates?: string[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface DateRange {
|
|
85
|
+
start: string;
|
|
86
|
+
end: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Legacy schema exports for backward compatibility
|
|
90
|
+
// These are now simple validation functions, not valibot schemas
|
|
74
91
|
|
|
75
|
-
|
|
76
|
-
export
|
|
92
|
+
/** @deprecated Use isValidISODate() instead */
|
|
93
|
+
export const isoDateSchema = {
|
|
94
|
+
parse: (value: string) => {
|
|
95
|
+
if (!isValidISODate(value)) throw new Error('Invalid ISO date');
|
|
96
|
+
return value;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** @deprecated Use isValidISODateTime() instead */
|
|
101
|
+
export const isoDateTimeSchema = {
|
|
102
|
+
parse: (value: string) => {
|
|
103
|
+
if (!isValidISODateTime(value)) throw new Error('Invalid ISO datetime');
|
|
104
|
+
return value;
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** @deprecated Use isValidDateRange() instead */
|
|
109
|
+
export const dateRangeSchema = {
|
|
110
|
+
parse: (value: DateRange) => {
|
|
111
|
+
if (!isValidDateRange(value.start, value.end))
|
|
112
|
+
throw new Error('Invalid date range');
|
|
113
|
+
return value;
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** @deprecated Use DatePickerValue type instead */
|
|
118
|
+
export const datePickerValueSchema = {
|
|
119
|
+
parse: (value: DatePickerValue) => value,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** @deprecated Use parseISODateSafe() instead */
|
|
123
|
+
export const dateSchema = {
|
|
124
|
+
parse: (value: string) => {
|
|
125
|
+
const date = parseISODateSafe(value);
|
|
126
|
+
if (!date) throw new Error('Invalid date');
|
|
127
|
+
return date;
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** @deprecated Alias for dateSchema */
|
|
132
|
+
export const temporalDateSchema = dateSchema;
|
package/lib/module/unistyles.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Re-export theme configuration from @dreamstack-us/kaal-themes
|
|
4
|
-
// This ensures the module augmentation is applied
|
|
5
|
-
export { configureKaalThemes } from '@dreamstack-us/kaal-themes';
|
|
6
|
-
|
|
7
|
-
// Import to ensure type augmentation is applied during build
|
|
8
|
-
import '@dreamstack-us/kaal-themes';
|
|
9
|
-
//# sourceMappingURL=unistyles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["configureKaalThemes"],"sourceRoot":"../../src","sources":["unistyles.ts"],"mappings":";;AAAA;AACA;AACA,SAASA,mBAAmB,QAAQ,4BAA4B;;AAEhE;AACA,OAAO,4BAA4B","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../src/unistyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,4BAA4B,CAAC"}
|
package/src/unistyles.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Re-export theme configuration from @dreamstack-us/kaal-themes
|
|
2
|
-
// This ensures the module augmentation is applied
|
|
3
|
-
export { configureKaalThemes } from '@dreamstack-us/kaal-themes';
|
|
4
|
-
|
|
5
|
-
// Import to ensure type augmentation is applied during build
|
|
6
|
-
import '@dreamstack-us/kaal-themes';
|