@mezzanine-ui/react 1.0.0-beta.1 → 1.0.0-beta.3

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 (172) hide show
  1. package/Anchor/Anchor.d.ts +51 -18
  2. package/Anchor/Anchor.js +15 -15
  3. package/Anchor/AnchorGroup.d.ts +34 -0
  4. package/Anchor/AnchorGroup.js +37 -0
  5. package/Anchor/AnchorItem.d.ts +30 -0
  6. package/Anchor/AnchorItem.js +65 -0
  7. package/Anchor/index.d.ts +2 -0
  8. package/Anchor/index.js +1 -0
  9. package/Anchor/utils.d.ts +13 -0
  10. package/Anchor/utils.js +95 -0
  11. package/AutoComplete/AutoComplete.d.ts +194 -0
  12. package/AutoComplete/AutoComplete.js +419 -0
  13. package/AutoComplete/index.d.ts +2 -0
  14. package/AutoComplete/index.js +1 -0
  15. package/AutoComplete/useAutoCompleteCreation.d.ts +33 -0
  16. package/AutoComplete/useAutoCompleteCreation.js +201 -0
  17. package/AutoComplete/useAutoCompleteKeyboard.d.ts +31 -0
  18. package/AutoComplete/useAutoCompleteKeyboard.js +149 -0
  19. package/AutoComplete/useAutoCompleteSearch.d.ts +16 -0
  20. package/AutoComplete/useAutoCompleteSearch.js +69 -0
  21. package/AutoComplete/useCreationTracker.d.ts +17 -0
  22. package/AutoComplete/useCreationTracker.js +47 -0
  23. package/Badge/Badge.js +2 -2
  24. package/Breadcrumb/BreadcrumbItem.d.ts +1 -1
  25. package/Button/Button.js +13 -11
  26. package/Button/index.d.ts +1 -1
  27. package/Button/typings.d.ts +27 -4
  28. package/Description/Description.d.ts +30 -0
  29. package/Description/Description.js +13 -0
  30. package/Description/DescriptionContent.d.ts +41 -0
  31. package/Description/DescriptionContent.js +14 -0
  32. package/Description/DescriptionGroup.d.ts +13 -0
  33. package/Description/DescriptionGroup.js +12 -0
  34. package/Description/DescriptionTitle.d.ts +45 -0
  35. package/Description/DescriptionTitle.js +17 -0
  36. package/Description/index.d.ts +8 -0
  37. package/Description/index.js +4 -0
  38. package/Dropdown/Dropdown.d.ts +43 -3
  39. package/Dropdown/Dropdown.js +154 -35
  40. package/Dropdown/DropdownAction.d.ts +1 -1
  41. package/Dropdown/DropdownAction.js +1 -4
  42. package/Dropdown/DropdownItem.d.ts +21 -4
  43. package/Dropdown/DropdownItem.js +23 -10
  44. package/Dropdown/DropdownItemCard.d.ts +5 -5
  45. package/Dropdown/DropdownItemCard.js +11 -10
  46. package/Dropdown/DropdownStatus.d.ts +2 -2
  47. package/Dropdown/DropdownStatus.js +29 -0
  48. package/Dropdown/dropdownKeydownHandler.d.ts +2 -1
  49. package/Dropdown/dropdownKeydownHandler.js +73 -0
  50. package/Dropdown/highlightText.js +5 -1
  51. package/Dropdown/shortcutTextHandler.d.ts +24 -0
  52. package/Dropdown/shortcutTextHandler.js +171 -0
  53. package/Form/FormControlContext.d.ts +2 -2
  54. package/Form/FormField.d.ts +56 -4
  55. package/Form/FormField.js +10 -6
  56. package/Form/FormHintText.d.ts +24 -1
  57. package/Form/FormHintText.js +4 -4
  58. package/Form/FormLabel.d.ts +6 -3
  59. package/Form/FormLabel.js +5 -3
  60. package/Input/Input.d.ts +29 -3
  61. package/Input/Input.js +22 -6
  62. package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.js +1 -1
  63. package/Modal/Modal.d.ts +103 -11
  64. package/Modal/Modal.js +14 -9
  65. package/Modal/ModalBodyForVerification.d.ts +59 -0
  66. package/Modal/ModalBodyForVerification.js +99 -0
  67. package/Modal/ModalControl.d.ts +2 -2
  68. package/Modal/ModalControl.js +1 -1
  69. package/Modal/ModalFooter.d.ts +119 -1
  70. package/Modal/ModalFooter.js +15 -3
  71. package/Modal/ModalHeader.d.ts +26 -7
  72. package/Modal/ModalHeader.js +33 -7
  73. package/Modal/index.d.ts +4 -5
  74. package/Modal/index.js +1 -2
  75. package/Modal/useModalContainer.d.ts +12 -3
  76. package/Modal/useModalContainer.js +28 -6
  77. package/Navigation/CollapsedMenu.d.ts +6 -0
  78. package/Navigation/CollapsedMenu.js +16 -0
  79. package/Navigation/Navigation.d.ts +17 -3
  80. package/Navigation/Navigation.js +48 -33
  81. package/Navigation/NavigationFooter.js +4 -2
  82. package/Navigation/NavigationHeader.d.ts +11 -1
  83. package/Navigation/NavigationHeader.js +6 -3
  84. package/Navigation/NavigationOption.d.ts +3 -2
  85. package/Navigation/NavigationOption.js +45 -26
  86. package/Navigation/NavigationOptionCategory.js +20 -2
  87. package/Navigation/context.d.ts +2 -0
  88. package/Navigation/useVisibleItems.d.ts +5 -0
  89. package/Navigation/useVisibleItems.js +54 -0
  90. package/NotificationCenter/NotificationCenter.d.ts +124 -0
  91. package/NotificationCenter/NotificationCenter.js +259 -0
  92. package/NotificationCenter/NotificationCenterDrawer.d.ts +89 -0
  93. package/NotificationCenter/index.d.ts +3 -0
  94. package/NotificationCenter/index.js +1 -0
  95. package/PageFooter/PageFooter.d.ts +19 -9
  96. package/PageFooter/PageFooter.js +10 -10
  97. package/PageHeader/PageHeader.js +4 -12
  98. package/PageToolbar/PageToolbar.d.ts +2 -6
  99. package/PageToolbar/utils.js +4 -12
  100. package/Select/index.d.ts +0 -2
  101. package/Select/index.js +0 -1
  102. package/Slider/useSlider.js +1 -1
  103. package/Table/Table.d.ts +53 -15
  104. package/Table/Table.js +178 -82
  105. package/Table/TableContext.d.ts +18 -42
  106. package/Table/components/TableActionsCell.d.ts +26 -0
  107. package/Table/components/TableActionsCell.js +78 -0
  108. package/Table/components/TableBody.d.ts +2 -5
  109. package/Table/components/TableBody.js +16 -19
  110. package/Table/components/TableBulkActions.d.ts +15 -0
  111. package/Table/components/TableBulkActions.js +26 -0
  112. package/Table/components/TableCell.d.ts +2 -0
  113. package/Table/components/TableCell.js +42 -10
  114. package/Table/components/TableColGroup.js +10 -112
  115. package/Table/components/TableColumnTitleMenu.d.ts +6 -0
  116. package/Table/components/TableColumnTitleMenu.js +20 -0
  117. package/Table/components/TableDragHandleCell.d.ts +2 -0
  118. package/Table/components/TableDragHandleCell.js +8 -1
  119. package/Table/components/TableExpandCell.d.ts +2 -0
  120. package/Table/components/TableExpandCell.js +8 -1
  121. package/Table/components/TableExpandedRow.js +3 -2
  122. package/Table/components/TableHeader.d.ts +2 -4
  123. package/Table/components/TableHeader.js +11 -14
  124. package/Table/components/TableResizeHandle.js +3 -7
  125. package/Table/components/TableRow.js +54 -20
  126. package/Table/components/TableSelectionCell.d.ts +5 -0
  127. package/Table/components/TableSelectionCell.js +12 -1
  128. package/Table/components/index.d.ts +1 -0
  129. package/Table/components/index.js +1 -0
  130. package/Table/hooks/index.d.ts +1 -1
  131. package/Table/hooks/index.js +1 -1
  132. package/Table/hooks/useTableDataSource.d.ts +2 -2
  133. package/Table/hooks/useTableExpansion.js +0 -6
  134. package/Table/hooks/useTableFixedOffsets.d.ts +1 -1
  135. package/Table/hooks/useTableFixedOffsets.js +24 -26
  136. package/Table/hooks/useTableResizedColumns.d.ts +2 -0
  137. package/Table/hooks/useTableResizedColumns.js +22 -0
  138. package/Table/hooks/useTableScroll.d.ts +3 -1
  139. package/Table/hooks/useTableScroll.js +25 -19
  140. package/Table/hooks/useTableSelection.js +32 -8
  141. package/Table/hooks/useTableVirtualization.d.ts +1 -1
  142. package/Table/index.d.ts +4 -4
  143. package/Table/index.js +5 -3
  144. package/Table/utils/calculateColumnWidths.d.ts +28 -0
  145. package/Table/utils/calculateColumnWidths.js +80 -0
  146. package/Table/utils/index.d.ts +2 -0
  147. package/Table/utils/index.js +1 -0
  148. package/Table/utils/useTableRowSelection.d.ts +5 -5
  149. package/Table/utils/useTableRowSelection.js +14 -6
  150. package/Tag/TagGroup.d.ts +3 -0
  151. package/Tag/index.d.ts +2 -0
  152. package/Tag/index.js +1 -0
  153. package/Upload/UploadPictureCard.js +1 -1
  154. package/index.d.ts +36 -20
  155. package/index.js +26 -7
  156. package/package.json +4 -4
  157. package/utils/format-number-with-commas.d.ts +4 -0
  158. package/utils/format-number-with-commas.js +27 -0
  159. package/utils/parse-number-with-commas.d.ts +4 -0
  160. package/utils/parse-number-with-commas.js +22 -0
  161. package/Modal/ModalActions.d.ts +0 -9
  162. package/Modal/ModalActions.js +0 -20
  163. package/Modal/ModalBody.d.ts +0 -7
  164. package/Modal/ModalBody.js +0 -14
  165. package/Notification/Notification.d.ts +0 -54
  166. package/Notification/Notification.js +0 -76
  167. package/Notification/index.d.ts +0 -3
  168. package/Notification/index.js +0 -1
  169. package/Select/AutoComplete.d.ts +0 -107
  170. package/Select/AutoComplete.js +0 -114
  171. package/Table/hooks/useTableColumns.d.ts +0 -8
  172. package/Table/hooks/useTableColumns.js +0 -91
