@mezzanine-ui/react 1.0.0-beta.6 → 1.0.0-beta.7

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 (142) hide show
  1. package/Accordion/Accordion.d.ts +23 -1
  2. package/Accordion/Accordion.js +59 -11
  3. package/Accordion/AccordionActions.d.ts +13 -0
  4. package/Accordion/AccordionActions.js +24 -0
  5. package/Accordion/AccordionContent.d.ts +9 -0
  6. package/Accordion/{AccordionDetails.js → AccordionContent.js} +4 -6
  7. package/Accordion/AccordionControlContext.d.ts +2 -2
  8. package/Accordion/AccordionGroup.d.ts +10 -0
  9. package/Accordion/AccordionGroup.js +26 -0
  10. package/Accordion/AccordionTitle.d.ts +14 -0
  11. package/Accordion/AccordionTitle.js +56 -0
  12. package/Accordion/index.d.ts +8 -4
  13. package/Accordion/index.js +4 -2
  14. package/AutoComplete/AutoComplete.d.ts +20 -6
  15. package/AutoComplete/AutoComplete.js +118 -30
  16. package/Backdrop/Backdrop.js +15 -19
  17. package/Calendar/CalendarDays.js +1 -1
  18. package/Card/BaseCard.d.ts +11 -0
  19. package/Card/BaseCard.js +48 -0
  20. package/Card/BaseCardSkeleton.d.ts +14 -0
  21. package/Card/BaseCardSkeleton.js +18 -0
  22. package/Card/CardGroup.d.ts +47 -0
  23. package/Card/CardGroup.js +147 -0
  24. package/Card/FourThumbnailCard.d.ts +14 -0
  25. package/Card/FourThumbnailCard.js +73 -0
  26. package/Card/FourThumbnailCardSkeleton.d.ts +14 -0
  27. package/Card/FourThumbnailCardSkeleton.js +20 -0
  28. package/Card/QuickActionCard.d.ts +12 -0
  29. package/Card/QuickActionCard.js +23 -0
  30. package/Card/QuickActionCardSkeleton.d.ts +14 -0
  31. package/Card/QuickActionCardSkeleton.js +18 -0
  32. package/Card/SingleThumbnailCard.d.ts +13 -0
  33. package/Card/SingleThumbnailCard.js +44 -0
  34. package/Card/SingleThumbnailCardSkeleton.d.ts +19 -0
  35. package/Card/SingleThumbnailCardSkeleton.js +18 -0
  36. package/Card/Thumbnail.d.ts +12 -0
  37. package/Card/Thumbnail.js +18 -0
  38. package/Card/ThumbnailCardInfo.d.ts +34 -0
  39. package/Card/ThumbnailCardInfo.js +43 -0
  40. package/Card/index.d.ts +43 -4
  41. package/Card/index.js +19 -2
  42. package/Card/typings.d.ts +442 -0
  43. package/Checkbox/Checkbox.d.ts +8 -0
  44. package/Checkbox/Checkbox.js +3 -2
  45. package/Checkbox/CheckboxGroup.js +1 -1
  46. package/ContentHeader/ContentHeader.d.ts +22 -70
  47. package/ContentHeader/ContentHeader.js +1 -1
  48. package/ContentHeader/ContentHeaderResponsive.d.ts +9 -0
  49. package/ContentHeader/ContentHeaderResponsive.js +7 -0
  50. package/ContentHeader/utils.d.ts +3 -3
  51. package/ContentHeader/utils.js +66 -20
  52. package/Cropper/Cropper.d.ts +66 -0
  53. package/Cropper/Cropper.js +115 -0
  54. package/Cropper/CropperElement.d.ts +10 -0
  55. package/Cropper/CropperElement.js +892 -0
  56. package/Cropper/index.d.ts +18 -0
  57. package/Cropper/index.js +8 -0
  58. package/Cropper/tools.d.ts +90 -0
  59. package/Cropper/tools.js +143 -0
  60. package/Cropper/typings.d.ts +69 -0
  61. package/Cropper/utils/cropper-calculations.d.ts +39 -0
  62. package/Cropper/utils/cropper-calculations.js +95 -0
  63. package/DateTimePicker/DateTimePicker.d.ts +1 -1
  64. package/DateTimePicker/DateTimePicker.js +14 -1
  65. package/Dropdown/Dropdown.d.ts +7 -1
  66. package/Dropdown/Dropdown.js +31 -14
  67. package/Dropdown/DropdownItem.d.ts +7 -1
  68. package/Dropdown/DropdownItem.js +36 -6
  69. package/Dropdown/DropdownItemCard.js +2 -1
  70. package/FloatingButton/FloatingButton.d.ts +21 -0
  71. package/FloatingButton/FloatingButton.js +18 -0
  72. package/FloatingButton/index.d.ts +2 -0
  73. package/FloatingButton/index.js +1 -0
  74. package/Form/FormField.d.ts +21 -10
  75. package/Form/FormField.js +12 -4
  76. package/Input/Input.js +9 -2
  77. package/Message/Message.js +1 -1
  78. package/MultipleDatePicker/MultipleDatePicker.js +2 -2
  79. package/Navigation/NavigationHeader.js +1 -1
  80. package/Picker/FormattedInput.d.ts +1 -1
  81. package/Picker/FormattedInput.js +2 -1
  82. package/Picker/PickerTriggerWithSeparator.d.ts +10 -0
  83. package/Picker/PickerTriggerWithSeparator.js +2 -2
  84. package/Picker/useDateInputFormatter.d.ts +6 -0
  85. package/Picker/useDateInputFormatter.js +4 -1
  86. package/Select/Select.d.ts +2 -8
  87. package/Select/Select.js +12 -33
  88. package/Select/SelectTrigger.js +21 -7
  89. package/Select/index.d.ts +0 -4
  90. package/Select/index.js +0 -2
  91. package/Select/typings.d.ts +0 -4
  92. package/Select/useSelectTriggerTags.d.ts +1 -1
  93. package/Select/useSelectTriggerTags.js +9 -6
  94. package/Separator/Separator.d.ts +14 -0
  95. package/Separator/Separator.js +17 -0
  96. package/Separator/index.d.ts +2 -0
  97. package/Separator/index.js +1 -0
  98. package/Table/utils/useTableRowSelection.js +6 -0
  99. package/Tag/TagGroup.d.ts +4 -2
  100. package/Tag/TagGroup.js +7 -4
  101. package/TextField/TextField.d.ts +1 -1
  102. package/TextField/TextField.js +63 -9
  103. package/TimePanel/TimePanelColumn.js +19 -12
  104. package/index.d.ts +27 -28
  105. package/index.js +23 -25
  106. package/package.json +4 -4
  107. package/Accordion/AccordionDetails.d.ts +0 -9
  108. package/Accordion/AccordionSummary.d.ts +0 -18
  109. package/Accordion/AccordionSummary.js +0 -51
  110. package/Alert/Alert.d.ts +0 -20
  111. package/Alert/Alert.js +0 -18
  112. package/Alert/index.d.ts +0 -3
  113. package/Alert/index.js +0 -1
  114. package/Card/Card.d.ts +0 -51
  115. package/Card/Card.js +0 -20
  116. package/Card/CardActions.d.ts +0 -34
  117. package/Card/CardActions.js +0 -15
  118. package/ConfirmActions/ConfirmActions.d.ts +0 -46
  119. package/ConfirmActions/ConfirmActions.js +0 -15
  120. package/ConfirmActions/index.d.ts +0 -2
  121. package/ConfirmActions/index.js +0 -1
  122. package/Select/Option.d.ts +0 -18
  123. package/Select/Option.js +0 -45
  124. package/Select/TreeSelect.d.ts +0 -72
  125. package/Select/TreeSelect.js +0 -205
  126. package/Tree/Tree.d.ts +0 -70
  127. package/Tree/Tree.js +0 -139
  128. package/Tree/TreeNode.d.ts +0 -40
  129. package/Tree/TreeNode.js +0 -50
  130. package/Tree/TreeNodeList.d.ts +0 -24
  131. package/Tree/TreeNodeList.js +0 -28
  132. package/Tree/getTreeNodeEntities.d.ts +0 -11
  133. package/Tree/getTreeNodeEntities.js +0 -92
  134. package/Tree/index.d.ts +0 -13
  135. package/Tree/index.js +0 -7
  136. package/Tree/toggleValue.d.ts +0 -4
  137. package/Tree/toggleValue.js +0 -19
  138. package/Tree/traverseTree.d.ts +0 -2
  139. package/Tree/traverseTree.js +0 -11
  140. package/Tree/typings.d.ts +0 -16
  141. package/Tree/useTreeExpandedValue.d.ts +0 -14
  142. package/Tree/useTreeExpandedValue.js +0 -33
