@moneyforward/mfui-components 3.34.0 → 3.36.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.
Files changed (108) hide show
  1. package/dist/src/DataTable/DataTable.d.ts +50 -0
  2. package/dist/src/DataTable/DataTable.js +44 -0
  3. package/dist/src/DataTable/DataTableFilterButton/DataTableFilterButton.d.ts +6 -0
  4. package/dist/src/DataTable/DataTableFilterButton/DataTableFilterButton.js +63 -0
  5. package/dist/src/DataTable/DataTableFilterButton/DataTableFilterButton.types.d.ts +49 -0
  6. package/dist/src/DataTable/DataTableFilterButton/DataTableFilterButton.types.js +1 -0
  7. package/dist/src/DataTable/DataTableFilterButton/index.d.ts +2 -0
  8. package/dist/src/DataTable/DataTableFilterButton/index.js +1 -0
  9. package/dist/src/DataTable/DataTableHeaderCell/DataTableHeaderCell.js +6 -2
  10. package/dist/src/DataTable/DataTableHeaderCell/DataTableHeaderCell.types.d.ts +23 -1
  11. package/dist/src/DataTable/DataTableSortButton/DataTableSortButton.d.ts +4 -0
  12. package/dist/src/DataTable/DataTableSortButton/DataTableSortButton.js +17 -0
  13. package/dist/src/DataTable/DataTableSortButton/DataTableSortButton.types.d.ts +25 -0
  14. package/dist/src/DataTable/DataTableSortButton/DataTableSortButton.types.js +1 -0
  15. package/dist/src/DataTable/DataTableSortButton/index.d.ts +2 -0
  16. package/dist/src/DataTable/DataTableSortButton/index.js +1 -0
  17. package/dist/src/DataTable/index.d.ts +2 -0
  18. package/dist/src/DateTimeSelection/DatePicker/DatePickerDateCell/DatePickerDateCell.js +3 -0
  19. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePickerPopover/DateRangePickerCalendar/DateRangePickerDateCell.d.ts +2 -2
  20. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePickerPopover/DateRangePickerCalendar/DateRangePickerDateCell.js +5 -2
  21. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePickerTrigger/DateRangePickerTrigger.js +3 -2
  22. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePickerTrigger/DateRangePickerTrigger.types.d.ts +17 -0
  23. package/dist/src/DateTimeSelection/FilterDateRangePicker/DateRangePickerContent/DateRangePickerContent.js +3 -1
  24. package/dist/src/DateTimeSelection/FilterDateRangePicker/FilterDateRangePicker.types.d.ts +2 -1
  25. package/dist/src/DateTimeSelection/FilterMonthPicker/FilterMonthPicker.types.d.ts +2 -1
  26. package/dist/src/DateTimeSelection/FilterMonthPicker/MonthPickerPopover/MonthPickerPopover.js +2 -1
  27. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerMonthCell/MonthRangePickerMonthCell.d.ts +1 -0
  28. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerMonthCell/MonthRangePickerMonthCell.js +11 -8
  29. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerMonthCell/constants.d.ts +7 -15
  30. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerMonthCell/constants.js +26 -13
  31. package/dist/src/DateTimeSelection/TimePicker/TimePicker.d.ts +2 -0
  32. package/dist/src/DateTimeSelection/TimePicker/TimePicker.js +3 -2
  33. package/dist/src/DateTimeSelection/TimePicker/TimePicker.types.d.ts +27 -0
  34. package/dist/src/DateTimeSelection/shared/BasePicker/BasePicker.js +4 -1
  35. package/dist/src/DateTimeSelection/shared/BasePicker/constants.d.ts +1 -1
  36. package/dist/src/DateTimeSelection/shared/BasePicker/constants.js +2 -0
  37. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePicker.d.ts +1 -1
  38. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePicker.js +4 -4
  39. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePicker.types.d.ts +33 -1
  40. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerCalendar/BaseRangePickerDateCell.d.ts +2 -2
  41. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerCalendar/BaseRangePickerDateCell.js +15 -36
  42. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerCalendar/index.d.ts +0 -1
  43. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerCalendar/index.js +0 -1
  44. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerPopover.js +2 -1
  45. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerTrigger/BaseRangePickerTrigger.js +3 -2
  46. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerTrigger/BaseRangePickerTrigger.types.d.ts +17 -0
  47. package/dist/src/DateTimeSelection/shared/accessibility/constants.d.ts +7 -16
  48. package/dist/src/DateTimeSelection/shared/accessibility/constants.js +30 -14
  49. package/dist/src/DateTimeSelection/shared/accessibility/generateDateLabel.d.ts +6 -1
  50. package/dist/src/DateTimeSelection/shared/accessibility/generateDateLabel.js +14 -8
  51. package/dist/src/DeterminateProgressIndicator/DeterminateProgressIndicator.d.ts +18 -0
  52. package/dist/src/DeterminateProgressIndicator/DeterminateProgressIndicator.js +20 -0
  53. package/dist/src/DeterminateProgressIndicator/DeterminateProgressIndicator.types.d.ts +41 -0
  54. package/dist/src/DeterminateProgressIndicator/DeterminateProgressIndicator.types.js +1 -0
  55. package/dist/src/DeterminateProgressIndicator/index.d.ts +2 -0
  56. package/dist/src/DeterminateProgressIndicator/index.js +1 -0
  57. package/dist/src/FilterSelectBox/FilterSelectBox.types.d.ts +1 -1
  58. package/dist/src/IconButton/IconButton.d.ts +2 -0
  59. package/dist/src/IconButton/IconButton.js +2 -2
  60. package/dist/src/IconButton/IconButton.types.d.ts +7 -0
  61. package/dist/src/MultipleFilterSelectBox/MultipleFilterSelectBox.types.d.ts +1 -1
  62. package/dist/src/MultipleSelectBox/MultipleSelectBox.d.ts +1 -1
  63. package/dist/src/MultipleSelectBox/MultipleSelectBox.js +2 -2
  64. package/dist/src/MultipleSelectBox/MultipleSelectBox.types.d.ts +5 -1
  65. package/dist/src/MultipleSelectBox/MultipleSelectBoxTrigger/MultipleSelectBoxTrigger.js +2 -2
  66. package/dist/src/MultipleSelectBox/MultipleSelectBoxTrigger/MultipleSelectBoxTrigger.types.d.ts +39 -1
  67. package/dist/src/MultipleSelectBox/hooks/useSearchBox.js +14 -3
  68. package/dist/src/Popover/Popover.js +1 -1
  69. package/dist/src/Popover/Popover.types.d.ts +1 -1
  70. package/dist/src/SelectBox/SelectBox.d.ts +1 -1
  71. package/dist/src/SelectBox/SelectBox.js +11 -4
  72. package/dist/src/SelectBox/SelectBox.types.d.ts +38 -1
  73. package/dist/src/SelectBox/hooks/useSearchBox.d.ts +6 -1
  74. package/dist/src/SelectBox/hooks/useSearchBox.js +23 -4
  75. package/dist/src/SplitView/SplitView.js +16 -2
  76. package/dist/src/TextBox/TextBox.d.ts +2 -1
  77. package/dist/src/TextBox/TextBox.js +4 -3
  78. package/dist/src/TextBox/TextBox.types.d.ts +26 -0
  79. package/dist/src/Textarea/Textarea.d.ts +2 -1
  80. package/dist/src/Textarea/Textarea.js +11 -3
  81. package/dist/src/Textarea/Textarea.types.d.ts +26 -0
  82. package/dist/src/index.d.ts +1 -0
  83. package/dist/src/index.js +1 -0
  84. package/dist/styled-system/recipes/base-range-picker-trigger-slot-recipe.d.ts +1 -0
  85. package/dist/styled-system/recipes/base-range-picker-trigger-slot-recipe.js +5 -0
  86. package/dist/styled-system/recipes/data-table-filter-button-slot-recipe.d.ts +33 -0
  87. package/dist/styled-system/recipes/data-table-filter-button-slot-recipe.js +43 -0
  88. package/dist/styled-system/recipes/data-table-header-cell-slot-recipe.d.ts +3 -2
  89. package/dist/styled-system/recipes/data-table-header-cell-slot-recipe.js +69 -1
  90. package/dist/styled-system/recipes/data-table-sort-button-slot-recipe.d.ts +33 -0
  91. package/dist/styled-system/recipes/data-table-sort-button-slot-recipe.js +35 -0
  92. package/dist/styled-system/recipes/determinate-progress-indicator-slot-recipe.d.ts +36 -0
  93. package/dist/styled-system/recipes/determinate-progress-indicator-slot-recipe.js +61 -0
  94. package/dist/styled-system/recipes/icon-button-slot-recipe.d.ts +2 -1
  95. package/dist/styled-system/recipes/icon-button-slot-recipe.js +33 -2
  96. package/dist/styled-system/recipes/index.d.ts +3 -0
  97. package/dist/styled-system/recipes/index.js +3 -0
  98. package/dist/styled-system/recipes/text-box-slot-recipe.d.ts +4 -0
  99. package/dist/styled-system/recipes/text-box-slot-recipe.js +8 -2
  100. package/dist/styled-system/recipes/textarea-slot-recipe.d.ts +4 -0
  101. package/dist/styled-system/recipes/textarea-slot-recipe.js +6 -0
  102. package/dist/styled-system/recipes/time-picker-slot-recipe.d.ts +4 -0
  103. package/dist/styled-system/recipes/time-picker-slot-recipe.js +8 -2
  104. package/dist/styles.css +293 -14
  105. package/dist/tsconfig.build.tsbuildinfo +1 -1
  106. package/package.json +10 -10
  107. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerCalendar/constants.d.ts +0 -18
  108. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerCalendar/constants.js +0 -18