package/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  export { arrayMove } from './utils/array-move.js';
2
2
  export { composeRefs } from './utils/composeRefs.js';
3
+ export { formatNumberWithCommas } from './utils/format-number-with-commas.js';
3
4
  export { getCSSVariableValue, getNumericCSSVariablePixelValue } from './utils/get-css-variable-value.js';
4
5
  export { getScrollbarWidth } from './utils/get-scrollbar-width.js';
5
6
  export { getElement } from './utils/getElement.js';
7
+ export { parseNumberWithCommas } from './utils/parse-number-with-commas.js';
6
8
  export { useClickAway } from './hooks/useClickAway.js';
7
9
  export { useComposeRefs } from './hooks/useComposeRefs.js';
8
10
  export { useDocumentEscapeKeyDown } from './hooks/useDocumentEscapeKeyDown.js';
@@ -31,6 +33,10 @@ export { default as Checkbox } from './Checkbox/Checkbox.js';
31
33
  export { default as CheckAll } from './Checkbox/CheckAll.js';
32
34
  export { default as CheckboxGroup } from './Checkbox/CheckboxGroup.js';
33
35
  export { default as Selection } from './Selection/Selection.js';
36
+ export { default as DropdownAction } from './Dropdown/DropdownAction.js';
37
+ export { default as DropdownItem } from './Dropdown/DropdownItem.js';
38
+ export { default as DropdownItemCard } from './Dropdown/DropdownItemCard.js';
39
+ export { default as DropdownStatus } from './Dropdown/DropdownStatus.js';
34
40
  export { default as Icon } from './Icon/Icon.js';
