@moneyforward/mfui-components 3.20.0 → 3.22.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 (63) hide show
  1. package/dist/src/DateTimeSelection/DatePicker/DatePicker.js +2 -11
  2. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePicker.d.ts +1 -1
  3. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePicker.js +10 -2
  4. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePicker.types.d.ts +14 -0
  5. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePickerPopover/DateRangePickerPopover.js +13 -5
  6. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePickerPopover/utilities/createDateRangePickerPopoverTestUtility.js +2 -2
  7. package/dist/src/DateTimeSelection/DateRangePicker/DateRangePickerTrigger/utilities/createDateRangePickerTriggerTestUtility.js +3 -1
  8. package/dist/src/DateTimeSelection/MonthPicker/MonthPicker.d.ts +1 -1
  9. package/dist/src/DateTimeSelection/MonthPicker/MonthPicker.js +10 -2
  10. package/dist/src/DateTimeSelection/MonthPicker/MonthPicker.types.d.ts +14 -0
  11. package/dist/src/DateTimeSelection/MonthPicker/MonthPickerPanel/MonthCell/MonthCell.js +2 -25
  12. package/dist/src/DateTimeSelection/MonthPicker/MonthPickerPanel/MonthPickerPanel.js +1 -1
  13. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePicker.d.ts +1 -1
  14. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePicker.js +14 -5
  15. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePicker.types.d.ts +21 -0
  16. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerMonthCell/MonthRangePickerMonthCell.d.ts +1 -0
  17. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerMonthCell/MonthRangePickerMonthCell.js +10 -3
  18. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerNavigation/MonthRangePickerNavigation.js +16 -3
  19. package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerPanel/MonthRangePickerPanel.js +3 -1
  20. package/dist/src/DateTimeSelection/TimePicker/TimePicker.d.ts +43 -0
  21. package/dist/src/DateTimeSelection/TimePicker/TimePicker.js +85 -0
  22. package/dist/src/DateTimeSelection/TimePicker/TimePicker.types.d.ts +61 -0
  23. package/dist/src/DateTimeSelection/TimePicker/TimePicker.types.js +1 -0
  24. package/dist/src/DateTimeSelection/TimePicker/constants.d.ts +4 -0
  25. package/dist/src/DateTimeSelection/TimePicker/constants.js +12 -0
  26. package/dist/src/DateTimeSelection/TimePicker/index.d.ts +2 -0
  27. package/dist/src/DateTimeSelection/TimePicker/index.js +1 -0
  28. package/dist/src/DateTimeSelection/index.d.ts +1 -0
  29. package/dist/src/DateTimeSelection/index.js +1 -0
  30. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePicker.d.ts +1 -1
  31. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePicker.js +2 -2
  32. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePicker.types.d.ts +10 -0
  33. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerProvider/BaseRangePickerProvider.js +24 -20
  34. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerProvider/BaseRangePickerProvider.types.d.ts +9 -0
  35. package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerTrigger/hooks/useDateRangeTriggerValueController.js +4 -4
  36. package/dist/src/DateTimeSelection/shared/CalendarLocale/CalendarLocaleContext.d.ts +1 -1
  37. package/dist/src/DateTimeSelection/shared/CalendarLocale/CalendarLocaleContext.js +1 -1
  38. package/dist/src/DateTimeSelection/shared/DayCell/DayCell.js +2 -3
  39. package/dist/src/DateTimeSelection/shared/YearSelector/YearSelector.js +1 -1
  40. package/dist/src/DateTimeSelection/shared/utilities/dateParsing.js +16 -9
  41. package/dist/src/DateTimeSelection/shared/utilities/japaneseCalendar.d.ts +36 -8
  42. package/dist/src/DateTimeSelection/shared/utilities/japaneseCalendar.js +82 -15
  43. package/dist/src/DateTimeSelection/shared/utilities/monthCellMonthFormat.d.ts +14 -0
  44. package/dist/src/DateTimeSelection/shared/utilities/monthCellMonthFormat.js +35 -0
  45. package/dist/src/FormFooter/FormFooter.types.d.ts +2 -3
  46. package/dist/src/SidePane/SidePane.d.ts +1 -1
  47. package/dist/src/SidePane/SidePane.types.d.ts +1 -3
  48. package/dist/src/Tooltip/Tooltip.js +12 -3
  49. package/dist/src/Tooltip/hooks/useTooltipDisplayController.d.ts +1 -0
  50. package/dist/src/Tooltip/hooks/useTooltipDisplayController.js +1 -0
  51. package/dist/styled-system/recipes/form-footer-slot-recipe.d.ts +1 -1
  52. package/dist/styled-system/recipes/form-footer-slot-recipe.js +0 -1
  53. package/dist/styled-system/recipes/index.d.ts +1 -0
  54. package/dist/styled-system/recipes/index.js +1 -0
  55. package/dist/styled-system/recipes/time-picker-slot-recipe.d.ts +44 -0
  56. package/dist/styled-system/recipes/time-picker-slot-recipe.js +62 -0
  57. package/dist/styled-system/tokens/index.js +892 -44
  58. package/dist/styled-system/tokens/tokens.d.ts +4 -4
  59. package/dist/styles.css +195 -35
  60. package/dist/tsconfig.build.tsbuildinfo +1 -1
  61. package/package.json +3 -3
  62. package/dist/src/DateTimeSelection/shared/BasePicker/YearSelector/YearSelector.d.ts +0 -18
  63. package/dist/src/DateTimeSelection/shared/BasePicker/YearSelector/YearSelector.js +0 -36
