@marianmeres/stuic 3.171.0 → 3.172.0

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.
Files changed (53) hide show
  1. package/AGENTS.md +10 -8
  2. package/API.md +90 -0
  3. package/README.md +1 -1
  4. package/dist/components/AssetsPreview/AssetsPreview.fixture.svelte +1 -1
  5. package/dist/components/Calendar/Calendar.svelte +799 -0
  6. package/dist/components/Calendar/Calendar.svelte.d.ts +135 -0
  7. package/dist/components/Calendar/README.md +294 -0
  8. package/dist/components/Calendar/calendar-i18n-sk.d.ts +20 -0
  9. package/dist/components/Calendar/calendar-i18n-sk.js +46 -0
  10. package/dist/components/Calendar/calendar-i18n.d.ts +61 -0
  11. package/dist/components/Calendar/calendar-i18n.js +73 -0
  12. package/dist/components/Calendar/index.css +307 -0
  13. package/dist/components/Calendar/index.d.ts +5 -0
  14. package/dist/components/Calendar/index.js +5 -0
  15. package/dist/components/Calendar/iso-date.d.ts +107 -0
  16. package/dist/components/Calendar/iso-date.js +247 -0
  17. package/dist/components/CommandMenu/CommandMenu.fixture.svelte +1 -1
  18. package/dist/components/Input/FieldDate.svelte +349 -0
  19. package/dist/components/Input/FieldDate.svelte.d.ts +79 -0
  20. package/dist/components/Input/FieldDateRange.svelte +373 -0
  21. package/dist/components/Input/FieldDateRange.svelte.d.ts +90 -0
  22. package/dist/components/Input/README.md +149 -16
  23. package/dist/components/Input/_internal/FieldDateShell.svelte +327 -0
  24. package/dist/components/Input/_internal/FieldDateShell.svelte.d.ts +66 -0
  25. package/dist/components/Input/index.css +119 -0
  26. package/dist/components/Input/index.d.ts +2 -0
  27. package/dist/components/Input/index.js +2 -0
  28. package/dist/components/ModalDialog/ModalDialog.fixture.svelte +1 -1
  29. package/dist/components/SlidingPanels/SlidingPanels.fixture.svelte +1 -1
  30. package/dist/icons/index.d.ts +1 -0
  31. package/dist/icons/index.js +1 -0
  32. package/dist/index.css +1 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +1 -0
  35. package/docs/_archive/README.md +10 -0
  36. package/docs/{component-testing → _archive/component-testing}/00-overview-and-roadmap.md +8 -6
  37. package/docs/{component-testing → _archive/component-testing}/01-framework-setup.md +4 -2
  38. package/docs/{component-testing → _archive/component-testing}/03-component-coverage-roadmap.md +3 -1
  39. package/docs/{component-testing → _archive/component-testing}/04-hard-cases-and-e2e.md +5 -3
  40. package/docs/{component-testing → _archive/component-testing}/05-ci.md +2 -0
  41. package/docs/{component-testing → _archive/component-testing}/PROGRESS.md +3 -1
  42. package/docs/_archive/component-testing/README.md +28 -0
  43. package/docs/{upgrading.md → _archive/upgrading.md} +2 -0
  44. package/docs/architecture.md +19 -11
  45. package/docs/domains/actions.md +4 -3
  46. package/docs/domains/components.md +22 -19
  47. package/docs/domains/utils.md +2 -1
  48. package/docs/maybe-todo.md +6 -6
  49. package/docs/tasks.md +19 -9
  50. package/docs/{component-testing/02-test-conventions.md → testing-components.md} +30 -31
  51. package/docs/testing.md +3 -3
  52. package/package.json +2 -1
  53. package/docs/component-testing/README.md +0 -38
package/AGENTS.md CHANGED
@@ -23,10 +23,10 @@
23
23
 