35
41
  export { default as AppBar } from './AppBar/AppBar.js';
36
42
  export { default as AppBarBrand } from './AppBar/AppBarBrand.js';
@@ -38,18 +44,23 @@ export { default as AppBarMain } from './AppBar/AppBarMain.js';
38
44
  export { default as AppBarSupport } from './AppBar/AppBarSupport.js';
39
45
  export { default as Breadcrumb } from './Breadcrumb/Breadcrumb.js';
40
46
  export { default as Drawer } from './Drawer/Drawer.js';
41
- export { default as Dropdown } from './Dropdown/Dropdown.js';
42
47
  export { default as Menu } from './Menu/Menu.js';
43
48
  export { default as MenuDivider } from './Menu/MenuDivider.js';
44
49
  export { default as MenuItem } from './Menu/MenuItem.js';
45
50
  export { default as MenuItemGroup, default as OptionGroup } from './Menu/MenuItemGroup.js';
46
51
  export { default as Navigation } from './Navigation/Navigation.js';
52
+ export { default as NavigationFooter } from './Navigation/NavigationFooter.js';
53
+ export { default as NavigationHeader } from './Navigation/NavigationHeader.js';
54
+ export { default as NavigationIconButton } from './Navigation/NavigationIconButton.js';
55
+ export { default as NavigationOption } from './Navigation/NavigationOption.js';
56
+ export { default as NavigationOptionCategory } from './Navigation/NavigationOptionCategory.js';
57
+ export { default as NavigationUserMenu } from './Navigation/NavigationUserMenu.js';
47
58
  export { default as PageFooter } from './PageFooter/PageFooter.js';
48
59
  export { default as PageHeader } from './PageHeader/PageHeader.js';
49
60
  export { default as Step } from './Stepper/Step.js';
50
61
  export { default as Stepper } from './Stepper/Stepper.js';
51
- export { default as TabItem } from './Tab/TabItem.js';
52
62
  export { default as Tab } from './Tab/Tab.js';
63
+ export { default as TabItem } from './Tab/TabItem.js';
53
64
  export { default as Accordion } from './Accordion/Accordion.js';
54
65
  export { default as AccordionDetails } from './Accordion/AccordionDetails.js';
55
66
  export { default as AccordionSummary } from './Accordion/AccordionSummary.js';
@@ -57,6 +68,10 @@ export { default as Badge } from './Badge/Badge.js';
57
68
  export { default as BadgeContainer } from './Badge/BadgeContainer.js';
58
69
  export { default as Card } from './Card/Card.js';
59
70
  export { default as CardActions } from './Card/CardActions.js';
71
+ export { default as Description } from './Description/Description.js';
72
+ export { default as DescriptionContent } from './Description/DescriptionContent.js';
73
+ export { default as DescriptionGroup } from './Description/DescriptionGroup.js';
74
+ export { default as DescriptionTitle } from './Description/DescriptionTitle.js';
60
75
  export { default as Empty } from './Empty/Empty.js';
61
76
  export { default as OverflowCounterTag } from './OverflowTooltip/OverflowCounterTag.js';
62
77
  export { default as Pagination } from './Pagination/Pagination.js';
@@ -65,10 +80,12 @@ export { default as PaginationJumper } from './Pagination/PaginationJumper.js';
65
80
  export { default as PaginationPageSize } from './Pagination/PaginationPageSize.js';
66
81
  export { Table } from './Table/Table.js';
67
82
  export { default as Tag } from './Tag/Tag.js';
83
+ export { default as TagGroup } from './Tag/TagGroup.js';
68
84
  export { default as Tooltip } from './Tooltip/Tooltip.js';
69
85
  export { default as Tree } from './Tree/Tree.js';
70
86
  export { default as TreeNode } from './Tree/TreeNode.js';
71
87
  export { default as TreeNodeList } from './Tree/TreeNodeList.js';
88
+ export { default as AutoComplete } from './AutoComplete/AutoComplete.js';
72
89
  export { default as DatePicker } from './DatePicker/DatePicker.js';