@@ -1,17 +1,9 @@
1
+ import { type BasePickerProps } from '../../shared/BasePicker/BasePicker.types';
2
+ type CalendarLocale = NonNullable<BasePickerProps['calendarLocale']>;
3
+ type MonthRangePickerA11yLabelKey = 'SELECTED' | 'IN_RANGE' | 'UNAVAILABLE' | 'RANGE_START' | 'RANGE_END';
1
4
  /**
2
- * Default Japanese accessibility labels for MonthRangePicker
3
- * These constants provide consistent Japanese text for screen readers.
4
- * Matches the DateRangePicker labels for consistency.
5
+ * Accessibility labels for MonthRangePicker, keyed by calendar locale.
6
+ * These constants provide consistent text for screen readers.
5
7
  */
6
- export declare const MONTH_RANGE_PICKER_A11Y_LABELS: {
7
- /** Label for selected months */
8
- readonly SELECTED: '選択済み';
9
- /** Label for months in the selected range */
10
- readonly IN_RANGE: '選択範囲内';
11
- /** Label for unavailable/disabled months */
12
- readonly UNAVAILABLE: '無効';
13
- /** Label for range start months */
14
- readonly RANGE_START: '範囲開始';
15
- /** Label for range end months */
16
- readonly RANGE_END: '範囲終了';
17
- };
8
+ export declare const MONTH_RANGE_PICKER_A11Y_LABELS: Record<CalendarLocale, Record<MonthRangePickerA11yLabelKey, string>>;
9
+ export {};
@@ -1,17 +1,30 @@
1
1
  /**
2
- * Default Japanese accessibility labels for MonthRangePicker
3
- * These constants provide consistent Japanese text for screen readers.
4
- * Matches the DateRangePicker labels for consistency.
2
+ * Accessibility labels for MonthRangePicker, keyed by calendar locale.
3
+ * These constants provide consistent text for screen readers.
5
4
  */
6
5
  export const MONTH_RANGE_PICKER_A11Y_LABELS = {
7
- /** Label for selected months */
8
- SELECTED: '選択済み',
9
- /** Label for months in the selected range */
10
- IN_RANGE: '選択範囲内',
11
- /** Label for unavailable/disabled months */
12
- UNAVAILABLE: '無効',
13
- /** Label for range start months */
14
- RANGE_START: '範囲開始',
15
- /** Label for range end months */
16
- RANGE_END: '範囲終了',
6
+ ja: {
7
+ /** Label for selected months */
8
+ SELECTED: '選択済み',
9
+ /** Label for months in the selected range */
10
+ IN_RANGE: '選択範囲内',
11
+ /** Label for unavailable/disabled months */
12
+ UNAVAILABLE: '無効',
13
+ /** Label for range start months */
14
+ RANGE_START: '範囲開始',
15
+ /** Label for range end months */
16
+ RANGE_END: '範囲終了',
17
+ },
18
+ en: {
19
+ /** Label for selected months */
20
+ SELECTED: 'Selected',
21
+ /** Label for months in the selected range */
22
+ IN_RANGE: 'In range',
23
+ /** Label for unavailable/disabled months */
24
+ UNAVAILABLE: 'Unavailable',
25
+ /** Label for range start months */
26
+ RANGE_START: 'Start month',
27
+ /** Label for range end months */
28
+ RANGE_END: 'End month',
29
+ },
17
30
  };
@@ -29,6 +29,7 @@ export declare const TimePicker: import("react").ForwardRefExoticComponent<Omit<
29
29
  format?: 'HH:mm' | 'HH:mm:ss';
30
30
  size?: 'small' | 'medium' | 'large';
31
31
  invalid?: boolean;
32
+ caution?: boolean;
32
33
  onClear?: (event: import("react").MouseEvent<HTMLButtonElement>) => void;
33
34
  enableClearButton?: boolean;
34
35
  clearButtonProps?: Pick<import("../..").IconButtonProps, 'aria-label'>;