@@ -7,10 +7,6 @@ export interface SelectValue<T = string> {
7
7
  id: T;
8
8
  name: string;
9
9
  }
10
- export interface TreeSelectOption<T = string> extends SelectValue<T> {
11
- dynamicChildrenFetching?: boolean;
12
- siblings?: TreeSelectOption<T>[];
13
- }
14
10
  export interface SelectControl<T = string> {
15
11
  value: SelectValue<T>[] | SelectValue<T> | null;
16
12
  onChange: (v: SelectValue<T> | null) => SelectValue<T>[] | SelectValue<T> | null;
@@ -1,5 +1,5 @@
1
- import { JSX, RefObject } from 'react';
2
1
  import { TagSize } from '@mezzanine-ui/core/tag';
2
+ import { JSX, RefObject } from 'react';
3
3
  import { SelectValue } from './typings';
4
4
  export interface UseSelectTriggerTagsProps {
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState, useRef, useCallback, useLayoutEffect, useEffect } from 'react';
3
2
  import { selectClasses } from '@mezzanine-ui/core/select';
3
+ import { useState, useRef, useCallback, useLayoutEffect, useEffect } from 'react';
4
4
  import Tag from '../Tag/Tag.js';
5
5
 
6
6
  const fakeTagClassName = 'mzn-select-trigger__fake-tag';
@@ -16,22 +16,25 @@ function useSelectTriggerTags(props) {
16
16
  const { containerRef, tagsRef, value = [], size, enabled = false } = props;
17
17
  const [takeCount, setTakeCount] = useState(value.length);
18
18
  const fakeContainerRef = useRef(null);
19
+ const updateTakeCount = useCallback((nextCount) => {
20
+ setTakeCount((prevCount) => prevCount === nextCount ? prevCount : nextCount);
21
+ }, []);
19
22
  const measure = useCallback(() => {
20
23
  var _a, _b;
21
24
  if (!enabled) {
22
- setTakeCount(value.length);
25
+ updateTakeCount(value.length);
23
26
  return;
24
27
  }
25
28
  const container = (_a = containerRef.current) !== null && _a !== void 0 ? _a : tagsRef.current;
26
29
  const fakeContainer = fakeContainerRef.current;
27
30
  if (!container || !fakeContainer) {
28
- setTakeCount(value.length);
31
+ // Keep current takeCount when refs are temporarily unavailable to avoid flicker.
29
32
  return;
30
33
  }
31
34
  const fakeTags = Array.from(fakeContainer.getElementsByClassName(fakeTagClassName));
32
35
  const fakeEllipsis = fakeContainer.getElementsByClassName(fakeEllipsisClassName)[0];
33
36
  if (!fakeTags.length) {
34
- setTakeCount(0);
37
+ // Keep current takeCount until fake tags are ready in DOM.
35
38
  return;
36
39
  }
37
40
  const computedStyleTarget = (_b = tagsRef.current) !== null && _b !== void 0 ? _b : container;
@@ -56,8 +59,8 @@ function useSelectTriggerTags(props) {
56
59
  consumedWidth += tagWidth;
57
60
  nextCount = i + 1;
58
61
  }
59
- setTakeCount(nextCount);
60
- }, [containerRef, enabled, tagsRef, value.length]);
62
+ updateTakeCount(nextCount);
63
+ }, [containerRef, enabled, tagsRef, updateTakeCount, value.length]);
61
64
  useLayoutEffect(() => {
62
65
  measure();
63
66
  }, [value, size, enabled, measure]);