73
90
  export { default as DatePickerCalendar } from './DatePicker/DatePickerCalendar.js';
74
91
  export { default as DateRangePicker } from './DateRangePicker/DateRangePicker.js';
@@ -82,7 +99,6 @@ export { default as PickerTrigger } from './Picker/PickerTrigger.js';
82
99
  export { default as RangePickerTrigger } from './Picker/RangePickerTrigger.js';
83
100
  export { default as Radio } from './Radio/Radio.js';
84
101
  export { default as RadioGroup } from './Radio/RadioGroup.js';
85
- export { default as AutoComplete } from './Select/AutoComplete.js';
86
102
  export { default as Option } from './Select/Option.js';
87
103
  export { default as Select } from './Select/Select.js';
88
104
  export { default as SelectTrigger } from './Select/SelectTrigger.js';
@@ -102,12 +118,11 @@ export { default as Alert } from './Alert/Alert.js';
102
118
  export { default as ConfirmActions } from './ConfirmActions/ConfirmActions.js';
103
119
  export { default as Message } from './Message/Message.js';
104
120
  export { default as Modal } from './Modal/Modal.js';
105
- export { default as ModalActions } from './Modal/ModalActions.js';
106
- export { default as ModalBody } from './Modal/ModalBody.js';
121
+ export { default as ModalBodyForVerification } from './Modal/ModalBodyForVerification.js';
107
122
  export { default as ModalFooter } from './Modal/ModalFooter.js';
108
123
  export { default as ModalHeader } from './Modal/ModalHeader.js';
109
124
  export { default as useModalContainer } from './Modal/useModalContainer.js';
110
- export { default as Notification } from './Notification/Notification.js';
125
+ export { default as NotificationCenter } from './NotificationCenter/NotificationCenter.js';
111
126
  export { default as Popconfirm } from './Popconfirm/Popconfirm.js';
112
127
  export { default as Progress } from './Progress/Progress.js';
113
128
  export { default as Skeleton } from './Skeleton/Skeleton.js';
@@ -116,6 +131,7 @@ export { default as InlineMessage } from './InlineMessage/InlineMessage.js';
116
131
  export { default as InlineMessageGroup } from './InlineMessage/InlineMessageGroup.js';
117
132
  export { default as ResultState } from './ResultState/ResultState.js';
118
133
  export { default as Anchor } from './Anchor/Anchor.js';
134
+ export { default as AnchorGroup } from './Anchor/AnchorGroup.js';
119
135
  export { default as Backdrop } from './Backdrop/Backdrop.js';
120
136
  export { default as AlertBanner } from './AlertBanner/AlertBanner.js';
121
137
  export { default as Calendar } from './Calendar/Calendar.js';
@@ -145,9 +161,12 @@ export { default as SlideFade } from './Transition/SlideFade.js';
145
161
  export { default as Transition } from './Transition/Transition.js';
146
162
  export { default as Translate } from './Transition/Translate.js';
147
163
  export { default as ConfigProvider } from './Provider/ConfigProvider.js';
164
+ export { default as Dropdown } from './Dropdown/Dropdown.js';
148
165
  export { useStepper } from './Stepper/useStepper.js';
149
166
  export { usePagination } from './Pagination/usePagination.js';
150
- export { TableContext, TableDataContext, useTableContext, useTableDataContext } from './Table/TableContext.js';
167
+ export { getCellAlignClass, getRowKey } from '@mezzanine-ui/core/table';
168
+ export { TableContext, TableDataContext, TableSuperContext, useTableContext, useTableDataContext, useTableSuperContext } from './Table/TableContext.js';
169
+ export { useTableDataSource } from './Table/hooks/useTableDataSource.js';
151
170
  export { useTableRowSelection } from './Table/utils/useTableRowSelection.js';
152
171
  export { getTreeNodeEntities } from './Tree/getTreeNodeEntities.js';
153
172
  export { toggleValue, toggleValueWithStatusControl, uniqueArray } from './Tree/toggleValue.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezzanine-ui/react",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "React components for mezzanine-ui",
5
5
  "author": "Mezzanine",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "@floating-ui/dom": "^1.7.4",
32
32
  "@floating-ui/react-dom": "^2.1.6",
33
33
  "@hello-pangea/dnd": "^18.0.1",
34
- "@mezzanine-ui/core": "^1.0.0-beta.1",
35
- "@mezzanine-ui/icons": "^1.0.0-beta.1",
36
- "@mezzanine-ui/system": "^1.0.0-beta.1",
34
+ "@mezzanine-ui/core": "1.0.0-beta.3",
35
+ "@mezzanine-ui/icons": "1.0.0-beta.3",
36
+ "@mezzanine-ui/system": "1.0.0-beta.3",
37
37
  "@tanstack/react-virtual": "^3.13.13",
38
38
  "@types/react-transition-group": "^4.4.12",
