origam 2.37.42 → 2.38.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 CHANGED
@@ -18,6 +18,24 @@ This project follows [Semantic Versioning](https://semver.org).
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [2.38.0] - 2026-11-16
22
+
23
+ ### Fixed — DatePicker : sélection d'année, flèches ‹ › et sélecteur mois/année (#1365)
24
+
25
+ - **Choisir une année ne faisait rien** : la grille des années appelait le handler des mois. Le parcours est désormais année → mois → jour.
26
+ - **Flèches ‹ › désactivées sur la grille des jours** après un passage par les mois ou les années : `viewMode` n'avait pas de défaut et la condition était inversée. `viewMode` vaut `month` par défaut ; les flèches sont actives sur la grille des jours et désactivées sur les grilles mois/années.
27
+ - **UI** : deux boutons `[Mois ▾] [Année ▾]` remplacent le libellé « Mois Année » + flèche isolée. Le chevron du bouton ouvert pivote (coupé sous `prefers-reduced-motion`) ; chaque bouton porte `aria-expanded` et un `aria-label` explicite.
28
+
29
+ #### ⚠️ Ruptures (mineure, projet pré-1.0)
30
+
31
+ - `OrigamDatePickerControls` / `OrigamDatePicker` : `text` ne contient plus que le **mois** (« June », plus « June 2024 ») ; nouvelle prop **`yearText`** pour l'année.
32
+ - Classe `origam-date-picker-controls__mode-btn` renommée **`__year-btn`**.
33
+ - Clé i18n `origam.date_picker_controls.toggle_year` remplacée par **`choose_month`** et **`choose_year`**.
34
+ - La prop `viewMode` des controls est désormais câblée (pilote `aria-expanded` et le chevron) et n'émet plus d'avertissement.
35
+
36
+ - **Vérifié** : Vitest complet exit 0 (7952 passés), e2e `date-picker.spec.ts` 12/12, `guards` 33/33, type-check exit 0. CI de la PR #1367 : 23/23 checks verts.
37
+ - Dérogation approuvée : `pnpm audit` porte 5 moderate préexistantes (nuxt 4.6.1), sans lien — remédiation #1366.
38
+
21
39
  ## [2.37.42] - 2026-11-11
22
40
 
23
41
  ### Changed — nettoyage du dépôt (#1346)
@@ -54,7 +54,8 @@
54
54
  "date_picker_controls": {
55
55
  "prev": "Previous",
56
56
  "next": "Next",
57
- "toggle_year": "Toggle year selection"
57
+ "choose_month": "Choose the month, currently {0}",
58
+ "choose_year": "Choose the year, currently {0}"
58
59
  },
59
60
  "no_data_text": "No data available",
60
61
  "bracket": {
@@ -54,7 +54,8 @@
54
54
  "date_picker_controls": {
55
55
  "prev": "Précédent",
56
56
  "next": "Suivant",
57
- "toggle_year": "Basculer la sélection de l'année"
57
+ "choose_month": "Choisir le mois, actuellement {0}",
58
+ "choose_year": "Choisir l'année, actuellement {0}"
58
59
  },
59
60
  "no_data_text": "Aucune donnée disponible",
60
61
  "bracket": {
@@ -32,7 +32,9 @@
32
32
  <origam-date-picker-controls
33
33
  ref="origamDatePickerControlsRef"
34
34
  :text="controlsText"
35
+ :year-text="controlsYearText"
35
36
  v-bind="{...datePickerControlsProps, ...disabledControlers}"
37
+ :view-mode="viewMode"
36
38
  @click:next="handleClickNext"
37
39
  @click:prev="handleClickPrev"
38
40
  @click:month="handleClickMonth"
@@ -61,7 +63,7 @@
61
63
  :max="maxDate"
62
64
  :min="minDate"
63
65
  v-bind="{ ...datePickerYearsProps }"
64
- @update:year="handleUpdateMonth"
66
+ @update:year="handleUpdateYear"
65
67
  />
66
68
  </template>
67
69
 
@@ -210,6 +212,7 @@ const props = defineProps({
210
212
  prevIcon: { type: null, required: false },
211
213
  modeIcon: { type: null, required: false },
212
214
  text: { type: String, required: false },
215
+ yearText: { type: String, required: false },
213
216
  viewMode: { type: null, required: false },
214
217
  hideWeekdays: { type: Boolean, required: false },
215
218
  multiple: { type: [Boolean, Number, String, Object], required: false },
@@ -250,7 +253,7 @@ const model = useVModel(
250
253
  (v) => wrapInArray(v),
251
254
  (v) => props.multiple || props.range ? v : v[0]
252
255
  );
253
- const viewMode = useVModel(props, "viewMode");
256
+ const viewMode = useVModel(props, "viewMode", DATE_MODE.MONTH);
254
257
  const viewModeIsMonth = computed(() => {
255
258
  return viewMode.value === DATE_MODE.MONTH;
256
259
  });
@@ -285,15 +288,19 @@ const header = computed(() => {
285
288
  }
286
289
  return model.value?.[0] && adapter.isValid(model.value?.[0]) ? adapter.format(adapter.date(model.value?.[0]), "normalDateWithWeekday") : t(props.header);
287
290
  });
288
- const monthAndYearText = computed(() => {
291
+ const displayedDate = computed(() => {
289
292
  let date = adapter.date();
290
293
  date = adapter.setDate(date, 1);
291
294
  date = adapter.setMonth(date, month.value);
292
- date = adapter.setYear(date, year.value);
293
- return adapter.format(date, "monthAndYear");
295
+ return adapter.setYear(date, year.value);
294
296
  });
297
+ const monthText = computed(() => adapter.format(displayedDate.value, "month"));
298
+ const displayedYearText = computed(() => adapter.format(displayedDate.value, "year"));
295
299
  const controlsText = computed(() => {
296
- return props.text || monthAndYearText.value;
300
+ return props.text || monthText.value;
301
+ });
302
+ const controlsYearText = computed(() => {
303
+ return props.yearText || displayedYearText.value;
297
304
  });
298
305
  const headerTransition = computed(() => {
299
306
  return {
@@ -316,7 +323,7 @@ const disabledControlers = computed(() => {
316
323
  disabledNext: props.disabledNext,
317
324
  disabledPrev: props.disabledPrev
318
325
  };
319
- if (viewModeIsMonth.value) {
326
+ if (!viewModeIsMonth.value) {
320
327
  targets.disabledNext = true;
321
328
  targets.disabledPrev = true;
322
329
  } else {
@@ -375,7 +382,7 @@ const handleUpdateMonth = (value) => {
375
382
  emits("update:month", value);
376
383
  };
377
384
  const handleUpdateYear = (value) => {
378
- if (viewModeIsYears.value) handleClickYear();
385
+ if (viewModeIsYears.value) viewMode.value = DATE_MODE.MONTHS;
379
386
  emits("update:year", value);
380
387
  };
381
388
  watch(model, (val, oldVal) => {
@@ -408,7 +415,7 @@ const pickerProps = computed(() => {
408
415
  const datePickerControlsProps = computed(() => {
409
416
  return origamDatePickerControlsRef.value?.filterProps(
410
417
  props,
411
- ["class", "style", "id", "text", "disabled"]
418
+ ["class", "style", "id", "text", "yearText", "viewMode", "disabled"]
412
419
  );
413
420
  });
414
421
  const datePickerHeaderProps = computed(() => {
@@ -466,14 +473,6 @@ defineExpose({
466
473
  width: var(--origam-date-picker--show-week---width);
467
474
  }
468
475
 
469
- &--year {
470
- :deep(.origam-date-picker-controls) {
471
- .origam-date-picker-controls__mode-btn {
472
- transform: rotate(180deg);
473
- }
474
- }
475
- }
476
-
477
476
  &__title {
478
477
  display: inline-block
479
478
  }
@@ -8,19 +8,23 @@
8
8
  <origam-btn-group>
9
9
  <template #default>
10
10
  <origam-btn
11
+ :append-icon="modeIcon"
12
+ :aria-expanded="isMonthsOpen"
13
+ :aria-label="monthLabel"
14
+ :class="monthClasses"
11
15
  :disabled="disableMonth"
12
16
  :text="text"
13
- class="origam-date-picker-controls__month-btn"
14
17
  rounded="0"
15
18
  @click="handleClickMonth"
16
19
  />
17
20
 
18
21
  <origam-btn
19
- key="mode-btn"
20
- :aria-label="t('origam.date_picker_controls.toggle_year')"
22
+ :append-icon="modeIcon"
23
+ :aria-expanded="isYearsOpen"
24
+ :aria-label="yearLabel"
25
+ :class="yearClasses"
21
26
  :disabled="disableYear"
22
- :icon="modeIcon"
23
- class="origam-date-picker-controls__mode-btn"
27
+ :text="yearText"
24
28
  rounded="0"
25
29
  @click="handleClickYear"
26
30
  />
@@ -78,6 +82,7 @@ const props = defineProps({
78
82
  prevIcon: { type: null, required: false, default: MDI_ICONS.CHEVRON_LEFT },
79
83
  modeIcon: { type: null, required: false, default: MDI_ICONS.MENU_DOWN_OUTLINE },
80
84
  text: { type: String, required: false },
85
+ yearText: { type: String, required: false },
81
86
  viewMode: { type: null, required: false, default: DATE_MODE.MONTH },
82
87
  id: { type: String, required: false },
83
88
  class: { type: [String, Array, Object], required: false },
@@ -89,12 +94,6 @@ useUnsupportedProp(
89
94
  "the controls row reflects the picker view state of its parent; it has no active state of its own.",
90
95
  () => props.active !== void 0
91
96
  );
92
- useUnsupportedProp(
93
- "OrigamDatePickerControls",
94
- "viewMode",
95
- "the displayed mode comes from the picker through `mode`, never from this prop.",
96
- () => props.viewMode !== DATE_MODE.MONTH
97
- );
98
97
  const emits = defineEmits(["click:year", "click:month", "click:prev", "click:next"]);
99
98
  defineSlots();
100
99
  const { filterProps } = useProps(props);
@@ -111,6 +110,18 @@ const disablePrev = computed(() => {
111
110
  const disableNext = computed(() => {
112
111
  return props.disabled || props.disabledNext;
113
112
  });
113
+ const isMonthsOpen = computed(() => props.viewMode === DATE_MODE.MONTHS);
114
+ const isYearsOpen = computed(() => props.viewMode === DATE_MODE.YEARS);
115
+ const monthClasses = computed(() => [
116
+ "origam-date-picker-controls__month-btn",
117
+ { "origam-date-picker-controls__month-btn--open": isMonthsOpen.value }
118
+ ]);
119
+ const yearClasses = computed(() => [
120
+ "origam-date-picker-controls__year-btn",
121
+ { "origam-date-picker-controls__year-btn--open": isYearsOpen.value }
122
+ ]);
123
+ const monthLabel = computed(() => t("origam.date_picker_controls.choose_month", props.text ?? ""));
124
+ const yearLabel = computed(() => t("origam.date_picker_controls.choose_year", props.yearText ?? ""));
114
125
  const handleClickPrev = () => {
115
126
  emits("click:prev");
116
127
  };
@@ -158,16 +169,25 @@ defineExpose({
158
169
  padding-inline-start: 6px;
159
170
  padding-inline-end: 12px;
160
171
 
161
- > :deep(.origam-btn) {
162
- &:first-child {
163
- text-transform: none;
164
- font-weight: 400;
165
- line-height: initial;
166
- letter-spacing: initial;
172
+ &__month-btn,
173
+ &__year-btn {
174
+ text-transform: none;
175
+ font-weight: 400;
176
+ line-height: initial;
177
+ letter-spacing: initial;
178
+
179
+ :deep(.origam-btn__append) {
180
+ transition: transform 0.2s ease;
181
+ }
182
+
183
+ &--open :deep(.origam-btn__append) {
184
+ transform: rotate(180deg);
167
185
  }
168
186
 
169
- &:last-child {
170
- margin-inline-start: 4px;
187
+ @media (prefers-reduced-motion: reduce) {
188
+ :deep(.origam-btn__append) {
189
+ transition: none;
190
+ }
171
191
  }
172
192
  }
173
193
 
@@ -19,13 +19,13 @@ export interface IDatePickerControlsProps extends ICommonsComponentProps {
19
19
  prevIcon?: TIcon;
20
20
  modeIcon?: TIcon;
21
21
  text?: string;
22
+ yearText?: string;
22
23
  viewMode?: TDateMode;
23
24
  }
24
25
  /** Emits fired by `<OrigamDatePickerControls>` — clicks on the four
25
26
  * toolbar buttons (year / month / prev / next). The month button
26
- * itself carries the `text` label (see `IDatePickerControlsProps.text`);
27
- * there is no button dedicated solely to the label, so there is no
28
- * separate `click:text` — a click on the label fires `click:month`.
27
+ * carries the `text` label and the year button the `yearText` label;
28
+ * a click on either fires `click:month` / `click:year`.
29
29
  * `event` is optional: the click handlers call `emits('click:prev')`
30
30
  * etc. without forwarding the originating MouseEvent. */
31
31
  export interface IDatePickerControlsEmits {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "origam",
3
- "version": "2.37.42",
3
+ "version": "2.38.0",
4
4
  "type": "module",
5
5
  "description": "origam — a Vue 3 design system with multi-theme design tokens, CSS-first components and TypeScript types.",
6
6
  "keywords": [