@weni/unnnic-system 3.11.1-alpha.1 → 3.11.1-alpha.4

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 (47) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/DatePicker/DatePicker.vue.d.ts +69 -249
  3. package/dist/components/DatePicker/DatePicker.vue.d.ts.map +1 -1
  4. package/dist/components/Drawer/Drawer.vue.d.ts.map +1 -1
  5. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +47 -911
  6. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts.map +1 -1
  7. package/dist/components/Select/SelectItem.vue.d.ts +1 -1
  8. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +1 -1
  9. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +1 -1
  10. package/dist/components/Sidebar/SidebarItem.vue.d.ts +2 -2
  11. package/dist/components/ui/drawer/Drawer.vue.d.ts.map +1 -1
  12. package/dist/components/ui/drawer/DrawerClose.vue.d.ts.map +1 -1
  13. package/dist/components/ui/drawer/DrawerContent.vue.d.ts.map +1 -1
  14. package/dist/components/ui/drawer/DrawerDescription.vue.d.ts.map +1 -1
  15. package/dist/components/ui/drawer/DrawerFooter.vue.d.ts.map +1 -1
  16. package/dist/components/ui/drawer/DrawerHeader.vue.d.ts.map +1 -1
  17. package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts.map +1 -1
  18. package/dist/components/ui/drawer/DrawerTitle.vue.d.ts.map +1 -1
  19. package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts.map +1 -1
  20. package/dist/{es-1e5cce64.mjs → es-fc643bdb.mjs} +1 -1
  21. package/dist/{index-8d75623f.mjs → index-4601aaf4.mjs} +9050 -9107
  22. package/dist/{pt-br-defd03da.mjs → pt-br-0b82e6d2.mjs} +1 -1
  23. package/dist/style.css +1 -1
  24. package/dist/unnnic.mjs +1 -1
  25. package/dist/unnnic.umd.js +42 -42
  26. package/package.json +1 -1
  27. package/src/components/DatePicker/DatePicker.vue +628 -516
  28. package/src/components/DatePicker/__tests__/DatePicker.spec.js +227 -0
  29. package/src/components/Drawer/Drawer.vue +6 -2
  30. package/src/components/Drawer/__tests__/Drawer.spec.js +11 -15
  31. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +9 -9
  32. package/src/components/InputDatePicker/InputDatePicker.vue +149 -183
  33. package/src/components/InputDatePicker/__test__/InputDatePicker.spec.js +159 -0
  34. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
  35. package/src/components/ui/drawer/Drawer.vue +4 -0
  36. package/src/components/ui/drawer/DrawerClose.vue +4 -0
  37. package/src/components/ui/drawer/DrawerContent.vue +5 -1
  38. package/src/components/ui/drawer/DrawerDescription.vue +4 -0
  39. package/src/components/ui/drawer/DrawerFooter.vue +5 -1
  40. package/src/components/ui/drawer/DrawerHeader.vue +5 -1
  41. package/src/components/ui/drawer/DrawerOverlay.vue +5 -1
  42. package/src/components/ui/drawer/DrawerTitle.vue +5 -1
  43. package/src/components/ui/drawer/DrawerTrigger.vue +4 -0
  44. package/src/stories/DatePicker.stories.js +71 -0
  45. package/src/stories/InputDatePicker.stories.js +22 -0
  46. package/dist/components/index.d.ts +0 -25946
  47. package/dist/components/index.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,38 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ # 3.11.1 (2025-11-27)