@@ -38,6 +39,7 @@ export declare const TimePicker: import("react").ForwardRefExoticComponent<Omit<
38
39
  format?: 'HH:mm' | 'HH:mm:ss';
39
40
  size?: 'small' | 'medium' | 'large';
40
41
  invalid?: boolean;
42
+ caution?: boolean;
41
43
  onClear?: (event: import("react").MouseEvent<HTMLButtonElement>) => void;
42
44
  enableClearButton?: boolean;
43
45
  clearButtonProps?: Pick<import("../..").IconButtonProps, 'aria-label'>;
@@ -35,7 +35,7 @@ import { getTimePickerLabel } from './constants';
35
35
  * // With seconds
36
36
  * <TimePicker format="HH:mm:ss" />
37
37
  */
38
- export const TimePicker = forwardRef(({ value, defaultValue, onChange, format = 'HH:mm', size = 'medium', disabled = false, invalid = false, step, onClear, enableClearButton = false, clearButtonProps, pickerIndicatorIconButtonProps, className, ...inputProps }, ref) => {
38
+ export const TimePicker = forwardRef(({ value, defaultValue, onChange, format = 'HH:mm', size = 'medium', disabled = false, invalid = false, caution = false, step, onClear, enableClearButton = false, clearButtonProps, pickerIndicatorIconButtonProps, className, ...inputProps }, ref) => {
39
39
  const inputRef = useRef(null);
40
40
  const mergedInputRef = mergeRefs(ref, inputRef);
41
41
  // Track the live value internally so the clear button can read it whether
@@ -43,7 +43,8 @@ export const TimePicker = forwardRef(({ value, defaultValue, onChange, format =
43
43
  const [internalValue, setInternalValue] = useState(value ?? defaultValue ?? '');
44
44
  const effectiveValue = value === undefined ? internalValue : value;
45
45
  const hasValue = effectiveValue !== '';
46
- const classes = timePickerSlotRecipe({ size, disabled, invalid });
46
+ // The error state takes precedence over the caution state
47
+ const classes = timePickerSlotRecipe({ size, disabled, invalid, caution: caution && !invalid });
47
48
  const pickerLabel = pickerIndicatorIconButtonProps?.['aria-label'] ?? getTimePickerLabel('ja', 'openPicker');
48
49
  const resolvedStep = step ?? (format === 'HH:mm:ss' ? 1 : undefined);
49
50
  const handleClear = useCallback((event) => {
@@ -35,6 +35,33 @@ type TimePickerOwnProps = {
35
35
  * @default false
36
36
  */
37
37
  invalid?: boolean;
38
+ /**
39
+ * Whether the input needs the user's attention while still being submittable.
40
+ * Use it when the time is valid but is worth double-checking.
41
+ *
42
+ * Unlike `invalid`, this does not set `aria-invalid` — the state is advisory, not an error.
43
+ * It changes the border color only, so you must also render an adjacent
44
+ * `<HelpMessage messageType="caution">` describing the concern — color alone does not
45
+ * convey the state (WCAG 2.2 1.4.1).
46
+ *
47
+ * Associate that `HelpMessage` with the input via `aria-describedby` so screen readers
48
+ * announce it on focus, and give it `role="status"` so it is also announced the moment it
49
+ * appears while focus is already inside the input.
50
+ *
51
+ * ```tsx
52
+ * const cautionMessageId = useId();
53
+ *
54
+ * <TimePicker caution aria-describedby={cautionMessageId} />
55
+ * <HelpMessage id={cautionMessageId} role="status" messageType="caution">
56
+ * 所定労働時間外の時刻が入力されています。
57
+ * </HelpMessage>
58
+ * ```
59
+ *
60
+ * Ignored while `invalid` is `true`, because the error state takes precedence.
61
+ *
62
+ * @default false
63
+ */
64
+ caution?: boolean;
38
65
  /**
39
66
  * Callback fired when the clear button is clicked.
40
67
  */
@@ -76,7 +76,10 @@ export function BasePicker({ targetDOMNode, enableAutoUnmount = true, open = fal
76
76
  }
77
77
  openPopover(event);
78
78
  }, [textBoxProps.wrapperProps, textBoxRef]);
79
- return (_jsx(BasePickerProvider, { initialViewingValue: value ?? defaultValue ?? initialViewingDate, value: value, internalValue: inputValueProps.value, format: format, baseFormat: baseFormat, children: _jsx(InternalPopover, { renderTrigger: ({ setTriggerRef, togglePopover, openPopover, handleTriggerKeyDown, handleTriggerBlur }) => (_jsx(TextBox, { ref: textBoxRef, ...inputValueProps, touchDeviceReadOnly: true, suffixSlot: _jsx(IconButton, { size: textBoxProps.textBoxSize === 'small' ? 'small' : 'default', "aria-label": calendarIconButtonProps?.['aria-label'] ?? calendarIconLabel, "data-active": shouldCalendarIconActive, "data-mfui-content": "calendar-icon-button", disabled: disabled, onClick: togglePopover, onBlur: handleTriggerBlur, children: _jsx(Calendar, {}) }), disabled: disabled, ...textBoxProps, wrapperProps: {
79
+ return (_jsx(BasePickerProvider, { initialViewingValue: value ?? defaultValue ?? initialViewingDate, value: value, internalValue: inputValueProps.value, format: format, baseFormat: baseFormat, children: _jsx(InternalPopover, { renderTrigger: ({ setTriggerRef, togglePopover, openPopover, handleTriggerKeyDown, handleTriggerBlur }) => (_jsx(TextBox, { ref: textBoxRef, ...inputValueProps, touchDeviceReadOnly: true, suffixSlot: _jsx(IconButton, { size: textBoxProps.textBoxSize === 'small' ? 'small' : 'default', "aria-label": calendarIconButtonProps?.['aria-label'] ?? calendarIconLabel, "data-active": shouldCalendarIconActive, "data-mfui-content": "calendar-icon-button", disabled: disabled, onClick: togglePopover, onBlur: handleTriggerBlur, children: _jsx(Calendar, {}) }), disabled: disabled, ...textBoxProps, clearButtonProps: {
80
+ 'aria-label': getBasePickerLabel('CLEAR_VALUE', calendarLocale),
81
+ ...textBoxProps.clearButtonProps,
82
+ }, wrapperProps: {
80
83
  ...textBoxProps.wrapperProps,
81
84
  ref: mergeRefs(setTriggerRef, triggerRef, textBoxProps.wrapperProps?.ref),
82
85
  onKeyDown: (event) => {
@@ -8,7 +8,7 @@ export declare const LABEL_SELECT_MONTH = "\u6708\u3092\u9078\u629E";
8
8
  export declare const LABEL_OPEN_CALENDAR = "\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u958B\u304F";
9
9
  export declare const LABEL_CLOSE_CALENDAR = "\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u9589\u3058\u308B";
10
10
  export declare const LABEL_TODAY = "\u4ECA\u65E5";
11
- type LabelKey = 'GO_TO_PREV_MONTH' | 'GO_TO_NEXT_MONTH' | 'GO_TO_PREV_YEAR' | 'GO_TO_NEXT_YEAR' | 'SELECT_MONTH' | 'SELECT_YEAR' | 'OPEN_CALENDAR' | 'CLOSE_CALENDAR' | 'TODAY';
11
+ type LabelKey = 'GO_TO_PREV_MONTH' | 'GO_TO_NEXT_MONTH' | 'GO_TO_PREV_YEAR' | 'GO_TO_NEXT_YEAR' | 'SELECT_MONTH' | 'SELECT_YEAR' | 'OPEN_CALENDAR' | 'CLOSE_CALENDAR' | 'TODAY' | 'CLEAR_VALUE';
12
12
  export declare const BASE_PICKER_LABELS: Record<NonNullable<BasePickerProps['calendarLocale']>, Record<LabelKey, string>>;
13
13
  export declare const DAY_ABBREVIATIONS: Record<NonNullable<BasePickerProps['calendarLocale']>, string[]>;
14
14
  export declare const DAY_FULL_NAMES: Record<NonNullable<BasePickerProps['calendarLocale']>, string[]>;
@@ -18,6 +18,7 @@ export const BASE_PICKER_LABELS = {
18
18
  OPEN_CALENDAR: 'カレンダーを開く',
19
19
  CLOSE_CALENDAR: 'カレンダーを閉じる',
20
20
  TODAY: '今日',
21
+ CLEAR_VALUE: '値をクリアする',
21
22
  },
22
23
  en: {
23
24
  GO_TO_PREV_MONTH: 'Previous month',
@@ -29,6 +30,7 @@ export const BASE_PICKER_LABELS = {
29
30
  OPEN_CALENDAR: 'Open calendar',
30
31
  CLOSE_CALENDAR: 'Close calendar',
31
32
  TODAY: 'Today',
33
+ CLEAR_VALUE: 'Clear value',
32
34
  },
33
35
  };
34
36
  export const DAY_ABBREVIATIONS = {
@@ -3,4 +3,4 @@ import { type BaseRangePickerProps } from './BaseRangePicker.types';
3
3
  * BaseRangePicker component
4
4
  * A generic component for selecting a range of dates with configurable format
5
5
  */
6
- export declare function BaseRangePicker({ value, defaultValue, disabled, invalid, targetDOMNode, onChange, format, onOpenStateChanged, disableAutoOpen, onBlur, allowedPlacements, enableViewportConstraint, enableClearButton, clearButtonProps, minDate, maxDate, enableAutoUnmount, minWidth, renderPopoverContent, startInputProps, endInputProps, calendarLocale, initialDisplayedMonths, initialViewingDate, customFormatValue, pendingFocusDayjsFormat, }: BaseRangePickerProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function BaseRangePicker({ value, defaultValue, disabled, invalid, caution, targetDOMNode, onChange, format, onOpenStateChanged, disableAutoOpen, onBlur, allowedPlacements, enableViewportConstraint, enableClearButton, clearButtonProps, minDate, maxDate, enableAutoUnmount, minWidth, renderPopoverContent, startInputProps, endInputProps, calendarLocale, initialDisplayedMonths, initialViewingDate, customFormatValue, pendingFocusDayjsFormat, }: BaseRangePickerProps): import("react/jsx-runtime").JSX.Element;
@@ -9,7 +9,7 @@ import { dayjs } from '../../../utilities/date/dayjs';
9
9
  /**
10
10
  * Internal component that has access to BaseRangePickerContext
11
11
  */
12
- function InternalBaseRangePicker({ startInputRef, endInputRef, disabled, invalid, format, enableClearButton, clearButtonProps, targetDOMNode, onBlur, isOpen, open, close, onOpenStateChanged, enableAutoUnmount, allowedPlacements, enableViewportConstraint, minWidth, renderPopoverContent, startInputProps = {}, endInputProps = {}, calendarLocale = 'ja', pendingFocusDayjsFormat = 'YYYY-MM-DD', }) {
12
+ function InternalBaseRangePicker({ startInputRef, endInputRef, disabled, invalid, caution, format, enableClearButton, clearButtonProps, targetDOMNode, onBlur, isOpen, open, close, onOpenStateChanged, enableAutoUnmount, allowedPlacements, enableViewportConstraint, minWidth, renderPopoverContent, startInputProps = {}, endInputProps = {}, calendarLocale = 'ja', pendingFocusDayjsFormat = 'YYYY-MM-DD', }) {
13
13
  const { setPendingFocusDate, temporaryStart, temporaryEnd, startDate, endDate, viewingMonth, setViewingMonth } = useBaseRangePickerContext();
14
14
  // Custom onOpen handler to prevent auto-focus when clicking on input elements
15
15
  // and implement smart focus management for calendar dates
@@ -65,7 +65,7 @@ function InternalBaseRangePicker({ startInputRef, endInputRef, disabled, invalid
65
65
  open,
66
66
  pendingFocusDayjsFormat,
67
67
  ]);
68
- return (_jsx(Popover, { enableAutomaticPortalTargetResolution: true, open: isOpen, allowedPlacements: allowedPlacements, enableViewportConstraint: enableViewportConstraint, minWidth: minWidth, renderTrigger: ({ setTriggerRef, handleTriggerBlur, handleTriggerKeyDown, openPopover }) => (_jsx(BaseRangePickerTrigger, { ref: setTriggerRef, disabled: disabled, invalid: invalid, format: format, enableClearValue: enableClearButton, clearButtonProps: clearButtonProps, startInputRef: startInputRef, endInputRef: endInputRef, startInputProps: startInputProps, endInputProps: endInputProps, popoverOpenFunction: openPopover, calendarLocale: calendarLocale, onBlur: handleTriggerBlur, onKeyDown: handleTriggerKeyDown })), renderContent: () => renderPopoverContent({
68
+ return (_jsx(Popover, { enableAutomaticPortalTargetResolution: true, open: isOpen, allowedPlacements: allowedPlacements, enableViewportConstraint: enableViewportConstraint, minWidth: minWidth, renderTrigger: ({ setTriggerRef, handleTriggerBlur, handleTriggerKeyDown, openPopover }) => (_jsx(BaseRangePickerTrigger, { ref: setTriggerRef, disabled: disabled, invalid: invalid, caution: caution, format: format, enableClearValue: enableClearButton, clearButtonProps: clearButtonProps, startInputRef: startInputRef, endInputRef: endInputRef, startInputProps: startInputProps, endInputProps: endInputProps, popoverOpenFunction: openPopover, calendarLocale: calendarLocale, onBlur: handleTriggerBlur, onKeyDown: handleTriggerKeyDown })), renderContent: () => renderPopoverContent({
69
69
  viewingValue: viewingMonth,
70
70
  setViewingValue: setViewingMonth,
71
71
  value: [temporaryStart, temporaryEnd],
@@ -77,12 +77,12 @@ function InternalBaseRangePicker({ startInputRef, endInputRef, disabled, invalid
77
77
  * BaseRangePicker component
78
78
  * A generic component for selecting a range of dates with configurable format
79
79
  */
80
- export function BaseRangePicker({ value, defaultValue, disabled, invalid, targetDOMNode, onChange, format = 'YYYY/MM/DD', onOpenStateChanged, disableAutoOpen = false, onBlur, allowedPlacements, enableViewportConstraint, enableClearButton = false, clearButtonProps, minDate, maxDate, enableAutoUnmount = true, minWidth, renderPopoverContent, startInputProps, endInputProps, calendarLocale = 'ja', initialDisplayedMonths, initialViewingDate, customFormatValue, pendingFocusDayjsFormat = 'YYYY-MM-DD', }) {
80
+ export function BaseRangePicker({ value, defaultValue, disabled, invalid, caution, targetDOMNode, onChange, format = 'YYYY/MM/DD', onOpenStateChanged, disableAutoOpen = false, onBlur, allowedPlacements, enableViewportConstraint, enableClearButton = false, clearButtonProps, minDate, maxDate, enableAutoUnmount = true, minWidth, renderPopoverContent, startInputProps, endInputProps, calendarLocale = 'ja', initialDisplayedMonths, initialViewingDate, customFormatValue, pendingFocusDayjsFormat = 'YYYY-MM-DD', }) {
81
81
  const { isOpen, open, close } = useDisclosure({ value: false });
82
82
  const startInputRef = useRef(null);
83
83
  const endInputRef = useRef(null);
84
84
  // Default renderPopoverContent implementation for backward compatibility
85
85
  const defaultRenderPopoverContent = useCallback(() => _jsx(BaseRangePickerPopover, { calendarLocale: calendarLocale }), [calendarLocale]);
86
86
  const finalRenderPopoverContent = renderPopoverContent ?? defaultRenderPopoverContent;
87
- return (_jsx(BaseRangePickerProvider, { value: value, defaultValue: defaultValue, disabled: disabled, format: format, isOpen: isOpen, open: open, close: close, disableAutoOpen: disableAutoOpen, minDate: minDate, maxDate: maxDate, initialDisplayedMonths: initialDisplayedMonths, initialViewingDate: initialViewingDate, customFormatValue: customFormatValue, pendingFocusDayjsFormat: pendingFocusDayjsFormat, onChange: onChange, children: _jsx(InternalBaseRangePicker, { startInputRef: startInputRef, endInputRef: endInputRef, disabled: disabled, invalid: invalid, format: format, enableClearButton: enableClearButton, clearButtonProps: clearButtonProps, targetDOMNode: targetDOMNode, allowedPlacements: allowedPlacements, enableViewportConstraint: enableViewportConstraint, enableAutoUnmount: enableAutoUnmount, minWidth: minWidth, startInputProps: startInputProps, endInputProps: endInputProps, isOpen: isOpen, open: open, close: close, renderPopoverContent: finalRenderPopoverContent, calendarLocale: calendarLocale, pendingFocusDayjsFormat: pendingFocusDayjsFormat, onBlur: onBlur, onOpenStateChanged: onOpenStateChanged }) }));
87
+ return (_jsx(BaseRangePickerProvider, { value: value, defaultValue: defaultValue, disabled: disabled, format: format, isOpen: isOpen, open: open, close: close, disableAutoOpen: disableAutoOpen, minDate: minDate, maxDate: maxDate, initialDisplayedMonths: initialDisplayedMonths, initialViewingDate: initialViewingDate, customFormatValue: customFormatValue, pendingFocusDayjsFormat: pendingFocusDayjsFormat, onChange: onChange, children: _jsx(InternalBaseRangePicker, { startInputRef: startInputRef, endInputRef: endInputRef, disabled: disabled, invalid: invalid, caution: caution, format: format, enableClearButton: enableClearButton, clearButtonProps: clearButtonProps, targetDOMNode: targetDOMNode, allowedPlacements: allowedPlacements, enableViewportConstraint: enableViewportConstraint, enableAutoUnmount: enableAutoUnmount, minWidth: minWidth, startInputProps: startInputProps, endInputProps: endInputProps, isOpen: isOpen, open: open, close: close, renderPopoverContent: finalRenderPopoverContent, calendarLocale: calendarLocale, pendingFocusDayjsFormat: pendingFocusDayjsFormat, onBlur: onBlur, onOpenStateChanged: onOpenStateChanged }) }));
88
88
  }
@@ -65,6 +65,37 @@ export type BaseRangePickerProps = {
65
65
  * @default false
66
66
  */
67
67
  invalid?: boolean;
68
+ /**
69
+ * Whether the inputs need the user's attention while still being submittable.
70
+ * Use it when the range passes validation but is worth double-checking.
71
+ *
72
+ * This changes the border color only, so you must also render an adjacent
73
+ * `<HelpMessage messageType="caution">` describing the concern — color alone does not
74
+ * convey the state (WCAG 2.2 1.4.1).
75
+ *
76
+ * Associate that `HelpMessage` with both inputs via `startInputProps['aria-describedby']`
77
+ * and `endInputProps['aria-describedby']` so screen readers announce it on focus, and give
78
+ * it `role="status"` so it is also announced the moment it appears while focus is already
79
+ * inside one of the inputs.
80
+ *
81
+ * ```tsx
82
+ * const cautionMessageId = useId();
83
+ *
84
+ * <DateRangePicker
85
+ * caution
86
+ * startInputProps={{ 'aria-describedby': cautionMessageId }}
87
+ * endInputProps={{ 'aria-describedby': cautionMessageId }}
88
+ * />
89
+ * <HelpMessage id={cautionMessageId} role="status" messageType="caution">
90
+ * 前会計年度をまたぐ期間が選択されています。
91
+ * </HelpMessage>
92
+ * ```
93
+ *
94
+ * Ignored while `invalid` is `true`, because the error state takes precedence.
95
+ *
96
+ * @default false
97
+ */
98
+ caution?: boolean;
68
99
  /**
69
100
  * The DOM node to attach the popover to
70
101
  */
@@ -148,7 +179,8 @@ export type BaseRangePickerProps = {
148
179
  * The properties for the clear button.
149
180
  * If this prop is not passed, the default values for each property will be applied.
150
181
  *
151
- * @property aria-label - The alternative text for the clear button. Default is '値をクリアする'.
182
+ * @property aria-label - The alternative text for the clear button.
183
+ * Default follows `calendarLocale` ('値をクリアする' for 'ja', 'Clear value' for 'en').
152
184
  */
153
185
  clearButtonProps?: Pick<React.ComponentPropsWithoutRef<'button'>, 'aria-label'>;
154
186
  /**
@@ -6,7 +6,7 @@ export type BaseRangePickerDateCellProps = DateCellProps & {
6
6
  isRangeEnd?: boolean;
7
7
  };
8
8
  /**
9
- * BaseRangePicker-specific DateCell component with enhanced accessibility
10
- * for Japanese users. Provides configurable labels and range-specific context.
9
+ * BaseRangePicker-specific DateCell component with enhanced accessibility.
10
+ * Provides locale-aware labels and range-specific context.
11
11
  */
12
12
  export declare function BaseRangePickerDateCell({ date, selected, inRange, disabled, isRangeStart, isRangeEnd, ...rest }: BaseRangePickerDateCellProps): import("react/jsx-runtime").JSX.Element;
@@ -1,42 +1,21 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from 'react';
3
- import dayjs from 'dayjs';
4
- import { DATE_RANGE_PICKER_A11Y_LABELS } from './constants';
5
2
  import { DateCell } from '../../../DateCell';
3
+ import { useCalendarLocale } from '../../../CalendarLocale/CalendarLocaleContext';
4
+ import { getDateAriaAttributes } from '../../../accessibility';
6
5
  /**
7
- * BaseRangePicker-specific DateCell component with enhanced accessibility
8
- * for Japanese users. Provides configurable labels and range-specific context.
6
+ * BaseRangePicker-specific DateCell component with enhanced accessibility.
7
+ * Provides locale-aware labels and range-specific context.
9
8
  */
10
9
  export function BaseRangePickerDateCell({ date, selected, inRange, disabled, isRangeStart, isRangeEnd, ...rest }) {
11
- const accessibleLabel = useMemo(() => {
12
- const today = new Date();
13
- const isToday = date.getFullYear() === today.getFullYear() &&
14
- date.getMonth() === today.getMonth() &&
15
- date.getDate() === today.getDate();
16
- // Create a comprehensive accessible label
17
- const dateText = dayjs(date).format('D MMMM YYYY');
18
- const statusParts = [];
19
- if (isToday) {
20
- statusParts.push(DATE_RANGE_PICKER_A11Y_LABELS.TODAY);
21
- }
22
- if (disabled) {
23
- statusParts.push(DATE_RANGE_PICKER_A11Y_LABELS.UNAVAILABLE);
24
- }
25
- else if (selected) {
26
- if (isRangeStart) {
27
- statusParts.push(DATE_RANGE_PICKER_A11Y_LABELS.RANGE_START);
28
- }
29
- else if (isRangeEnd) {
30
- statusParts.push(DATE_RANGE_PICKER_A11Y_LABELS.RANGE_END);
31
- }
32
- else {
33
- statusParts.push(DATE_RANGE_PICKER_A11Y_LABELS.SELECTED);
34
- }
35
- }
36
- else if (inRange) {
37
- statusParts.push(DATE_RANGE_PICKER_A11Y_LABELS.IN_RANGE);
38
- }
39
- return statusParts.length > 0 ? `${dateText}, ${statusParts.join(', ')}` : dateText;
40
- }, [date, selected, inRange, disabled, isRangeStart, isRangeEnd]);
41
- return (_jsx(DateCell, { ...rest, date: date, selected: selected, inRange: inRange, disabled: disabled, "aria-label": accessibleLabel, "aria-pressed": selected ? 'true' : undefined }));
10
+ const calendarLocale = useCalendarLocale();
11
+ const ariaAttributes = getDateAriaAttributes({
12
+ date,
13
+ selected,
14
+ inRange,
15
+ disabled,
16
+ isRangeStart,
17
+ isRangeEnd,
18
+ locale: calendarLocale,
19
+ });
20
+ return (_jsx(DateCell, { ...rest, date: date, selected: selected, inRange: inRange, disabled: disabled, ...ariaAttributes }));
42
21
  }
@@ -1,4 +1,3 @@
1
1
  export { BaseRangePickerCalendar } from './BaseRangePickerCalendar';
2
2
  export { BaseRangePickerDateCell } from './BaseRangePickerDateCell';
3
3
  export type { BaseRangePickerDateCellProps } from './BaseRangePickerDateCell';
4
- export { DATE_RANGE_PICKER_A11Y_LABELS } from './constants';
@@ -1,3 +1,2 @@
1
1
  export { BaseRangePickerCalendar } from './BaseRangePickerCalendar';
2
2
  export { BaseRangePickerDateCell } from './BaseRangePickerDateCell';
3
- export { DATE_RANGE_PICKER_A11Y_LABELS } from './constants';
@@ -6,6 +6,7 @@ import { cx } from '../../../../../styled-system/css';
6
6
  import { dateRangePickerPopoverSlotRecipe } from '../../../../../styled-system/recipes';
7
7
  import { BaseRangePickerFooter } from './BaseRangePickerFooter';
8
8
  import { BaseRangePickerCalendar } from './BaseRangePickerCalendar';
9
+ import { CalendarLocaleProvider } from '../../CalendarLocale/CalendarLocaleContext';
9
10
  import { dayjs } from '../../../../utilities/date/dayjs';
10
11
  import { IconButton } from '../../../../IconButton';
11
12
  import { Typography } from '../../../../Typography';
@@ -131,5 +132,5 @@ export function BaseRangePickerPopover({ wrapperProps, calendarLocale, }) {
131
132
  if (!isNextMonthDisabled()) {
132
133
  setViewingMonth(addMonths(viewingMonth, 1));
133
134
  }
134
- }, children: _jsx(PickerAfter, {}) })] })] }), _jsxs("div", { className: cx(classNames.calendars, 'mfui-BaseRangePickerPopover__calendars'), children: [_jsx(BaseRangePickerCalendar, { viewingMonth: viewingMonth, handleKeyboardNavigation: handleKeyboardNavigation }), _jsx(BaseRangePickerCalendar, { viewingMonth: rightViewingMonth, handleKeyboardNavigation: handleKeyboardNavigation })] }), _jsx(BaseRangePickerFooter, { calendarLocale: calendarLocale })] }));
135
+ }, children: _jsx(PickerAfter, {}) })] })] }), _jsx("div", { className: cx(classNames.calendars, 'mfui-BaseRangePickerPopover__calendars'), children: _jsxs(CalendarLocaleProvider, { value: calendarLocale, children: [_jsx(BaseRangePickerCalendar, { viewingMonth: viewingMonth, handleKeyboardNavigation: handleKeyboardNavigation }), _jsx(BaseRangePickerCalendar, { viewingMonth: rightViewingMonth, handleKeyboardNavigation: handleKeyboardNavigation })] }) }), _jsx(BaseRangePickerFooter, { calendarLocale: calendarLocale })] }));
135
136
  }
@@ -17,7 +17,7 @@ import { useDateRangeTriggerInputClick } from './hooks/useDateRangeTriggerInputC
17
17
  * Trigger component for BaseRangePicker
18
18
  * Handles the display and interaction of the date range input field
19
19
  */
20
- export const BaseRangePickerTrigger = forwardRef(({ enableClearValue = false, invalid = false, size = 'medium', disabled = false, wrapperProps = {}, clearButtonProps = {}, startInputProps = {}, endInputProps = {}, calendarButtonProps = {}, startInputRef, endInputRef, popoverOpenFunction, format = 'YYYY-MM-DD', calendarLocale = 'ja', ...props }, ref) => {
20
+ export const BaseRangePickerTrigger = forwardRef(({ enableClearValue = false, invalid = false, caution = false, size = 'medium', disabled = false, wrapperProps = {}, clearButtonProps = {}, startInputProps = {}, endInputProps = {}, calendarButtonProps = {}, startInputRef, endInputRef, popoverOpenFunction, format = 'YYYY-MM-DD', calendarLocale = 'ja', ...props }, ref) => {
21
21
  const isTouchDevice = useIsTouchDevice();
22
22
  const { toggle, disableAutoOpen, isOpen } = useBaseRangePickerContext();
23
23
  const { handleInputClick } = useDateRangeTriggerInputClick(disableAutoOpen ?? false, popoverOpenFunction);
@@ -40,7 +40,8 @@ export const BaseRangePickerTrigger = forwardRef(({ enableClearValue = false, in
40
40
  const finalStartPlaceholder = startInputPlaceholder ?? getBaseRangePickerTriggerLabel('START_DATE_PLACEHOLDER', calendarLocale);
41
41
  const finalEndPlaceholder = endInputPlaceholder ?? getBaseRangePickerTriggerLabel('END_DATE_PLACEHOLDER', calendarLocale);
42
42
  const shouldShowClearButton = enableClearValue && (enhancedStartInputProps.value || enhancedEndInputProps.value);
43
- const classes = baseRangePickerTriggerSlotRecipe({ invalid, disabled, size });
43
+ // The error state takes precedence over the caution state
44
+ const classes = baseRangePickerTriggerSlotRecipe({ invalid, caution: caution && !invalid, disabled, size });
44
45
  // Popover open: mark calendar icon active. Use `undefined` when closed — `data-active="false"` is still truthy in CSS.
45
46
  const shouldCalendarIconActive = isOpen ? true : undefined;
46
47
  const handleClickClearButton = useCallback((event) => {
@@ -12,6 +12,23 @@ export type BaseRangePickerTriggerProps = {
12
12
  * @default false
13
13
  */
14
14
  invalid?: boolean;
15
+ /**
16
+ * Whether the inputs need the user's attention while still being submittable.
17
+ *
18
+ * This changes the border color only, so you must also render an adjacent
19
+ * `<HelpMessage messageType="caution">` describing the concern — color alone does not
20
+ * convey the state (WCAG 2.2 1.4.1).
21
+ *
22
+ * Associate that `HelpMessage` with both inputs via `startInputProps['aria-describedby']`
23
+ * and `endInputProps['aria-describedby']` so screen readers announce it on focus, and give
24
+ * it `role="status"` so it is also announced the moment it appears while focus is already
25
+ * inside one of the inputs.
26
+ *
27
+ * Ignored while `invalid` is `true`, because the error state takes precedence.
28
+ *
29
+ * @default false
30
+ */
31
+ caution?: boolean;
15
32
  /**
16
33
  * Whether to enable the clear functionality
17
34
  *
@@ -1,18 +1,9 @@
1
+ import { type BasePickerProps } from '../BasePicker/BasePicker.types';
2
+ type CalendarLocale = NonNullable<BasePickerProps['calendarLocale']>;
3
+ type DatePickerA11yLabelKey = 'TODAY' | 'SELECTED' | 'IN_RANGE' | 'UNAVAILABLE' | 'RANGE_START' | 'RANGE_END';
1
4
  /**
2
- * Shared Japanese accessibility labels for date picker components
3
- * These constants provide consistent Japanese text for screen readers.
5
+ * Shared accessibility labels for date picker components, keyed by calendar locale.
6
+ * These constants provide consistent text for screen readers.
4
7
  */
5
- export declare const DATE_PICKER_A11Y_LABELS: {
6
- /** Label for today's date */
7
- readonly TODAY: '今日';
8
- /** Label for selected dates */
9
- readonly SELECTED: '選択済み';
10
- /** Label for dates in the selected range */
11
- readonly IN_RANGE: '選択範囲内';
12
- /** Label for unavailable/disabled dates */
13
- readonly UNAVAILABLE: '選択不可';
14
- /** Label for range start dates */
15
- readonly RANGE_START: '開始日';
16
- /** Label for range end dates */
17
- readonly RANGE_END: '終了日';
18
- };
8
+ export declare const DATE_PICKER_A11Y_LABELS: Record<CalendarLocale, Record<DatePickerA11yLabelKey, string>>;
9
+ export {};
@@ -1,18 +1,34 @@
1
1
  /**
2
- * Shared Japanese accessibility labels for date picker components
3
- * These constants provide consistent Japanese text for screen readers.
2
+ * Shared accessibility labels for date picker components, keyed by calendar locale.
3
+ * These constants provide consistent text for screen readers.
4
4
  */
5
5
  export const DATE_PICKER_A11Y_LABELS = {
6
- /** Label for today's date */
7
- TODAY: '今日',
8
- /** Label for selected dates */
9
- SELECTED: '選択済み',
10
- /** Label for dates in the selected range */
11
- IN_RANGE: '選択範囲内',
12
- /** Label for unavailable/disabled dates */
13
- UNAVAILABLE: '選択不可',
14
- /** Label for range start dates */
15
- RANGE_START: '開始日',
16
- /** Label for range end dates */
17
- RANGE_END: '終了日',
6
+ ja: {
7
+ /** Label for today's date */
8
+ TODAY: '今日',
9
+ /** Label for selected dates */
10
+ SELECTED: '選択済み',
11
+ /** Label for dates in the selected range */
12
+ IN_RANGE: '選択範囲内',
13
+ /** Label for unavailable/disabled dates */
14
+ UNAVAILABLE: '選択不可',
15
+ /** Label for range start dates */
16
+ RANGE_START: '開始日',
17
+ /** Label for range end dates */
18
+ RANGE_END: '終了日',
19
+ },
20
+ en: {
21
+ /** Label for today's date */
22
+ TODAY: 'Today',
23
+ /** Label for selected dates */
24
+ SELECTED: 'Selected',
25
+ /** Label for dates in the selected range */
26
+ IN_RANGE: 'In range',
27
+ /** Label for unavailable/disabled dates */
28
+ UNAVAILABLE: 'Unavailable',
29
+ /** Label for range start dates */
30
+ RANGE_START: 'Start date',
31
+ /** Label for range end dates */
32
+ RANGE_END: 'End date',
33
+ },
18
34
  };
@@ -1,3 +1,6 @@
1
+ import 'dayjs/locale/en';
2
+ import 'dayjs/locale/ja';
3
+ import { type BasePickerProps } from '../BasePicker/BasePicker.types';
1
4
  export type DateLabelOptions = {
2
5
  /** The date to generate a label for */
3
6
  date: Date;
@@ -11,6 +14,8 @@ export type DateLabelOptions = {
11
14
  isRangeStart?: boolean;
12
15
  /** Whether this date is the end of a range */
13
16
  isRangeEnd?: boolean;
17
+ /** The calendar locale used for the label text. Default is 'ja'. */
18
+ locale?: NonNullable<BasePickerProps['calendarLocale']>;
14
19
  };
15
20
  /**
16
21
  * Generates an accessible label for a date cell with status information
@@ -19,4 +24,4 @@ export type DateLabelOptions = {
19
24
  *
20
25
  * @returns Formatted accessible label string
21
26
  */
22
- export declare function generateAccessibleDateLabel({ date, selected, inRange, disabled, isRangeStart, isRangeEnd, }: DateLabelOptions): string;
27
+ export declare function generateAccessibleDateLabel({ date, selected, inRange, disabled, isRangeStart, isRangeEnd, locale, }: DateLabelOptions): string;
@@ -1,4 +1,6 @@
1
1
  import dayjs from 'dayjs';
2
+ import 'dayjs/locale/en';
3
+ import 'dayjs/locale/ja';
2
4
  import { DATE_PICKER_A11Y_LABELS } from './constants';
3
5
  /**
4
6
  * Generates an accessible label for a date cell with status information
@@ -7,33 +9,37 @@ import { DATE_PICKER_A11Y_LABELS } from './constants';
7
9
  *
8
10
  * @returns Formatted accessible label string
9
11
  */
10
- export function generateAccessibleDateLabel({ date, selected = false, inRange = false, disabled = false, isRangeStart = false, isRangeEnd = false, }) {
12
+ export function generateAccessibleDateLabel({ date, selected = false, inRange = false, disabled = false, isRangeStart = false, isRangeEnd = false, locale = 'ja', }) {
11
13
  const today = new Date();
12
14
  const isToday = date.getFullYear() === today.getFullYear() &&
13
15
  date.getMonth() === today.getMonth() &&
14
16
  date.getDate() === today.getDate();
17
+ // Fall back to 'ja' so an unknown locale from untyped consumers cannot crash the calendar
18
+ const safeLocale = locale in DATE_PICKER_A11Y_LABELS ? locale : 'ja';
19
+ const labels = DATE_PICKER_A11Y_LABELS[safeLocale];
15
20
  // Create a comprehensive accessible label
16
- const dateText = dayjs(date).format('D MMMM YYYY');
21
+ // Pin the dayjs locale per call so the output does not depend on the global dayjs locale
22
+ const dateText = dayjs(date).locale(safeLocale).format('D MMMM YYYY');
17
23
  const statusParts = [];
18
24
  if (isToday) {
19
- statusParts.push(DATE_PICKER_A11Y_LABELS.TODAY);
25
+ statusParts.push(labels.TODAY);
20
26
  }
21
27
  if (disabled) {
22
- statusParts.push(DATE_PICKER_A11Y_LABELS.UNAVAILABLE);
28
+ statusParts.push(labels.UNAVAILABLE);
23
29
  }
24
30
  else if (selected) {
25
31
  if (isRangeStart) {
26
- statusParts.push(DATE_PICKER_A11Y_LABELS.RANGE_START);
32
+ statusParts.push(labels.RANGE_START);
27
33
  }
28
34
  else if (isRangeEnd) {
29
- statusParts.push(DATE_PICKER_A11Y_LABELS.RANGE_END);
35
+ statusParts.push(labels.RANGE_END);
30
36
  }
31
37
  else {
32
- statusParts.push(DATE_PICKER_A11Y_LABELS.SELECTED);
38
+ statusParts.push(labels.SELECTED);
33
39
  }
34
40
  }
35
41
  else if (inRange) {
36
- statusParts.push(DATE_PICKER_A11Y_LABELS.IN_RANGE);
42
+ statusParts.push(labels.IN_RANGE);
37
43
  }
38
44
  return statusParts.length > 0 ? `${dateText}, ${statusParts.join(', ')}` : dateText;
39
45
  }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A UI that displays the loading progress as a horizontal bar.
3
+ *
4
+ * Use this component when the progress rate is known. For animations that do not
5
+ * represent a progress rate, use `ProgressIndicator` instead.
6
+ *
7
+ * Also extends the props of the `<div>` element.
8
+ *
9
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
10
+ */
11
+ export declare const DeterminateProgressIndicator: import("react").ForwardRefExoticComponent<{
12
+ value: number;
13
+ showValueText?: boolean;
14
+ valueTextPosition?: 'right' | 'top';
15
+ unit?: string;
16
+ 'aria-label'?: string;
17
+ className?: string;
18
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "role"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { cx } from '../../styled-system/css';
4
+ import { determinateProgressIndicatorSlotRecipe } from '../../styled-system/recipes';
5
+ import { Typography } from '../Typography';
6
+ /**
7
+ * A UI that displays the loading progress as a horizontal bar.
8
+ *
9
+ * Use this component when the progress rate is known. For animations that do not
10
+ * represent a progress rate, use `ProgressIndicator` instead.
11
+ *
12
+ * Also extends the props of the `<div>` element.
13
+ *
14
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
15
+ */
16
+ export const DeterminateProgressIndicator = forwardRef(({ value, showValueText = true, valueTextPosition = 'right', unit = '%', className, ...props }, ref) => {
17
+ const classes = determinateProgressIndicatorSlotRecipe({ valueTextPosition });
18
+ const clampedValue = Math.min(Math.max(value, 0), 100);
19
+ return (_jsxs("div", { ref: ref, role: "progressbar", "aria-valuenow": clampedValue, "aria-valuemin": 0, "aria-valuemax": 100, className: cx(classes.root, 'mfui-DeterminateProgressIndicator__root', className), ...props, children: [_jsx("div", { className: cx(classes.progressIndicator, 'mfui-DeterminateProgressIndicator__progressIndicator'), children: _jsx("div", { className: cx(classes.track, 'mfui-DeterminateProgressIndicator__track'), children: _jsx("div", { className: cx(classes.progress, 'mfui-DeterminateProgressIndicator__progress'), style: { width: `${clampedValue.toString()}%` } }) }) }), showValueText ? (_jsxs(Typography, { as: "div", variant: "amount", className: cx(classes.valueText, 'mfui-DeterminateProgressIndicator__valueText'), children: [_jsx("span", { className: cx(classes.value, 'mfui-DeterminateProgressIndicator__value'), children: clampedValue }), unit ? _jsx("span", { className: cx(classes.unit, 'mfui-DeterminateProgressIndicator__unit'), children: unit }) : null] })) : null] }));
20
+ });