@mezzanine-ui/react 1.0.0-rc.5 → 1.0.0-rc.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 (213) hide show
  1. package/Accordion/Accordion.d.ts +36 -0
  2. package/Accordion/Accordion.js +37 -1
  3. package/AlertBanner/AlertBanner.d.ts +30 -1
  4. package/AlertBanner/AlertBanner.js +56 -12
  5. package/AutoComplete/AutoComplete.d.ts +75 -11
  6. package/AutoComplete/AutoComplete.js +145 -25
  7. package/AutoComplete/AutoCompleteInside.d.ts +54 -0
  8. package/AutoComplete/AutoCompleteInside.js +17 -0
  9. package/AutoComplete/useAutoCompleteKeyboard.d.ts +2 -1
  10. package/AutoComplete/useAutoCompleteKeyboard.js +4 -1
  11. package/Backdrop/Backdrop.d.ts +33 -1
  12. package/Backdrop/Backdrop.js +33 -1
  13. package/Badge/Badge.d.ts +26 -1
  14. package/Badge/Badge.js +26 -1
  15. package/Badge/typings.d.ts +15 -0
  16. package/Breadcrumb/BreadcrumbDropdown.d.ts +1 -1
  17. package/Breadcrumb/BreadcrumbOverflowMenuDropdown.d.ts +1 -1
  18. package/Breadcrumb/typings.d.ts +1 -1
  19. package/Button/Button.d.ts +26 -1
  20. package/Button/Button.js +33 -5
  21. package/COMPONENTS.md +267 -0
  22. package/Calendar/useCalendarControls.d.ts +18 -0
  23. package/Calendar/useCalendarControls.js +18 -0
  24. package/Card/FourThumbnailCard.js +1 -1
  25. package/Card/SingleThumbnailCard.js +1 -1
  26. package/Checkbox/Checkbox.d.ts +30 -1
  27. package/Checkbox/Checkbox.js +54 -4
  28. package/Checkbox/CheckboxGroup.d.ts +39 -1
  29. package/Checkbox/CheckboxGroup.js +49 -3
  30. package/Cropper/Cropper.d.ts +2 -2
  31. package/Cropper/Cropper.js +2 -3
  32. package/Cropper/CropperElement.js +1 -1
  33. package/Cropper/utils/cropper-calculations.d.ts +1 -1
  34. package/Cropper/utils/cropper-calculations.js +16 -14
  35. package/DatePicker/DatePicker.d.ts +36 -2
  36. package/DatePicker/DatePicker.js +36 -2
  37. package/DateRangePicker/useDateRangePickerValue.d.ts +24 -0
  38. package/DateRangePicker/useDateRangePickerValue.js +24 -0
  39. package/Description/Description.d.ts +1 -1
  40. package/Description/Description.js +1 -1
  41. package/Description/DescriptionTitle.d.ts +6 -1
  42. package/Description/DescriptionTitle.js +2 -2
  43. package/Drawer/Drawer.d.ts +78 -33
  44. package/Drawer/Drawer.js +72 -34
  45. package/Dropdown/Dropdown.d.ts +63 -1
  46. package/Dropdown/Dropdown.js +203 -9
  47. package/Dropdown/DropdownItem.d.ts +26 -2
  48. package/Dropdown/DropdownItem.js +91 -43
  49. package/Dropdown/DropdownItemCard.d.ts +3 -2
  50. package/Dropdown/DropdownItemCard.js +8 -5
  51. package/Dropdown/DropdownStatus.d.ts +2 -2
  52. package/Dropdown/DropdownStatus.js +3 -2
  53. package/Dropdown/dropdownKeydownHandler.d.ts +6 -0
  54. package/Dropdown/dropdownKeydownHandler.js +14 -7
  55. package/Empty/icons/EmptyMainInitialDataIcon.js +1 -1
  56. package/Empty/icons/EmptyMainNotificationIcon.js +1 -1
  57. package/Empty/icons/EmptyMainResultIcon.js +1 -1
  58. package/Empty/icons/EmptyMainSystemIcon.js +1 -1
  59. package/FilterArea/Filter.d.ts +25 -2
  60. package/FilterArea/Filter.js +43 -2
  61. package/FilterArea/FilterArea.d.ts +43 -4
  62. package/FilterArea/FilterArea.js +39 -4
  63. package/FilterArea/FilterAreaContext.d.ts +6 -0
  64. package/FilterArea/FilterAreaContext.js +6 -0
  65. package/FilterArea/FilterLine.d.ts +19 -0
  66. package/FilterArea/FilterLine.js +19 -0
  67. package/FilterArea/index.d.ts +2 -2
  68. package/FilterArea/index.js +1 -1
  69. package/Form/FormField.d.ts +43 -2
  70. package/Form/FormField.js +40 -3
  71. package/Form/typings.d.ts +2 -0
  72. package/Form/useAutoCompleteValueControl.d.ts +20 -0
  73. package/Form/useAutoCompleteValueControl.js +20 -0
  74. package/Form/useCheckboxControlValue.d.ts +19 -0
  75. package/Form/useCheckboxControlValue.js +19 -0
  76. package/Form/useControlValueState.d.ts +16 -0
  77. package/Form/useControlValueState.js +16 -0
  78. package/Form/useCustomControlValue.d.ts +17 -0
  79. package/Form/useCustomControlValue.js +17 -0
  80. package/Form/useInputControlValue.d.ts +19 -0
  81. package/Form/useInputControlValue.js +19 -0
  82. package/Form/useInputWithClearControlValue.d.ts +20 -0
  83. package/Form/useInputWithClearControlValue.js +20 -0
  84. package/Form/useRadioControlValue.d.ts +19 -0
  85. package/Form/useRadioControlValue.js +19 -0
  86. package/Form/useSelectValueControl.d.ts +19 -0
  87. package/Form/useSelectValueControl.js +19 -0
  88. package/Form/useSwitchControlValue.d.ts +18 -0
  89. package/Form/useSwitchControlValue.js +18 -0
  90. package/Icon/Icon.d.ts +23 -1
  91. package/Icon/Icon.js +23 -1
  92. package/Input/Input.d.ts +31 -1
  93. package/Input/Input.js +31 -1
  94. package/Input/SpinnerButton/SpinnerButton.js +1 -1
  95. package/Message/Message.d.ts +56 -6
  96. package/Message/Message.js +59 -52
  97. package/Modal/Modal.d.ts +76 -4
  98. package/Modal/Modal.js +117 -6
  99. package/Modal/ModalBodyForVerification.js +3 -1
  100. package/Modal/ModalFooter.d.ts +21 -6
  101. package/Modal/ModalHeader.d.ts +50 -11
  102. package/Modal/ModalHeader.js +1 -1
  103. package/Modal/index.d.ts +1 -1
  104. package/Navigation/Navigation.js +20 -11
  105. package/Navigation/NavigationHeader.js +2 -1
  106. package/Navigation/NavigationIconButton.d.ts +8 -0
  107. package/Navigation/NavigationIconButton.js +2 -2
  108. package/Navigation/NavigationOption.js +6 -3
  109. package/Navigation/NavigationOverflowMenu.js +9 -6
  110. package/Navigation/NavigationUserMenu.js +3 -1
  111. package/Navigation/context.d.ts +1 -0
  112. package/NotificationCenter/NotificationCenter.d.ts +59 -9
  113. package/NotificationCenter/NotificationCenter.js +150 -54
  114. package/NotificationCenter/NotificationCenterDrawer.d.ts +56 -6
  115. package/NotificationCenter/NotificationCenterDrawer.js +6 -8
  116. package/NotificationCenter/index.d.ts +1 -1
  117. package/OverflowTooltip/OverflowTooltip.js +46 -5
  118. package/PageFooter/PageFooter.d.ts +1 -1
  119. package/PageFooter/PageFooter.js +8 -16
  120. package/Pagination/Pagination.d.ts +38 -1
  121. package/Pagination/Pagination.js +38 -1
  122. package/Pagination/PaginationPageSize.js +1 -1
  123. package/Pagination/usePagination.d.ts +20 -0
  124. package/Pagination/usePagination.js +20 -0
  125. package/Progress/Progress.d.ts +24 -1
  126. package/Progress/Progress.js +24 -1
  127. package/README.md +82 -0
  128. package/Radio/Radio.d.ts +35 -1
  129. package/Radio/Radio.js +50 -12
  130. package/Radio/RadioGroup.d.ts +2 -2
  131. package/Radio/RadioGroupContext.d.ts +3 -2
  132. package/Section/SectionGroup.d.ts +20 -0
  133. package/Section/SectionGroup.js +16 -0
  134. package/Section/index.d.ts +2 -0
  135. package/Section/index.js +1 -0
  136. package/Select/Select.d.ts +55 -1
  137. package/Select/Select.js +37 -2
  138. package/Select/typings.d.ts +9 -0
  139. package/{Selection/Selection.d.ts → SelectionCard/SelectionCard.d.ts} +23 -11
  140. package/{Selection/Selection.js → SelectionCard/SelectionCard.js} +14 -14
  141. package/SelectionCard/SelectionCardGroup.d.ts +28 -0
  142. package/SelectionCard/index.d.ts +12 -0
  143. package/SelectionCard/index.js +5 -0
  144. package/Separator/Separator.d.ts +19 -1
  145. package/Separator/Separator.js +19 -1
  146. package/Slider/Slider.d.ts +11 -0
  147. package/Slider/useSlider.d.ts +21 -0
  148. package/Spin/Spin.d.ts +14 -5
  149. package/Spin/Spin.js +6 -8
  150. package/Stepper/Stepper.d.ts +34 -1
  151. package/Stepper/Stepper.js +34 -1
  152. package/Stepper/useStepper.d.ts +18 -0
  153. package/Stepper/useStepper.js +18 -0
  154. package/Tab/Tab.d.ts +33 -1
  155. package/Tab/Tab.js +33 -1
  156. package/Table/Table.d.ts +51 -3
  157. package/Table/Table.js +52 -4
  158. package/Table/hooks/useTableDataSource.d.ts +4 -4
  159. package/Table/hooks/useTableDataSource.js +1 -1
  160. package/Tag/Tag.d.ts +27 -1
  161. package/Tag/Tag.js +27 -1
  162. package/Tag/typings.d.ts +28 -0
  163. package/Textarea/Textarea.d.ts +28 -1
  164. package/Textarea/Textarea.js +25 -1
  165. package/TimePicker/TimePicker.js +1 -1
  166. package/TimeRangePicker/TimeRangePicker.js +1 -1
  167. package/Toggle/Toggle.d.ts +34 -1
  168. package/Toggle/Toggle.js +34 -1
  169. package/Tooltip/Tooltip.d.ts +39 -1
  170. package/Tooltip/Tooltip.js +39 -1
  171. package/Tooltip/useDelayMouseEnterLeave.d.ts +17 -0
  172. package/Tooltip/useDelayMouseEnterLeave.js +17 -0
  173. package/Typography/Typography.d.ts +23 -1
  174. package/Typography/Typography.js +23 -1
  175. package/Upload/Upload.d.ts +13 -7
  176. package/Upload/Upload.js +55 -20
  177. package/Upload/UploadItem.d.ts +3 -3
  178. package/Upload/UploadItem.js +11 -8
  179. package/Upload/UploadPictureCard.d.ts +5 -0
  180. package/Upload/UploadPictureCard.js +10 -6
  181. package/Upload/Uploader.d.ts +32 -31
  182. package/Upload/Uploader.js +10 -9
  183. package/hooks/useClickAway.d.ts +16 -0
  184. package/hooks/useClickAway.js +16 -0
  185. package/hooks/useComposeRefs.d.ts +15 -0
  186. package/hooks/useComposeRefs.js +15 -0
  187. package/hooks/useDocumentEscapeKeyDown.d.ts +15 -0
  188. package/hooks/useDocumentEscapeKeyDown.js +15 -0
  189. package/hooks/useDocumentEvents.d.ts +16 -0
  190. package/hooks/useDocumentEvents.js +16 -0
  191. package/hooks/useDocumentTabKeyDown.d.ts +15 -0
  192. package/hooks/useDocumentTabKeyDown.js +15 -0
  193. package/hooks/useIsomorphicLayoutEffect.d.ts +16 -0
  194. package/hooks/useIsomorphicLayoutEffect.js +16 -0
  195. package/hooks/useLastCallback.d.ts +15 -0
  196. package/hooks/useLastCallback.js +15 -0
  197. package/hooks/useLastValue.d.ts +18 -0
  198. package/hooks/useLastValue.js +18 -0
  199. package/hooks/usePreviousValue.d.ts +14 -0
  200. package/hooks/usePreviousValue.js +14 -0
  201. package/hooks/useScrollLock.d.ts +6 -4
  202. package/hooks/useScrollLock.js +6 -4
  203. package/hooks/useTopStack.d.ts +17 -0
  204. package/hooks/useTopStack.js +17 -0
  205. package/hooks/useWindowWidth.d.ts +14 -0
  206. package/hooks/useWindowWidth.js +14 -0
  207. package/index.d.ts +6 -4
  208. package/index.js +3 -2
  209. package/llms.txt +200 -0
  210. package/package.json +5 -4
  211. package/Selection/SelectionGroup.d.ts +0 -28
  212. package/Selection/index.d.ts +0 -12
  213. package/Selection/index.js +0 -5