@@ -0,0 +1,14 @@
1
+ import { SeparatorOrientation } from '@mezzanine-ui/core/separator';
2
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
3
+ export interface SeparatorProps extends NativeElementPropsWithoutKeyAndRef<'hr'> {
4
+ /**
5
+ * The orientation of the separator.
6
+ * @default 'horizontal'
7
+ */
8
+ orientation?: SeparatorOrientation;
9
+ }
10
+ /**
11
+ * The react component for `mezzanine` separator.
12
+ */
13
+ declare const Separator: import("react").ForwardRefExoticComponent<SeparatorProps & import("react").RefAttributes<HTMLHRElement>>;
14
+ export default Separator;
@@ -0,0 +1,17 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { separatorClasses } from '@mezzanine-ui/core/separator';
3
+ import { forwardRef } from 'react';
4
+ import cx from 'clsx';
5
+
6
+ /**
7
+ * The react component for `mezzanine` separator.
8
+ */
9
+ const Separator = forwardRef(function Separator(props, ref) {
10
+ const { className, orientation = 'horizontal', ...rest } = props;
11
+ return (jsx("hr", { ...rest, "aria-orientation": orientation === 'vertical' ? 'vertical' : undefined, ref: ref, className: cx(separatorClasses.host, {
12
+ [separatorClasses.horizontal]: orientation === 'horizontal',
13
+ [separatorClasses.vertical]: orientation === 'vertical',
14
+ }, className) }));
15
+ });
16
+
17
+ export { Separator as default };
@@ -0,0 +1,2 @@
1
+ export { default } from './Separator';
2
+ export type { SeparatorProps } from './Separator';
@@ -0,0 +1 @@
1
+ export { default } from './Separator.js';
@@ -20,6 +20,12 @@ function useTableRowSelection(props) {
20
20
  ? subData.map((subRow) => getRowKey(subRow))
21
21
  : undefined;
22
22
  }
23
+ if (!selectedRow) {
24
+ // trigger select all or deselect all, need to find subKeys for all selected rows
25
+ return (subData === null || subData === void 0 ? void 0 : subData.length)
26
+ ? subData.map((subRow) => getRowKey(subRow))
27
+ : undefined;
28
+ }
23
29
  return (_a = prev.find((item) => item.key === pk)) === null || _a === void 0 ? void 0 : _a.subKeys;
24
30
  })();
25
31
  return {
package/Tag/TagGroup.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  import { ReactElement } from 'react';
2
- import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
3
- import Tag, { TagProps } from '../Tag';
4
2
  import OverflowCounterTag, { OverflowCounterTagProps } from '../OverflowTooltip/OverflowCounterTag';
3
+ import Tag, { TagProps } from '../Tag';
4
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
5
5
  import { TransitionImplementationChildProps } from '../Transition';
6
6
  type TagElement = ReactElement<TagProps & TransitionImplementationChildProps, typeof Tag>;
7
7
  type OverflowCounterTagElement = ReactElement<OverflowCounterTagProps & TransitionImplementationChildProps, typeof OverflowCounterTag>;
8
8
  type TagGroupChild = TagElement | OverflowCounterTagElement;
9
9
  export type TagGroupProps = Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'children'> & {
10
10
  children: TagGroupChild | TagGroupChild[];
11
+ transition?: 'fade' | 'none';
11
12
  };
12
13
  declare const TagGroup: import("react").ForwardRefExoticComponent<Omit<NativeElementPropsWithoutKeyAndRef<"div">, "children"> & {
13
14
  children: TagGroupChild | TagGroupChild[];
15
+ transition?: "fade" | "none";
14
16
  } & import("react").RefAttributes<HTMLDivElement>>;
15
17
  export default TagGroup;
package/Tag/TagGroup.js CHANGED
@@ -2,8 +2,8 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef, Children, isValidElement, createElement } from 'react';
3
3
  import OverflowCounterTag from '../OverflowTooltip/OverflowCounterTag.js';
4
4
  import { tagClasses } from '@mezzanine-ui/core/tag';
5
- import { TransitionGroup } from 'react-transition-group';
6
5
  import { MOTION_EASING, MOTION_DURATION } from '@mezzanine-ui/system/motion';
6
+ import { TransitionGroup } from 'react-transition-group';
7
7
  import Fade from '../Transition/Fade.js';
8
8
  import Tag from './Tag.js';
9
9
  import cx from 'clsx';
@@ -20,7 +20,7 @@ const fadeProps = {
20
20
  exit: MOTION_EASING.standard,
21
21
  },
22
22
  };