9
+
10
+ ### Added
11
+
12
+ - **DatePicker Component**:
13
+ - Added `periodBaseDate` prop to allow custom reference dates for predefined periods (e.g. `last-7-days`, `last-12-months`, `current-month`, `previous-month`), enabling use cases like "Last 7 days (up to 24h ago)".
14
+ - Added `data-testid` attributes to key interactive elements (root, navigation buttons, day/month/year cells, options, clear/apply buttons) to improve testability and coverage quality.
15
+ - Added new Storybook stories demonstrating multiple usage patterns:
16
+ - `SmallDayPicker` (type `day`, size `small`)
17
+ - `MonthView` (type `month`)
18
+ - `YearView` (type `year`)
19
+ - `WithMinAndMaxDateRange` (date range constrained by `minDate` and `maxDate`)
20
+ - `WithCustomLabelsAndDisableClear` (custom action/clear labels and `disableClear`)
21
+ - `CustomRelativePeriodsWithBaseDate` (custom relative filters backed by `periodBaseDate`).
22
+ - **InputDatePicker Component**:
23
+ - Added `periodBaseDate` prop passthrough so external consumers can leverage the new relative date presets from `UnnnicDatePicker` (e.g. "Last 7 days (up to 24h ago)").
24
+ - Added new Storybook story `WithCustomRelativePeriodsAndBaseDate` showcasing InputDatePicker with relative filters backed by `periodBaseDate`.
25
+ - Added focused unit tests for InputDatePicker covering integration with DatePicker, v-model behavior, formatting, and dropdown open/close logic.
26
+
27
+ ### Changed
28
+
29
+ - **DatePicker Component**:
30
+ - Migrated implementation to `<script setup lang="ts">` with Vue 3 Composition API while preserving the existing public API (props, events, and behavior) for backward compatibility.
31
+ - Normalized internal date-handling logic to use typed helpers (`dateToString`, `stringToTime`, etc.) for safer arithmetic across day, month, and year views.
32
+ - **InputDatePicker Component**:
33
+ - Migrated implementation to `<script setup lang="ts">` Composition API while preserving existing props (`modelValue`, `type`, `format`, `inputFormat`, etc.), events, and visual behavior for backward compatibility.
34
+
35
+ ### Fixed
36
+
37
+ - **DatePicker Component**:
38
+ - Corrected month label rendering in `type="month"` view by aligning month indices with the localized `monthsLocale` array (fixes incorrect labels and potential indexing errors).
39
+
8
40
  # 3.11.0 (2025-11-24)
9
41
 
10
42
  ### Added