@@ -1,5 +1,19 @@
1
1
  import { useState, useEffect } from 'react';
2
2
 
3
+ /**
4
+ * 追蹤目前視窗寬度的 Hook。
5
+ *
6
+ * 在元件掛載時以 `window.innerWidth` 初始化,並監聽 `resize` 事件持續更新,
7
+ * 元件卸載時自動移除監聽器。
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import { useWindowWidth } from '@mezzanine-ui/react';
12
+ *
13
+ * const width = useWindowWidth();
14
+ * const isMobile = width !== undefined && width < 768;
15
+ * ```
16
+ */
3
17
  function useWindowWidth() {
4
18
  const [windowWidth, setWindowWidth] = useState(window.innerWidth);
5
19
  function handleResize() {
package/index.d.ts CHANGED
@@ -84,6 +84,8 @@ export { default as Pagination, PaginationItem, PaginationJumper, PaginationPage
84
84
  export type { PaginationItemProps, PaginationItemType, PaginationJumperProps, PaginationPageSizeProps, PaginationProps, } from './Pagination';
85
85
  export { default as Section } from './Section';
86
86
  export type { SectionProps } from './Section';
87
+ export { SectionGroup } from './Section';
88
+ export type { SectionGroupProps } from './Section';
87
89
  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';
88
90
  export { default as Tag, TagGroup } from './Tag';
89
91
  export type { TagGroupProps, TagProps, TagSize } from './Tag';
@@ -120,8 +122,8 @@ export { default as Cascader, CascaderPanel } from './Cascader';
120
122
  export type { CascaderOption, CascaderPanelProps, CascaderProps, CascaderSize, } from './Cascader';
121
123
  export { default as Select, SelectControlContext, SelectTrigger, SelectTriggerTags, } from './Select';
122
124
  export type { SelectControl, SelectProps, SelectTriggerInputProps, SelectTriggerProps, SelectTriggerTagsProps, SelectValue, } from './Select';
123
- export { default as Selection } from './Selection';
124
- export type { SelectionProps, SelectionPropsBase } from './Selection';
125
+ export { default as SelectionCard } from './SelectionCard';
126
+ export type { SelectionCardProps, SelectionCardPropsBase, } from './SelectionCard';
125
127
  export { default as Slider, useSlider } from './Slider';
126
128
  export type { RangeSliderProps, RangeSliderValue, SingleSliderProps, SingleSliderValue, SliderBaseProps, SliderComponentProps, SliderProps, SliderRect, SliderValue, UseRangeSliderProps, UseSingleSliderProps, UseSliderCommonProps, UseSliderProps, UseSliderResult, } from './Slider';
127
129
  export { default as Textarea } from './Textarea';
@@ -132,8 +134,8 @@ export { default as TimePicker, TimePickerPanel } from './TimePicker';
132
134
  export type { TimePickerPanelProps, TimePickerProps } from './TimePicker';
133
135
  export { default as TimeRangePicker, useTimeRangePickerValue, } from './TimeRangePicker';
134
136
  export type { TimeRangePickerProps, TimeRangePickerValue, UseTimeRangePickerValueProps, } from './TimeRangePicker';
135
- export { default as Switch } from './Toggle';
136
- export type { ToggleProps as SwitchProps, ToggleSize as SwitchSize, } from './Toggle';
137
+ export { default as Toggle } from './Toggle';
138
+ export type { ToggleProps, ToggleSize } from './Toggle';
137
139
  export { Upload, UploadItem, UploadPictureCard, Uploader } from './Upload';
138
140
  export type { UploadFile, UploadItemProps, UploadPictureCardProps, UploadProps, UploaderProps, } from './Upload';
139
141
  /**
package/index.js CHANGED
@@ -31,7 +31,7 @@ export { default as ButtonGroup } from './Button/ButtonGroup.js';
31
31
  export { default as Cropper } from './Cropper/Cropper.js';
32
32
  export { default as Typography } from './Typography/Typography.js';
33
33
  export { BaseCardGeneric as BaseCard, FourThumbnailCardGeneric as FourThumbnailCard, QuickActionCardGeneric as QuickActionCard, SingleThumbnailCardGeneric as SingleThumbnailCard, ThumbnailGeneric as Thumbnail } from './Card/index.js';
34
- export { default as Selection } from './Selection/Selection.js';
34
+ export { default as SelectionCard } from './SelectionCard/SelectionCard.js';
35
35
  export { default as DropdownAction } from './Dropdown/DropdownAction.js';
36
36
  export { default as DropdownItem } from './Dropdown/DropdownItem.js';
37
37
  export { default as DropdownItemCard } from './Dropdown/DropdownItemCard.js';
@@ -77,6 +77,7 @@ export { default as PaginationItem } from './Pagination/PaginationItem.js';
77
77
  export { default as PaginationJumper } from './Pagination/PaginationJumper.js';
78
78
  export { default as PaginationPageSize } from './Pagination/PaginationPageSize.js';
79
79
  export { default as Section } from './Section/Section.js';
80
+ export { default as SectionGroup } from './Section/SectionGroup.js';
80
81
  export { Table } from './Table/Table.js';
81
82
  export { default as Tag } from './Tag/Tag.js';
82
83
  export { default as TagGroup } from './Tag/TagGroup.js';
@@ -115,7 +116,7 @@ export { default as TextField } from './TextField/TextField.js';
115
116
  export { default as TimePicker } from './TimePicker/TimePicker.js';
116
117
  export { default as TimePickerPanel } from './TimePicker/TimePickerPanel.js';
117
118
  export { default as TimeRangePicker } from './TimeRangePicker/TimeRangePicker.js';
118
- export { default as Switch } from './Toggle/Toggle.js';
119
+ export { default as Toggle } from './Toggle/Toggle.js';
119
120
  export { default as Upload } from './Upload/Upload.js';
120
121
  export { default as UploadItem } from './Upload/UploadItem.js';
121
122
  export { default as UploadPictureCard } from './Upload/UploadPictureCard.js';
package/llms.txt ADDED
@@ -0,0 +1,200 @@
1
+ # @mezzanine-ui/react
2
+
3
+ > React component library for Mezzanine UI — a comprehensive set of accessible, themeable components built on top of @mezzanine-ui/core, @mezzanine-ui/icons, and @mezzanine-ui/system.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mezzanine-ui/react @mezzanine-ui/core @mezzanine-ui/icons @mezzanine-ui/system react react-dom lodash
9
+ ```
10
+
11
+ Peer dependencies: `react >= 18`, `react-dom >= 18`, `lodash >= 4`
12
+
13
+ ## Related Packages
14
+
15
+ | Package | Role |
16
+ | ------------------------ | ------------------------------------------------- |
17
+ | `@mezzanine-ui/core` | CSS styles and TypeScript type definitions |
18
+ | `@mezzanine-ui/icons` | SVG icon definitions (plain objects) |
19
+ | `@mezzanine-ui/system` | Design tokens: palette, spacing, typography, etc. |
20
+
21
+ ## Import Patterns
22
+
23
+ Individual component (preferred for tree-shaking):
24
+ ```ts
25
+ import Button from '@mezzanine-ui/react/Button';
26
+ import Select from '@mezzanine-ui/react/Select';
27
+ ```
28
+
29
+ Named exports from the barrel (hooks, types, utilities):
30
+ ```ts
31
+ import { usePagination, useCheckboxControlValue, cx } from '@mezzanine-ui/react';
32
+ import type { ButtonProps, ButtonVariant } from '@mezzanine-ui/react';
33
+ ```
34
+
35
+ Sub-path imports for component groups and core types:
36
+ ```ts
37
+ // Navigation sub-components
38
+ import {
39
+ NavigationFooter,
40
+ NavigationHeader,
41
+ NavigationOption,
42
+ NavigationIconButton,
43
+ NavigationUserMenu,
44
+ } from '@mezzanine-ui/react/Navigation';
45
+
46
+ // ContentHeader (page-level header with back button + action slots)
47
+ import ContentHeader from '@mezzanine-ui/react/ContentHeader';
48
+
49
+ // Form layout tokens from core (used with FormField)
50
+ import {
51
+ ControlFieldSlotLayout,
52
+ FormFieldLayout,
53
+ FormFieldLabelSpacing,
54
+ } from '@mezzanine-ui/core/form';
55
+ ```
56
+
57
+ Spacing helpers in SCSS (from `@mezzanine-ui/system/spacing`):
58
+ ```scss
59
+ @use '@mezzanine-ui/system/spacing';
60
+
61
+ .host {
62
+ padding: spacing.semantic-variable(padding, vertical, spacious)
63
+ spacing.semantic-variable(padding, horizontal, comfort-fixed);
64
+ row-gap: spacing.semantic-variable(gap, calm);
65
+ }
66
+ ```
67
+
68
+ Required styles — create a `main.scss` and import it at your app entry point. All component styles are loaded at once via `@include mzn-core.styles()`:
69
+ ```scss
70
+ @use '@mezzanine-ui/system' as mzn-system;
71
+ @use '@mezzanine-ui/core' as mzn-core;
72
+
73
+ :root {
74
+ @include mzn-system.common-variables('default');
75
+ @include mzn-system.colors();
76
+ }
77
+
78
+ /* Optional: light/dark palette theming */
79
+ :root { @include mzn-system.palette-variables(light); }
80
+ [data-theme='dark'] { @include mzn-system.palette-variables(dark); }
81
+
82
+ /* Optional: compact density */
83
+ [data-density='compact'] { @include mzn-system.common-variables(compact); }
84
+
85
+ @include mzn-core.styles();
86
+ ```
87
+
88
+ > **Note:** The `~` prefix (e.g. `~@mezzanine-ui/core`) was required by older webpack 4 + sass-loader setups. Modern tooling (Next.js 13+, Vite) resolves node_modules without it — use bare paths as shown above.
89
+
90
+ ## Component Categories
91
+
92
+ - **General** — Button, ButtonGroup, Cropper, Icon, Layout, Separator, Typography
93
+ - **Navigation** — Breadcrumb, Drawer, Navigation (+ sub-components), PageHeader, PageFooter, Stepper, Tab
94
+ - **Data Display** — Accordion, Badge, Cards (BaseCard, FourThumbnailCard, SingleThumbnailCard, QuickActionCard), Description, Empty, Pagination, Table, Tag, Tooltip
95
+ - **Data Entry** — AutoComplete, Checkbox, DatePicker, DateRangePicker, DateTimePicker, FilterArea, FormField, Input, Radio, Select, Slider, Toggle, Textarea, TimePicker, Upload, Cascader
96
+ - **Feedback** — InlineMessage, Message, Modal, NotificationCenter, Progress, ResultState, Skeleton, Spin
97
+ - **Others** — AlertBanner, Anchor, Backdrop, FloatingButton
98
+ - **Utility** — Calendar, Dropdown, Popper, Portal, TimePanel, Transition animations (Collapse, Fade, Rotate, Scale, Slide, Translate)
99
+
100
+ ## Key Design Patterns
101
+
102
+ **Polymorphic `component` prop** — most components accept a `component` prop to override the rendered HTML element or pass a router link component:
103
+ ```tsx
104
+ <Button component="a" href="/page">Link Button</Button>
105
+ ```
106
+
107
+ **Controlled/uncontrolled with control hooks** — pair components with their corresponding hook:
108
+ ```tsx
109
+ const [value, onChange] = useCheckboxControlValue({ defaultValue: [] });
110
+ <CheckboxGroup value={value} onChange={onChange} options={options} />
111
+ ```
112
+
113
+ Available control hooks: `useAutoCompleteValueControl`, `useCheckboxControlValue`, `useInputControlValue`, `useInputWithClearControlValue`, `useRadioControlValue`, `useSelectValueControl`, `useSwitchControlValue`, `useCustomControlValue`.
114
+
115
+ **Portal-based overlays** — Modal, Drawer, and Tooltip render outside the component tree via `Portal`. Use the `container` prop to target a specific DOM node.
116
+
117
+ **Calendar adapter pattern** — Calendar components require wrapping the app with a date-adapter provider. Import from the library-specific entry point to avoid bundling unused date libraries:
118
+ ```tsx
119
+ // Day.js (recommended)
120
+ import { CalendarConfigProviderDayjs, CalendarLocale } from '@mezzanine-ui/react/dayjs';
121
+ <CalendarConfigProviderDayjs locale={CalendarLocale.ZH_TW}>{children}</CalendarConfigProviderDayjs>
122
+
123
+ // Moment.js
124
+ import { CalendarConfigProviderMoment, CalendarLocale } from '@mezzanine-ui/react/moment';
125
+
126
+ // Luxon
127
+ import { CalendarConfigProviderLuxon, CalendarLocale } from '@mezzanine-ui/react/luxon';
128
+ ```
129
+
130
+ **forwardRef** — all components forward their ref to the underlying DOM element.
131
+
132
+ **React Hook Form integration** — the recommended pattern is a `BaseField` wrapper that combines `FormField` with RHF's `formState.errors` for automatic error display. `ControlFieldSlotLayout.SUB` aligns the hint/error message with the input:
133
+ ```tsx
134
+ import { useFormContext, get } from 'react-hook-form';
135
+ import FormField from '@mezzanine-ui/react/Form/FormField';
136
+ import { ControlFieldSlotLayout, FormFieldLayout } from '@mezzanine-ui/core/form';
137
+
138
+ function BaseField({ name, label, required, disabled, children }) {
139
+ const { formState } = useFormContext();
140
+ const error = get(formState.errors, name);
141
+ return (
142
+ <FormField
143
+ name={name}
144
+ label={label}
145
+ required={required}
146
+ disabled={disabled}
147
+ layout={FormFieldLayout.VERTICAL}
148
+ controlFieldSlotLayout={ControlFieldSlotLayout.SUB}
149
+ hintText={error?.message ?? ''}
150
+ severity={error ? 'error' : 'info'}
151
+ >
152
+ {children}
153
+ </FormField>
154
+ );
155
+ }
156
+ ```
157
+
158
+ **Message imperative API** — `Message` is a global singleton for toast notifications. Call it imperatively without rendering any JSX:
159
+ ```tsx
160
+ import { Message } from '@mezzanine-ui/react';
161
+
162
+ Message.success('儲存成功');
163
+ Message.warning('請確認輸入資料');
164
+ Message.error('操作失敗,請稍後再試');
165
+ ```
166
+
167
+ **Select inside Modal** — when rendering a `Select` (or `AutoComplete`) inside a `Modal` or `Drawer`, pass `dropdownZIndex` higher than the overlay (default modal z-index is ~1000):
168
+ ```tsx
169
+ <Select options={options} dropdownZIndex={1004} />
170
+ ```
171
+
172
+ ## Common Pitfalls for AI Assistants
173
+
174
+ **Typography `variant` is not h1–h6.** The prop is named `variant` but its type is `TypographySemanticType` — a design-system semantic scale, not HTML heading levels. Valid values are `h1`, `h2`, `h3` (no h4/h5/h6), then `body`, `body-highlight`, `body-mono`, `caption`, `caption-highlight`, `annotation`, `annotation-highlight`, `button`, `input`, `label-primary`, `label-secondary`, and a few others. Never use `h4`, `h5`, or `h6`.
175
+ ```tsx
176
+ <Typography variant="h1">Title</Typography> // ✅
177
+ <Typography variant="body">Body text</Typography> // ✅
178
+ <Typography variant="h5">Subtitle</Typography> // ❌ h5 does not exist
179
+ ```
180
+
181
+ **Button icons use `icon` + `iconType`, not `prefix`/`suffix` JSX.** Pass an icon definition object (from `@mezzanine-ui/icons`) to the `icon` prop and set position via `iconType`: `"leading"` | `"trailing"` | `"icon-only"`. Do not wrap `<Icon />` in `prefix` or `suffix` props — those props do not exist on Button.
182
+ ```tsx
183
+ import { PlusIcon } from '@mezzanine-ui/icons';
184
+ <Button icon={PlusIcon} iconType="leading">新增</Button> // ✅
185
+ <Button prefix={<Icon icon={PlusIcon} />}>新增</Button> // ❌ prefix does not exist
186
+ ```
187
+
188
+ **`TextField` is a low-level layout container, not a full form field.** It renders the border/background/affix shell around an `<input>` but does not include a label, hint text, or error message. For a complete labeled form field, use `FormField` (which wraps `TextField` + `Input` + label + validation message).
189
+ ```tsx
190
+ // Full labeled form field:
191
+ <FormField label="Email" required errorMessage={error}>
192
+ <TextField><Input placeholder="you@example.com" /></TextField>
193
+ </FormField>
194
+ ```
195
+
196
+ ## Further Reference
197
+
198
+ - Full component index with descriptions: `packages/react/COMPONENTS.md`
199
+ - Complete prop types and JSDoc: `*.d.ts` files in the published package (or `packages/react/src/<ComponentName>/index.tsx`)
200
+ - GitHub: https://github.com/Mezzanine-UI/mezzanine
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezzanine-ui/react",
3
- "version": "1.0.0-rc.5",
3
+ "version": "1.0.0-rc.7",
4
4
  "description": "React components for mezzanine-ui",
5
5
  "author": "Mezzanine",
6
6
  "repository": {
@@ -13,6 +13,7 @@
13
13
  "module": "index.js",
14
14
  "typings": "index.d.ts",
15
15
  "sideEffects": false,
16
+ "llms": "./llms.txt",
16
17
  "publishConfig": {
17
18
  "access": "public"
18
19
  },
@@ -31,9 +32,9 @@
31
32
  "@floating-ui/dom": "^1.7.4",
32
33
  "@floating-ui/react-dom": "^2.1.6",
33
34
  "@hello-pangea/dnd": "^18.0.1",
34
- "@mezzanine-ui/core": "1.0.0-rc.5",
35
- "@mezzanine-ui/icons": "1.0.0-rc.5",
36
- "@mezzanine-ui/system": "1.0.0-rc.5",
35
+ "@mezzanine-ui/core": "1.0.0-rc.7",
36
+ "@mezzanine-ui/icons": "1.0.0-rc.7",
37
+ "@mezzanine-ui/system": "1.0.0-rc.7",
37
38
  "@tanstack/react-virtual": "^3.13.13",
38
39
  "@types/react-transition-group": "^4.4.12",
39
40
  "clsx": "^2.1.1",
@@ -1,28 +0,0 @@
1
- import { ComponentProps, ReactElement } from 'react';
2
- import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
3
- import Selection, { SelectionProps } from './Selection';
4
- export interface SelectionGroupBaseProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'children'> {
5
- /**
6
- * The class name of the selection group.
7
- */
8
- className?: string;
9
- }
10
- export interface SelectionGroupProps extends SelectionGroupBaseProps {
11
- /**
12
- * The selections in the group.
13
- * Only Selection components are allowed.
14
- * When provided, will take priority over selections prop.
15
- */
16
- children?: ReactElement<ComponentProps<typeof Selection>> | ReactElement<ComponentProps<typeof Selection>>[];
17
- /**
18
- * The selections array.
19
- * When provided, Selection components will be automatically rendered.
20
- * Will be ignored if children is provided.
21
- */
22
- selections?: SelectionProps[];
23
- }
24
- /**
25
- * The react component for `mezzanine` selection group.
26
- */
27
- declare const SelectionGroup: import("react").ForwardRefExoticComponent<SelectionGroupProps & import("react").RefAttributes<HTMLDivElement>>;
28
- export default SelectionGroup;
@@ -1,12 +0,0 @@
1
- import { PropsWithoutRef, ReactElement, RefAttributes } from 'react';
2
- import Selection, { SelectionProps, SelectionPropsBase } from './Selection';
3
- export type { SelectionDirection, SelectionType, } from '@mezzanine-ui/core/selection';
4
- export type { SelectionProps, SelectionPropsBase };
5
- /**
6
- * @remark
7
- * Add type alias here for parsable to react docgen typescript.
8
- */
9
- type GenericSelection = (props: PropsWithoutRef<SelectionProps> & RefAttributes<HTMLLabelElement>) => ReactElement<any>;
10
- export { Selection };
11
- declare const _default: GenericSelection;
12
- export default _default;
@@ -1,5 +0,0 @@
1
- import Selection from './Selection.js';
2
-
3
-
4
-
5
- export { Selection, Selection as default };