@@ -116,12 +116,10 @@ export type SidePaneProps = {
116
116
  * - `position: 'sticky'` (default): the footer is always pinned to the pane bottom, outside the scrollable content area.
117
117
  * - `position: 'stacking'`: the footer flows after the content inside the scroll area.
118
118
  *
119
- * `position: 'fixed'` is not supported here because it anchors to the viewport rather than the pane.
120
- *
121
119
  * @default undefined
122
120
  */
123
121
  formFooterProps?: Pick<FormFooterProps, 'optionsSlot' | 'actionsSlot'> & {
124
- position?: Exclude<FormFooterProps['position'], 'fixed'>;
122
+ position?: FormFooterProps['position'];
125
123
  };
126
124
  /**
127
125
  * Additional props to apply to the inside container element of the SidePane.
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { forwardRef, useId, useRef, isValidElement, cloneElement, useEffect } from 'react';
3
+ import { forwardRef, useId, useRef, isValidElement, cloneElement, useEffect, useMemo } from 'react';
4
4
  import { getOverflowAncestors } from '@floating-ui/react-dom';
5
5
  import { cx } from '../../styled-system/css';
6
6
  import { tooltipSlotRecipe } from '../../styled-system/recipes';
7
7
  import { Typography } from '../Typography';
8
8
  import { mergeRefs } from '../utilities/dom/mergeRefs';
9
+ import { useOnClickOutside } from '../utilities/dom/useOnClickOutside';
9
10
  import { useTooltipDisplayController } from './hooks/useTooltipDisplayController';
10
11
  import { ArrowIcon } from './icons/ArrowIcon';
11
12
  import { usePopoverController } from './hooks/usePopoverController';
@@ -46,11 +47,12 @@ export const DEFAULT_MAX_WIDTH = '268px';
46
47
  export const Tooltip = forwardRef(({ children, open, onOpenStateChanged, content, targetDOMNode, placement, trigger = ['hover', 'focus'], disabled = false, hideFromScreenReader = false, maxWidth = DEFAULT_MAX_WIDTH, className, contentProps, ...wrapperProps }, ref) => {
47
48
  const rootRef = useRef(null);
48
49
  const arrowRef = useRef(null);
50
+ const tooltipRef = useRef(null);
49
51
  const tooltipId = useId();
50
52
  // Use automatic target resolution matching Portal.tsx pattern
51
53
  // Resolution order: explicit prop → parent context → document.body fallback
52
54
  const targetElement = useAutomaticTargetDomNode(targetDOMNode, rootRef.current);
53
- const { open: calculatedOpen, rootAttributes, tooltipAttributes, closeImmediate, } = useTooltipDisplayController({
55
+ const { open: calculatedOpen, rootAttributes, tooltipAttributes, closeImmediate, closeWithManager, } = useTooltipDisplayController({
54
56
  trigger,
55
57
  wrapperProps,
56
58
  tooltipOpen: open,
@@ -77,6 +79,13 @@ export const Tooltip = forwardRef(({ children, open, onOpenStateChanged, content
77
79
  });
78
80
  };
79
81
  }, [calculatedOpen, closeImmediate]);
82
+ const hasClickTrigger = useMemo(() => (Array.isArray(trigger) ? trigger : [trigger]).includes('click'), [trigger]);
83
+ // Skip the trigger (rootRef) so the existing onClick toggle handles re-clicks —
84
+ // closing here would race with onClick and immediately reopen the tooltip.
85
+ useOnClickOutside(rootRef, closeWithManager, {
86
+ ignoreRefs: [tooltipRef],
87
+ disabled: !calculatedOpen || !hasClickTrigger || open !== undefined,
88
+ });
80
89
  const triggerRef = mergeRefs(setTriggerReference, rootRef, ref);
81
90
  const classes = tooltipSlotRecipe();
82
91
  const ariaDescribedBy = !hideFromScreenReader && content != null ? tooltipId : undefined;
@@ -90,5 +99,5 @@ export const Tooltip = forwardRef(({ children, open, onOpenStateChanged, content
90
99
  clip: 'rect(0, 0, 0, 0)',
91
100
  whiteSpace: 'nowrap',
92
101
  borderWidth: 0,
93
- }, children: content }) })), calculatedOpen ? (_jsx(Portal, { targetDOMNode: targetElement, children: _jsxs("div", { ref: setTooltipReference, className: cx(classes.tooltip, 'mfui-Tooltip__tooltip', contentProps?.className), role: "tooltip", id: tooltipId, "aria-hidden": hideFromScreenReader ? true : undefined, style: { maxWidth, ...tooltipStyles }, ...tooltipAttributes, children: [typeof content === 'string' ? _jsx(Typography, { variant: "helpMessage", children: content }) : content, _jsx(ArrowIcon, { ref: arrowRef, "aria-hidden": true, placement: calculatedPlacement, className: cx(classes.arrow, 'mfui-Tooltip__arrow'), style: arrowStyles })] }) })) : null] }));
102
+ }, children: content }) })), calculatedOpen ? (_jsx(Portal, { targetDOMNode: targetElement, children: _jsxs("div", { ref: mergeRefs(setTooltipReference, tooltipRef), className: cx(classes.tooltip, 'mfui-Tooltip__tooltip', contentProps?.className), role: "tooltip", id: tooltipId, "aria-hidden": hideFromScreenReader ? true : undefined, style: { maxWidth, ...tooltipStyles }, ...tooltipAttributes, children: [typeof content === 'string' ? _jsx(Typography, { variant: "helpMessage", children: content }) : content, _jsx(ArrowIcon, { ref: arrowRef, "aria-hidden": true, placement: calculatedPlacement, className: cx(classes.arrow, 'mfui-Tooltip__arrow'), style: arrowStyles })] }) })) : null] }));
94
103
  });
@@ -34,4 +34,5 @@ export declare function useTooltipDisplayController({ trigger, wrapperProps, too
34
34
  onMouseLeave: () => void;
35
35
  };
36
36
  closeImmediate: () => void;
37
+ closeWithManager: () => void;
37
38
  };
@@ -220,5 +220,6 @@ export function useTooltipDisplayController({ trigger, wrapperProps, tooltipOpen
220
220
  rootAttributes,
221
221
  tooltipAttributes,
222
222
  closeImmediate,
223
+ closeWithManager,
223
224
  };
224
225
  }
@@ -3,7 +3,7 @@ import type { ConditionalValue } from '../types/index';
3
3
  import type { DistributiveOmit, Pretty } from '../types/system-types';
4
4
 
5
5
  interface FormFooterSlotRecipeVariant {
6
- position: "stacking" | "fixed" | "sticky"
6
+ position: "stacking" | "sticky"
7
7
  sectionPosition: "center" | "fill"
8
8
  }
9
9
 
@@ -38,7 +38,6 @@ export const formFooterSlotRecipe = /* @__PURE__ */ Object.assign(formFooterSlot
38
38
  variantMap: {
39
39
  "position": [
40
40
  "stacking",
41
- "fixed",
42
41
  "sticky"
43
42
  ],
44
43
  "sectionPosition": [
@@ -70,6 +70,7 @@ export * from './status-label-slot-recipe';
70
70
  export * from './month-cell-slot-recipe';
71
71
  export * from './month-grid-slot-recipe';
72
72
  export * from './month-picker-panel-slot-recipe';
73
+ export * from './time-picker-slot-recipe';
73
74
  export * from './skeleton-slot-recipe';
74
75
  export * from './checkbox-group-slot-recipe';
75
76
  export * from './multiple-filter-select-box-slot-recipe';
@@ -69,6 +69,7 @@ export * from './status-label-slot-recipe.js';
69
69
  export * from './month-cell-slot-recipe.js';
70
70
  export * from './month-grid-slot-recipe.js';
71
71
  export * from './month-picker-panel-slot-recipe.js';
72
+ export * from './time-picker-slot-recipe.js';
72
73
  export * from './skeleton-slot-recipe.js';
73
74
  export * from './checkbox-group-slot-recipe.js';
74
75
  export * from './multiple-filter-select-box-slot-recipe.js';
@@ -0,0 +1,44 @@
1
+ /* eslint-disable */
2
+ import type { ConditionalValue } from '../types/index';
3
+ import type { DistributiveOmit, Pretty } from '../types/system-types';
4
+
5
+ interface TimePickerSlotRecipeVariant {
6
+ /**
7
+ * @default "medium"
8
+ */
9
+ size: "small" | "medium" | "large"
10
+ /**
11
+ * @default false
12
+ */
13
+ disabled: boolean
14
+ /**
15
+ * @default false
16
+ */
17
+ invalid: boolean
18
+ }
19
+
20
+ type TimePickerSlotRecipeVariantMap = {
21
+ [key in keyof TimePickerSlotRecipeVariant]: Array<TimePickerSlotRecipeVariant[key]>
22
+ }
23
+
24
+ type TimePickerSlotRecipeSlot = "root" | "input" | "clearButton" | "pickerButton"
25
+
26
+ export type TimePickerSlotRecipeVariantProps = {
27
+ [key in keyof TimePickerSlotRecipeVariant]?: ConditionalValue<TimePickerSlotRecipeVariant[key]> | undefined
28
+ }
29
+
30
+ export interface TimePickerSlotRecipeRecipe {
31
+ __slot: TimePickerSlotRecipeSlot
32
+ __type: TimePickerSlotRecipeVariantProps
33
+ (props?: TimePickerSlotRecipeVariantProps): Pretty<Record<TimePickerSlotRecipeSlot, string>>
34
+ raw: (props?: TimePickerSlotRecipeVariantProps) => TimePickerSlotRecipeVariantProps
35
+ variantMap: TimePickerSlotRecipeVariantMap
36
+ variantKeys: Array<keyof TimePickerSlotRecipeVariant>
37
+ splitVariantProps<Props extends TimePickerSlotRecipeVariantProps>(props: Props): [TimePickerSlotRecipeVariantProps, Pretty<DistributiveOmit<Props, keyof TimePickerSlotRecipeVariantProps>>]
38
+ getVariantProps: (props?: TimePickerSlotRecipeVariantProps) => TimePickerSlotRecipeVariantProps
39
+ }
40
+
41
+ /**
42
+ * Slot class for the TimePicker component (native <input type="time"> + custom panel).
43
+ */
44
+ export declare const timePickerSlotRecipe: TimePickerSlotRecipeRecipe
@@ -0,0 +1,62 @@
1
+ import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.js';
2
+ import { createRecipe } from './create-recipe.js';
3
+ const timePickerSlotRecipeDefaultVariants = {
4
+ "size": "medium",
5
+ "disabled": false,
6
+ "invalid": false
7
+ };
8
+ const timePickerSlotRecipeCompoundVariants = [];
9
+ const timePickerSlotRecipeSlotNames = [
10
+ [
11
+ "root",
12
+ "TimePicker__root"
13
+ ],
14
+ [
15
+ "input",
16
+ "TimePicker__input"
17
+ ],
18
+ [
19
+ "clearButton",
20
+ "TimePicker__clearButton"
21
+ ],
22
+ [
23
+ "pickerButton",
24
+ "TimePicker__pickerButton"
25
+ ]
26
+ ];
27
+ const timePickerSlotRecipeSlotFns = /* @__PURE__ */ timePickerSlotRecipeSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, timePickerSlotRecipeDefaultVariants, getSlotCompoundVariant(timePickerSlotRecipeCompoundVariants, slotName))]);
28
+ const timePickerSlotRecipeFn = memo((props = {}) => {
29
+ return Object.fromEntries(timePickerSlotRecipeSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
30
+ });
31
+ const timePickerSlotRecipeVariantKeys = [
32
+ "size",
33
+ "disabled",
34
+ "invalid"
35
+ ];
36
+ const getVariantProps = (variants) => ({ ...timePickerSlotRecipeDefaultVariants, ...compact(variants) });
37
+ export const timePickerSlotRecipe = /* @__PURE__ */ Object.assign(timePickerSlotRecipeFn, {
38
+ __recipe__: false,
39
+ __name__: 'timePickerSlotRecipe',
40
+ raw: (props) => props,
41
+ classNameMap: {},
42
+ variantKeys: timePickerSlotRecipeVariantKeys,
43
+ variantMap: {
44
+ "size": [
45
+ "small",
46
+ "medium",
47
+ "large"
48
+ ],
49
+ "disabled": [
50
+ "true",
51
+ "false"
52
+ ],
53
+ "invalid": [
54
+ "true",
55
+ "false"
56
+ ]
57
+ },
58
+ splitVariantProps(props) {
59
+ return splitProps(props, timePickerSlotRecipeVariantKeys);
60
+ },
61
+ getVariantProps
62
+ });