@urbicon-ui/blocks 6.19.0 → 6.19.2
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 +5 -5
- package/dist/components/AreaChart/AreaChart.svelte +7 -3
- package/dist/components/BarChart/BarChart.svelte +7 -3
- package/dist/components/Calendar/Calendar.svelte +46 -29
- package/dist/components/Calendar/CalendarAgendaView.svelte +1 -1
- package/dist/components/Calendar/CalendarDayView.svelte +19 -39
- package/dist/components/Calendar/CalendarDayView.svelte.d.ts +1 -3
- package/dist/components/Calendar/CalendarEventItem.svelte +0 -1
- package/dist/components/Calendar/CalendarGrid.svelte +12 -8
- package/dist/components/Calendar/CalendarHeader.svelte +2 -2
- package/dist/components/Calendar/CalendarMiniMonth.svelte +0 -2
- package/dist/components/Calendar/CalendarTimeEvent.svelte +1 -1
- package/dist/components/Calendar/CalendarTimeGrid.svelte +0 -3
- package/dist/components/Calendar/CalendarWeekGrid.svelte +1 -1
- package/dist/components/Calendar/calendar.context.d.ts +1 -0
- package/dist/components/Calendar/calendar.types.d.ts +2 -0
- package/dist/components/Calendar/calendar.variants.d.ts +0 -12
- package/dist/components/Calendar/calendar.variants.js +0 -4
- package/dist/components/Calendar/index.d.ts +6 -2
- package/dist/components/CompositionBar/CompositionBar.svelte +1 -1
- package/dist/components/CompositionBar/composition-bar.variants.d.ts +15 -16
- package/dist/components/CompositionBar/composition-bar.variants.js +4 -2
- package/dist/components/CompositionBar/index.d.ts +1 -1
- package/dist/components/CurrencyInput/CurrencyInput.svelte +10 -4
- package/dist/components/CurrencyInput/index.d.ts +13 -11
- package/dist/components/DatePicker/DatePicker.svelte +5 -3
- package/dist/components/DatePicker/DateRangePicker.svelte +3 -3
- package/dist/components/DatePicker/datepicker.engine.d.ts +6 -6
- package/dist/components/DatePicker/datepicker.engine.js +13 -13
- package/dist/components/DonutChart/DonutChart.svelte +5 -3
- package/dist/components/LineChart/LineChart.svelte +7 -3
- package/dist/components/Planner/Planner.svelte +7 -3
- package/dist/components/Planner/PlannerHeader.svelte +1 -1
- package/dist/components/Planner/planner.types.d.ts +3 -0
- package/dist/date/compare.d.ts +8 -0
- package/dist/date/compare.js +15 -0
- package/dist/date/index.d.ts +1 -1
- package/dist/date/index.js +1 -1
- package/dist/i18n/index.d.ts +24 -378
- package/dist/internal/date-grid/date-grid.svelte.d.ts +18 -3
- package/dist/internal/date-grid/date-grid.svelte.js +60 -19
- package/dist/internal/date-grid/index.d.ts +2 -2
- package/dist/internal/date-grid/index.js +2 -2
- package/dist/mint/README.md +12 -9
- package/dist/mint/registry.js +12 -0
- package/dist/primitives/Badge/badge.variants.d.ts +0 -1
- package/dist/primitives/Badge/badge.variants.js +1 -2
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +1 -2
- package/dist/primitives/ButtonGroup/ButtonGroup.svelte +1 -1
- package/dist/primitives/Combobox/Combobox.svelte +9 -1
- package/dist/primitives/Combobox/combobox.variants.d.ts +29 -0
- package/dist/primitives/Combobox/combobox.variants.js +22 -7
- package/dist/primitives/Menu/Menu.svelte +2 -2
- package/dist/primitives/Pagination/Pagination.svelte +10 -2
- package/dist/primitives/Pagination/PaginationItem.svelte +0 -2
- package/dist/primitives/Select/Select.svelte +0 -1
- package/dist/primitives/Stepper/StepperStep.svelte +3 -1
- package/dist/translations/de.d.ts +11 -7
- package/dist/translations/de.js +12 -8
- package/dist/translations/en.d.ts +11 -7
- package/dist/translations/en.js +12 -8
- package/dist/utils/date.d.ts +5 -0
- package/dist/utils/date.js +34 -24
- package/package.json +3 -3
package/dist/utils/date.js
CHANGED
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
* example because the database driver serialises timestamps that way),
|
|
7
7
|
* use these helpers to convert in both directions instead of redoing the
|
|
8
8
|
* arithmetic at every form site.
|
|
9
|
+
*
|
|
10
|
+
* The strict `YYYY-MM-DD` ↔ `Date` core is not reimplemented here: it lives in
|
|
11
|
+
* `../date/range` (`toIso` / `isoToDate`, the Layer-0 source of truth). These
|
|
12
|
+
* tolerant form helpers delegate to it and only add the tolerant shape rules
|
|
13
|
+
* (empty/undefined → nullish, 1-digit month/day, epoch-number coercion).
|
|
9
14
|
*/
|
|
15
|
+
import { isoToDate, toIso } from '../date/range.js';
|
|
10
16
|
/** Detect a finite, valid `Date` instance. */
|
|
11
17
|
function isValidDate(d) {
|
|
12
18
|
return !Number.isNaN(d.getTime());
|
|
@@ -48,15 +54,20 @@ export function coerceToDate(input) {
|
|
|
48
54
|
return undefined;
|
|
49
55
|
const dateOnly = trimmed.match(DATE_ONLY_RE);
|
|
50
56
|
if (dateOnly) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
// Pad to canonical YYYY-MM-DD so 1-digit month/day stays tolerated, then
|
|
58
|
+
// delegate the strict parse + day-existence check to `isoToDate`.
|
|
59
|
+
const canonical = `${dateOnly[1]}-${dateOnly[2].padStart(2, '0')}-${dateOnly[3].padStart(2, '0')}`;
|
|
60
|
+
try {
|
|
61
|
+
return isoToDate(canonical);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
// isoToDate throws a RangeError only for a non-existent day; anything
|
|
65
|
+
// else is unexpected and should surface, not be mislabelled here.
|
|
66
|
+
if (!(err instanceof RangeError))
|
|
67
|
+
throw err;
|
|
68
|
+
console.warn('[DatePicker] coerceToDate rejected out-of-range date-only string', { input });
|
|
69
|
+
return undefined;
|
|
57
70
|
}
|
|
58
|
-
console.warn('[DatePicker] coerceToDate rejected out-of-range date-only string', { input });
|
|
59
|
-
return undefined;
|
|
60
71
|
}
|
|
61
72
|
const date = new Date(trimmed);
|
|
62
73
|
if (!isValidDate(date)) {
|
|
@@ -87,12 +98,7 @@ export function coerceToDate(input) {
|
|
|
87
98
|
*/
|
|
88
99
|
export function toDateInputValue(d) {
|
|
89
100
|
const date = coerceToDate(d);
|
|
90
|
-
|
|
91
|
-
return '';
|
|
92
|
-
const year = date.getFullYear();
|
|
93
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
94
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
95
|
-
return `${year}-${month}-${day}`;
|
|
101
|
+
return date ? toIso(date) : '';
|
|
96
102
|
}
|
|
97
103
|
/**
|
|
98
104
|
* Parse a `YYYY-MM-DD` (or any other `Date`-parseable) string into a
|
|
@@ -109,17 +115,21 @@ export function fromDateInputValue(s) {
|
|
|
109
115
|
return null;
|
|
110
116
|
const dateOnly = trimmed.match(DATE_ONLY_RE);
|
|
111
117
|
if (dateOnly) {
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
// Same delegated strict parse as `coerceToDate`, but nullish on failure.
|
|
119
|
+
const canonical = `${dateOnly[1]}-${dateOnly[2].padStart(2, '0')}-${dateOnly[3].padStart(2, '0')}`;
|
|
120
|
+
try {
|
|
121
|
+
return isoToDate(canonical);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
// isoToDate throws a RangeError only for a non-existent day; anything
|
|
125
|
+
// else is unexpected and should surface, not be mislabelled here.
|
|
126
|
+
if (!(err instanceof RangeError))
|
|
127
|
+
throw err;
|
|
128
|
+
console.warn('[DatePicker] fromDateInputValue rejected out-of-range date-only string', {
|
|
129
|
+
input: s
|
|
130
|
+
});
|
|
131
|
+
return null;
|
|
118
132
|
}
|
|
119
|
-
console.warn('[DatePicker] fromDateInputValue rejected out-of-range date-only string', {
|
|
120
|
-
input: s
|
|
121
|
-
});
|
|
122
|
-
return null;
|
|
123
133
|
}
|
|
124
134
|
const date = new Date(trimmed);
|
|
125
135
|
if (!isValidDate(date)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urbicon-ui/blocks",
|
|
3
|
-
"version": "6.19.
|
|
3
|
+
"version": "6.19.2",
|
|
4
4
|
"description": "Svelte 5 UI component library with Tailwind CSS 4, OKLCH design tokens and zero runtime dependencies",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"@sveltejs/package": "^2.5.8",
|
|
92
92
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
93
93
|
"@tailwindcss/vite": "^4.3.1",
|
|
94
|
-
"@urbicon-ui/i18n": "6.19.
|
|
95
|
-
"@urbicon-ui/shared-types": "6.19.
|
|
94
|
+
"@urbicon-ui/i18n": "6.19.2",
|
|
95
|
+
"@urbicon-ui/shared-types": "6.19.2",
|
|
96
96
|
"prettier": "^3.8.4",
|
|
97
97
|
"prettier-plugin-svelte": "^4.1.1",
|
|
98
98
|
"prettier-plugin-tailwindcss": "^0.8.0",
|