@nanahoshi/mona-ui 0.24.5 → 0.24.7

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 (78) hide show
  1. package/README.md +2 -0
  2. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +196 -137
  3. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +14 -4
  4. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +164 -3
  5. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +124 -140
  6. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +205 -202
  7. package/fesm2022/nanahoshi-mona-ui-filter.mjs +233 -231
  8. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-BMCM0W8s.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-vXXNWmEN.mjs} +24 -12
  9. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-DDgNmgE0.mjs +208 -0
  10. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-Dzf6Vbs_.mjs +1100 -0
  11. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-C2kf5MwO.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DAPNqnWV.mjs} +34 -21
  12. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-Dh42tUui.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-B9rmDLq8.mjs} +2564 -927
  13. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  14. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -8
  15. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +1 -1
  16. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +3 -6
  17. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +33 -8
  18. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -8
  19. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -8
  20. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +33 -8
  21. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +33 -8
  22. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -8
  23. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +33 -8
  24. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +33 -8
  25. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -8
  26. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +33 -8
  27. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +33 -8
  28. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +33 -8
  29. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +33 -8
  30. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +195 -122
  31. package/fesm2022/nanahoshi-mona-ui-pager.mjs +367 -463
  32. package/fesm2022/nanahoshi-mona-ui-query.mjs +317 -122
  33. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +149 -167
  34. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +182 -137
  35. package/i18n/catalogs/en-US.messages.json +36 -11
  36. package/locales/ar-sa/ar-sa.messages.json +33 -8
  37. package/locales/de-de/de-de.messages.json +33 -8
  38. package/locales/es-es/es-es.messages.json +33 -8
  39. package/locales/fr-fr/fr-fr.messages.json +33 -8
  40. package/locales/id-id/id-id.messages.json +33 -8
  41. package/locales/it-it/it-it.messages.json +33 -8
  42. package/locales/ja-jp/ja-jp.messages.json +33 -8
  43. package/locales/ko-kr/ko-kr.messages.json +33 -8
  44. package/locales/pt-br/pt-br.messages.json +33 -8
  45. package/locales/ru-ru/ru-ru.messages.json +33 -8
  46. package/locales/tr-tr/tr-tr.messages.json +33 -8
  47. package/locales/zh-cn/zh-cn.messages.json +33 -8
  48. package/locales/zh-tw/zh-tw.messages.json +33 -8
  49. package/package.json +2 -2
  50. package/types/nanahoshi-mona-ui-calendar.d.ts +30 -11
  51. package/types/nanahoshi-mona-ui-check-box.d.ts +11 -1
  52. package/types/nanahoshi-mona-ui-date-input.d.ts +74 -3
  53. package/types/nanahoshi-mona-ui-date-picker.d.ts +61 -33
  54. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +79 -38
  55. package/types/nanahoshi-mona-ui-filter.d.ts +54 -32
  56. package/types/nanahoshi-mona-ui-grid.d.ts +359 -110
  57. package/types/nanahoshi-mona-ui-i18n.d.ts +47 -6
  58. package/types/nanahoshi-mona-ui-list-view.d.ts +1 -2
  59. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +31 -6
  60. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +31 -6
  61. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +31 -6
  62. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +31 -6
  63. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +31 -6
  64. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +31 -6
  65. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +31 -6
  66. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +31 -6
  67. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +31 -6
  68. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +31 -6
  69. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +31 -6
  70. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +31 -6
  71. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +31 -6
  72. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +57 -16
  73. package/types/nanahoshi-mona-ui-pager.d.ts +159 -76
  74. package/types/nanahoshi-mona-ui-query.d.ts +45 -14
  75. package/types/nanahoshi-mona-ui-time-picker.d.ts +72 -42
  76. package/types/nanahoshi-mona-ui-time-selector.d.ts +78 -46
  77. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-BSlV8Sua.mjs +0 -176
  78. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-CTOdnH29.mjs +0 -946
