@aiquants/period-slider 0.12.0 → 0.13.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.
@@ -19,7 +19,7 @@
19
19
 
20
20
  import type React from "react"
21
21
  import { memo, useEffect, useMemo, useState } from "react"
22
- import { formatLabel } from "./PeriodSlider"
22
+ import { formatIsoYear, formatLabel, type PeriodOptionFormatter } from "./PeriodSlider"
23
23
  import { STEPPER_ROW_GAP_CLASS, StepperButton } from "./StepperButton"
24
24
 
25
25
  /**
@@ -28,9 +28,9 @@ import { STEPPER_ROW_GAP_CLASS, StepperButton } from "./StepperButton"
28
28
  *
29
29
  * Accessible names default to English and option text to locale-independent ISO 8601, because a
30
30
  * generic package cannot know the host application's language: localisation is the consumer's
31
- * decision, expressed through `locale` or the aria-label props.
31
+ * decision, expressed through `formatOption`, `locale` or the aria-label props.
32
32
  * アクセシブル名の既定は英語、選択肢テキストの既定はロケール非依存の ISO 8601 表記。
33
- * 汎用パッケージは利用側アプリの言語を知り得ないため、地域化は `locale`・アクセシブル名 Props を
33
+ * 汎用パッケージは利用側アプリの言語を知り得ないため、地域化は `formatOption`・`locale`・アクセシブル名 Props を
34
34
  * 通じた利用側の選択。
35
35
  */