39
39
  "clsx": "^2.1.1",
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Formats a number or numeric string with commas according to the specified locale.
3
+ */
4
+ export declare function formatNumberWithCommas(input: number | string, locale?: string, options?: Intl.NumberFormatOptions): string;
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ /**
3
+ * Formats a number or numeric string with commas according to the specified locale.
4
+ */
5
+ function formatNumberWithCommas(input, locale = 'en-US', options) {
6
+ let value;
7
+ if (typeof input === 'number') {
8
+ if (!Number.isFinite(input))
9
+ return '';
10
+ value = input;
11
+ }
12
+ else {
13
+ const trimmed = input.trim();
14
+ if (trimmed === '')
15
+ return '';
16
+ const parsed = Number(trimmed);
17
+ if (!Number.isFinite(parsed))
18
+ return '';
19
+ value = parsed;
20
+ }
21
+ return new Intl.NumberFormat(locale, {
22
+ maximumFractionDigits: 20,
23
+ ...options,
24
+ }).format(value);
25
+ }
26
+
27
+ export { formatNumberWithCommas };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Parses a string representing a number with commas into a number.
3
+ */
4
+ export declare function parseNumberWithCommas(input: string, strict?: boolean): number | null;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Parses a string representing a number with commas into a number.
3
+ */
4
+ function parseNumberWithCommas(input, strict = false) {
5
+ if (typeof input !== 'string')
6
+ return null;
7
+ const trimmed = input.trim();
8
+ if (trimmed === '')
9
+ return null;
10
+ if (strict) {
11
+ /** Strictly formatted number with commas */
12
+ const STRICT_FORMAT = /^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?$/;
13
+ if (!STRICT_FORMAT.test(trimmed)) {
14
+ return null;
15
+ }
16
+ }
17
+ const normalized = trimmed.split(',').join('');
18
+ const value = Number(normalized);
19
+ return Number.isFinite(value) ? value : null;
20
+ }
21
+
22
+ export { parseNumberWithCommas };
@@ -1,9 +0,0 @@
1
- import { ConfirmActionsProps } from '../ConfirmActions';
2
- import { ModalFooterProps } from './ModalFooter';
3
- export interface ModalActionsProps extends ModalFooterProps, Pick<ConfirmActionsProps, 'cancelButtonProps' | 'cancelText' | 'confirmButtonProps' | 'confirmText' | 'hideCancelButton' | 'hideConfirmButton' | 'onCancel' | 'onConfirm'> {
4
- }
5
- /**
6
- * The react component for `mezzanine` modal actions.
7
- */
8
- declare const ModalActions: import("react").ForwardRefExoticComponent<ModalActionsProps & import("react").RefAttributes<HTMLDivElement>>;
9
- export default ModalActions;
@@ -1,20 +0,0 @@
1
- 'use client';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { modalClasses } from '@mezzanine-ui/core/modal';
4
- import { forwardRef, useContext } from 'react';
5
- import ModalFooter from './ModalFooter.js';
6
- import { ModalControlContext } from './ModalControl.js';
7
- import ConfirmActions from '../ConfirmActions/ConfirmActions.js';
8
-
9
- /**
10
- * The react component for `mezzanine` modal actions.
11
- */
12
- const ModalActions = forwardRef(function ModalActions(props, ref) {
13
- const { cancelButtonProps, cancelText, children, confirmButtonProps, confirmText, hideCancelButton, hideConfirmButton, onCancel, onConfirm, ...rest } = props;
14
- const { loading: confirmButtonLoading, ...restConfirmButtonProps } = confirmButtonProps || {};
15
- const { loading, severity } = useContext(ModalControlContext);
16
- const danger = severity === 'error';
17
- return (jsxs(ModalFooter, { ...rest, ref: ref, children: [children, jsx(ConfirmActions, { cancelButtonProps: cancelButtonProps, cancelText: cancelText, className: modalClasses.actions, confirmButtonProps: restConfirmButtonProps, confirmText: confirmText, danger: danger, hideCancelButton: hideCancelButton, hideConfirmButton: hideConfirmButton, loading: confirmButtonLoading !== null && confirmButtonLoading !== void 0 ? confirmButtonLoading : loading, onCancel: onCancel, onConfirm: onConfirm })] }));
18
- });
19
-
20
- export { ModalActions as default };
@@ -1,7 +0,0 @@
1
- import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
2
- export type ModalBodyProps = NativeElementPropsWithoutKeyAndRef<'div'>;
3
- /**
4
- * The react component for `mezzanine` modal body.
5
- */
6
- declare const ModalBody: import("react").ForwardRefExoticComponent<ModalBodyProps & import("react").RefAttributes<HTMLDivElement>>;
7
- export default ModalBody;
@@ -1,14 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef } from 'react';
3
- import { modalClasses } from '@mezzanine-ui/core/modal';
4
- import cx from 'clsx';
5
-
6
- /**
7
- * The react component for `mezzanine` modal body.
8
- */
9
- const ModalBody = forwardRef(function ModalBody(props, ref) {
10
- const { children, className, ...rest } = props;
11
- return (jsx("div", { ...rest, ref: ref, className: cx(modalClasses.body, className), children: children }));
12
- });
13
-
14
- export { ModalBody as default };
@@ -1,54 +0,0 @@
1
- import { NotificationSeverity } from '@mezzanine-ui/core/notification';
2
- import { FC, Key, ReactNode } from 'react';
3
- import { NotifierData, Notifier, NotifierConfig } from '../Notifier';
4
- import { SlideFadeProps } from '../Transition';
5
- export interface NotificationConfigProps extends Pick<NotifierConfig, 'duration'>, Pick<SlideFadeProps, 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited' | 'easing' | 'direction'> {
6
- }
7
- export interface NotificationData extends NotifierData, NotificationConfigProps {
8
- /**
9
- * Cancel button text;
10
- */
11
- cancelText?: ReactNode;
12
- /**
13
- * Confirm button text;
14
- */
15
- confirmText?: ReactNode;
16
- /**
17
- * Cancel button click event handler. <br />
18
- * If not provided, the event handler will fallback to a close function using `Notification.remove`.
19
- */
20
- onCancel?: VoidFunction;
21
- /**
22
- * Confirm button click event handler. <br />
23
- * If given, will render action button group.
24
- */
25
- onConfirm?: VoidFunction;
26
- /**
27
- * If given, the message will be closed after the amount of time.
28
- * You can use `Message.config` to overwrite.
29
- * @default false
30
- */
31
- /**
32
- * The identifier of the notification.
33
- */
34
- reference?: Key;
35
- /**
36
- * The severity of the message.
37
- * @default info
38
- */
39
- severity?: NotificationSeverity;
40
- /**
41
- * The title of notification.
42
- */
43
- title?: ReactNode;
44
- }
45
- export interface Notification extends FC<NotificationData>, Notifier<NotificationData, NotificationConfigProps>, Record<NotificationSeverity, (props?: Omit<NotificationData, 'severity'>) => Key> {
46
- }
47
- /**
48
- * The react component for `mezzanine` notification.
49
- *
50
- * Use the API from the Notification instance such as `Notification.success` and `Notification.error`
51
- * to display a notification globally.
52
- */
53
- declare const NotificationElement: Notification;
54
- export default NotificationElement;
@@ -1,76 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { notificationIcons, notificationClasses } from '@mezzanine-ui/core/notification';
3
- import { TimesIcon } from '@mezzanine-ui/icons';
4
- import { useState, useEffect } from 'react';
5
- import Button from '../Button/Button.js';
6
- import ButtonGroup from '../Button/ButtonGroup.js';
7
- import SlideFade from '../Transition/SlideFade.js';
8
- import Icon from '../Icon/Icon.js';
9
- import cx from 'clsx';
10
- import { createNotifier } from '../Notifier/createNotifier.js';
11
-
12
- /**
13
- * The react component for `mezzanine` notification.
14
- *
15
- * Use the API from the Notification instance such as `Notification.success` and `Notification.error`
16
- * to display a notification globally.
17
- */
18
- const NotificationElement = ((props) => {
19
- const { cancelText, children, confirmText, direction = 'left', duration, onCancel: onCancelProp, onClose: onCloseProp, onConfirm: onConfirmProp, onExited: onExitedProp, reference, severity, title, ...restTransitionProps } = props;
20
- const targetIcon = severity ? notificationIcons[severity] : undefined;
21
- const [open, setOpen] = useState(true);
22
- useEffect(() => {
23
- if (open && duration) {
24
- const timer = window.setTimeout(() => {
25
- setOpen(false);
26
- }, duration);
27
- return () => {
28
- window.clearTimeout(timer);
29
- };
30
- }
31
- }, [open, duration]);
32
- const onClose = () => {
33
- setOpen(false);
34
- if (onCloseProp) {
35
- onCloseProp(reference);
36
- }
37
- };
38
- const onConfirm = onConfirmProp
39
- ? () => {
40
- setOpen(false);
41
- onConfirmProp();
42
- }
43
- : undefined;
44
- const onCancel = onCancelProp
45
- ? () => {
46
- setOpen(false);
47
- onCancelProp();
48
- }
49
- : undefined;
50
- const onExited = (node) => {
51
- if (onExitedProp) {
52
- onExitedProp(node);
53
- }
54
- NotificationElement.remove(reference);
55
- };
56
- return (jsx(SlideFade, { in: open, appear: true, onExited: onExited, direction: direction, ...restTransitionProps, children: jsxs("div", { className: cx(notificationClasses.host, severity ? notificationClasses.severity(severity) : undefined), children: [targetIcon ? (jsx("div", { className: notificationClasses.iconContainer, children: jsx(Icon, { icon: targetIcon, className: notificationClasses.severityIcon }) })) : null, jsxs("div", { className: notificationClasses.body, children: [jsx("h4", { className: notificationClasses.title, children: title }), jsx("div", { className: notificationClasses.content, children: children }), onConfirm && !severity ? (jsxs(ButtonGroup, { className: notificationClasses.action, children: [jsx(Button, { variant: "contained", onClick: onConfirm, children: confirmText }), jsx(Button, { variant: "outlined", onClick: onCancel || onClose, children: cancelText })] })) : null] }), jsx(Icon, { icon: TimesIcon, className: notificationClasses.closeIcon, onClick: onClose })] }) }));
57
- });
58
- const { add, config, destroy, remove } = createNotifier({
59
- duration: false,
60
- render: (notif) => jsx(NotificationElement, { ...notif }),
61
- setRoot: (root) => {
62
- root === null || root === void 0 ? void 0 : root.setAttribute('class', notificationClasses.root);
63
- },
64
- });
65
- NotificationElement.add = add;
66
- NotificationElement.config = config;
67
- NotificationElement.destroy = destroy;
68
- NotificationElement.remove = remove;
69
- ['success', 'warning', 'error', 'info'].forEach((severity) => {
70
- NotificationElement[severity] = (props) => NotificationElement.add({
71
- ...props,
72
- severity,
73
- });
74
- });
75
-
76
- export { NotificationElement as default };
@@ -1,3 +0,0 @@
1
- export type { NotificationSeverity } from '@mezzanine-ui/core/notification';
2
- export type { NotificationData } from './Notification';
3
- export { default } from './Notification';
@@ -1 +0,0 @@
1
- export { default } from './Notification.js';
@@ -1,107 +0,0 @@
1
- import { Dispatch, SetStateAction, RefObject } from 'react';
2
- import { SelectInputSize } from '@mezzanine-ui/core/select';
3
- import { SelectValue } from './typings';
4
- import { MenuProps } from '../Menu';
5
- import { PopperProps } from '../Popper';
6
- import { PickRenameMulti } from '../utils/general';
7
- import { SelectTriggerProps, SelectTriggerInputProps } from './SelectTrigger';
8
- export interface AutoCompleteBaseProps extends Omit<SelectTriggerProps, 'active' | 'clearable' | 'forceHideSuffixActionIcon' | 'mode' | 'onClick' | 'onKeyDown' | 'onChange' | 'renderValue' | 'inputProps' | 'suffixActionIcon' | 'value'>, PickRenameMulti<Pick<MenuProps, 'itemsInView' | 'maxHeight' | 'role' | 'size'>, {
9
- maxHeight: 'menuMaxHeight';
10
- role: 'menuRole';
11
- size: 'menuSize';
12
- }>, PickRenameMulti<Pick<PopperProps, 'options'>, {
13
- options: 'popperOptions';
14
- }> {
15
- /**
16
- * Set to true when options can be added dynamically
17
- * @default false
18
- */
19
- addable?: boolean;
20
- /**
21
- * Should the filter rules be disabled (If you need to control options filter by yourself)
22
- * @default false
23
- */
24
- disabledOptionsFilter?: boolean;
25
- /**
26
- * The other native props for input element.
27
- */
28
- inputProps?: Omit<SelectTriggerInputProps, 'onChange' | 'placeholder' | 'role' | 'value' | `aria-${'controls' | 'expanded' | 'owns'}`>;
29
- /**
30
- * insert callback whenever insert icon is clicked
31
- * return `true` when insert is successfully
32
- */
33
- onInsert?(text: string): SelectValue;
34
- /**
35
- * The search event handler
36
- */
37
- onSearch?(input: string): any;
38
- /**
39
- * The options that mapped autocomplete options
40
- */
41
- options: SelectValue[];
42
- /**
43
- * select input placeholder
44
- */
45
- placeholder?: string;
46
- /**
47
- * Whether the selection is required.
48
- * @default false
49
- */
50
- required?: boolean;
51
- /**
52
- *
53
- */
54
- searchTextControlRef?: RefObject<{
55
- setSearchText: Dispatch<SetStateAction<string>>;
56
- } | undefined>;
57
- /**
58
- * The size of input.
59
- */
60
- size?: SelectInputSize;
61
- }
62
- export type AutoCompleteMultipleProps = AutoCompleteBaseProps & {
63
- /**
64
- * The default selection
65
- */
66
- defaultValue?: SelectValue[];
67
- /**
68
- * Controls the layout of trigger.
69
- */
70
- mode: 'multiple';
71
- /**
72
- * The change event handler of input element.
73
- */
74
- onChange?(newOptions: SelectValue[]): any;
75
- /**
76
- * The value of selection.
77
- * @default undefined
78
- */
79
- value?: SelectValue[];
80
- };
81
- export type AutoCompleteSingleProps = AutoCompleteBaseProps & {
82
- /**
83
- * The default selection
84
- */
85
- defaultValue?: SelectValue;
86
- /**
87
- * Controls the layout of trigger.
88
- */
89
- mode?: 'single';
90
- /**
91
- * The change event handler of input element.
92
- */
93
- onChange?(newOptions: SelectValue): any;
94
- /**
95
- * The value of selection.
96
- * @default undefined
97
- */
98
- value?: SelectValue | null;
99
- };
100
- export type AutoCompleteProps = AutoCompleteMultipleProps | AutoCompleteSingleProps;
101
- /**
102
- * The AutoComplete component for react. <br />
103
- * Note that if you need search for ONLY given options, not included your typings,
104
- * should considering using the `Select` component with `onSearch` prop.
105
- */
106
- declare const AutoComplete: import("react").ForwardRefExoticComponent<(Omit<AutoCompleteMultipleProps, "ref"> | Omit<AutoCompleteSingleProps, "ref">) & import("react").RefAttributes<HTMLDivElement>>;
107
- export default AutoComplete;
@@ -1,114 +0,0 @@
1
- 'use client';
2
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { forwardRef, useContext, useState, useImperativeHandle, useRef, useMemo } from 'react';
4
- import { selectClasses } from '@mezzanine-ui/core/select';
5
- import { PlusIcon } from '@mezzanine-ui/icons';
6
- import isArray from 'lodash/isArray';
7
- import { useComposeRefs } from '../hooks/useComposeRefs.js';
8
- import Option from './Option.js';
9
- import { SelectControlContext } from './SelectControlContext.js';
10
- import { useAutoCompleteValueControl } from '../Form/useAutoCompleteValueControl.js';
11
- import { useClickAway } from '../hooks/useClickAway.js';
12
- import SelectTrigger from './SelectTrigger.js';
13
- import { FormControlContext } from '../Form/FormControlContext.js';
14
- import InputTriggerPopper from '../_internal/InputTriggerPopper/InputTriggerPopper.js';
15
- import Menu from '../Menu/Menu.js';
16
- import Icon from '../Icon/Icon.js';
17
- import cx from 'clsx';
18
-
19
- const MENU_ID = 'mzn-select-autocomplete-menu-id';
20
- /**
21
- * The AutoComplete component for react. <br />
22
- * Note that if you need search for ONLY given options, not included your typings,
23
- * should considering using the `Select` component with `onSearch` prop.
24
- */
25
- const AutoComplete = forwardRef(function Select(props, ref) {
26
- var _a, _b;
27
- const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
28
- const { addable = false, className, disabled = disabledFromFormControl || false, disabledOptionsFilter = false, defaultValue, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputRef, inputProps, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize, mode = 'single', onChange: onChangeProp, onClear: onClearProp, onInsert, onSearch, options: optionsProp, popperOptions = {}, placeholder = '', prefix, required = requiredFromFormControl || false, searchTextControlRef, size, value: valueProp, } = props;
29
- const [open, toggleOpen] = useState(false);
30
- const { focused, onFocus, onChange, onClear, options, searchText, selectedOptions, setSearchText, unselectedOptions, value, } = useAutoCompleteValueControl({
31
- defaultValue,
32
- disabledOptionsFilter,
33
- mode,
34
- onChange: onChangeProp,
35
- onClear: onClearProp,
36
- onClose: () => toggleOpen(false),
37
- onSearch,
38
- options: optionsProp,
39
- value: valueProp,
40
- });
41
- /** export set search text action to props (allow user to customize search text) */
42
- useImperativeHandle(searchTextControlRef, () => ({ setSearchText }));
43
- /** insert feature */
44
- const [insertText, setInsertText] = useState('');
45
- const nodeRef = useRef(null);
46
- const controlRef = useRef(null);
47
- const popperRef = useRef(null);
48
- const composedRef = useComposeRefs([ref, controlRef]);
49
- const renderValue = focused ? () => searchText : undefined;
50
- useClickAway(() => {
51
- if (!open || focused)
52
- return;
53
- return () => {
54
- toggleOpen((prev) => !prev);
55
- };
56
- }, nodeRef, [focused, nodeRef, open, toggleOpen]);
57
- function getPlaceholder() {
58
- if (focused && value && !isArray(value)) {
59
- return value.name;
60
- }
61
- return placeholder;
62
- }
63
- /** Trigger input props */
64
- const onSearchInputChange = (e) => {
65
- /** should sync both search input and value */
66
- setSearchText(e.target.value);
67
- setInsertText(e.target.value);
68
- /** return current value to onSearch */
69
- onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value);
70
- };
71
- const onSearchInputFocus = (e) => {
72
- var _a;
73
- e.stopPropagation();
74
- toggleOpen(true);
75
- onFocus(true);
76
- (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
77
- };
78
- const onSearchInputBlur = (e) => {
79
- var _a;
80
- onFocus(false);
81
- (_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
82
- };
83
- const onClickSuffixActionIcon = () => {
84
- toggleOpen((prev) => !prev);
85
- };
86
- const resolvedInputProps = {
87
- ...inputProps,
88
- 'aria-controls': MENU_ID,
89
- 'aria-expanded': open,
90
- 'aria-owns': MENU_ID,
91
- onBlur: onSearchInputBlur,
92
- onChange: onSearchInputChange,
93
- onFocus: onSearchInputFocus,
94
- placeholder: getPlaceholder(),
95
- role: 'combobox',
96
- };
97
- const searchTextExistWithoutOption = !!searchText &&
98
- options.find((option) => option.name === searchText) === undefined;
99
- const context = useMemo(() => ({ onChange, value }), [onChange, value]);
100
- return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, { [selectClasses.hostFullWidth]: fullWidth }), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: true, disabled: disabled, ellipsis: true, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, prefix: prefix, readOnly: false, required: required, inputProps: resolvedInputProps, searchText: searchText, size: size, showTextInputAfterTags: true, suffixAction: onClickSuffixActionIcon, value: value, renderValue: renderValue }), jsxs(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, open: open, sameWidth: true, options: popperOptions, children: [options.length ? (jsx(Menu, { id: MENU_ID, "aria-activedescendant": Array.isArray(value) ? ((_b = (_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '') : value === null || value === void 0 ? void 0 : value.id, itemsInView: itemsInView, maxHeight: menuMaxHeight, role: menuRole, size: menuSize, style: { border: 0 }, children: mode === 'single' ? (jsx(Fragment, { children: options.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))) })) : (jsxs(Fragment, { children: [selectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))), unselectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id)))] })) })) : null, searchTextExistWithoutOption && addable ? (jsxs("button", { type: "button", className: selectClasses.autoComplete, onClick: (e) => {
101
- var _a;
102
- e.stopPropagation();
103
- if (insertText) {
104
- const newOption = (_a = onInsert === null || onInsert === void 0 ? void 0 : onInsert(insertText)) !== null && _a !== void 0 ? _a : null;
105
- if (newOption) {
106
- setInsertText('');
107
- setSearchText('');
108
- onChange(newOption);
109
- }
110
- }
111
- }, children: [jsx("p", { children: insertText }), jsx(Icon, { className: selectClasses.autoCompleteIcon, icon: PlusIcon })] })) : null] })] }) }));
112
- });
113
-
114
- export { AutoComplete as default };
@@ -1,8 +0,0 @@
1
- import { type TableColumn, type TableDataSource } from '@mezzanine-ui/core/table';
2
- import type { TableColumnState } from '../TableContext';
3
- import { ActionColumnConfig } from './typings';
4
- export interface UseTableColumnsOptions<T extends TableDataSource> {
5
- actionConfig: ActionColumnConfig;
6
- columns: TableColumn<T>[];
7
- }
8
- export declare function useTableColumns<T extends TableDataSource>({ actionConfig, columns, }: UseTableColumnsOptions<T>): TableColumnState;