@sixbell-telco/sdk 1.3.0 → 1.4.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.
- package/CHANGELOG.md +33 -0
- package/README.md +28 -1
- package/_index.css +109 -11
- package/assets/styles/toast.css +8 -0
- package/components/forms/date-picker/constants/date-picker.constants.d.ts +13 -0
- package/components/forms/date-picker/index.d.ts +5 -0
- package/components/forms/date-picker/public-api.d.ts +3 -0
- package/components/forms/date-picker/src/date-picker.component.d.ts +323 -0
- package/components/forms/date-picker/types/date-picker.types.d.ts +39 -0
- package/components/{forms/datepicker → sonner}/index.d.ts +1 -1
- package/components/sonner/public-api.d.ts +2 -0
- package/components/sonner/src/sonner.component.d.ts +39 -0
- package/components/sonner/toaster/index.d.ts +5 -0
- package/components/sonner/toaster/public-api.d.ts +1 -0
- package/components/sonner/toaster/src/toaster.component.d.ts +89 -0
- package/components/toast/public-api.d.ts +9 -0
- package/components/toast/services/toast.service.d.ts +3 -0
- package/components/toast/toast-message/toast-message.component.d.ts +3 -0
- package/components/toast/toasts-container/toasts-container.component.d.ts +3 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs +885 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs +132 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner-toaster.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner.mjs +179 -0
- package/fesm2022/sixbell-telco-sdk-components-sonner.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +14 -0
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs +90 -2
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -1
- package/package.json +47 -38
- package/utils/date/src/date-utils.d.ts +44 -0
- package/components/forms/datepicker/constants/datepicker.constants.d.ts +0 -5
- package/components/forms/datepicker/public-api.d.ts +0 -3
- package/components/forms/datepicker/src/datepicker.component.d.ts +0 -165
- package/components/forms/datepicker/types/datepicker.types.d.ts +0 -7
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +0 -487
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.4.0] - 2025-09-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Sonner Toast System**: Integrated ngx-sonner for modern toast notifications, including toaster component, custom toast component, and showcase examples (`6cfa165`, `4183642`, `0a6a564`)
|
|
15
|
+
- **Storybook Stories**: Added comprehensive Storybook stories for Sonner toaster with interactive toast examples (default, success, error, warning, info, loading, promise, action, long text) (`f89d35e`)
|
|
16
|
+
- **Dependencies**: Added ngx-sonner as a dependency for enhanced toast functionality (`6cfa165`)
|
|
17
|
+
- **Date Picker – New Component**: Implement a new date picker component with single and range selection modes as the foundation for time picker enhancements (`5dcd454`)
|
|
18
|
+
- **Date Picker – Time Picker**: Add time selection for single and range modes with optional seconds and 12h/24h display formats, including quick range options (`c35fdd2`, `b8186b8`, `f9a9eed`)
|
|
19
|
+
- **Date Picker – Quick Actions/i18n**: Add quick action labels for last hour and range selections, and time selection labels for English, Spanish, and Portuguese (`37609dc`, `15dc5da`, `2234a19`)
|
|
20
|
+
- **Date Picker – Events**: Expose range selection change handling outputs for better integration (`ba55f10`)
|
|
21
|
+
- **Date Picker – Typed API**: Introduce constants and types for modes, calendars, time formats, and date styles; use typed signals for date range and time handling; consolidate and document time string types (`4cfdd66`, `d7626c6`, `7832408`, `f6038a4`)
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **Shadow Variables**: Updated shadow variables for better consistency and clarified legacy toast system in CSS (`e2761cd`)
|
|
26
|
+
- **Toast CSS**: Updated toast.css to clarify deprecation and migration path to ngx-sonner (`cf6889b`)
|
|
27
|
+
- **Date Picker – Range Logic**: Improve range selection logic to avoid overriding developer/user-defined times; set default start/end times only when times are empty for different-day ranges (`77901e1`, `ced219d`)
|
|
28
|
+
- **Date Picker – Time Handling**: Initialize time picker signals with empty values for flexibility and improve time input handling UX (`8d02b36`, `3eee460`)
|
|
29
|
+
- **Date Picker – i18n/Locale**: Remove hardcoded language from components and demonstrate automatic language→calendar locale mapping; refresh on language change in showcase to apply translations (`8963f2b`, `6674c08`)
|
|
30
|
+
- **Date Picker – Codebase**: Refactor component/code structure for readability and to rely on typed constants; enhance documentation with remarks and examples (`32f6b37`, `d7626c6`, `2fefde6`)
|
|
31
|
+
- **Tooling/Config**: Update package.json to fix dependency versioning and change showcase port (`d5bf5c3`)
|
|
32
|
+
- **Styling**: Customize time input indicator style; update primary light color and add scrollbar auto-hide (`2c8d9db`, `09df058`)
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- **Self-Closing Tag**: Corrected self-closing tag for st-sonner-toaster in app.component.html (`f87fa2f`)
|
|
37
|
+
- **Date Picker – Default Times**: Ensure default full-day times are applied correctly when finalizing same-day selections, while preserving developer-defined times on different-day ranges (`ced219d`, `77901e1`)
|
|
38
|
+
|
|
39
|
+
### Deprecated
|
|
40
|
+
|
|
41
|
+
- **Toast Components**: Marked legacy toast components and services as deprecated, recommending migration to ngx-sonner (`2c566e5`)
|
|
42
|
+
|
|
10
43
|
## [1.3.0] - 2025-09-02
|
|
11
44
|
|
|
12
45
|
### Added
|
package/README.md
CHANGED
|
@@ -787,13 +787,13 @@ src/
|
|
|
787
787
|
},
|
|
788
788
|
"table": {
|
|
789
789
|
"entriesByPage": "Entries per page",
|
|
790
|
+
"perPage": "{{count}} / page",
|
|
790
791
|
"totalEntries": "{{total}} entries",
|
|
791
792
|
"entriesRange": "{{range}} of {{total}} entries",
|
|
792
793
|
"emptyListMessage": "No items to show"
|
|
793
794
|
},
|
|
794
795
|
"dataTable": {
|
|
795
796
|
"entriesByPage": "Entries per page",
|
|
796
|
-
"perPage": "{{count}} / page",
|
|
797
797
|
"totalEntries": "{{total}} entries",
|
|
798
798
|
"entriesRange": "{{range}} of {{total}} entries",
|
|
799
799
|
"emptyListMessage": "No items to show",
|
|
@@ -823,11 +823,20 @@ src/
|
|
|
823
823
|
"datePicker": {
|
|
824
824
|
"quickActions": {
|
|
825
825
|
"title": "Quick Select",
|
|
826
|
+
"lastHour": "Last hour",
|
|
827
|
+
"last3Hours": "Last 3 hours",
|
|
828
|
+
"last6Hours": "Last 6 hours",
|
|
829
|
+
"last12Hours": "Last 12 hours",
|
|
830
|
+
"last24Hours": "Last 24 hours",
|
|
826
831
|
"last7Days": "Last 7 days",
|
|
827
832
|
"last30Days": "Last 30 days",
|
|
828
833
|
"last6Months": "Last 6 months",
|
|
829
834
|
"lastYear": "Last year",
|
|
830
835
|
"clear": "Clear"
|
|
836
|
+
},
|
|
837
|
+
"labels": {
|
|
838
|
+
"from": "From",
|
|
839
|
+
"to": "To"
|
|
831
840
|
}
|
|
832
841
|
}
|
|
833
842
|
}
|
|
@@ -958,11 +967,20 @@ src/
|
|
|
958
967
|
"datePicker": {
|
|
959
968
|
"quickActions": {
|
|
960
969
|
"title": "Selección Rápida",
|
|
970
|
+
"lastHour": "Última hora",
|
|
971
|
+
"last3Hours": "Últimas 3 horas",
|
|
972
|
+
"last6Hours": "Últimas 6 horas",
|
|
973
|
+
"last12Hours": "Últimas 12 horas",
|
|
974
|
+
"last24Hours": "Últimas 24 horas",
|
|
961
975
|
"last7Days": "Últimos 7 días",
|
|
962
976
|
"last30Days": "Últimos 30 días",
|
|
963
977
|
"last6Months": "Últimos 6 meses",
|
|
964
978
|
"lastYear": "Último año",
|
|
965
979
|
"clear": "Limpiar"
|
|
980
|
+
},
|
|
981
|
+
"labels": {
|
|
982
|
+
"from": "Desde",
|
|
983
|
+
"to": "Hasta"
|
|
966
984
|
}
|
|
967
985
|
}
|
|
968
986
|
}
|
|
@@ -1093,11 +1111,20 @@ src/
|
|
|
1093
1111
|
"datePicker": {
|
|
1094
1112
|
"quickActions": {
|
|
1095
1113
|
"title": "Seleção Rápida",
|
|
1114
|
+
"lastHour": "Última hora",
|
|
1115
|
+
"last3Hours": "Últimas 3 horas",
|
|
1116
|
+
"last6Hours": "Últimas 6 horas",
|
|
1117
|
+
"last12Hours": "Últimas 12 horas",
|
|
1118
|
+
"last24Hours": "Últimas 24 horas",
|
|
1096
1119
|
"last7Days": "Últimos 7 dias",
|
|
1097
1120
|
"last30Days": "Últimos 30 dias",
|
|
1098
1121
|
"last6Months": "Últimos 6 meses",
|
|
1099
1122
|
"lastYear": "Último ano",
|
|
1100
1123
|
"clear": "Limpar"
|
|
1124
|
+
},
|
|
1125
|
+
"labels": {
|
|
1126
|
+
"from": "De",
|
|
1127
|
+
"to": "Até"
|
|
1101
1128
|
}
|
|
1102
1129
|
}
|
|
1103
1130
|
}
|
package/_index.css
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import 'tailwindcss' source('../');
|
|
2
2
|
@import '@angular/cdk/overlay-prebuilt.css';
|
|
3
|
+
/* Legacy toast system (deprecated) + Sonner relies on component classes */
|
|
3
4
|
@import './assets/styles/toast.css';
|
|
4
5
|
|
|
5
6
|
@plugin "@midudev/tailwind-animations";
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
|
|
57
58
|
/* Custom Colors */
|
|
58
59
|
--color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
|
|
59
|
-
--color-primary-light: color-mix(in oklch, var(--color-primary)
|
|
60
|
+
--color-primary-light: color-mix(in oklch, var(--color-primary) 75%, #fff);
|
|
60
61
|
--color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
|
|
61
62
|
--color-primary-gradient-content: oklch(100% 0 0);
|
|
62
63
|
--color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
|
|
@@ -137,7 +138,7 @@
|
|
|
137
138
|
|
|
138
139
|
/* Custom Colors */
|
|
139
140
|
--color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
|
|
140
|
-
--color-primary-light: color-mix(in oklch, var(--color-primary)
|
|
141
|
+
--color-primary-light: color-mix(in oklch, var(--color-primary) 75%, #000);
|
|
141
142
|
--color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
|
|
142
143
|
--color-primary-gradient-content: oklch(100% 0 0);
|
|
143
144
|
--color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
|
|
@@ -175,7 +176,7 @@
|
|
|
175
176
|
@theme {
|
|
176
177
|
/* Color tokens registered for Tailwind utilities; values provided in theme plugin blocks */
|
|
177
178
|
--color-base-50: color-mix(in oklch, var(--color-base-200), #000 7%);
|
|
178
|
-
--color-primary-light: color-mix(in oklch, var(--color-primary)
|
|
179
|
+
--color-primary-light: color-mix(in oklch, var(--color-primary) 75%, #fff);
|
|
179
180
|
--color-primary-gradient: color-mix(in oklch, var(--color-primary) 60%, #121212);
|
|
180
181
|
--color-primary-gradient-content: oklch(100% 0 0);
|
|
181
182
|
--color-secondary-gradient: color-mix(in oklch, var(--color-secondary) 60%, #121212);
|
|
@@ -208,8 +209,11 @@
|
|
|
208
209
|
--font-poppins: Poppins, sans-serif;
|
|
209
210
|
--font-heading: Poppins, sans-serif;
|
|
210
211
|
--font-body: Poppins, sans-serif;
|
|
211
|
-
--shadow-main:
|
|
212
|
-
|
|
212
|
+
--shadow-main:
|
|
213
|
+
var(--color-shadow-primary) 0px 0px 0px 0px, var(--color-shadow-primary) 0px 0px 0px 0px, var(--color-shadow-primary) 0px 0px 0px 0px,
|
|
214
|
+
var(--color-shadow-primary) 0px 0px 0px 0px, var(--color-shadow-primary) 0px 4px 6px -1px, var(--color-shadow-primary) 0px 2px 4px -2px;
|
|
215
|
+
--shadow-main-lg: 0 4px 12px var(--color-shadow-primary);
|
|
216
|
+
--shadow-backdrop: 0px 25px 50px -12px var(--color-shadow-backdrop);
|
|
213
217
|
--font-weight-inherit: inherit;
|
|
214
218
|
--ease-ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
215
219
|
--ease-ease-in-and-out-back: cubic-bezier(0.68, -0.55, 0.27, 1.55);
|
|
@@ -305,6 +309,10 @@
|
|
|
305
309
|
max-width: 100%;
|
|
306
310
|
}
|
|
307
311
|
|
|
312
|
+
input[type='time']::-webkit-calendar-picker-indicator {
|
|
313
|
+
background: none;
|
|
314
|
+
}
|
|
315
|
+
|
|
308
316
|
@media (prefers-reduced-motion: reduce) {
|
|
309
317
|
* {
|
|
310
318
|
animation-duration: 0.01ms !important;
|
|
@@ -433,17 +441,12 @@
|
|
|
433
441
|
--color-text-on-accent: var(--color-primary-content);
|
|
434
442
|
|
|
435
443
|
@apply font-body;
|
|
436
|
-
|
|
437
|
-
&::part(button):hover {
|
|
438
|
-
@apply bg-primary text-primary-content;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
444
|
&::part(button) {
|
|
442
445
|
@apply rounded-selector transition-colors duration-150 ease-linear;
|
|
443
446
|
}
|
|
444
447
|
|
|
445
448
|
&::part(range-inner) {
|
|
446
|
-
@apply bg-primary
|
|
449
|
+
@apply bg-primary-light text-primary-content rounded-none;
|
|
447
450
|
}
|
|
448
451
|
|
|
449
452
|
&::part(range-start) {
|
|
@@ -457,6 +460,23 @@
|
|
|
457
460
|
&::part(range-start range-end) {
|
|
458
461
|
@apply rounded-selector;
|
|
459
462
|
}
|
|
463
|
+
|
|
464
|
+
&::part(today) {
|
|
465
|
+
color: var(--color-primary);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
&::part(today selected),
|
|
469
|
+
&::part(today):focus-visible {
|
|
470
|
+
@apply text-primary-content;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/* Hover outline only for non-selected day buttons; selected part overrides this */
|
|
474
|
+
&::part(button):hover {
|
|
475
|
+
@apply bg-base-50 text-base-content;
|
|
476
|
+
}
|
|
477
|
+
&::part(button selected):hover {
|
|
478
|
+
@apply bg-primary text-primary-content;
|
|
479
|
+
}
|
|
460
480
|
}
|
|
461
481
|
|
|
462
482
|
calendar-date {
|
|
@@ -585,4 +605,82 @@
|
|
|
585
605
|
@apply border-base-300 bg-base-300 placeholder-base-content text-base-content/40 cursor-not-allowed;
|
|
586
606
|
}
|
|
587
607
|
}
|
|
608
|
+
|
|
609
|
+
.hide-x-scrollbar {
|
|
610
|
+
scrollbar-width: none; /* Firefox */
|
|
611
|
+
-ms-overflow-style: none; /* IE 10+ */
|
|
612
|
+
}
|
|
613
|
+
.hide-x-scrollbar::-webkit-scrollbar {
|
|
614
|
+
height: 0 !important; /* Chrome/Safari */
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/* Auto-hide/show scrollbars on hover (overlay-like, no reserved gutter) */
|
|
618
|
+
.scrollbar-x-auto-hide {
|
|
619
|
+
overflow-x: auto;
|
|
620
|
+
scrollbar-gutter: auto; /* don't reserve space */
|
|
621
|
+
-ms-overflow-style: none; /* IE/Edge */
|
|
622
|
+
scrollbar-width: thin; /* Firefox: keep thickness constant */
|
|
623
|
+
scrollbar-color: transparent transparent; /* invisible by default */
|
|
624
|
+
}
|
|
625
|
+
/* WebKit: keep thickness constant; toggle visibility via color */
|
|
626
|
+
.scrollbar-x-auto-hide::-webkit-scrollbar {
|
|
627
|
+
height: 8px;
|
|
628
|
+
background: transparent;
|
|
629
|
+
}
|
|
630
|
+
.scrollbar-x-auto-hide::-webkit-scrollbar-thumb {
|
|
631
|
+
background-color: transparent;
|
|
632
|
+
border-radius: 4px;
|
|
633
|
+
}
|
|
634
|
+
.scrollbar-x-auto-hide:hover {
|
|
635
|
+
scrollbar-color: var(--color-scroll-thumb) transparent;
|
|
636
|
+
}
|
|
637
|
+
.scrollbar-x-auto-hide:hover::-webkit-scrollbar-thumb {
|
|
638
|
+
background-color: var(--color-scroll-thumb);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.scrollbar-y-auto-hide {
|
|
642
|
+
overflow-y: auto;
|
|
643
|
+
scrollbar-gutter: auto; /* don't reserve space */
|
|
644
|
+
-ms-overflow-style: none; /* IE/Edge */
|
|
645
|
+
scrollbar-width: thin; /* Firefox */
|
|
646
|
+
scrollbar-color: transparent transparent; /* invisible by default */
|
|
647
|
+
}
|
|
648
|
+
.scrollbar-y-auto-hide::-webkit-scrollbar {
|
|
649
|
+
width: 8px;
|
|
650
|
+
background: transparent;
|
|
651
|
+
}
|
|
652
|
+
.scrollbar-y-auto-hide::-webkit-scrollbar-thumb {
|
|
653
|
+
background-color: transparent;
|
|
654
|
+
border-radius: 4px;
|
|
655
|
+
}
|
|
656
|
+
.scrollbar-y-auto-hide:hover {
|
|
657
|
+
scrollbar-color: var(--color-scroll-thumb) transparent;
|
|
658
|
+
}
|
|
659
|
+
.scrollbar-y-auto-hide:hover::-webkit-scrollbar-thumb {
|
|
660
|
+
background-color: var(--color-scroll-thumb);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/* Both axes */
|
|
664
|
+
.scrollbar-auto-hide {
|
|
665
|
+
overflow: auto;
|
|
666
|
+
scrollbar-gutter: auto;
|
|
667
|
+
-ms-overflow-style: none;
|
|
668
|
+
scrollbar-width: thin; /* Firefox */
|
|
669
|
+
scrollbar-color: transparent transparent; /* invisible by default */
|
|
670
|
+
}
|
|
671
|
+
.scrollbar-auto-hide::-webkit-scrollbar {
|
|
672
|
+
width: 8px;
|
|
673
|
+
height: 8px;
|
|
674
|
+
background: transparent;
|
|
675
|
+
}
|
|
676
|
+
.scrollbar-auto-hide::-webkit-scrollbar-thumb {
|
|
677
|
+
background-color: transparent;
|
|
678
|
+
border-radius: 4px;
|
|
679
|
+
}
|
|
680
|
+
.scrollbar-auto-hide:hover {
|
|
681
|
+
scrollbar-color: var(--color-scroll-thumb) transparent;
|
|
682
|
+
}
|
|
683
|
+
.scrollbar-auto-hide:hover::-webkit-scrollbar-thumb {
|
|
684
|
+
background-color: var(--color-scroll-thumb);
|
|
685
|
+
}
|
|
588
686
|
}
|
package/assets/styles/toast.css
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/* DEPRECATED: Legacy toast system styles
|
|
2
|
+
* --------------------------------------------------
|
|
3
|
+
* Retained for backward compatibility while migrating
|
|
4
|
+
* to ngx-sonner based toasts. Do not modify stacking
|
|
5
|
+
* logic; new styling lives inside Sonner component via
|
|
6
|
+
* Tailwind utility classes. Remove this file only when
|
|
7
|
+
* all consumers have switched to the new API.
|
|
8
|
+
*/
|
|
1
9
|
@use 'tailwindcss/base';
|
|
2
10
|
|
|
3
11
|
.toast-container > st-toast-message:nth-child(n + 4) > .toast-message {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported locales (BCP 47) for the date picker.
|
|
3
|
+
* These map directly to the underlying calendar web component locale attribute.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SUPPORTED_LOCALES: readonly ["en-US", "en-GB", "es-ES", "es-MX", "fr-FR", "de-DE", "it-IT", "pt-BR", "pt-PT", "ja-JP", "ko-KR", "zh-CN", "zh-TW", "ru-RU", "ar-SA", "hi-IN", "nl-NL", "sv-SE", "da-DK", "no-NO", "fi-FI", "pl-PL", "tr-TR", "he-IL", "th-TH", "vi-VN"];
|
|
6
|
+
/** Allowed datepicker modes */
|
|
7
|
+
export declare const DATEPICKER_MODES: readonly ["single", "range"];
|
|
8
|
+
/** Allowed time display formats for trigger text */
|
|
9
|
+
export declare const TIME_DISPLAY_FORMATS: readonly ["24h", "12h"];
|
|
10
|
+
/** Allowed Intl.DateTimeFormat dateStyle values we support */
|
|
11
|
+
export declare const DATE_STYLES: readonly ["short", "medium", "long", "full"];
|
|
12
|
+
/** Allowed number of calendars in range mode */
|
|
13
|
+
export declare const RANGE_CALENDARS: readonly [1, 2];
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { ControlValueAccessor, FormControl, FormGroup } from '@angular/forms';
|
|
2
|
+
import { OverlayComponent } from '@sixbell-telco/sdk/components/overlay';
|
|
3
|
+
import { DateRange, QuickRangePreset } from '@sixbell-telco/sdk/utils/date';
|
|
4
|
+
import 'cally';
|
|
5
|
+
import { DatePickerValue, OptionalTimeString } from '../types/date-picker.types';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Datepicker - Single date and date range picker with optional time selection
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This component wraps Cally.js calendar elements and provides a rich, accessible
|
|
12
|
+
* date and date-range picking experience for Angular apps. It supports:
|
|
13
|
+
* - Single or range modes
|
|
14
|
+
* - Quick action ranges
|
|
15
|
+
* - Optional time selection with minutes or seconds
|
|
16
|
+
* - 12h/24h time display for the trigger text
|
|
17
|
+
* - Locale-aware calendar (auto-mapped from the TranslationService or overridden)
|
|
18
|
+
* - Form integration (reactive forms) and standalone usage
|
|
19
|
+
*
|
|
20
|
+
* The component is exported as `stDatepicker` for template reference variables
|
|
21
|
+
* to access methods (e.g. displayValue()).
|
|
22
|
+
*
|
|
23
|
+
* @example Basic single date
|
|
24
|
+
* ```html
|
|
25
|
+
* <st-datepicker
|
|
26
|
+
* label="Pick a date"
|
|
27
|
+
* mode="single"
|
|
28
|
+
* format="DD/MM/YYYY"
|
|
29
|
+
* (dateUpdated)="onDate($event)"
|
|
30
|
+
* #picker="stDatepicker"
|
|
31
|
+
* >
|
|
32
|
+
* <st-button [outline]="true">{{ picker.displayValue() || 'Pick a date' }}</st-button>
|
|
33
|
+
* </st-datepicker>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Date range with time (minutes)
|
|
37
|
+
* ```html
|
|
38
|
+
* <st-datepicker
|
|
39
|
+
* label="Pick range with time"
|
|
40
|
+
* mode="range"
|
|
41
|
+
* [showTimePicker]="true"
|
|
42
|
+
* [showSeconds]="false"
|
|
43
|
+
* (rangeUpdated)="onRange($event)"
|
|
44
|
+
* (startTimeChanged)="onStartTime($event)"
|
|
45
|
+
* (endTimeChanged)="onEndTime($event)"
|
|
46
|
+
* #picker="stDatepicker"
|
|
47
|
+
* >
|
|
48
|
+
* <st-button [outline]="true">{{ picker.displayValue() || 'Pick range' }}</st-button>
|
|
49
|
+
* </st-datepicker>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Reactive form control (range)
|
|
53
|
+
* ```html
|
|
54
|
+
* <form [formGroup]="form">
|
|
55
|
+
* <st-datepicker
|
|
56
|
+
* [parentForm]="form"
|
|
57
|
+
* formControlName="range"
|
|
58
|
+
* mode="range"
|
|
59
|
+
* [rangeCalendars]="2"
|
|
60
|
+
* [showQuickActions]="true"
|
|
61
|
+
* name="range"
|
|
62
|
+
* >
|
|
63
|
+
* <st-input [value]="picker.displayValue()" [readonly]="true" name="range"></st-input>
|
|
64
|
+
* </st-datepicker>
|
|
65
|
+
* </form>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare class DatepickerComponent implements ControlValueAccessor {
|
|
69
|
+
/** Internal state for single date (ISO format) */
|
|
70
|
+
private readonly _selectedDateValue;
|
|
71
|
+
/** Internal state for date range (ISO format) */
|
|
72
|
+
private readonly _selectedRangeValue;
|
|
73
|
+
/** Disabled state */
|
|
74
|
+
private readonly _disabled;
|
|
75
|
+
/** Flag to prevent concurrent range updates */
|
|
76
|
+
private isUpdatingRange;
|
|
77
|
+
/** Translation service for reactive language changes */
|
|
78
|
+
private readonly translationService;
|
|
79
|
+
/** Form change callback */
|
|
80
|
+
private onControlChange;
|
|
81
|
+
/** Form touch callback */
|
|
82
|
+
private onControlTouch;
|
|
83
|
+
/** Overlay reference for controlling calendar popup */
|
|
84
|
+
datePickerOverlay: import("@angular/core").Signal<OverlayComponent | undefined>;
|
|
85
|
+
/** Label displayed above the fieldset legend */
|
|
86
|
+
label: import("@angular/core").InputSignal<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Picker mode
|
|
89
|
+
* @defaultValue 'single'
|
|
90
|
+
* @remarks 'single' for single date, 'range' for start/end selection
|
|
91
|
+
*/
|
|
92
|
+
mode: import("@angular/core").InputSignal<"single" | "range">;
|
|
93
|
+
/**
|
|
94
|
+
* Display/parse format for dates
|
|
95
|
+
* @defaultValue 'DD/MM/YYYY'
|
|
96
|
+
* @remarks Used for trigger text and for parsing external values (when provided as display strings)
|
|
97
|
+
*/
|
|
98
|
+
format: import("@angular/core").InputSignal<"DD/MM/YYYY" | "MM/DD/YYYY" | "YYYY-MM-DD" | "DD-MM-YYYY" | "MM-DD-YYYY" | "YYYY/MM/DD" | "DD.MM.YYYY" | "MM.DD.YYYY" | "YYYY.MM.DD">;
|
|
99
|
+
/**
|
|
100
|
+
* Locale used by the calendar web component
|
|
101
|
+
* @defaultValue 'en-US'
|
|
102
|
+
* @remarks If omitted or set to 'en-US', the component will auto-map from the TranslationService using `languageMapping`.
|
|
103
|
+
*/
|
|
104
|
+
language: import("@angular/core").InputSignal<"en-US" | "en-GB" | "es-ES" | "es-MX" | "fr-FR" | "de-DE" | "it-IT" | "pt-BR" | "pt-PT" | "ja-JP" | "ko-KR" | "zh-CN" | "zh-TW" | "ru-RU" | "ar-SA" | "hi-IN" | "nl-NL" | "sv-SE" | "da-DK" | "no-NO" | "fi-FI" | "pl-PL" | "tr-TR" | "he-IL" | "th-TH" | "vi-VN">;
|
|
105
|
+
/** Optional minimum selectable date (display or ISO). Internally coerced to ISO. */
|
|
106
|
+
minDate: import("@angular/core").InputSignal<string | null>;
|
|
107
|
+
/** Optional maximum selectable date (display or ISO). Internally coerced to ISO. */
|
|
108
|
+
maxDate: import("@angular/core").InputSignal<string | null>;
|
|
109
|
+
/** Single date value (external binding). Accepts display or ISO; stored internally as ISO. */
|
|
110
|
+
value: import("@angular/core").InputSignal<string>;
|
|
111
|
+
/** Date range value (external binding). Accepts display or ISO; stored internally as ISO. */
|
|
112
|
+
rangeValue: import("@angular/core").InputSignal<DateRange | null>;
|
|
113
|
+
/** Name attribute for associated input (useful when wrapping with st-input). */
|
|
114
|
+
name: import("@angular/core").InputSignal<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Number of calendars to show in range mode
|
|
117
|
+
* @defaultValue 2
|
|
118
|
+
*/
|
|
119
|
+
rangeCalendars: import("@angular/core").InputSignal<2 | 1>;
|
|
120
|
+
/**
|
|
121
|
+
* Whether to show quick action buttons for common ranges
|
|
122
|
+
* @defaultValue true
|
|
123
|
+
*/
|
|
124
|
+
showQuickActions: import("@angular/core").InputSignal<boolean>;
|
|
125
|
+
/**
|
|
126
|
+
* Whether to show time pickers for start/end
|
|
127
|
+
* @defaultValue false
|
|
128
|
+
*/
|
|
129
|
+
showTimePicker: import("@angular/core").InputSignal<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Whether to include seconds in time inputs and display
|
|
132
|
+
* @defaultValue false
|
|
133
|
+
*/
|
|
134
|
+
showSeconds: import("@angular/core").InputSignal<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Time display format for trigger text
|
|
137
|
+
* @defaultValue '24h'
|
|
138
|
+
* @remarks Affects only the textual display in the trigger, not the underlying stored time format
|
|
139
|
+
*/
|
|
140
|
+
timeDisplayFormat: import("@angular/core").InputSignal<"24h" | "12h">;
|
|
141
|
+
/**
|
|
142
|
+
* Mapping of translation language codes (e.g. 'en','es','pt') to calendar locales (e.g. 'en-US','es-MX','pt-BR')
|
|
143
|
+
* @defaultValue { en: 'en-US', es: 'es-MX', pt: 'pt-BR' }
|
|
144
|
+
*/
|
|
145
|
+
languageMapping: import("@angular/core").InputSignal<Record<string, "en-US" | "en-GB" | "es-ES" | "es-MX" | "fr-FR" | "de-DE" | "it-IT" | "pt-BR" | "pt-PT" | "ja-JP" | "ko-KR" | "zh-CN" | "zh-TW" | "ru-RU" | "ar-SA" | "hi-IN" | "nl-NL" | "sv-SE" | "da-DK" | "no-NO" | "fi-FI" | "pl-PL" | "tr-TR" | "he-IL" | "th-TH" | "vi-VN">>;
|
|
146
|
+
/**
|
|
147
|
+
* Use locale-based formatting for the trigger display instead of the custom pattern
|
|
148
|
+
* @defaultValue false
|
|
149
|
+
*/
|
|
150
|
+
useLocaleDisplay: import("@angular/core").InputSignal<boolean>;
|
|
151
|
+
/**
|
|
152
|
+
* Locale date style when useLocaleDisplay=true
|
|
153
|
+
* @defaultValue 'short'
|
|
154
|
+
*/
|
|
155
|
+
dateStyle: import("@angular/core").InputSignal<"short" | "medium" | "long" | "full">;
|
|
156
|
+
/** Optional external defaults for start/end time (HH:mm or HH:mm:ss). When empty string, inputs render blank. */
|
|
157
|
+
startTimeValue: import("@angular/core").InputSignal<OptionalTimeString>;
|
|
158
|
+
endTimeValue: import("@angular/core").InputSignal<OptionalTimeString>;
|
|
159
|
+
/**
|
|
160
|
+
* Current start time value (internal signal). Empty when unset.
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
readonly startTime: import("@angular/core").WritableSignal<OptionalTimeString>;
|
|
164
|
+
/**
|
|
165
|
+
* Current end time value (internal signal). Empty when unset.
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
readonly endTime: import("@angular/core").WritableSignal<OptionalTimeString>;
|
|
169
|
+
/** Parent reactive form group (optional) */
|
|
170
|
+
parentForm: import("@angular/core").InputSignal<FormGroup<any> | null>;
|
|
171
|
+
/** Name of the form control inside the parent form (optional) */
|
|
172
|
+
formControlName: import("@angular/core").InputSignal<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Emits formatted single date when it changes
|
|
175
|
+
* @remarks Uses the `format` (or locale display if enabled). For range mode, use `rangeUpdated`.
|
|
176
|
+
*/
|
|
177
|
+
dateUpdated: import("@angular/core").OutputEmitterRef<string>;
|
|
178
|
+
/**
|
|
179
|
+
* Emits an ISO `DateRange` when both start & end are selected
|
|
180
|
+
* @remarks Start/end are always emitted in ISO (YYYY-MM-DD). Time values are emitted separately.
|
|
181
|
+
*/
|
|
182
|
+
rangeUpdated: import("@angular/core").OutputEmitterRef<DateRange>;
|
|
183
|
+
/** Emits formatted date when value changes (single mode). Alias of `dateUpdated`. */
|
|
184
|
+
valueChanged: import("@angular/core").OutputEmitterRef<string>;
|
|
185
|
+
/** Emits ISO date range (alias of `rangeUpdated`). */
|
|
186
|
+
rangeValueChanged: import("@angular/core").OutputEmitterRef<DateRange>;
|
|
187
|
+
/** Emits start time (HH:mm or HH:mm:ss) changes; empty string when cleared */
|
|
188
|
+
startTimeChanged: import("@angular/core").OutputEmitterRef<OptionalTimeString>;
|
|
189
|
+
/** Emits end time (HH:mm or HH:mm:ss) changes; empty string when cleared */
|
|
190
|
+
endTimeChanged: import("@angular/core").OutputEmitterRef<OptionalTimeString>;
|
|
191
|
+
/** Effective minimum date (input or default 10 years ago) */
|
|
192
|
+
effectiveMinDate: import("@angular/core").Signal<string>;
|
|
193
|
+
/** Effective maximum date (input or default 10 years ahead) */
|
|
194
|
+
effectiveMaxDate: import("@angular/core").Signal<string>;
|
|
195
|
+
/** Locale for calendar components */
|
|
196
|
+
calendarLocale: import("@angular/core").Signal<"en-US" | "en-GB" | "es-ES" | "es-MX" | "fr-FR" | "de-DE" | "it-IT" | "pt-BR" | "pt-PT" | "ja-JP" | "ko-KR" | "zh-CN" | "zh-TW" | "ru-RU" | "ar-SA" | "hi-IN" | "nl-NL" | "sv-SE" | "da-DK" | "no-NO" | "fi-FI" | "pl-PL" | "tr-TR" | "he-IL" | "th-TH" | "vi-VN">;
|
|
197
|
+
/** Form control instance from parent form group */
|
|
198
|
+
formField: import("@angular/core").Signal<FormControl<any> | null>;
|
|
199
|
+
/** Formatted display value for single date */
|
|
200
|
+
selectedDate: import("@angular/core").Signal<string>;
|
|
201
|
+
/** Formatted display value for date range */
|
|
202
|
+
selectedRange: import("@angular/core").Signal<{
|
|
203
|
+
start: string;
|
|
204
|
+
end: string;
|
|
205
|
+
} | null>;
|
|
206
|
+
/** @internal Value for calendar-range component (ISO/ISO format) */
|
|
207
|
+
rangeCalendarValue: import("@angular/core").Signal<string>;
|
|
208
|
+
displayValue: import("@angular/core").Signal<string>;
|
|
209
|
+
/** Time values normalized for the inputs based on showSeconds */
|
|
210
|
+
startTimeDisplay: import("@angular/core").Signal<string>;
|
|
211
|
+
endTimeDisplay: import("@angular/core").Signal<string>;
|
|
212
|
+
/** Keep internal state in sync when rangeValue input changes */
|
|
213
|
+
syncInputEff: import("@angular/core").EffectRef;
|
|
214
|
+
/** Sync external start/end time inputs into internal signals */
|
|
215
|
+
syncTimeInputsEff: import("@angular/core").EffectRef;
|
|
216
|
+
/** Exposed selected date value (ISO format) for template access */
|
|
217
|
+
selectedDateValue: import("@angular/core").Signal<string>;
|
|
218
|
+
private formatMonthYear;
|
|
219
|
+
private formatWeekday;
|
|
220
|
+
private formatDateLocale;
|
|
221
|
+
fromDay: import("@angular/core").Signal<string>;
|
|
222
|
+
fromMonthYear: import("@angular/core").Signal<string>;
|
|
223
|
+
fromWeekday: import("@angular/core").Signal<string>;
|
|
224
|
+
toDay: import("@angular/core").Signal<string>;
|
|
225
|
+
toMonthYear: import("@angular/core").Signal<string>;
|
|
226
|
+
toWeekday: import("@angular/core").Signal<string>;
|
|
227
|
+
constructor();
|
|
228
|
+
/**
|
|
229
|
+
* Initialize component values based on inputs
|
|
230
|
+
*/
|
|
231
|
+
private initializeValues;
|
|
232
|
+
/**
|
|
233
|
+
* Set single date value programmatically
|
|
234
|
+
*/
|
|
235
|
+
private setSingleDateValue;
|
|
236
|
+
/**
|
|
237
|
+
* Emit change events and notify form controls
|
|
238
|
+
*/
|
|
239
|
+
private emitChanges;
|
|
240
|
+
/**
|
|
241
|
+
* Close overlay if available
|
|
242
|
+
*/
|
|
243
|
+
private closeOverlay;
|
|
244
|
+
/**
|
|
245
|
+
* Handle calendar change events from Cally components
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
248
|
+
onCalendarChange(calendarElement: HTMLElement, event?: Event): void;
|
|
249
|
+
/**
|
|
250
|
+
* Apply a predefined quick range preset
|
|
251
|
+
* @param preset One of: 'last7Days' | 'last30Days' | 'last6Months' | 'lastYear'
|
|
252
|
+
* @remarks This updates the date range (ISO). Time inputs are not modified.
|
|
253
|
+
*/
|
|
254
|
+
selectQuickRange(preset: QuickRangePreset): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* Apply a time-based quick range (last N hours). Visible only when time picker is enabled.
|
|
257
|
+
* @param hours Number of hours to go back from now
|
|
258
|
+
* @remarks Updates the date range and emits start/end time strings (HH:mm:ss)
|
|
259
|
+
*/
|
|
260
|
+
selectQuickLastHours(hours: number): Promise<void>;
|
|
261
|
+
/**
|
|
262
|
+
* Clear the current range selection
|
|
263
|
+
* @remarks Also clears start/end time inputs and emits empty strings for time changes.
|
|
264
|
+
*/
|
|
265
|
+
clearRange(): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* Clear the current single date selection
|
|
268
|
+
*/
|
|
269
|
+
clearDate(): void;
|
|
270
|
+
/**
|
|
271
|
+
* Set range value programmatically
|
|
272
|
+
*/
|
|
273
|
+
private setRangeValue;
|
|
274
|
+
/**
|
|
275
|
+
* Update calendar element to ensure Cally.js synchronization
|
|
276
|
+
*/
|
|
277
|
+
private updateCalendarElementValue;
|
|
278
|
+
/**
|
|
279
|
+
* Handle single date calendar change
|
|
280
|
+
*/
|
|
281
|
+
private handleSingleCalendarChange;
|
|
282
|
+
/**
|
|
283
|
+
* Handle range calendar change
|
|
284
|
+
*/
|
|
285
|
+
private handleRangeCalendarChange;
|
|
286
|
+
/**
|
|
287
|
+
* Finalize range selection: ensure same-day times if needed and emit when selection is complete
|
|
288
|
+
*/
|
|
289
|
+
private finalizeRangeSelection;
|
|
290
|
+
/**
|
|
291
|
+
* Extract date value from calendar element
|
|
292
|
+
*/
|
|
293
|
+
private extractDateValue;
|
|
294
|
+
/**
|
|
295
|
+
* Extract range value from calendar element
|
|
296
|
+
*/
|
|
297
|
+
private extractRangeValue;
|
|
298
|
+
/**
|
|
299
|
+
* Write external model value into the component
|
|
300
|
+
*/
|
|
301
|
+
writeValue(obj: DatePickerValue): void;
|
|
302
|
+
/**
|
|
303
|
+
* Register form change callback
|
|
304
|
+
*/
|
|
305
|
+
registerOnChange(fn: (value: DatePickerValue) => void): void;
|
|
306
|
+
/**
|
|
307
|
+
* Register form touched callback
|
|
308
|
+
*/
|
|
309
|
+
registerOnTouched(fn: () => void): void;
|
|
310
|
+
/**
|
|
311
|
+
* Update disabled state from Angular forms
|
|
312
|
+
*/
|
|
313
|
+
setDisabledState(isDisabled: boolean): void;
|
|
314
|
+
/** Icons for navigation buttons */
|
|
315
|
+
readonly iconChevronLeft = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M15.41 7.41L14 6l-6 6l6 6l1.41-1.41L10.83 12z\"></path></svg>";
|
|
316
|
+
readonly iconChevronRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M10 6L8.59 7.41L13.17 12l-4.58 4.59L10 18l6-6z\"></path></svg>";
|
|
317
|
+
readonly iconClock = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\" style=\"stroke-width:var(--ng-icon__stroke-width, 1.5)\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z\"></path></svg>";
|
|
318
|
+
private clampTime;
|
|
319
|
+
onStartTimeChange(ev: Event): void;
|
|
320
|
+
onEndTimeChange(ev: Event): void;
|
|
321
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DatepickerComponent, never>;
|
|
322
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DatepickerComponent, "st-datepicker", ["stDatepicker"], { "label": { "alias": "label"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "language": { "alias": "language"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "rangeValue": { "alias": "rangeValue"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "rangeCalendars": { "alias": "rangeCalendars"; "required": false; "isSignal": true; }; "showQuickActions": { "alias": "showQuickActions"; "required": false; "isSignal": true; }; "showTimePicker": { "alias": "showTimePicker"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "timeDisplayFormat": { "alias": "timeDisplayFormat"; "required": false; "isSignal": true; }; "languageMapping": { "alias": "languageMapping"; "required": false; "isSignal": true; }; "useLocaleDisplay": { "alias": "useLocaleDisplay"; "required": false; "isSignal": true; }; "dateStyle": { "alias": "dateStyle"; "required": false; "isSignal": true; }; "startTimeValue": { "alias": "startTimeValue"; "required": false; "isSignal": true; }; "endTimeValue": { "alias": "endTimeValue"; "required": false; "isSignal": true; }; "parentForm": { "alias": "parentForm"; "required": false; "isSignal": true; }; "formControlName": { "alias": "formControlName"; "required": false; "isSignal": true; }; }, { "dateUpdated": "dateUpdated"; "rangeUpdated": "rangeUpdated"; "valueChanged": "valueChanged"; "rangeValueChanged": "rangeValueChanged"; "startTimeChanged": "startTimeChanged"; "endTimeChanged": "endTimeChanged"; }, never, ["*"], true, never>;
|
|
323
|
+
}
|