36
36
  export interface MonthSelectorProps {
@@ -73,6 +73,8 @@ export interface MonthSelectorProps {
73
73
  selectAriaLabel?: string
74
74
  /** BCP 47 language tag switching option text to Intl formatting; omitted keeps locale-independent ISO 8601, and the input value stays yyyy-MM either way / 選択肢テキストを Intl 書式にする BCP 47 言語タグ (未指定時はロケール非依存の ISO 8601 表記・input の value は常に yyyy-MM) */
75
75
  locale?: string
76
+ /** Formatter for every option, placeholder and collapsed-control text this component owns, taking priority over `locale`; `variant="date"` cannot honour it and never invokes it (the browser owns that text) / 本コンポーネントが所有する全選択肢・プレースホルダ・畳んだ表示のフォーマッタ (`locale` より優先)。`variant="date"` は履行不能で呼び出しも行わない (表示はブラウザ所有) */
77
+ formatOption?: PeriodOptionFormatter
76
78
  }
77
79
 
78
80
  /**
@@ -96,11 +98,18 @@ function monthStart(year: number, monthIndex: number): Date {
96
98
  * Format a date as the yyyy-MM string used by the input, the select and the option list.
97
99
  * input / select / 選択肢で共用する yyyy-MM 文字列への整形。
98
100
  *
101
+ * The year comes from `formatIsoYear`, the package's single definition of that rule, so this machine value
102
+ * cannot drift from the displayed label the way an inline pad width did: `input[type="month"]` requires at
103
+ * least four year digits, and an unpadded year is both invalid there and different from what the option
104
+ * beside it prints.
105
+ * 年は `formatIsoYear` (パッケージ唯一の定義) から得る。桁数をこの場で書くと表示ラベルと食い違う
106
+ * (`input[type="month"]` は 4 桁以上を要求し、0 埋めしない年はそこでも不正、隣の選択肢の表記とも別物になる)。
107
+ *
99
108
  * @param date - Date to format / 整形対象の日付
100
109
  * @returns yyyy-MM representation / yyyy-MM 表記
101
110
  */
102
111
  function formatMonth(date: Date): string {
103
- return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}`
112
+ return `${formatIsoYear(date.getFullYear())}-${String(date.getMonth() + 1).padStart(2, "0")}`
104
113
  }
105
114
 
106
115
  /**
@@ -217,7 +226,9 @@ function expandBoundedMonths(minBound: Date, maxBound: Date): Date[] {
217
226
  const endIndex = maxBound.getFullYear() * 12 + maxBound.getMonth()
218
227
  const list: Date[] = []
219
228
  for (let i = startIndex; i <= endIndex; i++) {
220
- list.push(monthStart(Math.floor(i / 12), i % 12))
229
+ // 剰余演算子は負の通番で負の月を返す。それを monthStart が正規化すると年がもう 1 つ繰り下がり、
230
+ // 0 年以下の境界では選択肢一覧が丸ごと 1 年早い側へずれる (decode が持つ罠と同じ形)
231
+ list.push(monthStart(Math.floor(i / 12), ((i % 12) + 12) % 12))
221
232
  }
222
233
  return list
223
234
  }
@@ -229,12 +240,13 @@ function expandBoundedMonths(minBound: Date, maxBound: Date): Date[] {
229
240
  *
230
241
  * @param monthsAscending - Ascending selectable months / 昇順の選択可能月
231
242
  * @param locale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
243
+ * @param formatOption - Consumer formatter taking priority over `locale` / `locale` より優先される利用側フォーマッタ
232
244
  * @returns Descending options whose value is always yyyy-MM / value が常に yyyy-MM である降順選択肢
233
245
  */
234
- function toDescendingOptions(monthsAscending: Date[], locale: string | undefined): { label: string; value: string }[] {
246
+ function toDescendingOptions(monthsAscending: Date[], locale: string | undefined, formatOption: PeriodOptionFormatter | undefined): { label: string; value: string }[] {
235
247
  const options: { label: string; value: string }[] = []
236
248
  for (let i = monthsAscending.length - 1; i >= 0; i--) {
237
- options.push({ label: formatLabel("month", monthsAscending[i], undefined, locale), value: formatMonth(monthsAscending[i]) })
249
+ options.push({ label: formatLabel("month", monthsAscending[i], formatOption, locale), value: formatMonth(monthsAscending[i]) })
238
250
  }
239
251
  return options
240
252
  }
@@ -273,6 +285,7 @@ const MonthSelectorComponent = (props: MonthSelectorProps): React.JSX.Element =>
273
285
  nextMonthAriaLabel = "Next month",
274
286
  selectAriaLabel = "Month",
275
287
  locale,
288
+ formatOption,
276
289
  } = props
277
290
 
278
291
  assertLocaleProp(locale)
@@ -386,7 +399,12 @@ const MonthSelectorComponent = (props: MonthSelectorProps): React.JSX.Element =>
386
399
 
387
400
  const handleMonthString = (val: string) => {
388
401
  if (!val) return
389
- const [yearStr, monthStr] = val.split("-")
402
+ // 区切りで単純に分けると、0 年以下の拡張表記 (先頭の符号) が年を空文字列にし、
403
+ // 「-000001-03」が 0 年 1 月へ化ける。月は必ず最後の区切りの後ろにある
404
+ const separatorAt = val.lastIndexOf("-")
405
+ if (separatorAt <= 0) return
406
+ const yearStr = val.slice(0, separatorAt)
407
+ const monthStr = val.slice(separatorAt + 1)
390
408
  const year = Number(yearStr)
391
409
  const month = Number(monthStr) - 1
392
410
  if (!(Number.isInteger(year) && Number.isInteger(month))) return
@@ -406,7 +424,9 @@ const MonthSelectorComponent = (props: MonthSelectorProps): React.JSX.Element =>
406
424
  }
407
425
 
408
426
  const formattedValue = formatMonth(activeDate)
409
- const activeLabel = formatLabel("month", activeDate, undefined, locale)
427
+ // 描かれるのは variant="dropdown" かつ集合外のときだけ。常に組み立てると、履行できない面のために
428
+ // 利用側のフォーマッタが呼ばれ、描かれないテキストの生成が観測されてしまう
429
+ const activeLabel = variant === "dropdown" && !isActiveSelectable ? formatLabel("month", activeDate, formatOption, locale) : ""
410
430
 
411
431
  const minFormatted = minDateBound ? formatMonth(minDateBound) : undefined
412
432
 
@@ -414,10 +434,10 @@ const MonthSelectorComponent = (props: MonthSelectorProps): React.JSX.Element =>
414
434
 
415
435
  const dropdownOptions = useMemo(() => {
416
436
  if (variant !== "dropdown") return []
417
- if (selectableMonths !== null) return toDescendingOptions(selectableMonths, locale)
437
+ if (selectableMonths !== null) return toDescendingOptions(selectableMonths, locale, formatOption)
418
438
  if (minDateBound === null || maxDateBound === null) return []
419
- return toDescendingOptions(expandBoundedMonths(minDateBound, maxDateBound), locale)
420
- }, [variant, selectableMonths, minBoundTime, maxBoundTime, locale])
439
+ return toDescendingOptions(expandBoundedMonths(minDateBound, maxDateBound), locale, formatOption)
440
+ }, [variant, selectableMonths, minBoundTime, maxBoundTime, locale, formatOption])
421
441
 
422
442
  // <select> は一致する選択肢が無いと先頭項目を表示してしまうため、集合外の現在値は選択不可の実値プレースホルダとして明示する
423
443
  const selectValue = isActiveSelectable ? formattedValue : ""
@@ -489,6 +509,7 @@ export const MonthSelector = memo(MonthSelectorComponent, (prev, next) => {
489
509
  if (prev.nextMonthAriaLabel !== next.nextMonthAriaLabel) return false
490
510
  if (prev.selectAriaLabel !== next.selectAriaLabel) return false
491
511
  if (prev.locale !== next.locale) return false
512
+ if (prev.formatOption !== next.formatOption) return false
492
513
  return true
493
514
  })
494
515
  MonthSelector.displayName = "MonthSelector"
@@ -45,6 +45,62 @@ import { STEPPER_OUTWARD_RESERVE_CLASSES, STEPPER_ROW_GAP_CLASS, type StepArrowD
45
45
  */
46
46
  export type PeriodSliderUnit = "year" | "month" | "day"
47
47
 
48
+ /**
49
+ * Whether an option's text must identify a period on its own or name one calendar part beside its siblings.
50
+ * 選択肢テキストが単独で期間を名乗るのか、並ぶ兄弟の一部として暦の 1 部位だけを名乗るのかの区分。
51
+ *
52
+ * `"period"` is the entire value of one control: a month dropdown option, a year option, a day row, and
53
+ * the collapsed text of those controls. Its built-in rendering is `formatLabel` ("2025-04", or the Intl
54
+ * equivalent). `"part"` is one of the three fields `variant="split-dropdown"` shows side by side, where a
55
+ * self-identifying label would print the whole date three times; its built-in rendering is the part-scoped
56
+ * Intl option set ("04").
57
+ * 「period」は 1 つの操作要素の値そのもの (組み込みは `formatLabel`、"2025-04")。
58
+ * 「part」は `variant="split-dropdown"` が 3 つ並べる部位の 1 つで、単独で期間を名乗ると日付全体が 3 回印字される
59
+ * (組み込みは部位別の Intl オプション集合、"04")。
60
+ */
61
+ export type PeriodOptionScope = "period" | "part"
62
+
63
+ /**
64
+ * Formatter of one human-facing period text, told the precision and the scope it must render.
65
+ * 人間向けの期間テキスト 1 件を生成するフォーマッタ (描画すべき精度と区分を受領)。
66
+ *
67
+ * `date` is the date the surface stands for, normalized to the start of `unit` - for `scope: "part"` the
68
+ * whole combination the option would form with the two held parts, with the day clamped into the target
69
+ * month - so a shifted year or a quarter is derivable from the argument alone. It is never an Invalid Date.
70
+ * The one surface where it is not a value the widget would commit is the rail's hover tooltip, which passes
71
+ * the date under the pointer. The widget supplies `unit` and `scope`, so one page-wide callback serves the
72
+ * rail, a year select, a month select and a day list without a wrapper that could name the wrong unit.
73
+ * `date` はその面が表す日付 (`unit` の先頭へ正規化済み。`scope: "part"` では保持中の他 2 部位との組で、
74
+ * 日は対象月の日数へ丸め済み)。ずらした年・四半期は引数だけから導出でき、Invalid Date が渡ることはない。
75
+ * 確定値でない唯一の面はレールのホバーツールチップで、そこではポインタ下の日付が渡る。
76
+ * `unit` と `scope` はウィジェットが与えるため、1 つのコールバックがレール・年・月・日のすべてを賄う。
77
+ *
78
+ * A callback declared `(date: Date) => string` or `(date: Date, unit: PeriodSliderUnit) => string` stays
79
+ * assignable to this type, and the reverse is rejected, so a three-argument callback cannot reach a
80
+ * narrower slot. A callback whose second parameter is optional and not assignable from `PeriodSliderUnit`
81
+ * (`(date: Date, index?: number) => string`, the shape `Array.prototype.map` invites) was accepted by the
82
+ * one-argument type this replaced and is rejected here.
83
+ * `(date) => string` および `(date, unit) => string` は引き続き代入可能 (逆向きは型エラー)。
84
+ * 第 2 引数が任意でありながら `PeriodSliderUnit` を受けられない形 (`(date, index?: number) => string`) は、
85
+ * 置き換え前の 1 引数型では通っていたが本型では拒否される。
86
+ *
87
+ * The returned string reaches option text, placeholder text, the collapsed control - including the
88
+ * combobox's `value`, which is its visible text - and, on the rail, the handle labels, the hover tooltip
89
+ * and the `aria-valuetext` a screen reader announces. **It must therefore stay speakable.** It never
90
+ * reaches a machine value (`<option value>`, `data-value`, the native inputs' `value`), anything `onChange`
91
+ * emits, or an `aria-label` (accessible names come from their own string props).
92
+ * 返る文字列が届くのは選択肢・プレースホルダ・畳んだ表示 (コンボボックスの `value` はその可視テキスト)、
93
+ * およびレールのつまみラベル・ホバーツールチップ・読み上げ値 (`aria-valuetext`)。**読み上げ可能であること。**
94
+ * 機械可読値 (`<option value>`・`data-value`・ネイティブ入力の `value`)・`onChange` が発行する値・
95
+ * `aria-label` には届かない (アクセシブル名は専用の文字列 Props が持つ)。
96
+ *
97
+ * @param date - Date the surface stands for; the committed value everywhere but the rail's hover tooltip / その面が表す日付 (レールのホバーツールチップ以外では確定値)
98
+ * @param unit - Precision the text must name / テキストが名乗るべき精度
99
+ * @param scope - Whether the text stands alone or is one part of three / 単独か 3 部位の 1 つかの区分
100
+ * @returns Human-facing text for that surface / その面の表示テキスト
101
+ */
102
+ export type PeriodOptionFormatter = (date: Date, unit: PeriodSliderUnit, scope: PeriodOptionScope) => string
103
+
48
104
  /**
49
105
  * Side of the track the handle labels are placed on.
50
106
  * つまみラベルを配置するトラックの側。
@@ -203,7 +259,7 @@ export interface AccessibleSliderLabels {
203
259
  /** Accessible name for the stepper button moving the value toward maxDate / 値を maxDate 方向へ動かすステッパーボタンのアクセシブル名 (既定: "Increase") */
204
260
  increaseAriaLabel?: string
205
261
  /** Human-readable text formatter for screen readers / スクリーンリーダー専用読み上げフォーマッタ */
206
- formatAriaValueText?: (date: Date, unit: PeriodSliderUnit) => string
262
+ formatAriaValueText?: PeriodOptionFormatter
207
263
  }
208
264
 
209
265
  /**
@@ -244,7 +300,7 @@ export interface BasePeriodSliderProps extends AccessibleSliderLabels {
244
300
  /** Renders one tick per allowed date in discrete mode (default: false) / 離散モード時の目盛り点描画 (既定: false) */
245
301
  showTicks?: boolean
246
302
  /** Custom label formatter for handles and tooltips / つまみ・ツールチップ用カスタム日付フォーマッタ */
247
- formatLabel?: (date: Date) => string
303
+ formatLabel?: PeriodOptionFormatter
248
304
  /** BCP 47 language tag selecting Intl built-in label formatting; omitted keeps every built-in label on locale-independent ISO 8601 / 組み込みラベルを Intl 書式にする BCP 47 言語タグ (未指定時はロケール非依存の ISO 8601 表記) */
249
305
  locale?: string
250
306
  /** Color scheme theme preset for slider rails and handles (default: "blue-rose") / スライダーのカラーテーマプリセット (既定: "blue-rose") */
@@ -348,9 +404,9 @@ export interface BasePeriodSliderVernierProps extends BasePeriodSliderProps {
348
404
  /** Micro allowed discrete dates / ミクロ側の離散候補日付一覧 */
349
405
  microAllowedDates?: Date[]
350
406
  /** Custom label formatter for macro handles and tooltip / マクロ用カスタム日付フォーマッタ */
351
- formatMacroLabel?: (date: Date) => string
407
+ formatMacroLabel?: PeriodOptionFormatter
352
408
  /** Custom label formatter for micro handles and tooltip / ミクロ用カスタム日付フォーマッタ */
353
- formatMicroLabel?: (date: Date) => string
409
+ formatMicroLabel?: PeriodOptionFormatter
354
410
 
355
411
  // 他モード専用 Props の相互排他マーカー (vernier モードでは指定不可)
356
412
  range?: never
@@ -420,7 +476,7 @@ export type PeriodSliderProps = PeriodSliderRangeProps | PeriodSliderPointProps
420
476
  * @param value - Candidate value / 判定対象の値
421
477
  * @returns True when value is a Date and not an Invalid Date / Date かつ Invalid Date でない場合に true
422
478
  */
423
- const isValidDate = (value: unknown): value is Date => value instanceof Date && !Number.isNaN(value.getTime())
479
+ export const isValidDate = (value: unknown): value is Date => value instanceof Date && !Number.isNaN(value.getTime())
424
480
 
425
481
  /**
426
482
  * Renders an arbitrary value as a short diagnostic string for error messages.
@@ -800,6 +856,31 @@ const getDateTimeFormat = (unit: PeriodSliderUnit, locale: string): Intl.DateTim
800
856
  return formatter
801
857
  }
802
858
 
859
+ /** Digits an ISO 8601 four-digit calendar year is zero-padded to / ISO 8601 の 4 桁暦年が 0 埋めされる桁数 */
860
+ const ISO_YEAR_DIGITS = 4
861
+
862
+ /** Digits an ISO 8601 expanded (at or below zero) calendar year is zero-padded to / ISO 8601 の拡張表記 (0 年以下) が 0 埋めされる桁数 */
863
+ const ISO_EXPANDED_YEAR_DIGITS = 6
864
+
865
+ /**
866
+ * Renders a calendar year in ISO 8601, using the expanded representation for years at or below zero.
867
+ * 暦年の ISO 8601 表記 (0 年以下は拡張表記)。
868
+ *
869
+ * ISO 8601 has no four-digit form for a year at or below zero, so those take the expanded signed form,
870
+ * six digits wide after the sign (`-000001`), rather than a sign squeezed into four columns (`00-1`).
871
+ * The width matches `formatIsoDay`, whose output is a machine value. This is the package's single
872
+ * definition of the rule: option text, handle labels, machine values and `formatOptionText` all reach it,
873
+ * and three independent copies of the padding had already drifted apart before it existed.
874
+ * ISO 8601 は 0 年以下に 4 桁形式を持たないため、符号の後ろを 6 桁とした拡張表記 (`-000001`) を用いる
875
+ * (機械可読値を出す `formatIsoDay` と同じ幅。4 桁の中へ符号を押し込んだ
876
+ * `00-1` ではない)。この規則の定義はパッケージにこれ 1 つで、選択肢テキスト・つまみラベル・機械可読値・
877
+ * `formatOptionText` がすべてここへ届く。
878
+ *
879
+ * @param year - Calendar year, which may be zero or negative / 暦年 (0 以下も取り得る)
880
+ * @returns Zero-padded ISO 8601 year, signed and six digits wide at or below zero / 0 埋め済みの ISO 8601 年 (0 年以下は符号付き 6 桁)
881
+ */
882
+ export const formatIsoYear = (year: number): string => (year >= 0 ? String(year).padStart(ISO_YEAR_DIGITS, "0") : `-${String(-year).padStart(ISO_EXPANDED_YEAR_DIGITS, "0")}`)
883
+
803
884
  /**
804
885
  * Renders a date as a locale-independent ISO 8601 calendar string at the given unit.
805
886
  * 指定単位における日付の ISO 8601 暦表記 (ロケール非依存) を生成する関数。
@@ -809,7 +890,7 @@ const getDateTimeFormat = (unit: PeriodSliderUnit, locale: string): Intl.DateTim
809
890
  * @returns "2025" for year, "2025-01" for month, "2025-01-15" for day / year は "2025"、month は "2025-01"、day は "2025-01-15"
810
891
  */
811
892
  const formatIsoByUnit = (unit: PeriodSliderUnit, d: Date): string => {
812
- const year = String(d.getFullYear()).padStart(4, "0")
893
+ const year = formatIsoYear(d.getFullYear())
813
894
  if (unit === "year") return year
814
895
  const month = String(d.getMonth() + 1).padStart(2, "0")
815
896
  if (unit === "month") return `${year}-${month}`
@@ -835,9 +916,9 @@ const formatIsoByUnit = (unit: PeriodSliderUnit, d: Date): string => {
835
916
  * @returns Formatted label, or an empty string when d is absent or an Invalid Date / 書式化済みラベル (d が未指定・Invalid Date の場合は空文字列)
836
917
  * @throws RangeError when locale is not a structurally valid BCP 47 tag / locale が構造的に妥当な BCP 47 タグでない場合
837
918
  */
838
- export const formatLabel = (unit: PeriodSliderUnit, d: Date, customFormat?: (date: Date) => string, locale?: string): string => {
919
+ export const formatLabel = (unit: PeriodSliderUnit, d: Date, customFormat?: PeriodOptionFormatter, locale?: string): string => {
839
920
  if (!isValidDate(d)) return ""
840
- if (customFormat) return customFormat(d)
921
+ if (customFormat) return customFormat(d, unit, "period")
841
922
  if (locale === undefined) return formatIsoByUnit(unit, d)
842
923
  return getDateTimeFormat(unit, locale).format(d)
843
924
  }
@@ -857,7 +938,7 @@ export const formatLabel = (unit: PeriodSliderUnit, d: Date, customFormat?: (dat
857
938
  * @returns Announced text, or an empty string when d is absent or an Invalid Date / 読み上げ文字列 (d が未指定・Invalid Date の場合は空文字列)
858
939
  * @throws RangeError when locale is not a structurally valid BCP 47 tag / locale が構造的に妥当な BCP 47 タグでない場合
859
940
  */
860
- export const formatScreenReaderLabel = (unit: PeriodSliderUnit, d: Date, customFormat?: (date: Date) => string, locale?: string): string => formatLabel(unit, d, customFormat, locale)
941
+ export const formatScreenReaderLabel = (unit: PeriodSliderUnit, d: Date, customFormat?: PeriodOptionFormatter, locale?: string): string => formatLabel(unit, d, customFormat, locale)
861
942
 
862
943
  /**
863
944
  * Formats a date as the locale-independent quarter notation `<year>-Q<n>`.
@@ -4641,7 +4722,7 @@ const PeriodSliderComponent: React.FC<PeriodSliderProps> = (props) => {
4641
4722
  aria-valuemin={vernierMacroMinEnc}
4642
4723
  aria-valuemax={vernierMacroHighEnc}
4643
4724
  aria-valuenow={vernierMacroLowEnc}
4644
- aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMacroLowDate, macroUnit) : formatScreenReaderLabel(macroUnit, vernierMacroLowDate, formatMacroLabel, locale)}
4725
+ aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMacroLowDate, macroUnit, "period") : formatScreenReaderLabel(macroUnit, vernierMacroLowDate, formatMacroLabel, locale)}
4645
4726
  aria-orientation={isVertical ? "vertical" : "horizontal"}
4646
4727
  className={`period-slider-handle period-slider-handle-vernier ${isVertical ? "is-vertical" : ""} group absolute touch-none ${
4647
4728
  isVertical
@@ -4700,7 +4781,7 @@ const PeriodSliderComponent: React.FC<PeriodSliderProps> = (props) => {
4700
4781
  aria-valuemin={vernierMacroLowEnc}
4701
4782
  aria-valuemax={vernierMacroMaxEnc}
4702
4783
  aria-valuenow={vernierMacroHighEnc}
4703
- aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMacroHighDate, macroUnit) : formatScreenReaderLabel(macroUnit, vernierMacroHighDate, formatMacroLabel, locale)}
4784
+ aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMacroHighDate, macroUnit, "period") : formatScreenReaderLabel(macroUnit, vernierMacroHighDate, formatMacroLabel, locale)}
4704
4785
  aria-orientation={isVertical ? "vertical" : "horizontal"}