24
24
  ```
25
25
  src/lib/
26
- ├── components/ # 74 component directories
27
- ├── actions/ # 15 Svelte actions (use: directives)
26
+ ├── components/ # 75 component directories
27
+ ├── actions/ # 16 Svelte actions (use: directives)
28
28
  ├── attachments/ # Svelte attachments ({@attach} — preferred for new DOM helpers)
29
- ├── utils/ # 45 utility modules
29
+ ├── utils/ # 55 utility modules (48 on the barrel)
30
30
  ├── icons/ # Icon re-exports from @marianmeres/icons-fns
31
31
  ├── css/ # CSS-only presets (ratio-locked frame / letterbox)
32
32
  ├── index.css # Centralized CSS imports
@@ -39,7 +39,7 @@ src/lib/
39
39
  > attachments in `src/lib/attachments/` (export from its `index.ts`). The existing `actions/`
40
40
  > are kept as-is for back-compat; no need to migrate them.
41
41
 
42
- Theme CSS files are not bundled in this package — they're provided by `@marianmeres/design-tokens/css/*.css` (42 themes) and imported by `src/lib/index.css`.
42
+ Theme CSS files are not bundled in this package — they're provided by `@marianmeres/design-tokens/css/*.css` (54 themes) and imported by `src/lib/index.css`.
43
43
 
44
44
  ---
45
45
 
@@ -126,15 +126,17 @@ Global tokens that control cross-component visual properties. Defined in `src/li
126
126
  - [Architecture](./docs/architecture.md) — System design, data flow
127
127
  - [Conventions](./docs/conventions.md) — Code standards, patterns
128
128
  - [Tasks](./docs/tasks.md) — Common procedures
129
+ - [Testing](./docs/testing.md) — What we test, what we don't, the two-project split
130
+ - [Component test conventions](./docs/testing-components.md) — How to write a `*.svelte.test.ts`
129
131
 
130
132
  ### Domain Docs
131
133
 
132
- - [Components](./docs/domains/components.md) — 74 component directories, Props pattern, snippets
134
+ - [Components](./docs/domains/components.md) — 75 component directories, Props pattern, snippets
133
135
  - [Theming](./docs/domains/theming.md) — CSS tokens, dark mode, themes
134
136
  - [CSS presets](./docs/domains/css-presets.md) — ratio-locked frame (letterbox), safe-area, scrollbar
135
- - [Actions](./docs/domains/actions.md) — 15 Svelte directives
137
+ - [Actions](./docs/domains/actions.md) — 16 Svelte directives
136
138
  - [Attachments](./docs/domains/attachments.md) — `{@attach}` DOM helpers (preferred for new ones)
137
- - [Utils](./docs/domains/utils.md) — 45 utility modules
139
+ - [Utils](./docs/domains/utils.md) — 55 utility modules
138
140
 
139
141
  ### Reference
140
142
 
@@ -151,7 +153,7 @@ Global tokens that control cross-component visual properties. Defined in `src/li
151
153
  | `src/lib/index.css` | CSS entry point |
152
154
  | `src/lib/index.ts` | JS entry point |
153
155
  | `src/lib/utils/design-tokens.ts` | Re-exports from `@marianmeres/design-tokens` |
154
- | `@marianmeres/design-tokens/css/*.css` | Theme CSS files (42 themes, `--stuic-` prefix) |
156
+ | `@marianmeres/design-tokens/css/*.css` | Theme CSS files (54 themes, `--stuic-` prefix) |
155
157
  | `src/lib/components/Button/` | Reference component |
156
158
 
157
159
  ---
package/API.md CHANGED
@@ -329,6 +329,96 @@ Money input whose canonical bindable `value` is an **integer in minor units** (e
329
329
 
330
330
  The `formatMinorUnits`, `parseToMinorUnits`, and `money` helpers are exported for display elsewhere.
331
331
 
332
+ #### `Calendar`
333
+
334
+ Accessible month grid for picking a single date (`value`) or an inclusive range (`start` + `end`) — every value an ISO `YYYY-MM-DD` string. Roving-tabindex keyboard grid (arrows, Home/End, PageUp/PageDown ± Shift, Enter), `min` / `max` / `isDateDisabled`, several `months` side by side, `captionLayout="dropdown"` (native month + year selects), ISO week numbers, fixed 6-week height, a `renderDay` snippet, `locale` for the Intl day/month names and `t` for the UI texts (Slovak bundled). Date math from `@marianmeres/calendar-utils`. Used inside `FieldDate` / `FieldDateRange`; usable inline on its own.
335
+
336
+ | Prop | Type | Default | Description |
337
+ | ------------------------ | ------------------------------------ | ---------- | ---------------------------------------------------------------------- |
338
+ | `mode` | `"single" \| "range"` | `"single"` | Bind `value`, or `start` + `end` |
339
+ | `value` | `string \| null` | `null` | Bindable selected date (single) |
340
+ | `start`, `end` | `string \| null` | `null` | Bindable range ends (range) |
341
+ | `view` | `{ year, month }` | selection | Bindable first displayed month |
342
+ | `months` | `number` | `1` | Consecutive months side by side |
343
+ | `min`, `max` | `string \| null` | — | Selectable window (inclusive); days and navigation beyond are disabled |
344
+ | `isDateDisabled` | `(iso, cell) => boolean` | — | Blackout individual days |
345
+ | `weekStartsOn` | `1..7` | `1` | First day of the week (ISO, 1 = Monday) |
346
+ | `locale`, `zone` | `string` | browser | Intl names / which day is "today" |
347
+ | `captionLayout` | `"label" \| "dropdown"` | `"label"` | Caption text, or month + year selects |
348
+ | `showWeekNumbers` | `boolean` | `false` | ISO week column |
349
+ | `fixedWeeks` | `boolean` | `false` | Always 6 rows |
350
+ | `showToday`, `showClear` | `boolean` | `false` | Footer buttons |
351
+ | `onSelect` | `(value) => void` | — | Single mode pick / clear |
352
+ | `onRangeChange` | `({ start, end, complete }) => void` | — | Range mode pick / clear |
353
+ | `onViewChange` | `(view) => void` | — | Displayed month changed |
354
+
355
+ ```svelte
356
+ <Calendar mode="range" bind:start bind:end months={2} min={todayIso()} />
357
+ ```
358
+
359
+ Exports: `Calendar`, `CalendarProps`, `CalendarMode`, `CalendarCaptionLayout`, `CalendarDayState`, `CalendarRangeChange`, `CalendarDayCell`, `CalendarWeekday`, `createCalendarT`, `CALENDAR_MESSAGES_EN`, `CALENDAR_MESSAGES_SK`, and the ISO date helpers `isIsoDate`, `parseIsoDate`, `normalizeIsoDate`, `toIsoDate`, `todayIso`, `addDaysIso`, `addMonthsIso`, `compareIso`, `daysBetweenIso`, `rangeLengthIso`, `formatIsoDate`, `formatIsoDateRange` (types `IsoDate`, `IsoDateParts`, `YearMonth`).
360
+
361
+ #### `FieldDate`
362
+
363
+ Single-date field around `Calendar`: a trigger button showing the formatted date opens the calendar in a native dialog (default), or the calendar renders inline (`embedded`). The bound `value` is an ISO `YYYY-MM-DD` string; `name` goes on a hidden input carrying it, so the form submits the ISO date regardless of the display format. `required` / valid ISO / `min` / `max` / `isDateDisabled` are enforced by the field's validator (hidden inputs never validate natively).
364
+
365
+ | Prop | Type | Default | Description |
366
+ | --------------- | ---------------------------- | ------------------------- | ----------------------------------------------------------- |
367
+ | `value` | `string \| null` | `null` | Bindable ISO date |
368
+ | `name` | `string` | — | Hidden input name |
369
+ | `embedded` | `boolean` | `false` | Inline calendar instead of trigger + dialog |
370
+ | `closeOnSelect` | `boolean` | `true` | Close the dialog after a pick; `false` adds a "Done" button |
371
+ | `placeholder` | `string` | `t("placeholder_date")` | Trigger text while empty |
372
+ | `clearable` | `boolean` | `true` | Trailing × (dialog) / footer "Clear" (embedded) |
373
+ | `locale` | `string` | browser | Display text + calendar names |
374
+ | `formatOptions` | `Intl.DateTimeFormatOptions` | `{ dateStyle: "medium" }` | Display text format |
375
+ | `format` | `(iso) => string` | — | Custom display text |
376
+ | `months` | `number` | `1` | Months side by side |
377
+ | `calendarProps` | `Partial<CalendarProps>` | — | Anything else for the inner calendar |
378
+ | `validate` | `boolean \| ValidateOptions` | enabled | `false` disables the built-in guard; object merges |
379
+ | `t` | `TranslateFn` | English | i18n (see `createCalendarT`) |
380
+ | `onChange` | `(value) => void` | — | After a pick / clear through the UI |
381
+
382
+ Also forwards `min`, `max`, `isDateDisabled`, `weekStartsOn`, `weekendDays`, `zone`, `captionLayout`, `yearRange`, `showWeekNumbers`, `showOutsideDays`, `fixedWeeks`, `showToday`, `renderDay` to the calendar, and takes the usual field props (`label`, `description`, `renderSize`, `required`, `disabled`, `labelLeft`, class props, …). Methods: the imperative validate API plus `open()` / `close()`.
383
+
384
+ ```svelte
385
+ <FieldDate
386
+ bind:value={delivery}
387
+ label="Delivery date"
388
+ name="delivery"
389
+ min={todayIso()}
390
+ required
391
+ />
392
+ ```
393
+
394
+ Exports: `FieldDate`, `FieldDateProps`, `FieldDateCalendarProps`.
395
+
396
+ #### `FieldDateRange`
397
+
398
+ Date-range field around a range-mode `Calendar`: same trigger + dialog / `embedded` presentations as `FieldDate`, binding `start` + `end` and submitting two hidden inputs (`nameStart`, `nameEnd`). First pick anchors, second completes (either order), a complete range closes the dialog (`closeOnSelect`). A half range fails validation whether or not the field is `required`. The default `months={2}` collapses to one below the `md` breakpoint.
399
+
400
+ | Prop | Type | Default | Description |
401
+ | ---------------------- | -------------------------- | ------- | ---------------------------------------- |
402
+ | `start`, `end` | `string \| null` | `null` | Bindable ISO range ends |
403
+ | `nameStart`, `nameEnd` | `string` | — | Hidden input names |
404
+ | `format` | `(start, end) => string` | — | Custom display text for a complete range |
405
+ | `months` | `number` | `2` | Months side by side (1 below `md`) |
406
+ | `onChange` | `({ start, end }) => void` | — | After a pick / clear through the UI |
407
+
408
+ Everything else as `FieldDate`.
409
+
410
+ ```svelte
411
+ <FieldDateRange
412
+ bind:start={from}
413
+ bind:end={to}
414
+ label="Stay"
415
+ nameStart="from"
416
+ nameEnd="to"
417
+ />
418
+ ```
419
+
420
+ Exports: `FieldDateRange`, `FieldDateRangeProps`, `FieldDateRangeValue`.
421
+
332
422
  #### `FieldTextarea`
333
423
 
334
424
  Multi-line text input.
package/README.md CHANGED
@@ -171,7 +171,7 @@ AppShell, Accordion, Backdrop, Modal, ModalDialog, Drawer, Collapsible, Header,
171
171
 
172
172
  ### Forms & Inputs
173
173
 
174
- FieldInput, FieldMoney, FieldTextarea, FieldSelect, FieldCheckbox, FieldRadios, FieldFile, FieldAssets, FieldOptions, FieldKeyValues, FieldObject, FieldSwitch, FieldInputLocalized, FieldLikeButton, FieldPhoneNumber, FieldCountry, CronInput, Fieldset, LoginForm, LoginFormModal, RegisterForm, RegisterFormModal, LoginOrRegisterForm, LoginOrRegisterFormModal, EmailVerifyForm, OtpInput
174
+ FieldInput, FieldMoney, FieldDate, FieldDateRange, Calendar, FieldTextarea, FieldSelect, FieldCheckbox, FieldRadios, FieldFile, FieldAssets, FieldOptions, FieldKeyValues, FieldObject, FieldSwitch, FieldInputLocalized, FieldLikeButton, FieldPhoneNumber, FieldCountry, CronInput, Fieldset, LoginForm, LoginFormModal, RegisterForm, RegisterFormModal, LoginOrRegisterForm, LoginOrRegisterFormModal, EmailVerifyForm, OtpInput
175
175
 
176
176
  ### Buttons & Controls
177
177
 
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- // Conventions escape hatch (docs/component-testing/02-test-conventions.md):
2
+ // Conventions escape hatch (docs/testing-components.md):
3
3
  // AssetsPreview is imperative-only — it opens a ModalDialog via a ref method
4
4
  // open(index?). A *.svelte.test.ts file can't hold a bind:this + a trigger, so
5
5
  // this fixture exposes an opener button that calls open(openIndex); all other