@aiquants/period-slider 0.2.0 → 0.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.
@@ -1,31 +1,42 @@
1
1
  import { default as React } from 'react';
2
2
  import { PeriodSliderUnit } from './PeriodSlider';
3
+ /**
4
+ * Props of the day-resolution selector.
5
+ * 日単位セレクタの Props。
6
+ *
7
+ * Accessible names default to English and option text to locale-independent ISO 8601, because a
8
+ * generic package cannot know the host application's language: localisation is the consumer's
9
+ * decision, expressed through `locale`, the aria-label props or the per-part option formatters.
10
+ * アクセシブル名の既定は英語、選択肢テキストの既定はロケール非依存の ISO 8601 表記。
11
+ * 汎用パッケージは利用側アプリの言語を知り得ないため、地域化は `locale`・アクセシブル名 Props・
12
+ * 部位別フォーマッタを通じた利用側の選択。
13
+ */
3
14
  export interface DateSelectorProps {
4
- /** Controlled selected date / 選択日付(外部制御用) */
15
+ /** Controlled selected date; required unless `initialDate` is supplied; must be a valid Date / 選択日付(外部制御用・`initialDate` 未指定時は必須・Invalid Date 不可) */
5
16
  value?: Date;
6
- /** Initial selected date (defaults to current date) / 選択日付(未指定時は現在日) */
17
+ /** Initial selected date; required unless `value` is supplied; must be a valid Date / 初期選択日付(非制御用・`value` 未指定時は必須・Invalid Date 不可) */
7
18
  initialDate?: Date;
8
19
  /** Time resolution unit (ignored by selector, accepted for hook interoperability) / 時間解像度単位 (フック相互運用用) */
9
20
  unit?: PeriodSliderUnit;
10
- /** Callback triggered when date changes / 日付変更時コールバック */
21
+ /** Callback triggered when a selectable date is chosen / 選択可能な日付が選ばれた時のコールバック */
11
22
  onChange?(date: Date): void;
12
23
  /** Child elements / 子要素 */
13
24
  children?: React.ReactNode;
14
- /** Minimum selectable year / ドロップダウン・可能範囲の最小年 */
25
+ /** Minimum selectable year; intersected with minDate when both are given / 選択可能範囲の最小年 (minDate 併用時は厳しい方を採用) */
15
26
  minYear?: number;
16
- /** Maximum selectable year / ドロップダウン・可能範囲の最大年 */
27
+ /** Maximum selectable year; intersected with maxDate when both are given / 選択可能範囲の最大年 (maxDate 併用時は厳しい方を採用) */
17
28
  maxYear?: number;
18
- /** Minimum selectable date / 選択可能範囲の最小日付 */
29
+ /** Minimum selectable date; intersected with minYear when both are given / 選択可能範囲の最小日付 (minYear 併用時は厳しい方を採用) */
19
30
  minDate?: Date;
20
- /** Maximum selectable date / 選択可能範囲の最大日付 */
31
+ /** Maximum selectable date; intersected with maxYear when both are given / 選択可能範囲の最大日付 (maxYear 併用時は厳しい方を採用) */
21
32
  maxDate?: Date;
22
- /** Discrete allowed dates list / 選択可能な離散日付配列 */
33
+ /** Discrete allowed dates list; an empty array means nothing is selectable / 選択可能な離散日付配列 (空配列は「選択可能日なし」) */
23
34
  allowedDates?: Date[];
24
35
  /**
25
36
  * UI Variant:
26
- * - "dropdown": Single select element with yyyy-MM-dd options (既定の単一セレクトボックス)
27
- * - "date": Native input[type="date"]
28
- * - "split-dropdown": Three separate selects for year, month, and day
37
+ * - "date": Native input[type="date"] (default / 既定)
38
+ * - "dropdown": Single select element with yyyy-MM-dd options; requires a bounded range or allowedDates
39
+ * - "split-dropdown": Three separate selects for year, month, and day; requires a bounded range and rejects allowedDates
29
40
  */
30
41
  variant?: "date" | "dropdown" | "split-dropdown";
31
42
  /** Additional CSS class name / 追加の CSS クラス名 */
@@ -34,12 +45,30 @@ export interface DateSelectorProps {
34
45
  style?: React.CSSProperties;
35
46
  /** Disabled flag / 無効化フラグ */
36
47
  disabled?: boolean;
37
- /** Accessible label for previous date button / 前日ボタンのアクセシブル名 */
48
+ /** Accessible label for previous date button / 前日ボタンのアクセシブル名 (既定: "Previous day") */
38
49
  prevDateAriaLabel?: string;
39
- /** Accessible label for next date button / 翌日ボタンのアクセシブル名 */
50
+ /** Accessible label for next date button / 翌日ボタンのアクセシブル名 (既定: "Next day") */
40
51
  nextDateAriaLabel?: string;
41
- /** Accessible label for date select combobox / 年月日セレクトのアクセシブル名 */
52
+ /** Accessible label for the date select / input / 年月日セレクト・入力のアクセシブル名 (既定: "Date") */
42
53
  selectAriaLabel?: string;
54
+ /** Accessible label for the year select of variant="split-dropdown" / 年セレクトのアクセシブル名 (既定: "Year") */
55
+ yearAriaLabel?: string;
56
+ /** Accessible label for the month select of variant="split-dropdown" / 月セレクトのアクセシブル名 (既定: "Month") */
57
+ monthAriaLabel?: string;
58
+ /** Accessible label for the day select of variant="split-dropdown" / 日セレクトのアクセシブル名 (既定: "Day") */
59
+ dayAriaLabel?: string;
60
+ /** BCP 47 language tag switching option text to Intl formatting; omitted keeps locale-independent ISO 8601, and the input value stays yyyy-MM-dd either way / 選択肢テキストを Intl 書式にする BCP 47 言語タグ (未指定時はロケール非依存の ISO 8601 表記・input の value は常に yyyy-MM-dd) */
61
+ locale?: string;
62
+ /** Formatter for the year option text of variant="split-dropdown", taking priority over `locale` / variant="split-dropdown" の年選択肢テキスト用フォーマッタ (`locale` より優先) */
63
+ formatYearOption?: (year: number) => string;
64
+ /** Formatter for the month option text of variant="split-dropdown", receiving a 1-12 month, taking priority over `locale` / variant="split-dropdown" の月選択肢テキスト用フォーマッタ (1-12 の月を受領・`locale` より優先) */
65
+ formatMonthOption?: (month: number) => string;
66
+ /** Formatter for the day option text of variant="split-dropdown", receiving a 1-31 day, taking priority over `locale` / variant="split-dropdown" の日選択肢テキスト用フォーマッタ (1-31 の日を受領・`locale` より優先) */
67
+ formatDayOption?: (day: number) => string;
43
68
  }
69
+ /**
70
+ * Day-resolution selector re-rendering only when a prop its output depends on changes.
71
+ * 描画結果が依存する Props の変化時のみ再描画する日単位セレクタ。
72
+ */
44
73
  export declare const DateSelector: React.MemoExoticComponent<(props: DateSelectorProps) => React.JSX.Element>;
45
74
  //# sourceMappingURL=DateSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateSelector.d.ts","sourceRoot":"","sources":["../src/DateSelector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAA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AA;IACvB,kGAAkG;IAClG,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0PAA0P;IAC1P,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gKAAgK;IAChK,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAC3C,oMAAoM;IACpM,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC7C,gMAAgM;IAChM,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;CAC5C;AAslBD;;;GAGG;AACH,eAAO,MAAM,YAAY,oCArXa,iBAAiB,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA6YzE,CAAA"}
@@ -1,9 +1,20 @@
1
1
  import { default as React } from 'react';
2
2
  import { PeriodSliderUnit } from './PeriodSlider';
3
+ /**
4
+ * Props of the month-resolution selector.
5
+ * 月単位セレクタの Props。
6
+ *
7
+ * Accessible names default to English and option text to locale-independent ISO 8601, because a
8
+ * generic package cannot know the host application's language: localisation is the consumer's
9
+ * decision, expressed through `locale` or the aria-label props.
10
+ * アクセシブル名の既定は英語、選択肢テキストの既定はロケール非依存の ISO 8601 表記。
11
+ * 汎用パッケージは利用側アプリの言語を知り得ないため、地域化は `locale`・アクセシブル名 Props を
12
+ * 通じた利用側の選択。
13
+ */
3
14
  export interface MonthSelectorProps {
4
- /** Controlled selected date / 選択日付(外部制御用) */
15
+ /** Controlled selected date; required unless `initialDate` is supplied / 選択日付(外部制御用・`initialDate` 未指定時は必須) */
5
16
  value?: Date;
6
- /** Initial selected date (defaults to current month) / 選択日付(未指定時は現在月) */
17
+ /** Initial selected date; required unless `value` is supplied / 選択日付(非制御用・`value` 未指定時は必須) */
7
18
  initialDate?: Date;
8
19
  /** Time resolution unit (ignored by selector, accepted for hook interoperability) / 時間解像度単位 (フック相互運用用) */
9
20
  unit?: PeriodSliderUnit;
@@ -16,13 +27,13 @@ export interface MonthSelectorProps {
16
27
  * 表示バリエーション: "date" (input[type="month"]) または "dropdown" (select[yyyy-mm])。既定値 "date"
17
28
  */
18
29
  variant?: "date" | "dropdown";
19
- /** Minimum year for options / 選択肢・可能範囲の最小年 */
30
+ /** Lower bound year (January); combined with `minDate` as the stricter of the two. Required for variant="dropdown" together with `minDate` / 可能範囲の最小年 (1 月起点)。`minDate` とは厳しい方を採用。variant="dropdown" では `minDate` との少なくとも一方が必須 */
20
31
  minYear?: number;
21
- /** Maximum year for options / 選択肢・可能範囲の最大年 */
32
+ /** Upper bound year (December); combined with `maxDate` as the stricter of the two. Required for variant="dropdown" together with `maxDate` / 可能範囲の最大年 (12 月起点)。`maxDate` とは厳しい方を採用。variant="dropdown" では `maxDate` との少なくとも一方が必須 */
22
33
  maxYear?: number;
23
- /** Minimum date for options / 選択肢・可能範囲の最小日付 */
34
+ /** Lower bound date (truncated to its month); combined with `minYear` as the stricter of the two / 可能範囲の最小日付 (月単位に切り捨て)。`minYear` とは厳しい方を採用 */
24
35
  minDate?: Date;
25
- /** Maximum date for options / 選択肢・可能範囲の最大日付 */
36
+ /** Upper bound date (truncated to its month); combined with `maxYear` as the stricter of the two / 可能範囲の最大日付 (月単位に切り捨て)。`maxYear` とは厳しい方を採用 */
26
37
  maxDate?: Date;
27
38
  /** Warning style flag / 警告枠スタイル適用フラグ */
28
39
  isWarning?: boolean;
@@ -32,12 +43,18 @@ export interface MonthSelectorProps {
32
43
  style?: React.CSSProperties;
33
44
  /** Disabled flag / 無効化フラグ */
34
45
  disabled?: boolean;
35
- /** Accessible label for previous month button / 前月ボタンのアクセシブル名 */
46
+ /** Accessible label for previous month button / 前月ボタンのアクセシブル名 (既定: "Previous month") */
36
47
  prevMonthAriaLabel?: string;
37
- /** Accessible label for next month button / 翌月ボタンのアクセシブル名 */
48
+ /** Accessible label for next month button / 翌月ボタンのアクセシブル名 (既定: "Next month") */
38
49
  nextMonthAriaLabel?: string;
39
- /** Accessible label for month select combobox / 年月セレクトのアクセシブル名 */
50
+ /** Accessible label for month select combobox / 年月セレクトのアクセシブル名 (既定: "Month") */
40
51
  selectAriaLabel?: string;
52
+ /** 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) */
53
+ locale?: string;
41
54
  }
55
+ /**
56
+ * Month-resolution selector re-rendering only when a prop its output depends on changes.
57
+ * 描画結果が依存する Props の変化時のみ再描画する月単位セレクタ。
58
+ */
42
59
  export declare const MonthSelector: React.MemoExoticComponent<(props: MonthSelectorProps) => React.JSX.Element>;
43
60
  //# sourceMappingURL=MonthSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MonthSelector.d.ts","sourceRoot":"","sources":["../src/MonthSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,WAAW,kBAAkB;IAC/B,6CAA6C;IAC7C,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,yEAAyE;IACzE,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,0GAA0G;IAC1G,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,yDAAyD;IACzD,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3C,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC7B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,+CAA+C;I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