4705
4786
  className={`period-slider-handle period-slider-handle-vernier ${isVertical ? "is-vertical" : ""} group absolute touch-none ${
4706
4787
  isVertical
@@ -4759,7 +4840,7 @@ const PeriodSliderComponent: React.FC<PeriodSliderProps> = (props) => {
4759
4840
  aria-valuemin={vernierMicroMinEnc}
4760
4841
  aria-valuemax={isMicroPointShape ? vernierMicroMaxEnc : vernierMicroHighEnc}
4761
4842
  aria-valuenow={vernierMicroLowEnc}
4762
- aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMicroLowDate, microUnit) : formatScreenReaderLabel(microUnit, vernierMicroLowDate, formatMicroLabel, locale)}
4843
+ aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMicroLowDate, microUnit, "period") : formatScreenReaderLabel(microUnit, vernierMicroLowDate, formatMicroLabel, locale)}
4763
4844
  aria-orientation={isVertical ? "vertical" : "horizontal"}
4764
4845
  className={`period-slider-handle period-slider-handle-vernier ${isVertical ? "is-vertical" : ""} group absolute touch-none ${
4765
4846
  isVertical
@@ -4819,7 +4900,7 @@ const PeriodSliderComponent: React.FC<PeriodSliderProps> = (props) => {
4819
4900
  aria-valuemin={vernierMicroLowEnc}
4820
4901
  aria-valuemax={vernierMicroMaxEnc}
4821
4902
  aria-valuenow={vernierMicroHighEnc}
4822
- aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMicroHighDate, microUnit) : formatScreenReaderLabel(microUnit, vernierMicroHighDate, formatMicroLabel, locale)}
4903
+ aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(vernierMicroHighDate, microUnit, "period") : formatScreenReaderLabel(microUnit, vernierMicroHighDate, formatMicroLabel, locale)}
4823
4904
  aria-orientation={isVertical ? "vertical" : "horizontal"}