@@ -1,262 +1,82 @@
1
- declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
- initialStartDate: {
3
- type: StringConstructor;
4
- default: string;
5
- };
6
- initialEndDate: {
7
- type: StringConstructor;
8
- default: string;
9
- };
10
- minDate: {
11
- type: StringConstructor;
12
- default: string;
13
- };
14
- maxDate: {
15
- type: StringConstructor;
16
- default: string;
17
- };
18
- equivalentOption: {
19
- type: StringConstructor;
20
- default: string;
21
- };
22
- type: {
23
- type: StringConstructor;
24
- default: string;
25
- validator(type: unknown): boolean;
26
- };
27
- size: {
28
- type: StringConstructor;
29
- default: string;
30
- validator(size: unknown): boolean;
31
- };
32
- clearLabel: {
33
- type: StringConstructor;
34
- default: string;
35
- };
36
- actionLabel: {
37
- type: StringConstructor;
38
- default: string;
39
- };
40
- months: {
41
- type: ArrayConstructor;
42
- default: () => never[];
43
- validator(months: unknown): boolean;
44
- };
45
- days: {
46
- type: ArrayConstructor;
47
- default: () => never[];
48
- validator(days: unknown): boolean;
49
- };
50
- options: {
51
- type: ArrayConstructor;
52
- default: () => never[];
53
- };
54
- disableClear: {
55
- type: BooleanConstructor;
56
- default: boolean;
57
- };
58
- }>, {}, {
59
- referenceDate: string;
60
- startDate: string;
61
- endDate: string;
62
- optionSelected: string;
63
- defaultTranslations: {
64
- clean: {
65
- 'pt-br': string;
66
- en: string;
67
- es: string;
68
- };
69
- filter: {
70
- 'pt-br': string;
71
- en: string;
72
- es: string;
73
- };
74
- };
75
- }, {
76
- openMonths(): string[];
77
- value(): {
1
+ type PeriodOption = {
2
+ id: string;
3
+ name: string;
4
+ };
5
+ export interface DatePickerProps {
6
+ initialStartDate?: string;
7
+ initialEndDate?: string;
8
+ minDate?: string;
9
+ maxDate?: string;
10
+ periodBaseDate?: string;
11
+ equivalentOption?: string;
12
+ type?: 'day' | 'month' | 'year';
13
+ size?: 'small' | 'large';
14
+ clearLabel?: string;
15
+ actionLabel?: string;
16
+ months?: string[];
17
+ days?: string[];
18
+ options?: PeriodOption[];
19
+ disableClear?: boolean;
20
+ locale?: string;
21
+ translations?: Record<string, unknown>;
22
+ }
23
+ declare function dateToString(date: Date): string;
24
+ declare function getDatesOfTheMonth(reference: string): {
25
+ properties: string[];
26
+ toString: () => string;
27
+ }[];
28
+ declare function getStartAndEndDateByPeriod(period: string): {
29
+ startDate: string | undefined;
30
+ endDate: string | undefined;
31
+ };
32
+ declare function autoSelect(method: string): void;
33
+ declare const _default: import('vue').DefineComponent<DatePickerProps, {
34
+ i18n: (...args: any[]) => string | undefined;
35
+ startDate: import('vue').Ref<string, string>;
36
+ endDate: import('vue').Ref<string, string>;
37
+ optionSelected: import('vue').Ref<string, string>;
38
+ referenceDate: import('vue').Ref<string, string>;
39
+ autoSelect: typeof autoSelect;
40
+ dateToString: typeof dateToString;
41
+ getStartAndEndDateByPeriod: typeof getStartAndEndDateByPeriod;
42
+ getDatesOfTheMonth: typeof getDatesOfTheMonth;
43
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
44
+ change: (value: {
78
45
  startDate: string;
79
46
  endDate: string;
80
- };
81
- i18nLocale(): string;
82
- monthsLocale(): any;
83
- daysLocale(): any;
84
- periodsLocale(): any;
85
- clearText(): any;
86
- filterText(): any;
87
- }, {
88
- submit(): void;
89
- updateOptionSelected(): void;
90
- dateToString(date: any): string;
91
- dateToStringMonth(date: any): string;
92
- dateToStringYear(date: any): any;
93
- stringToTime(date: any): number;
94
- getDate(date: any): any;
95
- getMonth(date: any): any;
96
- getFullYear(date: any): number;
97
- addMonth(referenceDate: any, quantity: any): string;
98
- isDateBetween(internalDate: any): boolean;
99
- isDateBetweenMonth(internalDate: any): boolean;
100
- isDateBetweenYear(internalDate: any): boolean;
101
- getDatesOfTheMonth(referenceDate: any): {
102
- properties: string[];
103
- toString: () => string;
104
- }[];
105
- getMonthsOfTheYear(referenceDate: any): {
106
- properties: string[];
107
- date: string;
108
- toString: () => string;
109
- }[];
110
- getYears(referenceDate: any): {
111
- properties: string[];
112
- date: number;
113
- toString: () => string;
114
- }[];
115
- selectDate(date: any): void;
116
- clear(): void;
117
- getStartAndEndDateByPeriod(period: any): {
118
- startDate: string | undefined;
119
- endDate: string | undefined;
120
- };
121
- autoSelect(method: any): void;
122
- }, {
123
- props: {
124
- locale: {
125
- type: StringConstructor;
126
- };
127
- translations: {
128
- type: ObjectConstructor;
129
- };
130
- };
131
- methods: {
132
- i18n(...args: any[]): any;
133
- };
134
- }, import('vue').ComponentOptionsMixin, ("change" | "submit" | "update:equivalentOption")[], "change" | "submit" | "update:equivalentOption", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
135
- initialStartDate: {
136
- type: StringConstructor;
137
- default: string;
138
- };
139
- initialEndDate: {
140
- type: StringConstructor;
141
- default: string;
142
- };
143
- minDate: {
144
- type: StringConstructor;
145
- default: string;
146
- };
147
- maxDate: {
148
- type: StringConstructor;
149
- default: string;
150
- };
151
- equivalentOption: {
152
- type: StringConstructor;
153
- default: string;
154
- };
155
- type: {
156
- type: StringConstructor;
157
- default: string;
158
- validator(type: unknown): boolean;
159
- };
160
- size: {
161
- type: StringConstructor;
162
- default: string;
163
- validator(size: unknown): boolean;
164
- };
165
- clearLabel: {
166
- type: StringConstructor;
167
- default: string;
168
- };
169
- actionLabel: {
170
- type: StringConstructor;
171
- default: string;
172
- };
173
- months: {
174
- type: ArrayConstructor;
175
- default: () => never[];
176
- validator(months: unknown): boolean;
177
- };
178
- days: {
179
- type: ArrayConstructor;
180
- default: () => never[];
181
- validator(days: unknown): boolean;
182
- };
183
- options: {
184
- type: ArrayConstructor;
185
- default: () => never[];
186
- };
187
- disableClear: {
188
- type: BooleanConstructor;
189
- default: boolean;
190
- };
191
- }>> & Readonly<{
192
- onChange?: ((...args: any[]) => any) | undefined;
193
- onSubmit?: ((...args: any[]) => any) | undefined;
194
- "onUpdate:equivalentOption"?: ((...args: any[]) => any) | undefined;
47
+ }) => any;
48
+ submit: (value: {
49
+ startDate: string;
50
+ endDate: string;
51
+ }) => any;
52
+ "update:equivalentOption": (equivalentOption: string) => any;
53
+ }, string, import('vue').PublicProps, Readonly<DatePickerProps> & Readonly<{
54
+ onChange?: ((value: {
55
+ startDate: string;
56
+ endDate: string;
57
+ }) => any) | undefined;
58
+ onSubmit?: ((value: {
59
+ startDate: string;
60
+ endDate: string;
61
+ }) => any) | undefined;
62
+ "onUpdate:equivalentOption"?: ((equivalentOption: string) => any) | undefined;
195
63
  }>, {
196
- type: string;
197
- size: string;
64
+ type: "day" | "month" | "year";
65
+ size: "small" | "large";
66
+ locale: string;
198
67
  initialStartDate: string;
199
68
  initialEndDate: string;
200
69
  minDate: string;
201
70
  maxDate: string;
71
+ periodBaseDate: string;
202
72
  equivalentOption: string;
203
73
  clearLabel: string;
204
74
  actionLabel: string;
205
- months: unknown[];
206
- days: unknown[];
207
- options: unknown[];
75
+ months: string[];
76
+ days: string[];
77
+ options: PeriodOption[];
208
78
  disableClear: boolean;
209
- }, {}, {
210
- UnnnicButton: {
211
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('../Button/types.js').ButtonProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
212
- disabled: boolean;
213
- type: import('../Button/types.js').ButtonType;
214
- size: import('../Button/types.js').ButtonSize;
215
- text: string;
216
- iconLeft: string;
217
- iconRight: string;
218
- float: boolean;
219
- iconCenter: string;
220
- iconsFilled: boolean;
221
- loading: boolean;
222
- }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLButtonElement, import('vue').ComponentProvideOptions, {
223
- P: {};
224
- B: {};
225
- D: {};
226
- C: {};
227
- M: {};
228
- Defaults: {};
229
- }, Readonly<import('../Button/types.js').ButtonProps> & Readonly<{}>, {}, {}, {}, {}, {
230
- disabled: boolean;
231
- type: import('../Button/types.js').ButtonType;
232
- size: import('../Button/types.js').ButtonSize;
233
- text: string;
234
- iconLeft: string;
235
- iconRight: string;
236
- float: boolean;
237
- iconCenter: string;
238
- iconsFilled: boolean;
239
- loading: boolean;
240
- }>;
241
- __isFragment?: never;
242
- __isTeleport?: never;
243
- __isSuspense?: never;
244
- } & import('vue').ComponentOptionsBase<Readonly<import('../Button/types.js').ButtonProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
245
- disabled: boolean;
246
- type: import('../Button/types.js').ButtonType;
247
- size: import('../Button/types.js').ButtonSize;
248
- text: string;
249
- iconLeft: string;
250
- iconRight: string;
251
- float: boolean;
252
- iconCenter: string;
253
- iconsFilled: boolean;
254
- loading: boolean;
255
- }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
256
- $slots: {
257
- default?(_: {}): any;
258
- };
259
- });
260
- }, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
79
+ translations: Record<string, unknown>;
80
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
261
81
  export default _default;
262
82
  //# sourceMappingURL=DatePicker.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.vue.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.vue"],"names":[],"mappings":"AAyNA;"}
1
+ {"version":3,"file":"DatePicker.vue.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.vue"],"names":[],"mappings":"AAiPA;AAooCA,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAEzB,UAAU,CAAC,EAAE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AAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAZjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2OASG"}
1
+ {"version":3,"file":"Drawer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.vue"],"names":[],"mappings":"AAmFA;wBAmnBqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAZjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2OASG"}