@@ -1,6 +1,6 @@
1
1
  import { NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { computed, model, input, output, Component, Directive } from '@angular/core';
3
+ import { computed, input, model, output, Component, Directive } from '@angular/core';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { themeControlSurfaceClasses } from '@nanahoshi/mona-ui/internal';
@@ -129,6 +129,16 @@ class CheckBoxComponent {
129
129
  ...(ngDevMode ? [{ debugName: "containerLabelClasses" }] : /* istanbul ignore next */ []));
130
130
  this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.checked())), /* @ts-ignore */
131
131
  ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
132
+ /**
133
+ * @description Id of an element that describes the check box, such as an error message.
134
+ * @default ""
135
+ */
136
+ this.ariaDescribedBy = input("", { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
137
+ /**
138
+ * @description Accessible name of the check box when it has no visible label.
139
+ * @default ""
140
+ */
141
+ this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
132
142
  /**
133
143
  * @description Whether the control is checked.
134
144
  * @default false
@@ -230,7 +240,7 @@ class CheckBoxComponent {
230
240
  this.touch.emit();
231
241
  }
232
242
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CheckBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
233
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CheckBoxComponent, isStandalone: true, selector: "mona-check-box", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, labelSize: { classPropertyName: "labelSize", publicName: "labelSize", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", inputBlur: "inputBlur", inputChange: "inputChange", inputFocus: "inputFocus", touch: "touch" }, host: { properties: { "class": "'flex'", "attr.data-checked": "checked()", "attr.data-disabled": "disabled()", "attr.data-indeterminate": "indeterminate()" } }, ngImport: i0, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"disabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"label() || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #checkBox />\n\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\n @if (checked()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-check stroke-primary-foreground\">\n <path d=\"M18 6 9 17l-5-5\" />\n </svg>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
243
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CheckBoxComponent, isStandalone: true, selector: "mona-check-box", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, labelSize: { classPropertyName: "labelSize", publicName: "labelSize", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", inputBlur: "inputBlur", inputChange: "inputChange", inputFocus: "inputFocus", touch: "touch" }, host: { properties: { "class": "'flex'", "attr.data-checked": "checked()", "attr.data-disabled": "disabled()", "attr.data-indeterminate": "indeterminate()" } }, ngImport: i0, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"disabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy() || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #checkBox />\n\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\n @if (checked()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-check stroke-primary-foreground\">\n <path d=\"M18 6 9 17l-5-5\" />\n </svg>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
234
244
  }
235
245
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CheckBoxComponent, decorators: [{
236
246
  type: Component,
@@ -239,8 +249,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
239
249
  "[attr.data-checked]": "checked()",
240
250
  "[attr.data-disabled]": "disabled()",
241
251
  "[attr.data-indeterminate]": "indeterminate()"
242
- }, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"disabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"label() || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #checkBox />\n\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\n @if (checked()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-check stroke-primary-foreground\">\n <path d=\"M18 6 9 17l-5-5\" />\n </svg>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n" }]
243
- }], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputChange: [{ type: i0.Output, args: ["inputChange"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], labelSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelSize", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
252
+ }, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [required]=\"required()\"\n [checked]=\"checked()\"\n [tabindex]=\"disabled() ? -1 : tabIndex()\"\n [class]=\"checkBoxClasses()\"\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-describedby]=\"ariaDescribedBy() || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #checkBox />\n\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\n @if (checked()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-check stroke-primary-foreground\">\n <path d=\"M18 6 9 17l-5-5\" />\n </svg>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n" }]
253
+ }], propDecorators: { ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputChange: [{ type: i0.Output, args: ["inputChange"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], labelSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelSize", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
244
254
 
245
255
  class CheckboxDirective {
246
256
  constructor() {
@@ -1,9 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Pipe, Injectable } from '@angular/core';
3
- import { toImmutableSet, where, select, sequence } from '@mirei/ts-collections';
2
+ import { Directive, Pipe, Injectable, untracked, linkedSignal } from '@angular/core';
3
+ import { toImmutableSet, where, select, sequence, any } from '@mirei/ts-collections';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { themeOverlaySurfaceClasses } from '@nanahoshi/mona-ui/internal';
6
6
  import { Subject } from 'rxjs';
7
+ import { minDateError, maxDateError, transformedValue } from '@angular/forms/signals';
8
+ import { parseGregorianDate, gregorianDateTime } from '@nanahoshi/mona-ui/i18n';
7
9
 
8
10
  class DateInputPrefixTemplateDirective {
9
11
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DateInputPrefixTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -121,9 +123,168 @@ const generateSecondSet = (step = 1) => {
121
123
  return select(sequence(0, 59, step), s => ({ value: s, viewValue: s })).toImmutableSet();
122
124
  };
123
125
 
126
+ /**
127
+ * The clock a locale uses by default: "12" for en-US, ja-JP and ko-KR, "24" for de-DE, fr-FR and tr-TR. Locales that
128
+ * mark the hour cycle explicitly (`en-US-u-hc-h23`) are honoured.
129
+ */
130
+ function getLocaleHourFormat(localeId) {
131
+ try {
132
+ const hourCycle = new Intl.DateTimeFormat(localeId, { hour: "numeric" }).resolvedOptions().hourCycle;
133
+ return hourCycle === "h11" || hourCycle === "h12" ? "12" : "24";
134
+ }
135
+ catch {
136
+ return "24";
137
+ }
138
+ }
139
+
140
+ const singleDigitTokens = new Set(["MM", "dd", "HH", "hh", "mm", "ss"]);
141
+ /**
142
+ * Relaxes a Luxon format for typing: two-digit tokens (`MM`, `dd`, `HH`, `hh`, `mm`, `ss`) also accept one digit, and
143
+ * with `twoDigitYear` the year is typed as two digits. Quoted literals are left alone.
144
+ */
145
+ function relaxFormat(format, twoDigitYear) {
146
+ return format
147
+ .split(/('(?:[^']|'')*')/)
148
+ .map((part, index) => {
149
+ if (index % 2 === 1) {
150
+ return part;
151
+ }
152
+ return part.replace(/([A-Za-z])\1*/g, run => {
153
+ if (singleDigitTokens.has(run)) {
154
+ return run[0];
155
+ }
156
+ return twoDigitYear && run === "yyyy" ? "yy" : run;
157
+ });
158
+ })
159
+ .join("");
160
+ }
161
+ /**
162
+ * Parses text typed into a picker. The input format is tried first, then the same format with one-digit months, days,
163
+ * hours, minutes and seconds ("1/5/2025", "9:05"), then with a two-digit year ("1/5/25"). Two-digit years up to 60
164
+ * read as 20xx, later ones as 19xx.
165
+ * @returns The parsed date, or null when the text isn't a date in any of these forms.
166
+ */
167
+ function parseTypedDate(text, format, localeId) {
168
+ const trimmed = text.trim();
169
+ if (!trimmed) {
170
+ return null;
171
+ }
172
+ const relaxed = relaxFormat(format, false);
173
+ const twoDigitYear = relaxFormat(format, true);
174
+ const candidates = [format, ...(relaxed === format ? [] : [relaxed])];
175
+ for (const candidate of candidates) {
176
+ const dateTime = parseGregorianDate(trimmed, candidate, localeId);
177
+ if (dateTime.isValid) {
178
+ return dateTime;
179
+ }
180
+ }
181
+ if (twoDigitYear !== relaxed) {
182
+ // Luxon's "yy" also takes three digits and keeps them as they are ("3/4/202" is the year 202); two digits
183
+ // always land in 1961-2060, and four were read by the formats above.
184
+ const dateTime = parseGregorianDate(trimmed, twoDigitYear, localeId);
185
+ if (dateTime.isValid && dateTime.year >= 1900) {
186
+ return dateTime;
187
+ }
188
+ }
189
+ return null;
190
+ }
191
+ /** Whether a date is one of `disabledDates`, compared by day. */
192
+ function isDateDisabled(date, disabledDates) {
193
+ if (!disabledDates) {
194
+ return false;
195
+ }
196
+ if (typeof disabledDates === "function") {
197
+ return disabledDates(date);
198
+ }
199
+ return any(disabledDates, disabled => disabled.getFullYear() === date.getFullYear() &&
200
+ disabled.getMonth() === date.getMonth() &&
201
+ disabled.getDate() === date.getDate());
202
+ }
203
+ /** The part of a date that min and max are compared on: the day, the full date and time, or the time of day. */
204
+ function comparable(date, unit) {
205
+ switch (unit) {
206
+ case "date":
207
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
208
+ case "time":
209
+ return ((date.getHours() * 60 + date.getMinutes()) * 60 + date.getSeconds()) * 1000 + date.getMilliseconds();
210
+ default:
211
+ return date.getTime();
212
+ }
213
+ }
214
+ /**
215
+ * Checks a typed date against a picker's min, max and `disabledDates`, the same limits its popup applies.
216
+ * @returns The error to report, or null when the date is allowed. Range errors are Angular's `minDate` and `maxDate`
217
+ * errors, so they read like the signal-forms validators.
218
+ */
219
+ function checkTypedDate(date, constraints) {
220
+ const { disabledDates, max, min, unit } = constraints;
221
+ const value = comparable(date, unit);
222
+ if (min && value < comparable(min, unit)) {
223
+ return minDateError(min);
224
+ }
225
+ if (max && value > comparable(max, unit)) {
226
+ return maxDateError(max);
227
+ }
228
+ if (unit !== "time" && isDateDisabled(date, disabledDates)) {
229
+ const error = { kind: "disabledDate", date };
230
+ return error;
231
+ }
232
+ return null;
233
+ }
234
+ /** The error reported for text that doesn't parse. */
235
+ function typedDateParseError() {
236
+ return { kind: "parse" };
237
+ }
238
+ /**
239
+ * The typed-input pipeline of the date, time and date-time pickers. Call it in an injection context: the errors are
240
+ * reported to the form field (signal forms, `ngModel` or a reactive form control) bound to the picker.
241
+ */
242
+ function createTypedDateInput(options) {
243
+ const { constraints, format, localeId, resolve, value } = options;
244
+ const formatValue = (date) => date ? gregorianDateTime(date, localeId()).toFormat(format()) : "";
245
+ const committed = transformedValue(value, {
246
+ format: formatValue,
247
+ parse: (raw) => {
248
+ const current = untracked(value);
249
+ if (!raw.trim()) {
250
+ return { value: null };
251
+ }
252
+ const parsed = untracked(() => parseTypedDate(raw, format(), localeId()));
253
+ if (!parsed) {
254
+ return { error: typedDateParseError() };
255
+ }
256
+ const date = resolve ? resolve(parsed, current) : parsed.toJSDate();
257
+ const error = untracked(() => checkTypedDate(date, constraints()));
258
+ if (error) {
259
+ return { error };
260
+ }
261
+ return current?.getTime() === date.getTime() ? {} : { value: date };
262
+ }
263
+ });
264
+ const text = linkedSignal(() => committed(), /* @ts-ignore */
265
+ ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
266
+ return {
267
+ commit: () => {
268
+ committed.set(untracked(text));
269
+ if (untracked(committed.parseErrors).length === 0) {
270
+ // Shows "1/5/2025" as "01/05/2025" even when it names the date already set.
271
+ text.set(untracked(() => formatValue(value())));
272
+ }
273
+ },
274
+ edit: (typed) => {
275
+ text.set(typed);
276
+ if (typed === "") {
277
+ committed.set("");
278
+ }
279
+ },
280
+ errors: committed.parseErrors,
281
+ text
282
+ };
283
+ }
284
+
124
285
  /**
125
286
  * Generated bundle index. Do not edit.
126
287
  */
127
288
 
128
- export { CalendarService, DateInputPrefixTemplateDirective, TimeLimiterPipe, TimeSelectorService, datePopupThemeVariants, generateHourSet, generateMinuteSet, generateSecondSet };
289
+ export { CalendarService, DateInputPrefixTemplateDirective, TimeLimiterPipe, TimeSelectorService, checkTypedDate, createTypedDateInput, datePopupThemeVariants, generateHourSet, generateMinuteSet, generateSecondSet, getLocaleHourFormat, isDateDisabled, parseTypedDate, typedDateParseError };
129
290
  //# sourceMappingURL=nanahoshi-mona-ui-date-input.mjs.map