4824
4905
  className={`period-slider-handle period-slider-handle-vernier ${isVertical ? "is-vertical" : ""} group absolute touch-none ${
4825
4906
  isVertical
@@ -4909,7 +4990,7 @@ const PeriodSliderComponent: React.FC<PeriodSliderProps> = (props) => {
4909
4990
  aria-valuemin={rangeMin}
4910
4991
  aria-valuemax={isPointMode ? rangeMax : currentHighVal}
4911
4992
  aria-valuenow={currentLowVal}
4912
- aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(lowDate, unit) : formatScreenReaderLabel(unit, lowDate, props.formatLabel, locale)}
4993
+ aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(lowDate, unit, "period") : formatScreenReaderLabel(unit, lowDate, props.formatLabel, locale)}
4913
4994
  aria-orientation={isVertical ? "vertical" : "horizontal"}
4914
4995
  className={`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${cursorClass}`}
4915
4996
  style={lowHandleStyle}
@@ -4947,7 +5028,7 @@ const PeriodSliderComponent: React.FC<PeriodSliderProps> = (props) => {
4947
5028
  aria-valuemin={currentLowVal}
4948
5029
  aria-valuemax={rangeMax}
4949
5030
  aria-valuenow={currentHighVal}
4950
- aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(highDate, unit) : formatScreenReaderLabel(unit, highDate, props.formatLabel, locale)}
5031
+ aria-valuetext={props.formatAriaValueText ? props.formatAriaValueText(highDate, unit, "period") : formatScreenReaderLabel(unit, highDate, props.formatLabel, locale)}
4951
5032
  aria-orientation={isVertical ? "vertical" : "horizontal"}
4952
5033
  className={`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${cursorClass}`}
4953
5034
  style={highHandleStyle}
@@ -131,6 +131,12 @@ const monthStartSerial = (year: number, month: number): number => {
131
131
  * {@link DateOptionDomain.indexOf} で引く (全ラベルの前方一致照合を行わない)。
132
132
  * 100 年分の日付に対する先頭一致入力の費用は 1 か月分と同じ。
133
133
  *
134
+ * The buffer is contractually proleptic-Gregorian `yyyy[MM[dd]]`, independent of the displayed text:
135
+ * this function never consults {@link DateOptionDomain.labelAt}. A consumer formatter can therefore
136
+ * render anything without changing which keystrokes reach which row.
137
+ * バッファは表示テキストと無関係に先発グレゴリオ暦の `yyyy[MM[dd]]` と定める
138
+ * ({@link DateOptionDomain.labelAt} を参照しない)。利用側フォーマッタが何を描いても打鍵と行の対応は動かない。
139
+ *
134
140
  * @param buffer - Digits typed so far, separators already stripped / これまでに入力された数字 (区切り文字は除去済み)
135
141
  * @param domain - Option domain to locate the date in / 日付を引く対象の選択肢領域
136
142
  * @returns Matching index, or {@link NO_OPTION_INDEX} when the buffer cannot name a day in the set / 合致する添字 (集合内の日を名指せない場合は {@link NO_OPTION_INDEX})
@@ -333,13 +339,25 @@ export const VirtualDateDropdown: React.FC<VirtualDateDropdownProps> = ({ domain
333
339
  const activeIndexRef = useRef(activeIndex)
334
340
  activeIndexRef.current = activeIndex
335
341
 
342
+ // 開ける条件は open() の入口でしか見ていなかった。開いたまま境界が狭まって選択肢が 0 になる、
343
+ // あるいは disabled になると、ポップアップは消えるのに aria-expanded="true" と
344
+ // aria-controls / aria-activedescendant が存在しない要素を指したまま残り、読み上げが嘘をつく
345
+ useEffect(() => {
346
+ if (isOpen && (disabled || count === 0)) close()
347
+ }, [isOpen, disabled, count, close])
348
+
336
349
  // 選択肢集合が入れ替わったまま開いていると、保持していたスクロール位置は別の日を指す。
337
- // アクティブ行へ引き直さないと、開いたポップアップが無関係な位置を見せ続ける
350
+ // アクティブ行へ引き直さないと、開いたポップアップが無関係な位置を見せ続ける。
351
+ // 引き直すのはスクロール先だけでは足りない。件数が 0 にならずに縮んだときアクティブ添字が
352
+ // 範囲外へ取り残され、aria-activedescendant は描かれていない行の id を指し続け、
353
+ // Enter は commit の境界検査に弾かれて何も起きない (押しても無反応のキーになる)
338
354
  useEffect(() => {
339
355
  if (!isOpen) return
340
356
  const index = activeIndexRef.current
341
357
  if (index === NO_OPTION_INDEX) return
342
- scrollRef.current?.scrollToIndex(Math.min(index, count - 1), { align: "center" })
358
+ const clamped = Math.min(index, count - 1)
359
+ if (clamped !== index) setActiveIndex(clamped)
360
+ scrollRef.current?.scrollToIndex(clamped, { align: "center" })
343
361
  }, [count, isOpen])
344
362
 
345
363
  const moveActive = (next: number): void => {
@@ -417,8 +435,8 @@ export const VirtualDateDropdown: React.FC<VirtualDateDropdownProps> = ({ domain
417
435
  break
418
436
  }
419
437
 
420
- // 数字と日付の区切り文字だけを先頭一致入力として受け付ける。ISO でもロケール書式でも
421
- // 区切りを捨てれば同じ数字列になるため、表示書式に依存せず同じキー入力で辿れる
438
+ // 数字と日付の区切り文字だけを先頭一致入力として受け付ける。先頭一致入力は表示テキストではなく
439
+ // 先発グレゴリオ暦の yyyy[MM[dd]] を契約とするため、利用側フォーマッタが何を描いても打鍵は変わらない
422
440
  if (event.key.length !== 1) return
423
441
  const isDigit = event.key >= "0" && event.key <= "9"
424
442
  const isSeparator = event.key === "-" || event.key === "/" || event.key === "."
@@ -8,13 +8,13 @@
8
8
  * The ◀▶ buttons are drawn by `StepperButton`.
9
9
  *
10
10
  * ドロップダウンと ±1 年ステッパーによる年セレクタ。欠落値・不正値は代替せず即時エラー。
11
- * 選択肢テキストは既定でロケール非依存の ISO 8601 表記、`locale` 指定時のみ Intl 書式。
11
+ * 選択肢テキストは既定でロケール非依存の ISO 8601 表記 (`locale` 指定時は Intl 書式、`formatOption` 指定時はそれが最優先)。
12
12
  * ◀▶ は `StepperButton` が描く。
13
13
  */
14
14
 
15
15
  import type React from "react"
16
16
  import { memo, useEffect, useMemo, useState } from "react"
17
- import { formatLabel, resolveYearStartMonth } from "./PeriodSlider"
17
+ import { formatLabel, type PeriodOptionFormatter, resolveYearStartMonth } from "./PeriodSlider"
18
18
  import { STEPPER_ROW_GAP_CLASS, StepperButton } from "./StepperButton"
19
19
 
20
20
  /**
@@ -23,9 +23,9 @@ import { STEPPER_ROW_GAP_CLASS, StepperButton } from "./StepperButton"
23
23
  *
24
24
  * Accessible names default to English and option text to locale-independent ISO 8601, because a
25
25
  * generic package cannot know the host application's language: localisation is the consumer's
26
- * decision, expressed through `locale` or the aria-label props.
26
+ * decision, expressed through `formatOption`, `locale` or the aria-label props.
27
27
  * アクセシブル名の既定は英語、選択肢テキストの既定はロケール非依存の ISO 8601 表記。
28
- * 汎用パッケージは利用側アプリの言語を知り得ないため、地域化は `locale`・アクセシブル名 Props を
28
+ * 汎用パッケージは利用側アプリの言語を知り得ないため、地域化は `formatOption`・`locale`・アクセシブル名 Props を
29
29
  * 通じた利用側の選択。
30
30
  */
31
31
  export interface YearSelectorProps {
@@ -59,6 +59,8 @@ export interface YearSelectorProps {
59
59
  selectAriaLabel?: string
60
60
  /** BCP 47 language tag switching option text to Intl formatting; omitted keeps locale-independent ISO 8601 / 選択肢テキストを Intl 書式にする BCP 47 言語タグ (未指定時はロケール非依存の ISO 8601 表記) */
61
61
  locale?: string
62
+ /** Formatter for every option and for the collapsed control text, taking priority over `locale` / 全選択肢と畳んだ表示のフォーマッタ (`locale` より優先) */
63
+ formatOption?: PeriodOptionFormatter
62
64
  /** Calendar month a year starts in, 0-based; the emitted Date is that month's first day and a bound Date is read as the year containing it (default: 0) / 1 年が始まる暦月 (0 始まり)。発行される Date はその月の 1 日、境界 Date はそれを含む年として読まれる (既定: 0) */
63
65
  yearStartMonth?: number
64
66
  }
@@ -184,7 +186,25 @@ function resolveBoundYear(boundYear: number | undefined, boundDate: Date | undef
184
186
  * 境界外の保持値は丸めも即時失敗もせず選択肢へ加えて表示し、発行できない年へ進むステッパーは無効化。
185
187
  */
186
188
  const YearSelectorComponent = (props: YearSelectorProps): React.JSX.Element => {
187
- const { value, initialDate, onChange, children, minYear, maxYear, minDate, maxDate, className = "", style, disabled = false, prevYearAriaLabel = "Previous year", nextYearAriaLabel = "Next year", selectAriaLabel = "Year", locale, yearStartMonth: yearStartMonthProp } = props
189
+ const {
190
+ value,
191
+ initialDate,
192
+ onChange,
193
+ children,
194
+ minYear,
195
+ maxYear,
196
+ minDate,
197
+ maxDate,
198
+ className = "",
199
+ style,
200
+ disabled = false,
201
+ prevYearAriaLabel = "Previous year",
202
+ nextYearAriaLabel = "Next year",
203
+ selectAriaLabel = "Year",
204
+ locale,
205
+ formatOption,
206
+ yearStartMonth: yearStartMonthProp,
207
+ } = props
188
208
 
189
209
  const yearStartMonth = resolveYearStartMonth("YearSelector", yearStartMonthProp)
190
210
 
@@ -256,7 +276,7 @@ const YearSelectorComponent = (props: YearSelectorProps): React.JSX.Element => {
256
276
  if (nextYear !== null) emit(nextYear)
257
277
  }
258
278
 
259
- const years = useMemo(() => {
279
+ const yearOptions = useMemo(() => {
260
280
  const list: number[] = []
261
281
  for (let y = maxYearBound; y >= minYearBound; y--) {
262
282
  list.push(y)
@@ -267,11 +287,13 @@ const YearSelectorComponent = (props: YearSelectorProps): React.JSX.Element => {
267
287
  list.push(currentYear)
268
288
  list.sort((a, b) => b - a)
269
289
  }
270
- return list
271
- }, [minYearBound, maxYearBound, isSelectionOutsideBounds, currentYear])
290
+ // ラベルを JSX の中で組むと、フォーマッタが 1 描画ごとに全選択肢ぶん呼ばれる。
291
+ // 同じものを MonthSelector は既にメモしている
292
+ return list.map((y) => ({ value: y, label: formatLabel("year", yearStart(y, yearStartMonth), formatOption, locale) }))
293
+ }, [minYearBound, maxYearBound, isSelectionOutsideBounds, currentYear, yearStartMonth, locale, formatOption])
272
294
 
273
295
  return (
274
- <div className={`inline-flex items-center ${STEPPER_ROW_GAP_CLASS} ${className}`} style={style}>
296
+ <div className={`inline-flex items-center ${STEPPER_ROW_GAP_CLASS} ${className}`} style={style} data-out-of-range={isSelectionOutsideBounds ? "true" : undefined}>
275
297
  <StepperButton neighbour="control" direction="left" disabled={disabled} canStep={prevYear !== null} onStep={handlePrevious} ariaLabel={prevYearAriaLabel} />
276
298
  <select
277
299
  aria-label={selectAriaLabel}
@@ -285,9 +307,9 @@ const YearSelectorComponent = (props: YearSelectorProps): React.JSX.Element => {
285
307
  if (!Number.isInteger(selected)) return
286
308
  emit(selected)
287
309
  }}>
288
- {years.map((y) => (
289
- <option key={y} value={y} className="text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100">
290
- {formatLabel("year", yearStart(y, yearStartMonth), undefined, locale)}
310
+ {yearOptions.map((opt) => (
311
+ <option key={opt.value} value={opt.value} disabled={isSelectionOutsideBounds && opt.value === currentYear} className="text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100">
312
+ {opt.label}
291
313
  </option>
292
314
  ))}
293
315
  </select>
@@ -325,6 +347,7 @@ export const YearSelector = memo(YearSelectorComponent, (prev, next) => {
325
347
  if (prev.nextYearAriaLabel !== next.nextYearAriaLabel) return false
326
348
  if (prev.selectAriaLabel !== next.selectAriaLabel) return false
327
349
  if (prev.locale !== next.locale) return false
350
+ if (prev.formatOption !== next.formatOption) return false
328
351
  return true
329
352
  })
330
353
  YearSelector.displayName = "YearSelector"
@@ -2,26 +2,20 @@
2
2
  * @fileoverview Lazily derived option domain of a bounded or discrete day-resolution selector.
3
3
  *
4
4
  * Describes the option set of a date dropdown as an index space instead of an array: the count is
5
- * computed from the bounds, and the date / machine value / human label of index `i` are derived on
5
+ * computed from the bounds, and the date and the human label of index `i` are derived on
6
6
  * demand. A bound change therefore costs O(1) for a continuous range and O(log n) for a discrete
7
7
  * one, never O(count), and nothing proportional to the option count is ever allocated.
8
8
  *
9
9
  * 日単位セレクタの選択肢集合を「配列」ではなく「添字空間」として記述するモジュール。
10
- * 件数は境界から算出し、添字 i の日付・機械可読値・表示ラベルは要求時に導出する。
10
+ * 件数は境界から算出し、添字 i の日付・表示ラベルは要求時に導出する。
11
11
  * 境界変更の費用は連続範囲で O(1)、離散集合で O(log n) であり、件数に比例した確保は一切行わない。
12
12
  */
13
13
 
14
- import { formatLabel } from "./PeriodSlider"
14
+ import { formatIsoYear, formatLabel, type PeriodOptionFormatter } from "./PeriodSlider"
15
15
 
16
16
  /** Milliseconds in one civil day, used only as the divisor of the UTC day serial / 暦日 1 日のミリ秒数 (UTC 日通番の除数としてのみ使用) */
17
17
  const MS_PER_DAY = 86_400_000
18
18
 
19
- /** Digits an ISO 8601 four-digit calendar year is zero-padded to / ISO 8601 の 4 桁暦年が 0 埋めされる桁数 */
20
- const ISO_YEAR_DIGITS = 4
21
-
22
- /** Digits an ISO 8601 expanded (negative) calendar year is zero-padded to / ISO 8601 の拡張表記 (負の暦年) が 0 埋めされる桁数 */
23
- const ISO_EXPANDED_YEAR_DIGITS = 6
24
-
25
19
  /** Digits the ISO 8601 month and day fields are zero-padded to / ISO 8601 の月・日フィールドが 0 埋めされる桁数 */
26
20
  const ISO_MONTH_DAY_DIGITS = 2
27
21
 
@@ -94,8 +88,7 @@ export const fromDaySerial = (serial: number): Date => {
94
88
  * @returns Zero-padded yyyy-MM-dd of the local calendar day / ローカル暦日の 0 埋め yyyy-MM-dd
95
89
  */
96
90
  export const formatIsoDay = (date: Date): string => {
97
- const year = date.getFullYear()
98
- const yearText = year >= 0 ? String(year).padStart(ISO_YEAR_DIGITS, "0") : `-${String(-year).padStart(ISO_EXPANDED_YEAR_DIGITS, "0")}`
91
+ const yearText = formatIsoYear(date.getFullYear())
99
92
  return `${yearText}-${String(date.getMonth() + 1).padStart(ISO_MONTH_DAY_DIGITS, "0")}-${String(date.getDate()).padStart(ISO_MONTH_DAY_DIGITS, "0")}`
100
93
  }
101
94
 
@@ -114,8 +107,6 @@ export interface DateOptionDomain {
114
107
  readonly count: number
115
108
  /** Local-midnight Date of the option at `index` / 添字 index の選択肢が表す日付 (ローカル 0 時) */
116
109
  dateAt(index: number): Date
117
- /** Machine-readable yyyy-MM-dd of the option at `index` / 添字 index の選択肢の機械可読値 (yyyy-MM-dd) */
118
- valueAt(index: number): string
119
110
  /** Human-facing option text of the option at `index` / 添字 index の選択肢の表示テキスト */
120
111
  labelAt(index: number): string
121
112
  /** Index of a date inside the set, or {@link NO_OPTION_INDEX} when it is not selectable / 集合内での添字 (選択不可なら {@link NO_OPTION_INDEX}) */
@@ -129,9 +120,10 @@ export interface DateOptionDomain {
129
120
  * @param minBound - Inclusive lower bound, normalized to local midnight / 下限 (ローカル 0 時に正規化済み・含む)
130
121
  * @param maxBound - Inclusive upper bound, normalized to local midnight / 上限 (ローカル 0 時に正規化済み・含む)
131
122
  * @param locale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
123
+ * @param formatOption - Consumer formatter taking priority over `locale`, passed straight through so no per-row closure is allocated / `locale` より優先される利用側フォーマッタ (素通しのため行ごとのクロージャ確保は発生しない)
132
124
  * @returns Descending option domain of every calendar day in the range / 範囲内全暦日の降順選択肢領域
133
125
  */
134
- export const createContinuousDateOptionDomain = (minBound: Date, maxBound: Date, locale: string | undefined): DateOptionDomain => {
126
+ export const createContinuousDateOptionDomain = (minBound: Date, maxBound: Date, locale: string | undefined, formatOption: PeriodOptionFormatter | undefined): DateOptionDomain => {
135
127
  const minSerial = toDaySerial(minBound)
136
128
  const maxSerial = toDaySerial(maxBound)
137
129
  const count = maxSerial >= minSerial ? maxSerial - minSerial + 1 : 0
@@ -139,8 +131,7 @@ export const createContinuousDateOptionDomain = (minBound: Date, maxBound: Date,
139
131
  return {
140
132
  count,
141
133
  dateAt,
142
- valueAt: (index) => formatIsoDay(dateAt(index)),
143
- labelAt: (index) => formatLabel("day", dateAt(index), undefined, locale),
134
+ labelAt: (index) => formatLabel("day", dateAt(index), formatOption, locale),
144
135
  indexOf: (date) => {
145
136
  const serial = toDaySerial(date)
146
137
  if (serial < minSerial || serial > maxSerial) return NO_OPTION_INDEX
@@ -162,16 +153,16 @@ export const createContinuousDateOptionDomain = (minBound: Date, maxBound: Date,
162
153
  * @param loIndex - First in-bounds index, or a value greater than hiIndex when the window is empty / 境界内の先頭添字 (空窓時は hiIndex より大きい値)
163
154
  * @param hiIndex - Last in-bounds index / 境界内の末尾添字
164
155
  * @param locale - BCP 47 language tag enabling Intl label formatting / Intl ラベル書式を有効化する BCP 47 言語タグ
156
+ * @param formatOption - Consumer formatter taking priority over `locale`, passed straight through so no per-row closure is allocated / `locale` より優先される利用側フォーマッタ (素通しのため行ごとのクロージャ確保は発生しない)
165
157
  * @returns Descending option domain over the in-bounds window / 境界内の窓を降順に見せる選択肢領域
166
158
  */
167
- export const createDiscreteDateOptionDomain = (ascending: readonly Date[], loIndex: number, hiIndex: number, locale: string | undefined): DateOptionDomain => {
159
+ export const createDiscreteDateOptionDomain = (ascending: readonly Date[], loIndex: number, hiIndex: number, locale: string | undefined, formatOption: PeriodOptionFormatter | undefined): DateOptionDomain => {
168
160
  const count = hiIndex >= loIndex ? hiIndex - loIndex + 1 : 0
169
161
  const dateAt = (index: number): Date => ascending[hiIndex - index]
170
162
  return {
171
163
  count,
172
164
  dateAt,
173
- valueAt: (index) => formatIsoDay(dateAt(index)),
174
- labelAt: (index) => formatLabel("day", dateAt(index), undefined, locale),
165
+ labelAt: (index) => formatLabel("day", dateAt(index), formatOption, locale),
175
166
  indexOf: (date) => {
176
167
  const time = date.getTime()
177
168
  let low = loIndex
@@ -192,9 +183,9 @@ export const createDiscreteDateOptionDomain = (ascending: readonly Date[], loInd
192
183
  * Option domain presented when no day is selectable at all.
193
184
  * 選択可能な日が 1 つも無い場合に提示される選択肢領域。
194
185
  *
195
- * The three accessors throw rather than inventing a date, because an empty domain has no index to
186
+ * The two index accessors throw rather than inventing a date, because an empty domain has no index to
196
187
  * serve and a substituted value would propagate a day the user never chose.
197
- * 3 つのアクセサは日付を捏造せず送出する (空領域には提供できる添字が無く、代替値は利用者が
188
+ * 添字を取る 2 つのアクセサは日付を捏造せず送出する (空領域には提供できる添字が無く、代替値は利用者が
198
189
  * 選んでいない日を伝播させるため)。
199
190
  */
200
191
  export const EMPTY_DATE_OPTION_DOMAIN: DateOptionDomain = {
@@ -202,9 +193,6 @@ export const EMPTY_DATE_OPTION_DOMAIN: DateOptionDomain = {
202
193
  dateAt: (index) => {
203
194
  throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(index)})`)
204
195
  },
205
- valueAt: (index) => {
206
- throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(index)})`)
207
- },
208
196
  labelAt: (index) => {
209
197
  throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(index)})`)
210
198
  },