23
- const TagGroup = forwardRef(function TagGroup({ className, children, ...rest }, ref) {
23
+ const TagGroup = forwardRef(function TagGroup({ className, children, transition = 'none', ...rest }, ref) {
24
24
  const hasInvalidChild = Children.toArray(children).some((child) => {
25
25
  if (!isTagElement(child) && !isOverflowCounterElement(child)) {
26
26
  console.error('<TagGroup> only accepts <Tag> or <OverflowCounterTag>');
@@ -31,11 +31,14 @@ const TagGroup = forwardRef(function TagGroup({ className, children, ...rest },
31
31
  if (hasInvalidChild) {
32
32
  return null;
33
33
  }
34
- return (jsx("div", { ...rest, ref: ref, className: cx(tagClasses.group, className), children: jsx(TransitionGroup, { component: null, children: Children.map(children, (child, index) => {
34
+ return (jsx("div", { ...rest, ref: ref, className: cx(tagClasses.group, className), children: transition === 'fade' ? (jsx(TransitionGroup, { component: null, children: Children.map(children, (child, index) => {
35
35
  var _a;
36
36
  return (createElement(Fade, { ...fadeProps, key: (_a = child.key) !== null && _a !== void 0 ? _a : index },
37
37
  jsx("span", { children: child })));
38
- }) }) }));
38
+ }) })) : (Children.map(children, (child, index) => {
39
+ var _a;
40
+ return (jsx("span", { children: child }, (_a = child.key) !== null && _a !== void 0 ? _a : index));
41
+ })) }));
39
42
  });
40
43
 
41
44
  export { TagGroup as default };
@@ -1,5 +1,5 @@
1
- import { MouseEventHandler, ReactNode } from 'react';
2
1
  import { TextFieldSize } from '@mezzanine-ui/core/text-field';
2
+ import { MouseEventHandler, ReactNode } from 'react';
3
3
  import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
4
4
  /**
5
5
  * Padding info provided to children function
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { forwardRef, useState, useRef, useEffect } from 'react';
4
3
  import { textFieldClasses } from '@mezzanine-ui/core/text-field';
5
- import { useTextFieldControl } from './useTextFieldControl.js';
4
+ import { forwardRef, useState, useRef, useEffect } from 'react';
6
5
  import ClearActions from '../ClearActions/ClearActions.js';
7
6
  import { useComposeRefs } from '../hooks/useComposeRefs.js';
7
+ import { useTextFieldControl } from './useTextFieldControl.js';
8
8
  import cx from 'clsx';
9
9
 
10
10
  /**
@@ -13,7 +13,11 @@ import cx from 'clsx';
13
13
  const TextField = forwardRef(function TextField(props, ref) {
14
14
  const { active = false, children, className, clearable = false, disabled, error = false, fullWidth = true, onClear, onClick: onClickProps, onKeyDown: onKeyDownProps, prefix, readonly, role: roleProp, size = 'main', suffix, typing: typingProp, warning, ...rest } = props;
15
15
  const [isTyping, setIsTyping] = useState(false);
16
+ const [isHovered, setIsHovered] = useState(false);
17
+ const [isFocused, setIsFocused] = useState(false);
18
+ const [hasValue, setHasValue] = useState(false);
16
19
  const containerRef = useRef(null);
20
+ const checkValueRef = useRef(null);
17
21
  const hostRef = useComposeRefs([ref, containerRef]);
18
22
  const typing = disabled || readonly
19
23
  ? false
@@ -21,27 +25,67 @@ const TextField = forwardRef(function TextField(props, ref) {
21
25
  ? typingProp
22
26
  : isTyping;
23
27
  useEffect(() => {
24
- if (typingProp !== undefined || disabled || readonly)
25
- return;
26
28
  const container = containerRef.current;
27
29
  if (!container)
28
30
  return;
29
31
  const input = container.querySelector('input, textarea');
30
32
  if (!input)
31
33
  return;
34
+ const checkValue = () => {
35
+ // 檢查值是否為空(包括空字符串和只有空白字符)
36
+ const value = (input.value || '').trim();
37
+ setHasValue(value.length > 0);
38
+ };
39
+ // 保存 checkValue 函數到 ref,以便在 onClear 後可以立即調用
40
+ checkValueRef.current = checkValue;
32
41
  const handleInput = () => {
33
42
  setIsTyping(true);
43
+ checkValue();
44
+ };
45
+ const handleFocus = () => {
46
+ setIsFocused(true);
47
+ checkValue();
34
48
  };
35
49
  const handleBlur = () => {
36
50
  setIsTyping(false);
51
+ setIsFocused(false);
52
+ checkValue();
53
+ };
54
+ const handleMouseEnter = () => {
55
+ checkValue(); // 在 hover 時也檢查值,確保狀態正確
56
+ setIsHovered(true);
57
+ };
58
+ const handleMouseLeave = () => {
59
+ setIsHovered(false);
37
60
  };
38
- input.addEventListener('input', handleInput, false);
39
- input.addEventListener('mousedown', handleInput, false);
61
+ // 初始化檢查值
62
+ checkValue();
63
+ // 監聽輸入框事件(用於 typing 狀態)
64
+ if (typingProp === undefined && !disabled && !readonly) {
65
+ input.addEventListener('input', handleInput, false);
66
+ input.addEventListener('mousedown', handleInput, false);
67
+ }
68
+ // 監聽 focus/blur 事件
69
+ input.addEventListener('focus', handleFocus, false);
40
70
  input.addEventListener('blur', handleBlur, false);
71
+ // 監聽 hover 事件(在容器上)
72
+ container.addEventListener('mouseenter', handleMouseEnter, false);
73
+ container.addEventListener('mouseleave', handleMouseLeave, false);
74
+ // 監聽值變化(適用於受控組件)
75
+ input.addEventListener('input', checkValue, false);
76
+ input.addEventListener('change', checkValue, false);
41
77
  return () => {
42
- input.removeEventListener('input', handleInput, false);
43
- input.removeEventListener('mousedown', handleInput, false);
78
+ if (typingProp === undefined && !disabled && !readonly) {
79
+ input.removeEventListener('input', handleInput, false);
80
+ input.removeEventListener('mousedown', handleInput, false);
81
+ }
82
+ input.removeEventListener('focus', handleFocus, false);
44
83
  input.removeEventListener('blur', handleBlur, false);
84
+ container.removeEventListener('mouseenter', handleMouseEnter, false);
85
+ container.removeEventListener('mouseleave', handleMouseLeave, false);
86
+ input.removeEventListener('input', checkValue, false);
87
+ input.removeEventListener('change', checkValue, false);
88
+ checkValueRef.current = null;
45
89
  };
46
90
  }, [typingProp, disabled, readonly]);
47
91
  const { role, onClick, onKeyDown } = useTextFieldControl({
@@ -49,6 +93,9 @@ const TextField = forwardRef(function TextField(props, ref) {
49
93
  onKeyDown: onKeyDownProps,
50
94
  });
51
95
  const isChildrenFunction = typeof children === 'function';
96
+ const shouldShowClearable = clearable &&
97
+ hasValue &&
98
+ (isHovered || typing || isFocused);
52
99
  const paddingInfo = {
53
100
  paddingClassName: cx(textFieldClasses.inputPadding, size === 'main' ? textFieldClasses.inputPaddingMain : textFieldClasses.inputPaddingSub),
54
101
  };
@@ -71,9 +118,16 @@ const TextField = forwardRef(function TextField(props, ref) {
71
118
  [textFieldClasses.typing]: typing,
72
119
  [textFieldClasses.active]: active,
73
120
  [textFieldClasses.warning]: warning,
74
- }, className), children: [prefix && jsx("div", { className: textFieldClasses.prefix, children: prefix }), renderedChildren, clearable && (jsx(ClearActions, { type: "clearable", className: textFieldClasses.clearIcon, onClick: (event) => {
121
+ }, className), children: [prefix && jsx("div", { className: textFieldClasses.prefix, children: prefix }), renderedChildren, clearable && (jsx(ClearActions, { type: "clearable", className: textFieldClasses.clearIcon, style: {
122
+ opacity: shouldShowClearable ? 1 : 0,
123
+ pointerEvents: shouldShowClearable ? 'auto' : 'none',
124
+ }, onClick: (event) => {
75
125
  if (!disabled && !readonly && onClear) {
76
126
  onClear(event);
127
+ requestAnimationFrame(() => {
128
+ var _a;
129
+ (_a = checkValueRef.current) === null || _a === void 0 ? void 0 : _a.call(checkValueRef);
130
+ });
77
131
  }
78
132
  }, onMouseDown: (event) => event.preventDefault(), tabIndex: -1 })), suffix && jsx("div", { className: textFieldClasses.suffix, children: suffix })] }));
79
133
  });
@@ -1,4 +1,4 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { timePanelClasses } from '@mezzanine-ui/core/time-panel';
3
3
  import { forwardRef, useRef, useCallback, useEffect } from 'react';
4
4
  import { getNumericCSSVariablePixelValue } from '../utils/get-css-variable-value.js';
@@ -16,22 +16,29 @@ const TimePanelColumn = forwardRef(function TimePanelColumn(props, ref) {
16
16
  onChange === null || onChange === void 0 ? void 0 : onChange(unit);
17
17
  }, [onChange]);
18
18
  const preferSmoothScrollRef = useRef(true);
19
- useEffect(() => {
19
+ const onScrollToTarget = useCallback((element) => {
20
20
  const activeIndex = units.findIndex(({ value }) => value === activeUnit);
21
- if (viewportRef.current) {
22
- viewportRef.current.scrollTo({
23
- behavior: preferSmoothScrollRef.current ? 'auto' : 'smooth',
24
- top: activeIndex * cellHeight, // (activeIndex - 3) * cellHeight, (center)
25
- });
26
- }
21
+ element.scrollTo({
22
+ behavior: preferSmoothScrollRef.current ? 'auto' : 'smooth',
23
+ top: activeIndex * cellHeight,
24
+ });
27
25
  preferSmoothScrollRef.current = false;
28
26
  }, [activeUnit, cellHeight, units]);
27
+ useEffect(() => {
28
+ if (viewportRef.current) {
29
+ onScrollToTarget(viewportRef.current);
30
+ }
31
+ }, [onScrollToTarget]);
29
32
  const handleViewportReady = useCallback((viewport) => {
30
33
  viewportRef.current = viewport;
31
- }, []);
32
- return (jsx("div", { ref: ref, className: timePanelClasses.column, children: jsx(Scrollbar, { maxHeight: cellHeight * 7, onViewportReady: handleViewportReady, children: units.map((unit) => (jsx("button", { type: "button", className: cx(timePanelClasses.button, timePanelClasses.columnButton, {
33
- [timePanelClasses.buttonActive]: unit.value === activeUnit,
34
- }), onClick: getChangeHandler(unit), children: unit.label }, unit.value))) }) }));
34
+ onScrollToTarget(viewport);
35
+ }, [onScrollToTarget]);
36
+ // Number of padding cells needed for centering (3 cells above and below the center position)
37
+ const paddingCellCount = 3;
38
+ const placeholders = Array.from({ length: paddingCellCount }, (_, i) => (jsx("div", { className: timePanelClasses.columnPlaceholder, style: { height: cellHeight }, "aria-hidden": true }, `placeholder-${i}`)));
39
+ return (jsx("div", { ref: ref, className: timePanelClasses.column, children: jsxs(Scrollbar, { maxHeight: cellHeight * 7, onViewportReady: handleViewportReady, children: [placeholders, units.map((unit) => (jsx("button", { type: "button", className: cx(timePanelClasses.button, timePanelClasses.columnButton, {
40
+ [timePanelClasses.buttonActive]: unit.value === activeUnit,
41
+ }), onClick: getChangeHandler(unit), children: unit.label }, unit.value))), placeholders] }) }));
35
42
  });
36
43
 
37
44
  export { TimePanelColumn as default };
package/index.d.ts CHANGED
@@ -37,8 +37,12 @@ export * from './Form/useSwitchControlValue';
37
37
  */
38
38
  export { default as Button, ButtonGroup } from './Button';
39
39
  export type { ButtonComponent, ButtonGroupChild, ButtonGroupOrientation, ButtonGroupProps, ButtonProps, ButtonPropsBase, ButtonSize, ButtonVariant, } from './Button';
40
+ export { default as Cropper } from './Cropper';
41
+ export type { CropperComponent, CropperProps, CropperPropsBase, CropperSize, } from './Cropper';
40
42
  export { default as Icon } from './Icon';
41
43
  export type { IconColor, IconProps } from './Icon';
44
+ export { default as Separator } from './Separator';
45
+ export type { SeparatorProps } from './Separator';
42
46
  export { default as Typography } from './Typography';
43
47
  export type { TypographyAlign, TypographyColor, TypographyComponent, TypographyDisplay, TypographyProps, TypographySemanticType, } from './Typography';
44
48
  /**
@@ -57,20 +61,18 @@ export type { PageFooterProps } from './PageFooter';
57
61
  export { default as PageHeader } from './PageHeader';
58
62
  export type { PageHeaderProps } from './PageHeader';
59
63
  export { Step, default as Stepper, useStepper } from './Stepper';
60
- export type { StepperProps, StepProps } from './Stepper';
64
+ export type { StepProps, StepperProps } from './Stepper';
61
65
  export { default as Tab, TabItem } from './Tab';
62
66
  export type { TabItemProps, TabProps, TabsChild } from './Tab';
63
67
  /**
64
68
  * Data Display
65
69
  */
66
- export { default as Accordion, AccordionDetails, AccordionSummary, } from './Accordion';
67
- export type { AccordionDetailsProps, AccordionProps, AccordionSummaryProps, } from './Accordion';
70
+ export { default as Accordion, AccordionActions, AccordionContent, AccordionGroup, AccordionTitle, } from './Accordion';
71
+ export type { AccordionActionsProps, AccordionContentProps, AccordionGroupProps, AccordionProps, AccordionTitleProps, } from './Accordion';
68
72
  export { default as Badge, BadgeContainer } from './Badge';
69
73
  export type { BadgeProps } from './Badge';
70
- export { default as Section } from './Section';
71
- export type { SectionProps } from './Section';
72
- export { default as Card, CardActions } from './Card';
73
- export type { CardActionsProps, CardProps } from './Card';
74
+ export { BaseCardGeneric as BaseCard, BaseCardSkeleton, CardGroup, FourThumbnailCardGeneric as FourThumbnailCard, FourThumbnailCardSkeleton, QuickActionCardGeneric as QuickActionCard, QuickActionCardSkeleton, SingleThumbnailCardGeneric as SingleThumbnailCard, SingleThumbnailCardSkeleton, ThumbnailGeneric as Thumbnail, } from './Card';
75
+ export type { BaseCardActionProps, BaseCardActionVariant, BaseCardComponent, BaseCardComponentProps, BaseCardDefaultProps, BaseCardOverflowProps, BaseCardProps, BaseCardPropsCommon, BaseCardSkeletonProps, BaseCardToggleProps, BaseCardType, CardGroupLoadingType, CardGroupProps, FourThumbnailCardActionProps, FourThumbnailCardComponent, FourThumbnailCardComponentProps, FourThumbnailCardDefaultProps, FourThumbnailCardOverflowProps, FourThumbnailCardProps, FourThumbnailCardPropsCommon, FourThumbnailCardSkeletonProps, FourThumbnailCardType, QuickActionCardComponent, QuickActionCardComponentProps, QuickActionCardMode, QuickActionCardProps, QuickActionCardPropsCommon, QuickActionCardSkeletonProps, QuickActionCardWithIconProps, QuickActionCardWithTitleProps, SingleThumbnailCardActionProps, SingleThumbnailCardComponent, SingleThumbnailCardComponentProps, SingleThumbnailCardDefaultProps, SingleThumbnailCardOverflowProps, SingleThumbnailCardProps, SingleThumbnailCardPropsCommon, SingleThumbnailCardSkeletonProps, SingleThumbnailCardType, ThumbnailCardInfoProps, ThumbnailComponent, ThumbnailComponentProps, ThumbnailPropsBase, } from './Card';
74
76
  export { Description, DescriptionContent, DescriptionGroup, DescriptionTitle, } from './Description';
75
77
  export type { DescriptionContentProps, DescriptionGroupProps, DescriptionProps, DescriptionTitleProps, } from './Description';
76
78
  export { default as Empty } from './Empty';
@@ -79,13 +81,13 @@ export { OverflowCounterTag } from './OverflowTooltip';
79
81
  export type { OverflowCounterTagProps } from './OverflowTooltip';
80
82
  export { default as Pagination, PaginationItem, PaginationJumper, PaginationPageSize, usePagination, } from './Pagination';
81
83
  export type { PaginationItemProps, PaginationItemType, PaginationJumperProps, PaginationPageSizeProps, PaginationProps, } from './Pagination';
82
- export { getCellAlignClass, getRowKey, default as Table, TableContext, TableDataContext, TableSuperContext, useTableContext, useTableDataContext, useTableDataSource, useTableRowSelection, useTableSuperContext, type ColumnAlign, type FixedType, type HighlightMode, type SortOrder, type TableActionItem, type TableActions, type TableActionsBase, type TableActionsWithMinWidth, type TableBaseProps, type TableBulkActions, type TableBulkGeneralAction, type TableBulkOverflowAction, type TableCollectable, type TableColumn, type TableColumnBase, type TableColumnBaseWithMinWidthRequired, type TableColumnTitleMenu, type TableColumnWithDataIndex, type TableColumnWithDataIndexAndMinWidth, type TableColumnWithMinWidth, type TableColumnWithRender, type TableColumnWithRenderAndMinWidth, type TableContextValue, type TableDataContextValue, type TableDataSource, type TableDataSourceWithId, type TableDataSourceWithKey, type TableDraggable, type TableExpandable, type TableExpansionState, type TableNonVirtualizedProps, type TableProps, type TableRecord, type TableResizedColumnState, type TableRowSelection, type TableRowSelectionBase, type TableRowSelectionCheckbox, type TableRowSelectionRadio, type TableScroll, type TableSelectionMode, type TableSelectionState, type TableSize, type TableSortingState, type TableToggleable, type TableTransitionState, type TableVirtualizedProps, type UpdateDataSourceOptions, type UseTableDataSourceOptions, type TableDraggableOnlyProps, type TableNoDragOrPinProps, type TableNonResizableProps, type TablePinnableOnlyProps, type TableResizableProps, } from './Table';
84
+ export { default as Section } from './Section';
85
+ export type { SectionProps } from './Section';
86
+ export { default as Table, TableContext, TableDataContext, TableSuperContext, getCellAlignClass, getRowKey, useTableContext, useTableDataContext, useTableDataSource, useTableRowSelection, useTableSuperContext, type ColumnAlign, type FixedType, type HighlightMode, type SortOrder, type TableActionItem, type TableActions, type TableActionsBase, type TableActionsWithMinWidth, type TableBaseProps, type TableBulkActions, type TableBulkGeneralAction, type TableBulkOverflowAction, type TableCollectable, type TableColumn, type TableColumnBase, type TableColumnBaseWithMinWidthRequired, type TableColumnTitleMenu, type TableColumnWithDataIndex, type TableColumnWithDataIndexAndMinWidth, type TableColumnWithMinWidth, type TableColumnWithRender, type TableColumnWithRenderAndMinWidth, type TableContextValue, type TableDataContextValue, type TableDataSource, type TableDataSourceWithId, type TableDataSourceWithKey, type TableDraggable, type TableDraggableOnlyProps, type TableExpandable, type TableExpansionState, type TableNoDragOrPinProps, type TableNonResizableProps, type TableNonVirtualizedProps, type TablePinnableOnlyProps, type TableProps, type TableRecord, type TableResizableProps, type TableResizedColumnState, type TableRowSelection, type TableRowSelectionBase, type TableRowSelectionCheckbox, type TableRowSelectionRadio, type TableScroll, type TableSelectionMode, type TableSelectionState, type TableSize, type TableSortingState, type TableToggleable, type TableTransitionState, type TableVirtualizedProps, type UpdateDataSourceOptions, type UseTableDataSourceOptions, } from './Table';
83
87
  export { default as Tag, TagGroup } from './Tag';
84
88
  export type { TagGroupProps, TagProps, TagSize } from './Tag';
85
89
  export { default as Tooltip } from './Tooltip';
86
90
  export type { TooltipProps } from './Tooltip';
87
- export { getTreeNodeEntities, toggleValue, toggleValueWithStatusControl, traverseTree, default as Tree, TreeNode, TreeNodeList, uniqueArray, useTreeExpandedValue, } from './Tree';
88
- export type { GetTreeNodeEntitiesProps, TreeExpandControl, TreeNodeData, TreeNodeElementProps, TreeNodeEntities, TreeNodeEntity, TreeNodeListElementProps, TreeNodeListProps, TreeNodeProp, TreeNodeProps, TreeNodeRefs, TreeNodeRefsShape, TreeProps, UseTreeExpandedValueProps, } from './Tree';
89
91
  /**
90
92
  * Data Entry
91
93
  */
@@ -101,20 +103,20 @@ export { default as DateTimePicker } from './DateTimePicker';
101
103
  export type { DateTimePickerProps } from './DateTimePicker';
102
104
  export { DateTimeRangePicker } from './DateTimeRangePicker';
103
105
  export type { DateTimeRangePickerProps, DateTimeRangePickerValue, } from './DateTimeRangePicker';
104
- export { default as MultipleDatePicker, MultipleDatePickerTrigger, useMultipleDatePickerValue, } from './MultipleDatePicker';
105
- export type { MultipleDatePickerDateValue, MultipleDatePickerProps, MultipleDatePickerTriggerProps, UseMultipleDatePickerValueProps, UseMultipleDatePickerValueReturn, } from './MultipleDatePicker';
106
- export { FormControlContext, FormField, FormHintText, FormLabel } from './Form';
107
- export { FilterArea, FilterLine, Filter } from './FilterArea';
106
+ export { Filter, FilterArea, FilterLine } from './FilterArea';
108
107
  export type { FilterAreaProps, FilterLineProps, FilterProps, } from './FilterArea';
108
+ export { FormControlContext, FormField, FormHintText, FormLabel } from './Form';
109
109
  export type { FormControl, FormFieldProps, FormHintTextProps, FormLabelProps, } from './Form';
110
110
  export { default as Input } from './Input';
111
- export type { ActionInputProps, BaseInputProps, ClearableInput, InputBaseProps, InputProps, InputSize, InputStrength, NumberInput, NumberInputProps, PasswordInputProps, SearchInputProps, SelectInputProps, CurrencyInputProps, WithAffixInputProps, WithPasswordStrengthIndicator, } from './Input';
111
+ export type { ActionInputProps, BaseInputProps, ClearableInput, CurrencyInputProps, InputBaseProps, InputProps, InputSize, InputStrength, NumberInput, NumberInputProps, PasswordInputProps, SearchInputProps, SelectInputProps, WithAffixInputProps, WithPasswordStrengthIndicator, } from './Input';
112
+ export { default as MultipleDatePicker, MultipleDatePickerTrigger, useMultipleDatePickerValue, } from './MultipleDatePicker';
113
+ export type { MultipleDatePickerDateValue, MultipleDatePickerProps, MultipleDatePickerTriggerProps, UseMultipleDatePickerValueProps, UseMultipleDatePickerValueReturn, } from './MultipleDatePicker';
112
114
  export { PickerTrigger, RangePickerTrigger, usePickerDocumentEventClose, usePickerValue, useTabKeyClose, } from './Picker';
113
115
  export type { PickerTriggerProps, RangePickerTriggerProps, UsePickerDocumentEventCloseProps, UsePickerValueProps, } from './Picker';
114
116
  export { default as Radio, RadioGroup } from './Radio';
115
117
  export type { RadioGroupOrientation, RadioGroupProps, RadioProps, RadioSize, } from './Radio';
116
- export { Option, OptionGroup, default as Select, SelectControlContext, SelectTrigger, SelectTriggerTags, TreeSelect, } from './Select';
117
- export type { OptionGroupProps, OptionProps, SelectControl, SelectProps, SelectTriggerInputProps, SelectTriggerProps, SelectTriggerTagsProps, SelectValue, TreeSelectOption, TreeSelectProps, } from './Select';
118
+ export { OptionGroup, default as Select, SelectControlContext, SelectTrigger, SelectTriggerTags, } from './Select';
119
+ export type { OptionGroupProps, SelectControl, SelectProps, SelectTriggerInputProps, SelectTriggerProps, SelectTriggerTagsProps, SelectValue, } from './Select';
118
120
  export { default as Selection } from './Selection';
119
121
  export type { SelectionProps, SelectionPropsBase } from './Selection';
120
122
  export { default as Slider, useSlider } from './Slider';
@@ -125,20 +127,15 @@ export { default as TextField } from './TextField';
125
127
  export type { TextFieldAffixProps, TextFieldBaseProps, TextFieldInteractiveStateProps, TextFieldPaddingInfo, TextFieldProps, TextFieldSize, } from './TextField';
126
128
  export { default as TimePicker, TimePickerPanel } from './TimePicker';
127
129
  export type { TimePickerPanelProps, TimePickerProps } from './TimePicker';
128
- export { default as TimeRangePicker } from './TimeRangePicker';
130
+ export { default as TimeRangePicker, useTimeRangePickerValue, } from './TimeRangePicker';
129
131
  export type { TimeRangePickerProps, TimeRangePickerValue, UseTimeRangePickerValueProps, } from './TimeRangePicker';
130
- export { useTimeRangePickerValue } from './TimeRangePicker';
131
132
  export { default as Switch } from './Toggle';
132
133
  export type { ToggleProps as SwitchProps, ToggleSize as SwitchSize, } from './Toggle';
133
- export { Upload, Uploader, UploadItem, UploadPictureCard } from './Upload';
134
- export type { UploaderProps, UploadFile, UploadItemProps, UploadPictureCardProps, UploadProps, } from './Upload';
134
+ export { Upload, UploadItem, UploadPictureCard, Uploader } from './Upload';
135
+ export type { UploadFile, UploadItemProps, UploadPictureCardProps, UploadProps, UploaderProps, } from './Upload';
135
136
  /**
136
137
  * Feedback
137
138
  */
138
- export { default as Alert } from './Alert';
139
- export type { AlertProps, AlertSeverity } from './Alert';
140
- export { default as ConfirmActions } from './ConfirmActions';
141
- export type { ConfirmActionsProps } from './ConfirmActions';
142
139
  export { default as Message } from './Message';
143
140
  export type { MessageData, MessageSeverity, MessageType } from './Message';
144
141
  export { default as Modal, ModalBodyForVerification, ModalFooter, ModalHeader, useModalContainer, } from './Modal';
@@ -158,12 +155,14 @@ export type { ResultStateActions, ResultStateProps } from './ResultState';
158
155
  /**
159
156
  * Others
160
157
  */
158
+ export { default as AlertBanner } from './AlertBanner';
159
+ export type { AlertBannerProps } from './AlertBanner';
161
160
  export { default as Anchor, AnchorGroup } from './Anchor';
162
161
  export type { AnchorGroupProps, AnchorProps } from './Anchor';
163
162
  export { default as Backdrop } from './Backdrop';
164
163
  export type { BackdropProps } from './Backdrop';
165
- export { default as AlertBanner } from './AlertBanner';
166
- export type { AlertBannerProps } from './AlertBanner';
164
+ export { default as FloatingButton } from './FloatingButton';
165
+ export type { FloatingButtonProps } from './FloatingButton';
167
166
  /**
168
167
  * Utility
169
168
  */
@@ -195,4 +194,4 @@ export { default as DropdownItemCard } from './Dropdown/DropdownItemCard';
195
194
  export type { DropdownItemCardProps } from './Dropdown/DropdownItemCard';
196
195
  export { default as DropdownStatus } from './Dropdown/DropdownStatus';
197
196
  export type { DropdownStatusProps } from './Dropdown/DropdownStatus';
198
- export type { DropdownCheckPosition, DropdownInputPosition, DropdownItemLevel, DropdownItemSharedProps, DropdownItemValidate, DropdownMode, DropdownOption, DropdownOptionFlat, DropdownOptionGrouped, DropdownOptionsByType, DropdownOptionTree, DropdownStatus as DropdownStatusType, DropdownType, } from '@mezzanine-ui/core/dropdown';
197
+ export type { DropdownCheckPosition, DropdownInputPosition, DropdownItemLevel, DropdownItemSharedProps, DropdownItemValidate, DropdownMode, DropdownOption, DropdownOptionFlat, DropdownOptionGrouped, DropdownOptionTree, DropdownOptionsByType, DropdownStatus as DropdownStatusType, DropdownType, } from '@mezzanine-ui/core/dropdown';